Export Parameter - Text generated from iLogic

Export Parameter - Text generated from iLogic

AnthonyB7
Enthusiast Enthusiast
216 Views
1 Reply
Message 1 of 2

Export Parameter - Text generated from iLogic

AnthonyB7
Enthusiast
Enthusiast

Hello everyone!

 

I am using Inventor 2022 and I have an iLogic code here that creates a flat pattern of any sheet metal part and then creates the bounding box and fill in the information on the custom iProperty for Width and Height of the plate.  (see below). My question is how do I export the Height and Width of the custom iProperty as a parameter so that the BOM utility that we have can be populated with the same information? As of now it does not populate because there is no parameter called Height and Width and no tick box to check. 

 

Is this even possible to link without checking the tick box in the parameters table? 

 

If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.", vbCritical, "")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisDoc.Document
Dim oSMDef As SheetMetalComponentDefinition = Nothing
If TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
	oSMDef = oPDoc.ComponentDefinition
Else
	Try
		oPDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
		oSMDef = oPDoc.ComponentDefinition
	Catch
		MsgBox("Error converting non-sheet metal part to sheet metal.", vbCritical, "")
		Exit Sub
	End Try
End If
Dim oFP As FlatPattern = Nothing
If oSMDef.HasFlatPattern Then
	oFP = oSMDef.FlatPattern
Else
	Try
		ThisApplication.ScreenUpdating = False
		oSMDef.Unfold
		oSMDef.FlatPattern.ExitEdit
		ThisApplication.ScreenUpdating = True
		oFP = oSMDef.FlatPattern
	Catch
		MsgBox("Error Unfolding part to craete FlatPattern.", vbCritical, "")
		Exit Sub
	End Try
End If

Dim extents_length As String = Round(SheetMetal.FlatExtentsLength, 3)
Dim extents_width As String = Round(SheetMetal.FlatExtentsWidth, 3)

iProperties.Value("Custom", "Height") = extents_length
iProperties.Value("Custom", "Width") = extents_width

 

0 Likes
217 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

If you need a parameter for the BOM Export tool then you will need to create one. Here is a VBA sample. 

You will likely find an ilogic sample on this forum with error handling if the parameter is already existing.

 

When you have created the parameter you can then tick the option for property export through code. 

 

Parameter.ExposedAsProperty() As Boolean
If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes