Change Material from .idw

Change Material from .idw

CGVJM6DF
Enthusiast Enthusiast
517 Views
6 Replies
Message 1 of 7

Change Material from .idw

CGVJM6DF
Enthusiast
Enthusiast

Hi,

 

It is possible to change the part material with a iLogic rule from .idw?

0 Likes
Accepted solutions (1)
518 Views
6 Replies
Replies (6)
Message 2 of 7

Andrii_Humeniuk
Advisor
Advisor

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.

EESignature

0 Likes
Message 3 of 7

CGVJM6DF
Enthusiast
Enthusiast

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.

0 Likes
Message 4 of 7

A.Acheson
Mentor
Mentor

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. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 7

CGVJM6DF
Enthusiast
Enthusiast

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.

0 Likes
Message 6 of 7

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

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.

EESignature

0 Likes
Message 7 of 7

CGVJM6DF
Enthusiast
Enthusiast

Cool, Thanks @Andrii_Humeniuk 

0 Likes