iLogic to see if Custom Parameter is set to Export, then either Set to Export or not.

iLogic to see if Custom Parameter is set to Export, then either Set to Export or not.

arkelec
Collaborator Collaborator
544 Views
2 Replies
Message 1 of 3

iLogic to see if Custom Parameter is set to Export, then either Set to Export or not.

arkelec
Collaborator
Collaborator

Is this possible?

 

A custom parameter xLength already exists in a part file, but may or may not be set to export.

I'd like to check, by running some code launched from a form button & then set the status.

What I can't work out, is how to read a specific custom parameter (the correct syntax).

 

Thanks in advance.

 

 

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

arkelec
Collaborator
Collaborator
Accepted solution

Found the answer (well partially):

Sub Main()
'-------------------------------------------------------------------------
'Vars
'-------------------------------------------------------------------------
'
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oFormat As CustomPropertyFormat
'
'
'============ Custom User Parameter Property Format =============
'
	oParam = oDoc.ComponentDefinition.Parameters("xLength")
'
	If oParam.ExposedAsProperty = False Then 'Flag for Export
		oParam.ExposedAsProperty = True 
		oFormat = oParam.CustomPropertyFormat
		oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = False		
'
	Else If oParam.ExposedAsProperty = True Then 'Flag for Export
		oFormat = oParam.CustomPropertyFormat
		oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
		oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
		oFormat.ShowUnitsString = False
		oFormat.ShowLeadingZeros = False
		oFormat.ShowTrailingZeros = False	

	End If
'
End Sub

 

0 Likes
Message 3 of 3

bradeneuropeArthur
Mentor
Mentor
Accepted solution
Public Sub Main
	Dim a As Inventor.Application = ThisApplication	
	
 	Dim p As Inventor.PartDocument = a.ActiveDocument
	
	Dim c As Inventor.PartComponentDefinition = p.ComponentDefinition
	
	MsgBox (c.Parameters.Item("xLength").ExposedAsProperty)
	
	End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes