Format exposed custom property at Assembly level (iLogic)

Format exposed custom property at Assembly level (iLogic)

CCarreiras
Mentor Mentor
758 Views
2 Replies
Message 1 of 3

Format exposed custom property at Assembly level (iLogic)

CCarreiras
Mentor
Mentor

Hi!

 

I want to set  the parameter "Thickness" as exposed and also format the value from i.e. "5,000 mm" to "5 mm" 

I want to do that on every part of the main assembly. (All parts are SheetMetal)

 

The first part is working(set as exposed), but formatting the property does not.

 

Any help?

SyntaxEditor Code Snippet

Dim openDoc As Document
openDoc = ThisApplication.ActiveDocument
Dim docFile As Document
If openDoc.DocumentType = 12291 Then
    For Each docFile In openDoc.AllReferencedDocuments
        If docFile.SubType.Equals("{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then
			
        docFile.ComponentDefinition.Parameters("Thickness").ExposedAsProperty = True 
	
	
	'___________NOT WORKING___________
 ShowUnitString = True
 ShowLeadingZeros = True
 ShowTrailingZeros = False
 Precision = kTwoDecimalPlacesPrecision
'_________________

		End If


Next
	 
End If

 

CCarreiras

EESignature

0 Likes
Accepted solutions (1)
759 Views
2 Replies
Replies (2)
Message 2 of 3

rhasell
Advisor
Advisor
Accepted solution

Hi

 

Give this a crack.

 

Dim openDoc As Document
openDoc = ThisApplication.ActiveDocument
Dim docFile As Document
If openDoc.DocumentType = 12291 Then
    For Each docFile In openDoc.AllReferencedDocuments
        If docFile.SubType.Equals("{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}") Then
		
		oParam = docFile.ComponentDefinition.Parameters("Thickness")
		       'docFile.ComponentDefinition.Parameters("Thickness").ExposedAsProperty = True 
			   oParam.ExposedAsProperty = True
			   
			oFormat=oParam.CustomPropertyFormat 'For some reason or other this line is needed to enable the following formatting'
			oFormat.ShowUnitsString=True
			oFormat.ShowLeadingZeros=True
			oFormat.ShowTrailingZeros = False
			oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kOneDecimalPlacePrecision 'Set one decimal place

		End If
		Next
	End If

Regards

 

Reg
2026.1
0 Likes
Message 3 of 3

CCarreiras
Mentor
Mentor

HI!

It works well.

Thank you very much.

CCarreiras

EESignature