Hi all
I'm currently working on a macro to check if my assembly is totally constrained. If not, the goal is to list the unstressed parts, and ideally, also check if all the components of the subassemblies are fully constrained.
In a second step, I want to extend this check to all the sketches of each component present in the assemblies and subassemblies, in order to determine if they are also fully constrained.
I am looking for APIs that will allow me to perform these tests on a part and a sketch. If utilities in MyCADTools or other features of SolidWorks Premium can accomplish this, I'd be interested as well.
Thank you in advance for your answers and your help.
After a quick search, nothing found that did this.
For the search in English constraint it is mates.
You find out how to add constraints, but nothing seen to see if one of them is free or under constraint.
Possibly without knowing if it's feasible, look for this symbol (-) which means under constraint in a sketch as for constraints.
An example of adding a constraint:
Hello
Normally, by scanning the construction tree, we get the title of the line, so we just have to do some text analysis.
Thank you for your answers, but when I scan the tree and get info either with .name / .name2 / .gettitle none returns the name with (-), if you know of any other command I'm interested
Hello;
I wonder if it's not possible to do it with the Design Checker tool (Solidworks premium)
https://help.solidworks.com/2022/french/SolidWorks/solidworks_design_checker/c_welcome_design_checker.htm
To be confirmed or invalidated, for the moment I don't have control over my position...
Kind regards
Hello
What version of Solidworks are you using?
Otherwise, here's a link I found. Maybe he can help you:
https://help.solidworks.com/2019/french/SolidWorks/Sldworks/c_Best_Practices_for_Mates_SWassy.htm
From what I've found, to perform stress testing on a part and sketch in SolidWorks, using the SolidWorks API to access assembly constraints and sketches is recommended. Moreover, reviewing the utilities available in MyCADTools could also be beneficial.
Some useful links:
https://help.solidworks.com/2022/French/SolidWorks/sldworks/HIDD_OPTIONS_LARGE_ASSEMBLY.htm
https://help.solidworks.com/2022/french/SolidWorks/sldworks/HIDD_OPTIONS_EDGES.htm
https://help.solidworks.com/2022/french/SolidWorks/sldworks/hidd_options_sketch.htm
Hello;
I have this for the function sketches:
https://help.solidworks.com/2020/English/api/sldworksapi/Fully_Define_Underdefined_Sketch_Example_VB.htm
On the other hand, for assemblies it's a different story... not found for the moment.
Kind regards.
I found the . GetConstrainedStatus() which works on components, my only on the first level, otherwise it returns the value of the parent subset
https://help.solidworks.com/2021/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IComponent2~GetConstrainedStatus.html?verRedirect=1
The method seems to work also for sketches with:
https://help.solidworks.com/2020/english/api/sldworksapi/Get_Sketch_Constraints_Example_VB.htm
Otherwise, I tried to set up the Design Checker but I can't get what I want.
If anyone has any other idea, I'll take it,
Kind regards