Delete Material property from assembly

Delete Material property from assembly

PolemEngineering
Advocate Advocate
1,009 Views
10 Replies
Message 1 of 11

Delete Material property from assembly

PolemEngineering
Advocate
Advocate

Perhaps due to a legacy from an earlier version (we have been using Vault since 2008) we have a large dataset where the Assemblies contain the Material property "S235JR".

This is annoyingly visible in the Vault in the overviews with Material as a column.

 

By simply running the iLogic code below, you can see that the property is actually in the Inventor file.

 

Dim oDoc As Inventor.AssemblyDocument
oDoc = ThisApplication.ActiveDocument

MatVar = oDoc.PropertySets.Item("Design Tracking Properties").Item("Material").Value
MatWeldVar = oDoc.PropertySets.Item("Design Tracking Properties").Item("Weld Material").Value

MessageBox.Show(MatVar & " - " & MatWeldVar, "Title")

 

 

However, with the function:

oDoc.PropertySets.Item("Design Tracking Properties").Item("Material").Value = ""

or 

oDoc.PropertySets.Item("Design Tracking Properties").Item("Material").Delete

I am not able to empty or delete the Property.

 

For new files I can just start with a fresh template file not containing this Property, but how to clean the existing files?

I haven't tried it yet, but maybe a limitation within iLogic, which can be avoided by writing a small add-in?

 

[currently using Autodesk Inventor Professional 2023.2]

 

René van der Starre

0 Likes
Accepted solutions (2)
1,010 Views
10 Replies
Replies (10)
Message 2 of 11

WCrihfield
Mentor
Mentor

Hi @PolemEngineering.  I don't have Vault, but I can tell you that those standard iProperties are ReadOnly, so they just reflect last material settings, but won't let you change them through API access to the iProperties.  There is also another standard iProperty within that same PropertySet called "Material Identifier", which is also ReadOnly, and is supposed to contain a String of the material library path concatenated with the material name, and there is no user interface access to this one either.  These can be fact checked through the related Enum's documentation for each PropertySet (Link1, Link2, Link3, Link4).

Since an AssemblyDocument does not have the ActiveMaterial property, like a PartDocument does, and there is seemingly not any normal way to set an 'active' material to an assembly, I am not sure how to clear that property.  Maybe try purging the materials & appearances stored locally in the document.  But even my assembly templates each contain at least one (regular assembly), or two (weldments) materials that I can't seem to get rid of.  I think it has to do with the 'virtual components' that you can create for BOM purposes.  There is a setting within the Document Settings of an assembly for the 'Default Material' for Virtual Components.  This is most likely what is holding onto the one material.  You could try changing that to a different material, but I don't think it can be left blank (no value).

Edit:  Just wanted to add that the weld material is specified within the iProperties dialog, at the top of the Physical tab, then weld appearances are specified on the Weld Bead tab in that same dialog.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 11

Cadkunde.nl
Collaborator
Collaborator

Assemblies can only have materials assigned in Weldments.

For this case I usually set in the template for weldment a material named "-".

 

But for legacy items. I guess you need to run a script that opens every welded assembly, and set the material to something else.

The iProperty values that you find are read-only and change when material is changed

0 Likes
Message 4 of 11

Cadkunde.nl
Collaborator
Collaborator
Dim odoc As Document = ThisDoc.Document
Dim oAsmDoc As AssemblyDocument = Nothing
oAsmDoc = TryCast(odoc, AssemblyDocument)

If oAsmDoc Is Nothing Then Exit Sub

If oAsmDoc.SubType = "{28EC8354-9024-440F-A8A2-0E0E55D635B0}" Then

	Dim oAsmCompDef As WeldmentComponentDefinition = oAsmDoc.ComponentDefinition
	If oAsmCompDef.WeldBeadMaterial.DisplayName = "S235JR" Then

		Dim oMat As Inventor.MaterialAsset = ThisApplication.ActiveMaterialLibrary.MaterialAssets.Item("Generic")
		Dim oMaterial As Inventor.MaterialAsset
		Try
			oMaterial = oMat.CopyTo(oAsmDoc)
		Catch
			oMaterial = oAsmDoc.MaterialAssets.Item(oMat.DisplayName)
		End Try
		oAsmCompDef.WeldBeadMaterial = oMaterial
	End If
End If
0 Likes
Message 5 of 11

PolemEngineering
Advocate
Advocate

Thanks for all the responses. The thing is, Weld Material is empty, only Material has a value. Also the assemblies aren't Weldment Assemblies.

René van der Starre

0 Likes
Message 6 of 11

Cadkunde.nl
Collaborator
Collaborator

Can you copy an assembly that has that problem, empty it, and then upload it here?

0 Likes
Message 7 of 11

PolemEngineering
Advocate
Advocate

@Cadkunde.nl 

Enclosed an empty assembly file with "the problem". Perhaps you can find something.

Thanks in advance

René van der Starre

0 Likes
Message 8 of 11

Cadkunde.nl
Collaborator
Collaborator
Accepted solution

I was sceptical: maybe you had a custom iproperty or whatever.

But it appears you have an assembly with a material assigned.

As far as I know: That is impossible, and also to edit it

 

Might be the cause of using the same template since 2008.

I can only guess here.

 

I also dont see a solution with vault pro (inventor mapping material) Its all locked.

 

If you still have the problem in the current template of the assembly.

Atleast rebuild that one with a clean template @ C:\Users\Public\Documents\Autodesk

But ofcourse you are also doing lots of copy designs.

 

Guess you need someone from Autodesk to solve this problem

Message 9 of 11

PolemEngineering
Advocate
Advocate

I make sure that new documents use a clean template. For the issue with the contaminated documents, I will consult our software supplier again. Perhaps they have a short line with Autodesk.

René van der Starre

0 Likes
Message 10 of 11

PolemEngineering
Advocate
Advocate
Accepted solution

Sorry, I never updated this post...

After consulting Autodesk I received a response almost immediately stating that a (hidden) function (_CleanMaterialProperty) is available for this. It works like a charm.

 

René van der Starre

Message 11 of 11

Cadkunde.nl
Collaborator
Collaborator

Ah ok, thanks for sharing 👍

0 Likes