Page 1 of 1
How do I set the Custom Property Tab Template from a VB Macro?
Posted: Thu Mar 11, 2021 11:25 am
by Craig Makarowski
Can't seem to record macro of when you select a Custom Property Template
Now I select the template
then i get this
All the while I'm recording the Macro, even after I click the Apply button and Save!
This is what i get in the Macro
So none of the Property tab template functionallity gets recorded, I need to be able to control this in my Main Macro
that has a form with values that would auto fill the fields in the Property tab. I can fill in the Custom properties directly from
exsisting code but no Idea how to set the Property Tab Template from my VB code.
I'm using SW2013 SP05 x64bit On Win7
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Thu Mar 11, 2021 1:23 pm
by josh
sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Mon Mar 15, 2021 11:57 am
by Craig Makarowski
josh wrote: ↑Thu Mar 11, 2021 1:23 pm
sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
wow that was fast and thank you very much!!!
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Wed Aug 09, 2023 5:38 am
by lenoli
sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
this macro can't run in SW2020?
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Wed Aug 09, 2023 11:23 am
by gupta9665
lenoli wrote: ↑Wed Aug 09, 2023 5:38 am
sub main()
application.sldworks.activedoc.extension.custompropertybuildertemplate(false) = "whatever.prtprp"
end sub
this macro can't run in SW2020?
Did you specified the correct path for the property tab builder file with extension?
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Thu Aug 10, 2023 1:05 am
by lenoli
gupta9665 wrote: ↑Wed Aug 09, 2023 11:23 am
Did you specified the correct path for the property tab builder file with extension?
Yes , I have set system option > file location> CustomPropertyfile folder.
and all CustomProperty template show in list but still not working.
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Fri Aug 11, 2023 12:44 am
by gupta9665
lenoli wrote: ↑Thu Aug 10, 2023 1:05 am
Yes , I have set system option > file location> CustomPropertyfile folder.
and all CustomProperty template show in list but still not working.
Sorry I meant to ask if you changed the "
whatever.prtprp" with your
required Custom Property template name with extension?
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Mon Aug 28, 2023 4:54 am
by T_H2O_mas
Hi!
After struggling with this particular issue for about half a day, I've discovered that it doesn't like to show whether it succeeded or not.
I tried to use a boolean to show whether it succeeded or not, however that was exactly the thing that prevented it from succeeding.
Just have the line mentioned before, nothing else
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Mon Aug 28, 2023 5:57 pm
by josh
You are setting a Property of an object. You don't get a return from setting a Property. You only get returns from Methods.
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Thu Aug 31, 2023 8:58 am
by crimsoncleansed
Glad I came across the post.
I want to check if it is the desired effect, but when I run this I have to save the file, then close it and reopen it before I can see the Custom Properties template changed out. Is this normal?
Thanks.
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Sun Dec 24, 2023 7:40 pm
by little zombie
This is because the taskpane is not updated in real time. You can switch the taskpane manually or use the following code.
'close taskpane
swApp.SetToolbarVisibility swToolbar_e.swTaskPaneToolbar, False
'open taskpane
swApp.SetToolbarVisibility swToolbar_e.swTaskPaneToolbar, True
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Tue Jul 16, 2024 5:01 am
by blackzero007
In our team, we have saved custom property templates as .asmprp & .prtprp files for assemblies and parts. For the drawings, we have prepared standard drawing templates saved as .DRWDOT in a standard shared location on a network drive.
The problem occurred when the IT changed the network folder address from \\10.100.xx.xx to \\abcxxxx.
All the existing data (thousands of parts, assemblies and drawings) couldn't even be opened because it kept searching for the templates and custom properties files in the old location which didn't exist anymore.
We updated the default file locations for everything, but all in vain. SW was unable to pick up the templates from new locations. It always stopped responding while opening the files. The way-around was to open the solidworks and make sure 'home' is active tab then open. But the moment we clicked on custom properties, it stopped responding. For drawings, there was nothing we could do as they always got stuck.
After lots of hit and trial, we figured out that if we copy the data to a local drive, then disconnect the network (pull the cable / disconnect wifi), we can open the files. Then we could see an error message telling that custom properties template couldn't be found.
Solution we devised:
Open files offline; run a script to re-link the custom properties. The script I picked from the same thread and ran it across the folders and sub-folders. It ran overnight and by the morning, thousands of part and assembly files were rectified. If you want, I can copy the script here.
Re: How do I set the Custom Property Tab Template from a VB Macro?
Posted: Tue Jul 16, 2024 5:35 pm
by mp3-250
blackzero007 wrote: ↑Tue Jul 16, 2024 5:01 am
In our team, we have saved custom property templates as
.asmprp &
.prtprp files for assemblies and parts. For the drawings, we have prepared standard drawing templates saved as
.DRWDOT in a standard shared location on a network drive.
The problem occurred when the IT changed the network folder address from \\10.100.xx.xx to \\abcxxxx.
All the existing data (thousands of parts, assemblies and drawings) couldn't even be opened because it kept searching for the templates and custom properties files in the old location which didn't exist anymore.
We updated the default file locations for everything, but all in vain. SW was unable to pick up the templates from new locations. It always stopped responding while opening the files. The way-around was to open the solidworks and make sure 'home' is active tab then open. But the moment we clicked on custom properties, it stopped responding. For drawings, there was nothing we could do as they always got stuck.
After lots of hit and trial, we figured out that if we copy the data to a local drive, then disconnect the network (pull the cable / disconnect wifi), we can open the files. Then we could see an error message telling that custom properties template couldn't be found.
Solution we devised:
Open files offline; run a script to re-link the custom properties. The script I picked from the same thread and ran it across the folders and sub-folders. It ran overnight and by the morning, thousands of part and assembly files were rectified. If you want, I can copy the script here.
have you tried mapping a network drive? \\ network paths have a lot of compatibility problems. using a nwtwork drive will point to the same place, but it mimic the local drive behavior so even very old scripts and programs could run like it was a local path.