iLogic to Calculate Actual Area of Flat Pattern

iLogic to Calculate Actual Area of Flat Pattern

arkelec
Collaborator Collaborator
3,770 Views
18 Replies
Message 1 of 19

iLogic to Calculate Actual Area of Flat Pattern

arkelec
Collaborator
Collaborator

I've seen a few threads with similar requests, but not one that will calculate the area of a flay pattern with all of the holes & cut-outs accounted for.  I know how to get the x * y value (which I also need), but not the area of the elements to deduct from that.

 

I can read the figure for iProperties.Volume & material thickness, but for some reason, I can't get this to update when changes are made to the part (e.g. 1000 x 1000 x 2mm = 0.002m³.  Add a cut of 500 x 500 x 2mm should result in 0.0015m³).

 

The figure for iProperties.Mass however, does update.  Is there a way or reading the material property for Density (rather than calculating it from iProperties, as I've seen referenced elsewhere)?  I've looked, but I can't find anything.

0 Likes
Accepted solutions (2)
3,771 Views
18 Replies
Replies (18)
Message 2 of 19

_dscholtes_
Advocate
Advocate

The first idea that comes to mind is to find the largest face of the unfolded pattern and get the surface area of it using it's build in evaluator; <oFace>.Evaluator.Area


[edit] Just realized I'm used to working in VBA and not in iLogic, so actual code may differ[/edit]

0 Likes
Message 3 of 19

WCrihfield
Mentor
Mentor

There are iProperties for that.

Under oDoc.PropertySets.Item("Design Tracking Properties") there are the following Properties you can check.

  • "Material" (10th item)
  • "Mass" (39th item)
  • "SurfaceArea" (40th item)
  • "Volume" (41st item)
  • "Density" (42nd item)
  • "Valid MassProps" (43rd item)
  • "Flat Pattern Width" (44th item)
  • "Flat Pattern Length" (45th item)
  • "Flat Pattern Area" (46th item)
  • "Sheet Metal Width (48th item)
  • "Sheet Metal Length" (50th item)
  • "Sheet Metal Area" (51st item)

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 19

_dscholtes_
Advocate
Advocate

@WCrihfield I'm not very familiar with sheet metal parts, so could you explain the difference between items 44, 45, 46 on one hand and 48, 50, 51 on the other? Thanks in advance.

0 Likes
Message 5 of 19

arkelec
Collaborator
Collaborator

Thanks. Do those only work in a Drawing, as opposed to the Part file?

0 Likes
Message 6 of 19

bradeneuropeArthur
Mentor
Mentor

the one is in default inventor units "cm"

the other in part units like (mm or inch)

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 7 of 19

WCrihfield
Mentor
Mentor
Accepted solution

Sorry for the lack of clarity.

Yes they are different, to some extent.

They are available within all documents, but are either empty or have a value of 0, when not in a sheet metal part file.  And the Flat Pattern ones will only populate after you have created an actual Flat Pattern within that sheet metal part.

The Flat Pattern properties always show in centimeters (the system default, no matter what your units settings), but the Sheet Metal properties always show in the document units.

I'm not 100% sure, but I believe the Flat Pattern Area property shows the entire surface area of the part, including sides, top & bottom, because it seems to come out much larger than I'm expecting.

The Sheet Metal Area, though, seems to show the area of just the one flat side, correctly.  However, it doesn't appear to subtract for interior holes & cutouts.

 

Perhaps a better way would be to use some code similar to this:

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
If oSMDef.HasFlatPattern Then
	MsgBox("Area = " & oSMDef.FlatPattern.BottomFace.Evaluator.Area/(Pow(2.54,2)).ToString,vbOKOnly," ")
Else
	MsgBox("No Flat Pattern", vbOKOnly, " ")
End If

You'll notice I'm using SheetMetalComponentDefinition instead of PartComponentDefinition.  This is necessary for accessing the Sheet Metal specific stuff within the model.

Also you'll notice I'm deviding the Area by Pow(2.54,2).  This is to convert the resulting number from centimeters squared to inches squared.  The Pow() function is being used to represent the 2.54 (squared or to the 'power' of 2).

The result is the same as if you used the manual measure tool on the activated Flat Pattern flat face.  This does subtract for interior holes & cutouts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 8 of 19

WCrihfield
Mentor
Mentor

The Flat Pattern Area property does just measure the one flat face, it's value just needs to be converted from centimeters squared to whatever units you're using.  And it is just like the Sheet Metal Area property, just in the default 'cm' instead of document units.  So it doesn't account for interior holes & cutouts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 9 of 19

WCrihfield
Mentor
Mentor

@arkelec 

Here's another informational ilogic code you may find informational for this subject.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument

Dim oDTP As PropertySet = oPDoc.PropertySets.Item("Design Tracking Properties")

Dim oMatl As String = oDTP.Item("Material").Value
Dim oMass As Double = oDTP.Item("Mass").Value
Dim oSArea As Double = oDTP.Item("SurfaceArea").Value
Dim oVolume As Double = oDTP.Item("Volume").Value


Dim oFPW As Double = oDTP.Item("Flat Pattern Width").Value
Dim oFPL As Double = oDTP.Item("Flat Pattern Length").Value
Dim oFPA As Double = oDTP.Item("Flat Pattern Area").Value

Dim oSMW As String = oDTP.Item("Sheet Metal Width").Value
Dim oSML As String = oDTP.Item("Sheet Metal Length").Value
Dim oSMA As String = oDTP.Item("Sheet Metal Area").Value

MsgBox("Material = " & oMatl & vbCr & _
"Mass = " & oMass.ToString & vbCr & _
"Surface Area = " & oSArea.ToString & vbCr & _
"Volume = " & oVolume.ToString & vbCr & _
"Flat Pattern Width = " & (oFPW/2.54).ToString & vbCr & _
"Flat Pattern Length = " & (oFPL/2.54).ToString & vbCr & _
"Flat Pattern Area = " & (oFPA/(Pow(2.54,2))).ToString & vbCr & _
"Sheet Metal Width = " & oSMW & vbCr & _
"Sheet Metal Length = " & oSML & vbCr & _
"Sheet Metal Area = " & oSMA,vbOKOnly," ")

It lays all those iProperties out in a multi-line MsgBox, to show you all their values.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 10 of 19

arkelec
Collaborator
Collaborator

Thanks @WCrihfield, the solution below is perfect:

oSMDef.FlatPattern.BottomFace.Evaluator.Area

 

This has opened up a whole new are for me.  I tried searching for reference articles on "SheetMetalComponentDefinition", but the Autodesk Knowledge link returned a 404.

 

Are there any up to date references, or are the ones from 2008, 2010 still valid?

 

0 Likes
Message 11 of 19

WCrihfield
Mentor
Mentor

Try this link.  This is in the online API reference help section.

SheetMetalComponentDefinition Object 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 12 of 19

arkelec
Collaborator
Collaborator

Brilliant, thanks.

Again!

0 Likes
Message 13 of 19

arkelec
Collaborator
Collaborator

Hi @WCrihfield, one more question on this if I may.

 

Is it not possible to read the Material Density value in a Part file?

 

https://knowledge.autodesk.com/search-result/caas/simplecontent/content/list-all-iproperties-and-how...

0 Likes
Message 14 of 19

WCrihfield
Mentor
Mentor
Accepted solution

Yes, it is possible.

You can use this to show it in a MsgBox.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDensity As String = oPDoc.PropertySets.Item("Design Tracking Properties").Item("Density").Value
MsgBox("Density iProperty = " & oDensity)

If it's not working, try opening your iProperties dialog box to the Physical tab, and clicking the Update button, then run your code again.

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 15 of 19

WCrihfield
Mentor
Mentor

Another, less friendly way to get the Density is to go through the material asset, then through its' physical property asset, then to its AssetValue, like this.

 

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oMatl As MaterialAsset = oPDoc.ActiveMaterial
Dim oAV As AssetValue = oMatl.PhysicalPropertiesAsset.Item("structural_Density")
MsgBox("Density = " & oAV.Value)

 

It's a bit tricky because the AssetValue.Value doesn't show up in the iLogic Rule Editor's pop-up list of options, when hovering over the AssetValue after the following dot, but it does work.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 16 of 19

arkelec
Collaborator
Collaborator

Great, thanks for these.

0 Likes
Message 17 of 19

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Do you need the netto flat-pattern area without holes etc?

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 18 of 19

arkelec
Collaborator
Collaborator
Hi, yes, I used SheetMetal.FlatExtentsLength & SheetMetal.FlatExtentsWidth for that.
0 Likes
Message 19 of 19

Anonymous
Not applicable

Here's a link to a similar question I had a few months back that solves this problem using iLogic.

https://forums.autodesk.com/t5/inventor-customization/calculate-area-of-holes-and-cutouts-in-flat-pa...

0 Likes