Macro Identify Repeat (Stitch)

Hello;

I frequently use the "Make-Independent" Macro found at CodeStack:
https://www.codestack.net/solidworks-api/document/assembly/components/make-independent-drawing/
(This macro allows you to "save a copy as.." a part (or an assembly) with its drawing by associating their references/Associations)

It is very useful to me with one restriction:
Components included in derived/driven repeats can be renamed without impacting the original component or its other "copies"...
Example:

  • The coordinate system (1) is my component to repeat. The marks (2) and is the repetition of (1).

    If I apply the macro on the coordinate system (2):  With the new file
    Then only this occurrence becomes independent without (1) or (3) being modified.

And to top it off, in the properties of multiple components, the settings are always to "Use the same configuration as the original component".
So, to put it simply: is it possible, when selecting a component (from the tree or in the graphics window (face)) to prevent the selection of a repeat occurrence?

Kind regards.

1 Like

Bah!
Sometimes we look far away for functions under our noses....
To determine if the selected component is part of a repeat:

Dim instance As IComponent2
Dim value As System.Boolean
 
value = instance.IsPatternInstance()

With return value: "True" if the component is part of a repeat and "False" if it is not.

It's not more complicated.

 

3 Likes

Thanks for the info @Maclane it's been at least 1 year that I wanted to exclude some instance of repetition of one of my macros in vain.

If you have a trick to also exclude a part made with a belt function (Insertion, Assembly function, Chain belt, and check Create a belt part), I'm all for it!

 

Hello sbadenis glad I was able to help...
For chains and belts, I haven't had to use this type of function yet
I have a few leads to dig if you feel like it: ( Dim instance As IChainPatternFeatureData )
-> https://help.solidworks.com/...Aide 01
-> https://r1132100503382-eu1-3dswym.3dexperience.3ds.com/...Forum Solidworks

2 Likes