I have this iLogic which works great for me. I add a description in the assembly environment by selecting the parts. When I'm done click escape.
Dim oOccurrence As ComponentOccurrence
msg = "Select a component (press ESC to exit)"
While True
oOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, msg)
' If nothing gets selected then we're done
If IsNothing(oOccurrence) Then Exit While
oName = oOccurrence.Name
ThisApplication.ActiveDocument.selectset.select(oOccurrence)
oDesc = iProperties.Value(oName, "Project", "Description")
oDesc = InputBox(oName & " Description", "iLogic", oDesc)
If Not oDesc = Nothing Then iProperties.Value(oName, "Project", "Description") = oDesc
End While
I am interested in whether it is possible to first create a custom iproperty (in case it does not exist) and then add a value to it in the same way in the assembly environment. The name custom iLogic does not need to be created through the toolbox, through iLogic is perfectly fine.
If it is possible to use the same iLogic also in a part environment, that would be really great
Solved! Go to Solution.
Solved by Michael.Navara. Go to Solution.
Solved by Michael.Navara. Go to Solution.
You need just to wrap property value obtaining to Try-Catch.
Dim oOccurrence As ComponentOccurrence
msg = "Select a component (press ESC to exit)"
While True
oOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, msg)
' If nothing gets selected then we're done
If IsNothing(oOccurrence) Then Exit While
oName = oOccurrence.Name
ThisApplication.ActiveDocument.SelectSet.Select(oOccurrence)
oDesc = iProperties.Value(oName, "Project", "Description")
oDesc = InputBox(oName & " Description", "iLogic", oDesc)
If Not oDesc = Nothing Then iProperties.Value(oName, "Project", "Description") = oDesc
'Custom description
Dim customDesc As String
Try
customDesc = iProperties.Value(oName, "Custom", "CustomDescription")
Catch
customDesc = ""
End Try
customDesc = InputBox(oName & " Custom Description", "iLogic", customDesc)
If Not customDesc = Nothing Then iProperties.Value(oName, "Custom", "CustomDescription") = customDesc
End While
Hi,
one more thing.
Is it possible to make a rule for part envirovment that, when runing, checks if there is a custom property name eg "Sample"? If it does not exist, it will be created. In both cases (exist or no), after that, a small window will open with the possibility to add or change value for that custom property.
This is the same code (lines 17 - 26) without argument oName
OK 😀
Try this code in part. If you want to change iProperties of the document where you run the rule, you don't need to select anything.
'Custom description
Dim customDesc As String
Try
customDesc = iProperties.Value("Custom", "CustomDescription")
Catch
customDesc = ""
End Try
customDesc = InputBox("Custom Description", "iLogic", customDesc)
If Not customDesc = Nothing Then iProperties.Value("Custom", "CustomDescription") = customDesc
Can't find what you're looking for? Ask the community or share your knowledge.