Inventor Customization

Inventor Customization

Reply
Member
ToddVS
Posts: 3
Registered: ‎03-17-2009
Message 1 of 4 (687 Views)

iLogic 2013 - Create Yes/No property type

687 Views, 3 Replies
06-21-2012 08:05 AM
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

*Expert Elite*
Curtis_Waguespack
Posts: 2,934
Registered: ‎03-08-2006
Message 2 of 4 (678 Views)

Re: iLogic 2013 - Create Yes/No property type

06-21-2012 03:33 PM 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

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Distinguished Contributor
sergelachance
Posts: 179
Registered: ‎04-30-2012
Message 3 of 4 (425 Views)

Re: iLogic 2013 - Create Yes/No property type

01-10-2013 07:16 AM in reply to: Curtis_Waguespack

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

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 4 of 4 (404 Views)

Re: iLogic 2013 - Create Yes/No property type

01-13-2013 07:04 PM in reply to: sergelachance

Hi,

 

It looks fine to me with the code 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.