Welcome to 3DCADForums

Join our CAD community forums where over 25,000 users interact to solve day to day problems and share ideas. We encourage you to visit, invite you to participate and look forward to your input and opinions. Acrobat 3D, AutoCAD, Catia, Inventor, IronCAD, Creo, Pro/ENGINEER, Solid Edge, SolidWorks, and others.

Register Log in

Flatpattern Dimensions

S

sotiris

Guest
Hello,
Do any have an idea how to print in the BOM the
extens dimensions of the flat pattern in a sheetmetal part.
Thank you.
 

support

New member
Reply from Autodesk...

We located a reply from Bob Van der Donck of Autodesk regarding your issue.
Good Luck!
3DCADTips Help desk :cool:

Reply From: Bob Van der Donck \(Autodesk\)
Date: Jun/08/06 - 19:43 (CDT) NEW!

Re: Flatpattern Dimensions
You could extract the extents via the API and feed these values to a custom property in your sheet metal part. After you use the part in an assembly, you can add custom properties to the BOM with the command "Add custom iProperty columns" (icon number six on the toolbar). I called the custom props "length" and "width".

You will also need to define a dummy "length" and "width" property in your
assembly. I have attached a sample R11 assembly and sample VBA code.
However each time the sheet metal part extents change , you will need to run this macro to get the values updated in the BOM.

Bob
-------------------------------Cut here ----------------------------------
Public Sub extents_to_custom_props()
Dim objpartDoc As PartDocument
Set objpartDoc = ThisApplication.ActiveDocument
Dim objCompDef As SheetMetalComponentDefinition
Set objCompDef = objpartDoc.ComponentDefinition
Dim fpBox As Box
Set fpBox = objCompDef.FlatPattern.Body.RangeBox
Dim width As Double
Dim length As Double
length = fpBox.MaxPoint.X - fpBox.MinPoint.X
width = fpBox.MaxPoint.Y - fpBox.MinPoint.Y
Dim objUOM As UnitsOfMeasure
Set objUOM = objpartDoc.UnitsOfMeasure
Dim strLength As String
Dim strWidth As String
strLength = objUOM.GetStringFromValue(length,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
strWidth = objUOM.GetStringFromValue(width,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
Call MsgBox("Width = " + strWidth + vbCrLf + "Length = " + strLength,
vbOKOnly, "Sheet Metal Flat Pattern")
Call Create_ext_prop("width", strWidth)
Call Create_ext_prop("length", strLength)
End Sub

Sub Create_ext_prop(prop As String, prop_value As String)
Dim opropsets As PropertySets
Dim opropset As PropertySet
Dim oUserPropertySet As PropertySet
Set opropsets = ThisApplication.ActiveDocument.PropertySets
For Each opropset In opropsets
If opropset.Name = "Inventor User Defined Properties" Then Set
oUserPropertySet = opropset
Next opropset
' If Property does not exist then add the new Property
On Error Resume Next
Call oUserPropertySet.Add(prop_value, prop)
' Try to set the Property value if it already exists
For i = 1 To oUserPropertySet.Count
If oUserPropertySet.Item(i).Name = prop Then
oUserPropertySet.Item(i).Value = prop_value
Next i
End Sub
-------------------------------Cut here-----------------------------
 

Attachments

S

sotiris

Guest
support said:
We located a reply from Bob Van der Donck of Autodesk regarding your issue.
Good Luck!
3DCADTips Help desk :cool:

Reply From: Bob Van der Donck \(Autodesk\)
Date: Jun/08/06 - 19:43 (CDT) NEW!

Re: Flatpattern Dimensions
You could extract the extents via the API and feed these values to a custom property in your sheet metal part. After you use the part in an assembly, you can add custom properties to the BOM with the command "Add custom iProperty columns" (icon number six on the toolbar). I called the custom props "length" and "width".

You will also need to define a dummy "length" and "width" property in your
assembly. I have attached a sample R11 assembly and sample VBA code.
However each time the sheet metal part extents change , you will need to run this macro to get the values updated in the BOM.

Bob
-------------------------------Cut here ----------------------------------
Public Sub extents_to_custom_props()
Dim objpartDoc As PartDocument
Set objpartDoc = ThisApplication.ActiveDocument
Dim objCompDef As SheetMetalComponentDefinition
Set objCompDef = objpartDoc.ComponentDefinition
Dim fpBox As Box
Set fpBox = objCompDef.FlatPattern.Body.RangeBox
Dim width As Double
Dim length As Double
length = fpBox.MaxPoint.X - fpBox.MinPoint.X
width = fpBox.MaxPoint.Y - fpBox.MinPoint.Y
Dim objUOM As UnitsOfMeasure
Set objUOM = objpartDoc.UnitsOfMeasure
Dim strLength As String
Dim strWidth As String
strLength = objUOM.GetStringFromValue(length,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
strWidth = objUOM.GetStringFromValue(width,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
Call MsgBox("Width = " + strWidth + vbCrLf + "Length = " + strLength,
vbOKOnly, "Sheet Metal Flat Pattern")
Call Create_ext_prop("width", strWidth)
Call Create_ext_prop("length", strLength)
End Sub

Sub Create_ext_prop(prop As String, prop_value As String)
Dim opropsets As PropertySets
Dim opropset As PropertySet
Dim oUserPropertySet As PropertySet
Set opropsets = ThisApplication.ActiveDocument.PropertySets
For Each opropset In opropsets
If opropset.Name = "Inventor User Defined Properties" Then Set
oUserPropertySet = opropset
Next opropset
' If Property does not exist then add the new Property
On Error Resume Next
Call oUserPropertySet.Add(prop_value, prop)
' Try to set the Property value if it already exists
For i = 1 To oUserPropertySet.Count
If oUserPropertySet.Item(i).Name = prop Then
oUserPropertySet.Item(i).Value = prop_value
Next i
End Sub
-------------------------------Cut here-----------------------------
Actually I am using Inventor R9 and I could not open the files in order to how the code runs.
I copy the macro in my part (Ver 9) and when I run the macro I get the MsgBox with the values of length and width.
How can I use them in assembly.
Please send me a sample part and assembly in Inventor 9
Thank you in advance.
Sotiris
 
Thank you

We located a reply from Bob Van der Donck of Autodesk regarding your issue.
Good Luck!
3DCADTips Help desk :cool:

Reply From: Bob Van der Donck \(Autodesk\)
Date: Jun/08/06 - 19:43 (CDT) NEW!

Re: Flatpattern Dimensions
You could extract the extents via the API and feed these values to a custom property in your sheet metal part. After you use the part in an assembly, you can add custom properties to the BOM with the command "Add custom iProperty columns" (icon number six on the toolbar). I called the custom props "length" and "width".

You will also need to define a dummy "length" and "width" property in your
assembly. I have attached a sample R11 assembly and sample VBA code.
However each time the sheet metal part extents change , you will need to run this macro to get the values updated in the BOM.

Bob
-------------------------------Cut here ----------------------------------
Public Sub extents_to_custom_props()
Dim objpartDoc As PartDocument
Set objpartDoc = ThisApplication.ActiveDocument
Dim objCompDef As SheetMetalComponentDefinition
Set objCompDef = objpartDoc.ComponentDefinition
Dim fpBox As Box
Set fpBox = objCompDef.FlatPattern.Body.RangeBox
Dim width As Double
Dim length As Double
length = fpBox.MaxPoint.X - fpBox.MinPoint.X
width = fpBox.MaxPoint.Y - fpBox.MinPoint.Y
Dim objUOM As UnitsOfMeasure
Set objUOM = objpartDoc.UnitsOfMeasure
Dim strLength As String
Dim strWidth As String
strLength = objUOM.GetStringFromValue(length,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
strWidth = objUOM.GetStringFromValue(width,
UnitsTypeEnum.kDefaultDisplayLengthUnits)
Call MsgBox("Width = " + strWidth + vbCrLf + "Length = " + strLength,
vbOKOnly, "Sheet Metal Flat Pattern")
Call Create_ext_prop("width", strWidth)
Call Create_ext_prop("length", strLength)
End Sub

Sub Create_ext_prop(prop As String, prop_value As String)
Dim opropsets As PropertySets
Dim opropset As PropertySet
Dim oUserPropertySet As PropertySet
Set opropsets = ThisApplication.ActiveDocument.PropertySets
For Each opropset In opropsets
If opropset.Name = "Inventor User Defined Properties" Then Set
oUserPropertySet = opropset
Next opropset
' If Property does not exist then add the new Property
On Error Resume Next
Call oUserPropertySet.Add(prop_value, prop)
' Try to set the Property value if it already exists
For i = 1 To oUserPropertySet.Count
If oUserPropertySet.Item(i).Name = prop Then
oUserPropertySet.Item(i).Value = prop_value
Next i
End Sub
-------------------------------Cut here-----------------------------
Thank you I use
 

ajc5050

New member
1. create custom iProperty in your sheetmetal part.


name= G_L
type= text
Value= =<FLAT PATTERN LENGTH>*10


create another one,

name= G_W
type= text
Value= =<FLAT PATTERN WIDTH>*10

these values will only update once a flat pattern is created and will display them as length & width in your BOM
 

Sponsor

Top