Edward Emuss

Macro to write current display state to global var or custom property?

Discussion created by Edward Emuss on Mar 9, 2020

Hi all,

I'm not sure if this is even feasible, but is there any way to read the current display state of a part file and write the information out to either a global var or custom property?


I am attempting to automate the creation of BIM models from assemblies using the following workflow: -

  1. Set BIM display state at top level assembly level which will set appropiate BIM display states in child components.
  2. Save assembly as part with all components.
  3. Save new part as *rfa/*step/*dxf as needed.


The assembly level BIM display state will hide all small/internal components and fixings,  I am attempting to get the part level BIM display state to control suppression states for cavity filling/detail obscuring merged features.  This will have a two fold effect in allowing us to use the simplified BIM display state when using the components as envelopes and increase drawing performance.


The method can either be via macro or a more direct link (I don't think it exists) and the information can be written out in either a text format for a custom property of an integer format for global var.  Ideally I want the feature suppression to be controlled via the equation manager but equally happy to have a custom property that can then be linked back to a global var.


I have a work flow that works to a fashion but it isn't really automated enough for my liking.  I have added a design table that records the display state and a simple IF statement that sets the suppression state of the simplifying/BIM features; however once the display state is changed this relies on the design table being opened, updated and saved before the change is made on the model.  An embedded macro that updates the design table on change of display state would be acceptable.


The obvious answer is not to use display states and to set up a BIM configuration but then you're introducing additional possibilities of rebuild errors occuring in the vault; if possible I prefer to keep numbers of configurations to a minimum.  It's also fun to push the software to see how far it will bend before it breaks!


My knowledge of VBA is unfortunately limited to recording macros and hacking them together till it does what I want it to do, I don't have a true grasp of the toolset.


Anyone got any suggestions?