AnsweredAssumed Answered

Rebuild and save parts w/o read-only parts

Question asked by Claus Hierling on May 27, 2020
Latest reply on May 28, 2020 by Claus Hierling

I would need your help with a macro I'm currently struggling with.

A short introduction to the initial situation.
I use a macro which writes custom material properties from a part into a custom property (MatCustProp). So that this happens automatically during the rebuild of the part and the user does not have to do this manually, I have included this macro in every part with the macro from Artem "Auto run Macro on rebuild". This also works great (thanks a lot for both macros to Artem!).
The problem is that when rebuilding the parent assembly the cutsom material props are not updated. Only when the part is opened and then rebuilt there, the material props are updated. I have solved with another macro "RebuildNSaveAllParts" from the 3dContenCentral library. So far it works fine. But we also have read-only library parts that should not be (opened, rebuilt and) saved.

 

I tried to adjust the RebuildNSaveAllParts macro to get the read-only status of the part and if it is false the macro procedure should start, otherwise the part should be ignored.
I added these to the macro script after to the inquiri for the dokumenttype gots the type "SLDPRT" :

        ReOnState = instance.IsOpenedReadOnly()
        If (ReOnState = False) Then

...

 

Unfortunately, my adjustment was unsuccessful and I'm at a loss how to adjust this to work correctly.

Maybe one of you can help me with this, or has a better idea how I can get the material property automatically into subparts. 

Outcomes