Inventor Customization

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

iLogic 2013 - Create Yes/No property type

648 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,773
Registered: ‎03-08-2006
Message 2 of 4 (639 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: 166
Registered: ‎04-30-2012
Message 3 of 4 (386 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,233
Registered: ‎06-12-2011
Message 4 of 4 (365 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube