Sheet Metal Sizes into PArameter for dwg

Sheet Metal Sizes into PArameter for dwg

machiel.veldkamp
Collaborator Collaborator
435 Views
1 Reply
Message 1 of 2

Sheet Metal Sizes into PArameter for dwg

machiel.veldkamp
Collaborator
Collaborator

I want to put the extents from a sheet metal part in a Parameter. 

 

Sub Main()
	'Determines if there is a flat pattern
	Dim oDoc As PartDocument
	oDoc = ThisDoc.Document
	'ensure this part has a flat pattern
	Dim oSMDef As SheetMetalComponentDefinition
	oSMDef = oDoc.ComponentDefinition
	
	If oSMDef.FlatPattern Is Nothing Then
		'Warns the user there is no flat pattern
		'MessageBox.Show("This file has no flat pattern", "iLogic")
	Else
		Extents
	End If
End Sub

Sub Extents()
	extents_length = SheetMetal.FlatExtentsLength
	extents_width = SheetMetal.FlatExtentsWidth
	LengthFrac = Round(SheetMetal.FlatExtentsLength, 1)
	WidthFrac = Round(SheetMetal.FlatExtentsWidth, 1)
	Dim oValue As String
	Dim param As Parameter
	
		If extents_width < extents_length Then
			oValue = ("FP " &  WidthFrac & "x" & LengthFrac &"x" & Parameter("Thickness") & "mm")
			param=param.AddByValue("DIMENSIONS", (oValue)  , "text")
		Else
			oValue = ("FP " &  LengthFrac & "x" & WidthFrac &"x" & Parameter("Thickness") & "mm")
			param=param.AddByValue("DIMENSIONS", (oValue)  , "text")
	End If
End Sub

 

I'm close but I can't figure out how to actually make the parameter. 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Accepted solutions (1)
436 Views
1 Reply
Reply (1)
Message 2 of 2

machiel.veldkamp
Collaborator
Collaborator
Accepted solution

Never mind. Solved it by putting it in the Custom iProperties. 

 

 

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes