3DCADWorld Network | 3DCADTips | 3DCADTutorials | 3DCADForums | 3DCADSearch | 3DCADBooks | Design World






Get CAD tips and tutorials on your desktop when you register at 3DCADTips.com!

3DCADTips Weekly
Latest Issue
Archive

3DCADTips Forum Update
Latest Issue
Archive










  #1 (permalink)  
Old May 28th, 2006, 01:11 PM
sotiris
 
Posts: n/a
Default Flatpattern Dimensions

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Link


  #2 (permalink)  
Old June 24th, 2006, 01:05 AM
support
 
Posts: n/a
Cool Reply from Autodesk...

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

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-----------------------------
Attached Files
File Type: zip sm_extents.zip (256.5 KB, 14 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old July 3rd, 2006, 02:18 PM
sotiris
 
Posts: n/a
Default

Quote:
Originally Posted by support
We located a reply from Bob Van der Donck of Autodesk regarding your issue.
Good Luck!
3DCADTips Help desk

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -6. The time now is 04:42 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0