I want to select all identical components in Assembly using API.
Is there any way to select all identical components in Assembly?
Please help me.
you want a component counter? Like this?
Do you mean the components which derive from the same model and configuration? Or you also mean the components with the same geometry (even if they are different parts)?
only one part with one configuration
you can type partial file name on the top of the tree items
and all the parts/assembly containing the string will be shown.
Hope it helps.
One more useful and advanced approach is to use "select tool".
If you go to "Advanced Select" you'll get so many options.
yes, yes, this is what you need, but I want to do this with a macro (select tool)
I want to select parts with macro
Sorry for my English. I'm use SW2017.
I will clarify:
I want to get an analog (Select Tool / select identical components) in code.
What end result you looking for for selecting them?
Have you looked into this option?
Yes, I looked - it's not what I need.
The end result: all identical parts (one model and one configuration) are selected in the tree and they are highlighted on the display.
The code should copy the command as in the picture (Select Tools/ Select identical parts). Is this possible?
I'm sure this can be done but still not able to understand as what you would do with the selection.
I will show the information about the selected component on the display:
Quantity in the assembly - very important for me
Quantity in the assembly (full)
Quantity in the assembly (suppressed components)
I looked at the method of counting quantities in an assembly like:
But I think, that counting quantities through the method
value = instance.GetSelectedObjectCount2 (Mark)
is a better way
Have you looked into Assembly visualization tool?
yes, but I have very big projects
Assembly visualization tool is loaded very slowly
I want to get the right information with the fewest number of mouse clicks
You can use Advanced Selection tool from the API: 2017 SOLIDWORKS API Help - Use Advanced Component Selection Example (VBA)
You can give me some code or explain how to do it?
I attached the macro for you, it works great but doesnt display Component Description in the pop up window.
If you get the macro to show the Description in the pop up displayed info, then please share the update.
Retrieving data ...