Macro to unlink configuration properties (parent/child)

Hello

In our operation, we are very often required to use the " insert a part " function, so as to have a part within a room.

When importing the part, for quality needs, we will need to bind certain properties (Parent/child).

There is indeed the possibility, during import, to bind properties. The problem with this is that it binds them all.

I have two options so:
1- I bind all the properties to the import, then I unlink the ones I don't want
2- I don't bind anything, then I only bind the properties I need.

What I'm getting at is that I'd need to do this via a macro that would trigger when the SmartProperties starts.
Basically, I want to act on these checkmarks:

My problem is that me and the VBA, we're not great friends, well yes... He's a great friend, he has no problem with me. Me, on the other hand...! :sweat_smile:

Would a charitable soul be able to help me out or at least guide me on this subject?
Thank you in advance!! :blush:

1 Like

A bit of a beta question... Why do a macro to do that?

Obviously, you sometimes need to do it and sometimes you don't. The macro automating this, it will do the action every time SmartProperties starts

Hello;

Even if I don't condone the use of nested parts in other parts: (Yuck)
Solidworks Help tells us:
https://help.solidworks.com/2021/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ICustomPropertyManager~LinkAll.html

So it is possible to deduce (to be tested):

Option Explicit

Sub main()

    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2

swmodel.LinkAll = False

End Sub

In theory, this breaks all the links of all the properties... but it seems almost too simple to me...

Otherwise, but it's much more complicated, there seems to be the possibility of breaking the links between some properties... (but you still have to know all their names and know who should be related to whom... or not.)
https://help.solidworks.com/2021/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ICustomPropertyManager~LinkProperty.html

I think that the technique of not choosing to link properties to the import of a new part remains the simplest. (Even if making an assembly is better :shushing_face:)

Kind regards.

1 Like

For once, no, I need to do it all the time.

In almost all of our designs, we have a room within a room.
I saw that there was a way to condition the SmartProperties, i.e. to modify the properties it writes according to conditions.

Wholesale:

  • if I select option 1, I have SmartProperties 1 and that gives me room 1,
  • if I select option 2, I have SmartProperties 2 and that gives me room 2.

I still have a 2 piece that uses a 1 piece.

What I would like is for the SmarProperties 2 to trigger this macro to unlink certain properties on its own and then write on them.
Between Exhibit 1 and Exhibit 2, we always have common properties that must be kept linked.

Clearly, it's " comfort ", indeed you can do it by hand, but it was if ever there was a " simple " way to make a macro...

1 Like

Thank you! :slight_smile:
I'll dig into that!

" Even if blending is better :shushing_face: ",
I agree... :face_with_peeking_eye: but that's how my company works

1 Like