Results 1 to 5 of 5
  1. #1
    sotiris Guest

    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.

    •   AltAdvertisment

        

  2. #2
    Join Date
    Feb 2006
    Posts
    323

    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 Attached Files

    •   AltAdvertisment

        

  3. #3
    sotiris Guest

    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

    •   AltAdvertisment

        

  4. #4
    Join Date
    Apr 2013
    Posts
    1

    Thumbs up Thank you

    Quote Originally Posted by support View Post
    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-----------------------------
    Thank you I use

  5. #5
    Join Date
    Jun 2014
    Posts
    3

    Default

    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

Similar Threads

  1. Align Dimensions
    By Ariabod in forum Inventor Forum
    Replies: 4
    Last Post: July 21st, 2008, 10:06 AM
  2. Fractional dimensions
    By NewBoy in forum Inventor Forum
    Replies: 5
    Last Post: March 13th, 2008, 08:27 AM
  3. Dimensions not associated
    By cmlucifer in forum AutoCAD Forum
    Replies: 0
    Last Post: February 15th, 2008, 08:00 AM
  4. No dimensions on drawings
    By broncolane1 in forum SolidWorks Forum
    Replies: 6
    Last Post: February 9th, 2008, 01:08 PM
  5. How can I edit dimensions?
    By newbie1924 in forum Solid Edge Forum
    Replies: 5
    Last Post: September 12th, 2006, 09:30 PM

 

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •