Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to export certain model properties from a iPart in to an excel sheet.

JonnyPot
Advocate

How to export certain model properties from a iPart in to an excel sheet.

JonnyPot
Advocate
Advocate

To calculate the manufactering costs of sheet metal i need the folowing propertis:
-code part
-width
-height
-description
-thickness
-height flat model
-width flat model
-perimeter
-n° of breakthroughs ( number of times the laser will have to desente, exemple attached)
-n° of folds (total folds of the piece) 


I need help with finding the n° of breakthroughs ( number of times the laser will have to decente, exemple attached) and help with exporting all those parameters into a excel sheet.

0 Likes
Reply
Accepted solutions (1)
660 Views
3 Replies
Replies (3)

JelteDeJong
Mentor
Mentor

you can try this:

Dim doc As PartDocument = ThisDoc.Document
Dim def As SheetMetalComponentDefinition = doc.ComponentDefinition

If (def.HasFlatPattern) Then
    def.FlatPattern.Edit()
Else
    def.Unfold()
End If

Dim flat As FlatPattern = def.FlatPattern
Dim sketch As PlanarSketch = flat.Sketches.Add(flat.TopFace, True)

sketch.Profiles.AddForSolid()


Dim profile As Profile = sketch.Profiles.Item(1)
MsgBox("Number of bends: " & def.Bends.Count & System.Environment.NewLine &
       "Number of profiles (that includes outerprofile): " & profile.Count & System.Environment.NewLine &
       "Number of breakthroughs: " & profile.Count - 1)

'you don't need this part but might be good to know that it Is possible
'For Each path As ProfilePath In profile
'    Dim addMaterial = Path.AddsMaterial
'    For Each ent As ProfileEntity In Path
'        ' in the ProfileEntities you can find the 
'        ' Information to calulate the perimeter of the 
'        ' breakthroughs and the outer perimeter
'    Next
'Next
sketch.Delete()
flat.ExitEdit()

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

JelteDeJong
Mentor
Mentor
Accepted solution

After reading this post i realised there is a better way to do this.

Dim doc As PartDocument = ThisDoc.Document
Dim def As SheetMetalComponentDefinition = doc.ComponentDefinition
If (def.HasFlatPattern) Then
	def.FlatPattern.Edit()
Else
	def.Unfold()
End If

Dim flat As FlatPattern = def.FlatPattern
Dim edgeloops As EdgeLoops = flat.TopFace.EdgeLoops

Dim oMeasure As MeasureTools = ThisApplication.MeasureTools
Dim outerPerimeter As Double = 0
Dim breakthroughsPerimeter As Double = 0
For Each edgeLoop As EdgeLoop In edgeloops
	' length is multiplied by 10 to convert cm to mm
	Dim edgeLength = oMeasure.GetLoopLength(EdgeLoop) * 10

	If (EdgeLoop.IsOuterEdgeLoop) Then
		outerPerimeter = outerPerimeter + edgeLength
	Else
		breakthroughsPerimeter = breakthroughsPerimeter + edgeLength
	End If
Next
flat.ExitEdit()
MsgBox("Number of bends: " & def.Bends.Count & System.Environment.NewLine &
		"Number of edge loops (that includes outerprofile): " & edgeloops.Count & System.Environment.NewLine &
		"Number of breakthroughs: " & (edgeloops.Count - 1) & System.Environment.NewLine &
		"Total outer perimeter: " & Math.Round(outerPerimeter, 1) & System.Environment.NewLine &
		"Total breakthroughs perimeter: " & Math.Round(breakthroughsPerimeter, 2))

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

JonnyPot
Advocate
Advocate

do you know if it's possible to export that information from all the instances of a iPart to a excel sheet?

0 Likes