Access Active Model State iProperties of Active Drawing using iLogic

Access Active Model State iProperties of Active Drawing using iLogic

C_Haines_ENG
Collaborator Collaborator
374 Views
1 Reply
Message 1 of 2

Access Active Model State iProperties of Active Drawing using iLogic

C_Haines_ENG
Collaborator
Collaborator

Hello all!

 

I cant seem to figure out how to change the description of a part in a drawing, on its active model state with iLogic. I have seen many where they are accessing ALL model states, but how can I just access the model state of the part inserted into the drawing?

 

My current script accesses the inserted parts iproperties but it always just changes the factory parts iproperties.

 

Many thanks. 

0 Likes
375 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @C_Haines_ENG.  We can place views of multiple different ModelState versions of the same model file into the same drawing, and even on the same sheet within the drawing.  So, the drawing itself does not really have an active ModelState.  Each view within the drawing can be set to one of the specific ModelState objects that are available within the model file that the view is referencing.  It is possible for the view to be set to one ModelState, while the actual model document that may be open in another file tab, may have a different ModelState currently active.

DrawingView.ActiveModelState (ReadOnly property with String type value)

DrawingView.SetActiveModelState (Method used to 'set' which ModelState the view should be referencing)

 

So, if starting from a drawing, then the code must access one specific drawing view, check which ModelState that view is currently set to, then after you access the file that the view is referencing, you would then need to ensure that you will be working with the same ModelState that the drawing view was set to, one way or another.  The 'factory' document is simply the document that is associated with whichever ModelState happens to be 'active' at that time in that model file.  There will only be a factory document if the file has 2 or more ModelStates in it.  Any document associated with a ModelState that is not active, is known as a ModelState member document, and will act like it is ReadOnly.  The ModelState object has a 'method' (Sub routine) called Activate, which can be used to set that ModelState object to be the active one.  Or, there is also the ModelStateTable object, which can be used to access the table containing the data for all existing ModelStates, where you can change the values of individual table cells.  There is also the MemberEditScope that needs to be kept in mind.  That is used for iParts, iAssemblies, and for ModelStates, to control whether changes should only effect the 'active member' or all members, with a value from the MemberEditScopeEnum.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes