Inventor | c# | Create Material not creating physical asset

Inventor | c# | Create Material not creating physical asset

Anonymous
Not applicable
1,314 Views
8 Replies
Message 1 of 9

Inventor | c# | Create Material not creating physical asset

Anonymous
Not applicable

I am using below code to create material. Inventor documentation says physical asset would be created automatically.

 
NameDescription
AddMethod that creates a new asset. The new created Asset object is returned. Currently only material and appearance assets can be created. When a material asset is created a physical asset is automatically created that is associated with it that you can edit.

 

With this method, Material gets created. Then i move it to my custom material library.

2021-01-05 19_26_20-Window.png

 

but physical asset it is not created. So when i try to get hold of physical assets, to update properties it throws error.

2021-01-05 19_26_31-Window.png

 

below is PhysicalPropertiesAsset quick watch & error screenshot

2021-01-05 19_37_55-Window.png

 

I am using inventor professional 2019 build 136.

2021-01-05 19_30_06-Window.png

 

 

Any help would be appreciated

 

0 Likes
Accepted solutions (1)
1,315 Views
8 Replies
Replies (8)
Message 2 of 9

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

I am using Inventor 2019, and I tried creating the new material and to obtain the asset value from physical properties, and it is working. Below is the code in Vb.Net, as I am not good with C#.

 

I can see that you are defining your material asset with "ma" in your code, and when you are trying to get Physical properties to value you are using "m", I am not sure if that's causing the issue, but just seen it in the snapshots.

 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim docAssets As Assets = oDoc.Assets

Dim oMA As MaterialAsset = docAssets.Add(AssetTypeEnum.kAssetTypeMaterial, "TEST1", "MyNewMat2", "MyNewMat2")
Dim v As Asset = oMA.PhysicalPropertiesAsset

Dim oAV As AssetValue = v.Item("structural_Minimum_yield_stress")
MessageBox.Show(oAV.ValueType)  

Hope this will be helpful.

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 3 of 9

Anonymous
Not applicable

I have the same thing in C#. but it doesn't work.

 

2021-01-07 09_03_20-Window.png

 

I even tried the similar VBA code, but it looks like it doesn't create Physical Asset when we create Material.

WHen i open the material created via code, it shows like this.

 

2021-01-07 09_05_07-Window.png

It doesn't have physical tab

2021-01-07 09_05_37-Window.png

 

 

WHen i check the asset browser, it only has appearace asset created along with material. But per documentation, physical asset should have been created.

 

2021-01-07 09_06_45-Window.png

 

Is there a setting which stopped Physical Asset getting created?

or is this a bug?

0 Likes
Message 4 of 9

Anonymous
Not applicable

Missed to clarify about 'm' & 'ma'.

i create MaterialAsset 'ma' in current document. Then i copy it to custom material library and then loop through all materials with 'm' as iterator to access physical properties. Here is the snippet of that.

 

2021-01-07 09_34_03-LD Machine (TC123_AWC_SCP) - VNC Viewer.png

0 Likes
Message 5 of 9

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

I am using 2019 and Build 330, and you are using Build 136, I can not say whether it is a bug in the programme in that specific build or not because I can not test it. 

 

If you can send me your code and the part in which you are using this code, I can try and test it.

 

In the meantime, I have found one thread, which is discussing a bit about the similar aspect, not exactly related but maybe a bit helpful.

 

https://forums.autodesk.com/t5/inventor-forum/physical-asset-missing/td-p/5460789

 

 

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 6 of 9

dutt.thakar
Collaborator
Collaborator

@Anonymous 

 

Also, I would advise you not to copy the material in your own library, and keep it in the default library and check once what results you are getting?

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 7 of 9

Anonymous
Not applicable

thanks for the pointer.

I had tried this already. But it doesn't do anything different. Physical asset is still missing. THat is the reason i thought i could be some bug or some setting which is causing this to happen.

 

I need to remove internal code pieces & then I'll share the code. And i don't have any part data. I create empty part file and then try to create Materials. We want to create a custom material library. 

 

0 Likes
Message 8 of 9

Anonymous
Not applicable

@Xun.Zhang 

i read your one of the post related to material library. can you help me in my issue? 

0 Likes
Message 9 of 9

Anonymous
Not applicable
Accepted solution

I tried a lot around the existing system but couldn't get it to work. I tried to create material in existing library, favourites, new library, but same issue surfaced everywhere.

 

Then I reinstalled Inventor and same program started to work without issues. So it looks like some corruption somewhere. But i couldn't figure out where it was.

0 Likes