Sheet Metal Flatpattern Info

Sheet Metal Flatpattern Info

rhutchins
Enthusiast Enthusiast
2,645 Views
21 Replies
Message 1 of 22

Sheet Metal Flatpattern Info

rhutchins
Enthusiast
Enthusiast
Ok I have searched and searched for this and I cannot find anything it is possible in AutoCAD but I cannot find a way to automate it in Inventor or actually even do it in inventor, what I would like is to be able to get a "Total Linear" cut length of a sheet metal part - all perimeters of cuts, holes, what ever shows up in the flat pattern I would use this info for quoting of parts that I draw currently I have to create a flat pattern save to AutoCAD as dwg or dxf clean up the file so only the Items that the laser will be cutting are in the drawing, then I have a code I found in the AutoCAD customize discussion group that will allow me to select a bunch of enities and it computes the total length of all lines arcs circles ..... that I select then I take that value and type it into a "User Defined" sketched symbol in my IDW. if anyone knows of any way to get this info using inventor that is easy please help.

Thanks
0 Likes
2,646 Views
21 Replies
Replies (21)
Message 2 of 22

Anonymous
Not applicable
So, basically, do you need the total length of all internal and external
loops on the top face of the flat pattern?

Sanjay-

wrote in message news:5331009@discussion.autodesk.com...
Ok I have searched and searched for this and I cannot find anything it is
possible in AutoCAD but I cannot find a way to automate it in Inventor or
actually even do it in inventor, what I would like is to be able to get a
"Total Linear" cut length of a sheet metal part - all perimeters of cuts,
holes, what ever shows up in the flat pattern I would use this info for
quoting of parts that I draw currently I have to create a flat pattern save
to AutoCAD as dwg or dxf clean up the file so only the Items that the laser
will be cutting are in the drawing, then I have a code I found in the
AutoCAD customize discussion group that will allow me to select a bunch of
enities and it computes the total length of all lines arcs circles .....
that I select then I take that value and type it into a "User Defined"
sketched symbol in my IDW. if anyone knows of any way to get this info using
inventor that is easy please help.

Thanks
0 Likes
Message 3 of 22

rhutchins
Enthusiast
Enthusiast
Correct that is exactly what I want I just want to be able to put it to a custom iprop or something so I can get it into my idw. Thanks for the quick response
0 Likes
Message 4 of 22

Anonymous
Not applicable
I've attached some code that displays the total length of all loops on the
top face of the flat pattern. The code assumes that the active document
contains a flat pattern. The sub uses a function (GetTopFaceOfFlat) to get
the top face of the flat pattern. You can also select the desired face via
the UI and use that instead.

However, there is a caveat that you need to be aware of. This sub should
work fine in cases except where the outer profile has silhoutte edges,
chamfers, etc. This code assumes that the outer edge loop of the top face
matches the outer profile that you might see in the DXF output. This is not
always true. As I mentioned earlier, if the outer profile contains chamfers,
etc., this code will not provide the correct values. So make sure to test
various situations to decide if this will work for you.

Sanjay-

Sub GetTotalLength()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oFace As Face
'Set oFace = oDoc.SelectSet(1)
Set oFace = GetTopFaceOfFlat

Dim TotalLength As Double
TotalLength = 0

Dim oEdge As Edge

For Each oEdge In oFace.Edges

Dim oEvaluator As CurveEvaluator
Set oEvaluator = oEdge.Evaluator

Dim minparam As Double
Dim maxparam As Double
Call oEvaluator.GetParamExtents(minparam, maxparam)

Dim length As Double
Call oEvaluator.GetLengthAtParam(minparam, maxparam, length)

TotalLength = TotalLength + length
Next

MsgBox "Total length of all loops on face: " & TotalLength & " cms"

End Sub

Function GetTopFaceOfFlat() As Face

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDef As SheetMetalComponentDefinition
Set oDef = oDoc.ComponentDefinition

'Assumes that the flat has been created
Dim oFlatPattern As FlatPattern
Set oFlatPattern = oDef.FlatPattern

Dim oFace As Face

For Each oFace In oFlatPattern.Body.Faces

' Only interested in planar faces
If oFace.SurfaceType = kPlaneSurface Then

Dim oPlane As Plane
Set oPlane = oFace.Geometry

Dim oZAxis As UnitVector
Set oZAxis =
ThisApplication.TransientGeometry.CreateUnitVector(0, 0, 1)

' Only interested in faces that have z-direction normal
If oPlane.Normal.IsParallelTo(oZAxis) Then

' Look for the face with Z = 0
If oPlane.RootPoint.Z <= 0.0000001 Then
Set GetTopFaceOfFlat = oFace
Exit For
End If
End If
End If
Next

End Function


wrote in message news:5331048@discussion.autodesk.com...
Correct that is exactly what I want I just want to be able to put it to a
custom iprop or something so I can get it into my idw. Thanks for the quick
response
0 Likes
Message 5 of 22

rhutchins
Enthusiast
Enthusiast
Seems to work good I wish I had time to learn more about vba one thing if you don't mind is there an easy way to change it to inches not cm also could you some how send the value to a custom iprop or even the clipboard?? Thank you so much for the help.
0 Likes
Message 6 of 22

Anonymous
Not applicable
I've modified the first sub to display the value in inches as well as create
a custom iProperty named "TotalLength" in the part document. The sub can
also be modified to display and add the iProp value in the current document
units, if you so wish. The 2nd sub (function) remains the same.

Sub GetTotalLength()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oFace As Face
'Set oFace = oDoc.SelectSet(1)
Set oFace = GetTopFaceOfFlat

Dim TotalLength As Double
TotalLength = 0

Dim oEdge As Edge

For Each oEdge In oFace.Edges

Dim oEvaluator As CurveEvaluator
Set oEvaluator = oEdge.Evaluator

Dim minparam As Double
Dim maxparam As Double
Call oEvaluator.GetParamExtents(minparam, maxparam)

Dim length As Double
Call oEvaluator.GetLengthAtParam(minparam, maxparam, length)

TotalLength = TotalLength + length
Next

Dim TotalLengthInchs As Double
TotalLengthInchs = oDoc.UnitsOfMeasure.ConvertUnits(TotalLength,
kDatabaseLengthUnits, kInchLengthUnits)

Dim oCustomPropSet As PropertySet
Set oCustomPropSet =
oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

On Error Resume Next
Dim oCustomProp As Property
Set oCustomProp = oCustomPropSet.Item("TotalLength")

If oCustomProp Is Nothing Then
Set oCustomProp = oCustomPropSet.Add(TotalLengthInchs,
"TotalLength")
Else
oCustomProp.Value = TotalLengthInchs
End If

MsgBox "Total length of all loops on face: " & TotalLengthInchs & " in"

End Sub

Sanjay-

wrote in message news:5331126@discussion.autodesk.com...
Seems to work good I wish I had time to learn more about vba one thing if
you don't mind is there an easy way to change it to inches not cm also could
you some how send the value to a custom iprop or even the clipboard?? Thank
you so much for the help.
Message 7 of 22

rhutchins
Enthusiast
Enthusiast
I have another question same area sortof say i have a sheetmetal part with some holes and some cuts and even some cuts using say the extrude feature enstead of the cut feature, is there a way I can have INV count the qty of features that actually cut threw the part example I have a part with 6 hole features 3 cut features and 10 extruded "using the cut option" features that would place a qty of "19" in a custom iprop field.

Might be a long shot but Thanks in advance
0 Likes
Message 8 of 22

Anonymous
Not applicable
This should be doable, but there may be some complications involved. A
feature may define multiple profiles. Say a cut feature was created by
identifying 3 circular hole profiles. Would you consider the count to be 1
or 3? Same for extrude feature with multiple profiles or a hole feature with
multiple holes.

Sanjay-

wrote in message news:5331261@discussion.autodesk.com...
I have another question same area sortof say i have a sheetmetal part with
some holes and some cuts and even some cuts using say the extrude feature
enstead of the cut feature, is there a way I can have INV count the qty of
features that actually cut threw the part example I have a part with 6 hole
features 3 cut features and 10 extruded "using the cut option" features that
would place a qty of "19" in a custom iprop field.

Might be a long shot but Thanks in advance
0 Likes
Message 9 of 22

rhutchins
Enthusiast
Enthusiast
How I would want it to count would be total holes or cuts for instance say you import a hole pattern from ACAD and use that hole pattern to create an extrusion which in the end gives you 50 holes I would want the number "50" to be sent to the iproperties not "1" ,

On another topic is there a way I can get some of the custom Iproperties over to parameters so I can perform formulas on them?

Thanks
bhutchins
0 Likes
Message 10 of 22

Anonymous
Not applicable
Okay, I thought as much about the hole count. This is doable, as I said
before. But it's not all that straightforward. For extrude and cut features
that define multiple holes, there will need to be quite a bit of logic to
determine the true 'hole' count by analyzing the geometry created by the
feature.

<
over to parameters so I can perform formulas on them?>>
Yes, this is possible also. This will involve getting the value of the
custom property (ies) and creating user parameters using those values.

Sanjay-


wrote in message news:5331317@discussion.autodesk.com...
How I would want it to count would be total holes or cuts for instance say
you import a hole pattern from ACAD and use that hole pattern to create an
extrusion which in the end gives you 50 holes I would want the number "50"
to be sent to the iproperties not "1" ,

On another topic is there a way I can get some of the custom Iproperties
over to parameters so I can perform formulas on them?

Thanks
bhutchins
0 Likes
Message 11 of 22

Anonymous
Not applicable
And there are more complications with the hole count issue. There could be
pattern features in the part that have patterned hole, cut and extrude
features. These need to be accounted for. And worse, we could have iFeatures
that define holes. The individual feature information within an iFeature is
not exposed, so there'll be more geometry analysis to perform.

Sanjay-

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:5331325@discussion.autodesk.com...
Okay, I thought as much about the hole count. This is doable, as I said
before. But it's not all that straightforward. For extrude and cut features
that define multiple holes, there will need to be quite a bit of logic to
determine the true 'hole' count by analyzing the geometry created by the
feature.

<
over to parameters so I can perform formulas on them?>>
Yes, this is possible also. This will involve getting the value of the
custom property (ies) and creating user parameters using those values.

Sanjay-


wrote in message news:5331317@discussion.autodesk.com...
How I would want it to count would be total holes or cuts for instance say
you import a hole pattern from ACAD and use that hole pattern to create an
extrusion which in the end gives you 50 holes I would want the number "50"
to be sent to the iproperties not "1" ,

On another topic is there a way I can get some of the custom Iproperties
over to parameters so I can perform formulas on them?

Thanks
bhutchins
0 Likes
Message 12 of 22

rhutchins
Enthusiast
Enthusiast
Maybe I am explaining myself incorrectlly the qty of cuts in the part does not have to be a circular hole it could be any type of cut or extrusion not just a hole,.. rectangle ellipse text I didn't know if there was a way for INV to see that there has been a subtraction from the object or not? Basically I think if there was a way for INV to see how many interior profiles there are on a flatpattern that would be the number I am looking for??
0 Likes
Message 13 of 22

rhutchins
Enthusiast
Enthusiast
On the topic of the custom iproperties to paremeters does that also have to be done with VBA to get the custom values??
0 Likes
Message 14 of 22

Anonymous
Not applicable
<< Basically I think if there was a way for INV to see how many interior
profiles there are on a flatpattern that would be the number I am looking
for??>>

Now that you phrase it this way, there may be hope :). Try the macro below.
This also requires the GetTopFaceOfFlat function that I'd posted earlier.
The code basically counts the number of loops on the top face and decreases
the count by 1 to account for the exterior loop. The count is published to a
custom prop named "InteriorLoopCount".

Sanjay-

Sub PublishInteriorLoopCount()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oFace As Face
Set oFace = GetTopFaceOfFlat

'Assume that the face has just 1 exterior loop
Dim iInteriorLoopCount As Long
iInteriorLoopCount = oFace.EdgeLoops.Count - 1

Dim oCustomPropSet As PropertySet
Set oCustomPropSet =
oDoc.PropertySets.Item("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

On Error Resume Next
Dim oCustomProp As Property
Set oCustomProp = oCustomPropSet.Item("InteriorLoopCount")

If oCustomProp Is Nothing Then
Set oCustomProp = oCustomPropSet.Add(iInteriorLoopCount,
"InteriorLoopCount")
Else
oCustomProp.Value = iInteriorLoopCount
End If

End Sub
wrote in message news:5331323@discussion.autodesk.com...
Maybe I am explaining myself incorrectlly the qty of cuts in the part does
not have to be a circular hole it could be any type of cut or extrusion not
just a hole,.. rectangle ellipse text I didn't know if there was a way for
INV to see that there has been a subtraction from the object or not?
Basically I think if there was a way for INV to see how many interior
profiles there are on a flatpattern that would be the number I am looking
for??
0 Likes
Message 15 of 22

Anonymous
Not applicable
No, I think you can achieve what you need thru the UI as well. Try the
following:

1. Create a new user parameter with the exact same name as the custom
property.
2. Copy the value of the custom property to the parameter's value field.
3. Mark the user parameter as 'Exported' (check the 'Export Parameter'
column in the parameters dialog).
4. The user parameter and the custom property are now linked. Any changes to
the parameter value will now reflect in the custom property (but not vice
versa).

Sanjay-

wrote in message news:5331340@discussion.autodesk.com...
On the topic of the custom iproperties to paremeters does that also have to
be done with VBA to get the custom values??
0 Likes
Message 16 of 22

rhutchins
Enthusiast
Enthusiast
Once again you are AWSOME!!! Thank you Thank you Thank you and Thank you

On the parameter and iprop issue what I am trying to be able to do is use the first macro "get total linear length" value then use the "interior loop count" value and basically create another custom iprop that would contain a formula like below

a= get total linear
b=interior loop count

The formula would look like the below if you were to do it in excel

((a/1.8)+(b*2)+(b*.5))/60

The "1.8" "2" and ".5" would all be numbers that could be changed in the VBA or make copies of the macro which contains the same info with those 3 numbers being different in each one.
;) is this clear as mudd??

Thanks again for all your help
0 Likes
Message 17 of 22

Anonymous
Not applicable
I don't really know anything about macros so i was wondering if someone could me implement this code in my inventor
0 Likes
Message 18 of 22

Anonymous
Not applicable
Okay, with 2009 release, there are some changes to how we can get information on the SheetMetal Extents. I have some questions about this.


Dim oSheetMetalCompDef As Inventor.SheetMetalComponentDefinition
oSheetMetalCompDef = oPartDoc.ComponentDefinition

Dim dLength as Double
Dim dWidth as Double
Dim dArea as Double


dLength = oSheetMetalCompDef.FlatPattern.Length
dWidth = oSheetMetalCompDef.FlatPattern.width
dArea = ?????

why is the "w" in "width" lowercase?

how do I get to the "Area" of the FlatPattern?

Thx,

AllenG
0 Likes
Message 19 of 22

Anonymous
Not applicable
The name of the width property should be upper-case.

Getting the area of a sheet metal part isn't necessarily a simple process.
In most cases it is but in the case where you have features on the part that
deform (i.e. dimples) or are different on each side of the part (i.e.
counter sink) then it's not so simple.

For the simple case you can use another new feature in Inventor 2009 where
you can easily access either the top or bottom face of the flat pattern. In
the basic case where all cuts are through the entire part the top and bottom
faces will be the same. From the returned Face object you can use
Face.Evaluator.Area to get the area of the face. The area returned will
always be in square centimeters.
--
Brian Ekins
Autodesk Inventor API
0 Likes
Message 20 of 22

Anonymous
Not applicable
Thanks Brian,

I was assuming that Area was simply Length x Width, I hadn't thought about the other cases you mentioned.

I was expecting that it would be exposed under Extents in 2009 like when you RMB on the Flat Pattern in the browser.

I've got everything I need to finish what I'm doing. All I really need is Length x Width.

-AllenG
0 Likes