A few years ago I was shown a macro to simplify an assembly.
This macro that was launched from an assembly created a "Simplified" or "Fastener" config (I don't remember the name, in which all the screws had gone to the deleted state (ISfastener=1)
And the same thing in all the sub-assemblies of the main assembly.
This allowed me to have a lighter configuration (without the screws of a complex assembly) so that it could be inserted into my layout afterwards.
Does anyone have a macro to share that comes close to this request?
Otherwise I'll have to try to find time to rewrite it, even if it seems a bit complex to me with my limit level in SW coding.
With the ISfastener Filter=1 It's simpler, isn't it? Especially since you can combine several Filters, reverse them or cancel them. (And Save them too...)
Your @Maclane solution actually works very well when all the screws are in the head assembly.
The problem is that I have screws in a lot of sub-assemblies, and I have to keep these screws in the default config so that the (screw) orders are switched to automatic when launching.
The only way is to do this damn macro.
After for the macro, the filter solution may be to be considered.
Zozo_mp : 2015 for this "New" function (Solidworks doesn't communicate very well about their new features... useful) As for the horrible ToolBox (Yuck) I never use it (Except to create holes/taps/lights... can be used with the drilling wizard). I created my own custom libraries (with the IsFastener property set to 0 or 1).
-> FYI: this Property (IsFastener) is the one used for drawing sections or for collision detection (option: Exclude bolts). sbadenis : The use of Macros seems indeed inevitable to create each "Lite" configuration of all Subassemblies... (The VBA function is: "PowerSelec" for Smart Selection but for now I don't know more -sorry-
Hi everyone, I made a macro that creates a configuration without screws for the assembly and its sub-assemblies.
For it to work, it is necessary to use the Document Manager APIs. In particular to read the invisible property "IsToolboxStandard" allowing you to define whether the part is a screw. A license is requested at the first launch. To obtain this license, you must apply for it through the SolidWorks Customer Portal, following these procedures :
To request a SOLIDWORKS Document Manager API license key:
Follow the online instructions to request your license key.
A SOLIDWORKS Document Manager API license key is emailed to you upon approval of your request.
It works with Toolbox components and custom libraries whose components have the "IsToolboxStandard" property.
You can add this property easily with the utility provided for this purpose: "sldsetdocprop.exe" located in the folder: "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\Toolbox\data utilities"
I invite you to test the macro on test assemblies and give me your feedback.
Thank you @remrem, I just tested after a few problems to get the famous key.
The email was going to Spam, I had to do it on my personal mailbox, and wait a few days...
Except for the operation, now that I have been able to test! This is very close to my need, thank you for this very good base.
The configurations are well created for all assemblies.
On the other hand, in these configurations, the screws are not removed (even if the ISFastener option is set to 1)
Also, I would like it to create the configuration only if the assembly contains screws with ISFastener=1 and a "Category" property is "Assembly".
In subassemblies, the active configuration remains default instead of Fasteners enabled in the fasteneres enable configuration of the main assembly.
I'd try some modifications in the code which is a very good base, to improve it in my own way, but I've always developed via VBA macros (without going through dlls) and I don't know how to debug if possible via visual studio to see where it gets stuck and see the changes live if possible.
Do you have to compile the project to test it later?
Can we execute step by step and see where it gets stuck?
Be careful, there is a mistake. The "IsFastener" property is only used to hide the fasteners in the MEPs. The macro doesn't use this property but as I indicated in my previous post:
It works with Toolbox components and custom libraries whose components have the "IsToolboxStandard" property.
You can add this property easily with the utility provided for this purpose: "sldsetdocprop.exe" located in the folder: "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\Toolbox\data utilities"
The "IsToolboxStandard" property is hidden. Therefore, it is not visible in the SolidWorks Property Editor. That's why I had to use the Document Manager library.
Indeed @remrem, there was a mistake, I will look at how to improve the project which is a very good basis. Can you answer me if you have some time on the method used to compile and debug projects via a dll.
Since you joined the entire project with a little time and work, I should eventually succeed in modifying this project for my usefulness.