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 Degree Minute Second format for Parameter

1 REPLY 1
Reply
Message 1 of 2
adam.parr
391 Views, 1 Reply

iLogic Degree Minute Second format for Parameter

I am trying to have iLogic change the custom property format for my user parameters.  I am able to work with linear measurements, but I would like to also work with angular measurements.  I want my angular units to be "Degrees" the format to be "Deg-Min-Sec" and the precision to be DD MM.

 

Below is my code to change the units to deg, but I can't change the format or precision:

 

 Dim oPartDoc As PartDocument
    oPartDoc = ThisApplication.ActiveDocument
    Dim oParameter As Parameter
    Dim oFormat As CustomPropertyFormat
   
   
    For Each oParameter In oPartDoc.ComponentDefinition.Parameters.UserParameters
       
        oFormat = oParameter.CustomPropertyFormat 'set the parameter as a custom property
        oParameter.ExposedAsProperty = True 'export the parameter as an iProperty
 oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType 'set the custom iProperty as a text type
       
        oFormat.Units = "deg" 'sets the unit type.   
       
Next oParameter

1 REPLY 1
Message 2 of 2
jdkriek
in reply to: adam.parr

It's in the .Precision setting:

 

kDegreesAnglePrecision

kMinutesAnglePrecision

kSecondsAnglePrecision 

 

Will set format to Deg-Min-Sec

 

Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oParameter As Parameter
	For Each oParameter In oPartDoc.ComponentDefinition.Parameters.UserParameters
		Dim oFormat As CustomPropertyFormat = oParameter.CustomPropertyFormat 
		oParameter.ExposedAsProperty = True 'export the parameter as an iProperty
		oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType 
		oFormat.Units = "deg" 
		' When you set the precision it will change to Deg-Min-Sec
		oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kDegreesAnglePrecision
		oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kMinutesAnglePrecision
		oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kSecondsAnglePrecision
	Next oParameter

For the Degree and minutes I only see one option from the API, but seconds has:

 

kSecondsOneDecimalPlaceAnglePrecision

kSecondsTwoDecimalPlaceAnglePrecision

kSecondsThreeDecimalPlaceAnglePrecision

kSecondsFourDecimalPlaceAnglePrecision

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report