Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to manage model state via iLogic in an assembly file to link all corresponding states between main and sub assemblies? in other words, I want to automate the "Link Model state" command under productivity tool and based on what I experience, you can not add any column to the temporary excel worksheet using API/iLogic and all the objects you have access to via iLogic are read-only. if anyone has any experience with this, it would be greatly appreciated if you can share.
here is the code I wrote , is this correct? any potential issues with this?
Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oStates As ModelStates = oDef.ModelStates
Dim oState As ModelState
oModelStateName = oStates.ActiveModelState.Name
Dim oTable As ModelStateTable= oStates.ModelStateTable
Dim oRow As ModelStateTableRow
CurrentState = oStates.ActiveModelState.Name
i = 1
For Each oRow In oTable.TableRows
'this activates the row to make it the current state
oStates.Item(i).Activate
'MsgBox(oStates.Item(i).Name)
'Start Looping
For Each oOcc As ComponentOccurrence In oDoc.ComponentDefinition.Occurrences
oOcc.ActiveModelState=oStates.Item(i).Name
Next
i = i + 1
Next 'model state
Solved! Go to Solution.