Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
It is possible to change the part material with a iLogic rule from .idw?
Solved! Go to Solution.
Hi,
It is possible to change the part material with a iLogic rule from .idw?
Solved! Go to Solution.
Hi @CGVJM6DF . Yes, of course it is possible. This question has already been asked several times, here are some ready-made solutions: link , link , link . If you have any problems, we are happy to help you.
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
thanks @Andrii_Humeniuk ,
But that's not what I want.
I need a rule for the .idw (Drawing) template, that will change/add a material to the part (sheet metal) it belongs to.
Hi @CGVJM6DF
Please provide the method how you currently do this manually. Images of the method will clarify the request. Your description currently has multiple possibilities.
Hi @A.Acheson
I didn't do it yet. I ask if it is possible to assign a material to the part, with a rule, running it from the drawing of the part.
This iLogic code change material your part from drawing.
Public Sub Main()
Dim oInvApp As Inventor.Application = ThisApplication
Dim oDDoc As DrawingDocument = TryCast(oInvApp.ActiveDocument, DrawingDocument)
If oDDoc Is Nothing Then Exit Sub
Dim oViews As DrawingViews = oDDoc.ActiveSheet.DrawingViews
If oViews.Count = 0 Then Exit Sub
Dim oDoc As PartDocument = TryCast(oViews(1).ReferencedDocumentDescriptor.ReferencedDocument, PartDocument)
Dim oList As New List(Of String)
For Each oAssetlib As AssetLibrary In oInvApp.AssetLibraries
For i As Integer = 1 To oAssetlib.MaterialAssets.Count
oList.Add(oAssetlib.MaterialAssets(i).DisplayName)
Next
Next
oList.Sort
Dim sMat As String = InputListBox(oDoc.DisplayName, oList,
oDoc.ActiveMaterial.DisplayName, "Asset Libraries.", "Select Material:")
If String.IsNullOrEmpty(sMat) Then Exit Sub
If oDoc.ActiveMaterial.DisplayName = sMat Then Exit Sub
Dim oNewAsset As Asset
For Each oAssetlib As AssetLibrary In oInvApp.AssetLibraries
For i As Integer = 1 To oAssetlib.MaterialAssets.Count
If oAssetlib.MaterialAssets(i).DisplayName <> sMat Then Continue For
oNewAsset = oAssetlib.MaterialAssets(i)
Next
Next
Try : oDoc.ActiveMaterial = oNewAsset
Catch : MessageBox.Show("Failed to change material!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error) : End Try
End Sub
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
Cool, Thanks @Andrii_Humeniuk