Dim propertyName1 As String = "Mortise" Dim propertyName2 As String = "Cut Length" customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") Try prop = customPropertySet.Item(propertyName1) prop = customPropertySet.Item(propertyName2) Catch ' Assume error means not found customPropertySet.Add("", propertyName1) customPropertySet.Add("", propertyName2) End Try 'output the custom iproperties and update the file RuleParametersOutput() InventorVb.DocumentUpdate() 'set iProperties 'iProperties.Value("Custom", "Mortise") = "" 'update file iLogicVb.UpdateWhenDone = True
This code creates custom iProperties if the iProperty isn't found. I'd like to add another iProperty called "Resaw" with a Yes/No property type. Is there a way of doing this the way I have things started here?
Thanks very much
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi ToddVS,
Here is some code (and and example file) that should show how to do this.
Note that I ran into an issue with combining more than one custom iProperty in the Try/Catch, and have found it better to keep them seperate as I show in the example below.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim propertyName1 As String = "Paint Code" Dim propertyName2 As String = "Size" Dim propertyName3 As String = "Galvanized" Dim propertyName4 As String= "Completion Date" 'define custom prp[erty collection oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties") Try 'set property value oProp = oCustomPropertySet.Item(propertyName1) Catch ' Assume error means not found so create it oCustomPropertySet.Add("", propertyName1) End Try Try 'look for property oProp = oCustomPropertySet.Item(propertyName2) Catch ' Assume error means not found so create it oCustomPropertySet.Add("", propertyName2) End Try Try 'look for property oProp = oCustomPropertySet.Item(propertyName3) Catch ' Assume error means not found so create it oCustomPropertySet.Add("", propertyName3) End Try Try oProp = oCustomPropertySet.Item(propertyName4) Catch ' Assume error means not found so create it oCustomPropertySet.Add("", propertyName4) End Try Dim strPaintCode As String Dim dblSize As Double Dim blGalv As Boolean Dim dtDate As Date 'get values from user strPaintCode = InputBox("Enter the paint code.", "iLogic", "") 'no default value dblSize = InputBox("Enter the size.", "iLogic", 100) 'set default to 100 blGalv = InputRadioBox("Is this thing galvanized?", "Yes", "No", True, "iLogic") 'default is True (yes) dtDate = InputBox("When was this completed?", "iLogic", Now.ToString("MM/dd/yyyy")) 'set default to today's date 'set custom property values iProperties.Value("Custom", "Paint Code") = strPaintCode iProperties.Value("Custom", "Size") = dblSize iProperties.Value("Custom", "Galvanized") = blGalv iProperties.Value("Custom", "Completion Date") = dtDate iLogicVb.UpdateWhenDone = True
work really great to find but not to save or created pdf, dxf, dwf, etc,... 😞
Hi,
It looks fine to me with the code Curtis_Waguespack provided in message 2. I am not clear on your further question. Could you elaborate?
********
Update: now I understood from your comments in the other thread:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/ilogic-oPath-in-workgroup/td-p/