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 to create custom iproperty

3 REPLIES 3
Reply
Message 1 of 4
dschleede
1231 Views, 3 Replies

iLogic to create custom iproperty

I use the following ilogic code to calculate mass of a part or assembly and display it without the "lbs" or "kgs" label.  I am wondering what else I need to add to export the parameter as a custom iproperty.  Please excuse me if this is a dumb question; I am just learning iLogic.

 

 

SyntaxEditor Code Snippet

Dim openDoc As Document
openDoc = ThisDoc.Document

'KG
If openDoc.unitsofmeasure.massunits = 11283 Then
conversion_factor_lbs = 2.20462
conversion_factor_kgs = 1.0
End If

'grams
If openDoc.unitsofmeasure.massunits = 11284 Then
conversion_factor_lbs = 0.0022046
conversion_factor_kgs = 0.001
End If

'slugs
If openDoc.unitsofmeasure.massunits = 11285 Then
conversion_factor_lbs = 32.1740486
conversion_factor_kgs = 14.5939029
End If

'lbs
If openDoc.unitsofmeasure.massunits = 11286 Then
conversion_factor_lbs = 1.0
conversion_factor_kgs = 0.4535924
End If

Mass_lbs = iProperties.Mass * conversion_factor_lbs
Mass_kgs = iProperties.Mass * conversion_factor_kgs

If Mass_lbs < 1 Then
Weight_lbs = Round(Mass_lbs,2)
Else If Mass_lbs >= 1 Then
Weight_lbs = Round(Mass_lbs)
End If

If Mass_kgs < 1 Then
Weight_kgs = Round(Mass_lbs,2)
Else If Mass_kgs >= 1 Then
Weight_kgs = Round(Mass_kgs)
End If
3 REPLIES 3
Message 2 of 4
rossano_praderi
in reply to: dschleede

Hi,

inside the Ilogics editor you will find this piece of code which can be used to add/change a custom Iproperty.

 

iProperties.Value("Custom", "PropertyName") = 100

 



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 3 of 4

I know it's an old post but still....

If you try to set a non-existent custom iproperty IV will automaticaly add that property?
How does it define the property? As text? Because there are several types to choose from when adding a custom field from the iproperty window.

Message 4 of 4

Hi,

the follow link give you a well explained answer

https://modthemachine.typepad.com/my_weblog/2010/02/custom-iproperties.html

 

Bregs

Rossano Praderi



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------

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

Post to forums  

Autodesk Design & Make Report