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

count of bends, laser cutting distance, sheet thickness and bent part area in BOM table

Anonymous

count of bends, laser cutting distance, sheet thickness and bent part area in BOM table

Anonymous
Not applicable

Hello,

last time i was asking about iLogic rule to show laser cutting length in my drawing table. Today my question is:
Does Inventor 2021 have any possibility (ex by iLogic rule) to show parameters like count of bends, laser cutting length, sheet thickness and bent part area in BOM table? It'd be easier to determine costs if I will have this parameters in 1 table together on assembly drawing.

Do anyone have skills and knowledge to write this rule?


Best regards

0 Likes
Reply
Accepted solutions (1)
1,413 Views
7 Replies
Replies (7)

WCrihfield
Mentor
Mentor

This sounds like it could potentially be a somewhat large project.  First of all, I would have to say that if you can do it manually, then there's hope that it can be done by iLogic.  Have you tried to do any of this manually yet?  In an assembly's BOM, you can manually add columns for standard & custom iProperties.  If those iProperties were reflections of parameters, that were being kept accurate, then you may have all the data you need in one place, as you are wanting.  Of course, since this is the BOM we're talking about, any columns you add to it for custom iProperties will effect/encompass all components listed in the BOM, so if that custom iProperty doesn't exist yet, it will create that custom iProperty within the document of every component listed.  It can be quicker/easier to mass create custom iProperties this way when needed.  The manual alternative would be to first open every component, and add the custom iProperty manually, then save them.  But it sounds like some of the information you are wanting shown within the BOM may need to be retrieved into these properties by iLogic rules which inspect those components and ensure the values of those properties are accurate.  Do you already have the rules needed to collect all the needed data from your model files into the parameters & properties?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Anonymous
Not applicable

hello, thanks for response.

I managed to add sheet thickness, laser cut distance and bend radius to custom iproperties. But I still have a problem how to invoke count of bends and see this in parameters. Can anyone edit my rule below? this rule working good but it only showing count of bends and isnt adding this to parameters.

 

Thanks a lot

 

'access the active document
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

' Set a reference to the active flat pattern.
Dim oFlatPattern As FlatPattern
oFlatPattern = oDoc.ComponentDefinition.FlatPattern

Dim oBends As FlatBendResults
oBends = oFlatPattern.FlatBendResults  

MessageBox.Show("FlatBendResults count: " &  oBends.Count, "iLogic")

Dim oAllBendEdges As EdgeCollection
oTopFaceBendEdges = ThisApplication.TransientObjects.CreateEdgeCollection

Dim oEdge As Edge
Dim oEdges As Edges
 
' Get all Bend UP edges on top face  
'True = Top Face
oEdges = oFlatPattern.GetEdgesOfType _
(FlatPatternEdgeTypeEnum.kBendUpFlatPatternEdge, True)

i = 0
For Each oEdge In oEdges
    i = i + 1
Next

' Get all Bend DOWN edges on top face
'True = Top Face
oEdges = oFlatPattern.GetEdgesOfType _
(FlatPatternEdgeTypeEnum.kBendDownFlatPatternEdge, True)

For Each oEdge In oEdges
    i = i + 1
Next

MessageBox.Show("Top face bends count: " &  i, "iLogic")

' Get all Bend UP edges on bottom face  
'True = Bottom Face
oEdges = oFlatPattern.GetEdgesOfType _
(FlatPatternEdgeTypeEnum.kBendUpFlatPatternEdge, True)

i = 0
For Each oEdge In oEdges
    i = i + 1
Next

' Get all Bend DOWN edges on bottom face
'False = Bottom Face
oEdges = oFlatPattern.GetEdgesOfType _
(FlatPatternEdgeTypeEnum.kBendDownFlatPatternEdge, False)

For Each oEdge In oEdges
    i = i + 1
Next

MessageBox.Show("Bottom face bends count: " &  i, "iLogic")

 

0 Likes

WCrihfield
Mentor
Mentor

Hi @Anonymous.  There are several different numbers to consider, so I'm not sure which ones you want to just show the user, and which ones you want written to parameters.  I created an alternate rule, based on your general idea, and included a few more things you might consider.  I have one big report (MsgBox) near the end to show results from all inspections.  Then I added a little code to the end, showing you how to write one of the values to a user parameter, if you wanted.  Then I commented that part out for now, until you have had time to decide which final numbers you want to write to parameters.

Here's what I've got right now:

 

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If Not TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
	MsgBox("This Part is not a Sheet Metal Part.  Exiting rule.",,"")
	Exit Sub
End If
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oBends As Integer = oSMDef.Bends.Count
Dim oBendPartFeatures As Integer = oSMDef.Features.BendPartFeatures.Count
Dim oUnwrapFeatures As Integer = oSMDef.Features.UnwrapFeatures.Count
If Not oSMDef.HasFlatPattern Then
	Try
		oSMDef.Unfold
	Catch
		MsgBox("The attempt to 'Unfold' this part to get its Flat Pattern failed.  Exiting rule.", , "")
		Exit Sub
	End Try
End If
Dim oFPatt As FlatPattern = oSMDef.FlatPattern
Dim oFlatBendResults As Integer = oFPatt.FlatBendResults.Count

Dim oTopBendEdges, oBottomBendEdges, oTotalBendEdges As Integer
Dim oEdges As Edges
 
' Get all Bend UP edges on top face (True = Top Face)
oEdges = oFPatt.GetEdgesOfType(FlatPatternEdgeTypeEnum.kBendUpFlatPatternEdge, True)
oTopBendEdges = oEdges.Count

' Get all Bend DOWN edges on top face (True = Top Face)
oEdges = oFPatt.GetEdgesOfType(FlatPatternEdgeTypeEnum.kBendDownFlatPatternEdge, True)
oTopBendEdges = oTopBendEdges + oEdges.Count

' Get all Bend UP edges on bottom face (False = Bottom Face)
oEdges = oFPatt.GetEdgesOfType(FlatPatternEdgeTypeEnum.kBendUpFlatPatternEdge, False)
oBottomBendEdges = oEdges.Count

' Get all Bend DOWN edges on bottom face (False = Bottom Face)
oEdges = oFPatt.GetEdgesOfType(FlatPatternEdgeTypeEnum.kBendDownFlatPatternEdge, False)
oBottomBendEdges = oBottomBendEdges + oEdges.Count

oTotalBendEdges = oTopBendEdges + oBottomBendEdges

MsgBox("This Sheet Metal Part has:  " & vbCrLf & _
oBends & " 'Bends'" & vbCrLf & _
oBendPartFeatures & " 'BendPartFeatures'" & vbCrLf & _
oUnwrapFeatures & " 'UnwrapFeatures'" & vbCrLf & _
oFlatBendResults & " 'FlatBendResults'" & vbCrLf & _
oTopBendEdges & " Flat Pattern Top Face Bend Edges" & vbCrLf & _
oBottomBendEdges & " Flat Pattern Bottom Face Bend Edges" & vbCrLf & _
oTotalBendEdges & " Total Flat Pattern Bend Edges", , "")

'Dim oUParams As UserParameters = oSMDef.Parameters.UserParameters
'Dim oUParam As UserParameter
'Try
'	oUParam = oUParams.Item("BendsCount").Value = oBends
'Catch
'	oUParam = oUParams.AddByValue("BendsCount", oBends, UnitsTypeEnum.kUnitlessUnits)
'End Try

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

Anonymous
Not applicable

Hello,
You're very helpful for me and thank you for this. But still I got problem because no one of parameters showed in MSGBOX didnt save in parameter list. I need total count of bends for part, I think it is just "Bends" in your rule. And totally I dont know how to repair this to have what i want..

Could you edit your rule, last one time pls?

0 Likes

WCrihfield
Mentor
Mentor
Accepted solution

Here is an image I captured from my computer after I ran that rule on a simple sheet metal part with one bend.

Sheet Metal Bends Count Results.png

 As you can see, the message displayed by my rule reported that there were:

1 Bends

0 BendPartFeatures

0 UnwrapFeatures

2 FlatBendResults

1 Flat Pattern Top Face Bend Edges

1 Flat Pattern Bottom Face Bend Edges

2 Total Flat Pattern Bend Edges

 

This part was started from a 'Face' feature (simple rectangular sketch, which was thickened into a solid plate using the sheet metal Plate tool.  Then I added one 'Flange' at 90 degrees using the sheet metal Flange tool, which automatically adds the bend in there for me, according to the current sheet metal rule.  The other features are just Hole features.  So this detailed inspection of this simple part, should give us some insight into how these types of things are counted.

 

I will now simplify my rule above to only get the 'Bends' count, then write that number to a user parameter named "BendsCount", similarly to what I had commented out at the end of that last code.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
If Not TypeOf oPDoc.ComponentDefinition Is SheetMetalComponentDefinition Then
	MsgBox("This Part is not a Sheet Metal Part.  Exiting rule.",,"")
	Exit Sub
End If
Dim oSMDef As SheetMetalComponentDefinition = oPDoc.ComponentDefinition
Dim oBends As Integer = oSMDef.Bends.Count
MsgBox("This Sheet Metal Part has:  " & oBends & " 'Bends'.", vbInformation, "BendsCount")
Dim oUParams As UserParameters = oSMDef.Parameters.UserParameters
Dim oUParam As UserParameter
Try
	oUParam = oUParams.Item("BendsCount")
	oUParam.Value = oBends
Catch
	oUParam = oUParams.AddByValue("BendsCount", oBends, UnitsTypeEnum.kUnitlessUnits)
End Try

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Anonymous
Not applicable

Hello,

Your rule work good as everytime. Im so thankful. 

Have a nice day!

0 Likes

3deducad
Explorer
Explorer
Bravo!
Great tool to organize sheetmetal parts.
Thanks.
0 Likes