iLogic Rule to append iProperty Part Number with Model State Name

iLogic Rule to append iProperty Part Number with Model State Name

Ray_Feiler
Advisor Advisor
128 Views
0 Replies
Message 1 of 1

iLogic Rule to append iProperty Part Number with Model State Name

Ray_Feiler
Advisor
Advisor

This iLogic rule will append the iPropery for Part Number with the name of each model state with a "-" separator.

 

'Set up the Document Settings to access the Model States
Dim oDoc = ThisDoc.Document
Dim oCompDef As ComponentDefinition = oDoc.ComponentDefinition
Dim oModelStates As ModelStates = oCompDef.ModelStates
Dim oModelState As ModelState
'Cycle through each Model State and activate them in order
For Each oModelState In oModelStates
If oModelState.Name <> "[Primary]" Then
oModelState.Activate
End If
'Append iPropery Part Number with Model State name
Dim oModelStateName As String = oModelState.Name
Dim oFileName As String = ThisDoc.FileName(False) 'without extension
Dim oPartNumber As String = oFileName & "-" & oModelStateName
iProperties.Value("Project", "Part Number") = oPartNumber
'Update the document to view the active Model States
InventorVb.DocumentUpdate()
Next 

 


Product Design & Manufacturing Collection 2024
Sometimes you just need a good old reboot.
0 Likes
129 Views
0 Replies
Replies (0)