Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic 2013 - Create Yes/No property type

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
ToddVS
2466 Views, 3 Replies

iLogic 2013 - Create Yes/No property type

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

3 REPLIES 3
Message 2 of 4
Curtis_Waguespack
in reply to: ToddVS

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

 

Message 3 of 4

work really great to find but not to save or created pdf, dxf, dwf, etc,... 😞

Message 4 of 4

Hi,

 

It looks fine to me with the code 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report