- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
.
If you want and have time, I would appreciate your Vote(s) for My IDEAS
or you can Explore My CONTRIBUTIONS
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Here is an image I captured from my computer after I ran that rule on a simple sheet metal part with one bend.
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
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Your rule work good as everytime. Im so thankful.
Have a nice day!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report