Cant change material in BOM - revert - logic issue

Cant change material in BOM - revert - logic issue

GKPByDesign
Advocate Advocate
868 Views
8 Replies
Message 1 of 9

Cant change material in BOM - revert - logic issue

GKPByDesign
Advocate
Advocate

Hey I am having an issue trying to change the material of any part, as I believe my background logic is conflicting can someone help me amend the code is that I can change the material

 

MultiValue.List("gkp_Materials") = iProperties.Materials
0 Likes
869 Views
8 Replies
Replies (8)
Message 2 of 9

GKPByDesign
Advocate
Advocate

This code below is the problem

 

gkp_Materials = iProperties.Material 

I use a custom prop to generate the materials, any ideas? 

0 Likes
Message 3 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@GKPByDesign,

 

In the below documentation link, detailed description of iProperty.Material are provided and go through the same for changing material of part.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2015...

 

Please explain the requirement with more details using screen shots and make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 4 of 9

GKPByDesign
Advocate
Advocate

Basically I need an illogic code that states the following

 

if material is chosen then gkp_materials equals the same

 

or if gkp_materials if chosen then material equals the same

 

i have the correct code but only in one direction, when I actually need it in both directions 

0 Likes
Message 5 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@GKPByDesign,

 

Is "gkp_materials" Multivalue parameter which contain list of custom materials?

 

If current material of part is not available, need to update "gkp_materials" material list.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 6 of 9

GKPByDesign
Advocate
Advocate

Yes it picks up the material list 

0 Likes
Message 7 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@GKPByDesign,

 

To change appearance or material of part , below sample iLogic code can be used.

 

Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

' Get an appearance from the document.  To assign an appearance is must
' exist in the document.  This looks for a local appearance and if that
' fails it copies the appearance from a library to the document.
Dim localAsset As Asset
Try
	localAsset = oDoc.Assets.Item("Chrome - Polished")
Catch
	Dim assetLib As AssetLibrary
	assetLib = ThisApplication.AssetLibraries.Item("Inventor Material Library") 

	' Get an asset in the library.  Again, either the displayed name or the internal
	' name can be used.
	Dim libAsset As Asset
	libAsset = assetLib.AppearanceAssets.Item("Chrome - Polished")

	' Copy the asset locally.
	localAsset = libAsset.CopyTo(oDoc)
End Try  

oDoc.ActiveAppearance = localAsset

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 8 of 9

GKPByDesign
Advocate
Advocate

The issue I have is that you cannot simply put the property for "Material" in a form without creating a custom parameter. The issue I have is that my custom parameter overrides the material.

 

What I mean by this is I can change the material within the form, but only within the form. If I try to use the default drop down menu at the top of the screen It overwrites the choice and reverts to what ever the form says. 

 

The code I posted earlier is the culprit. I appreciate your help, but I simply require a code that works for both the default material and custom material parameter, so that I can select the material with the form OR from the drop down menu at the top of the screen. 

 

The issue currently prevents me changing material in the BOM because the custom parameter has higher priority due to the code above

 

The code needs to be 

 

If custom material parameter is changed then default material parameter to equal 

 

If Default material parameter is changed then custom material parameter is changed

 

 

Can someone help 

0 Likes
Message 9 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@GKPByDesign,

 

For more understanding, can you please provide video record to demonstrate steps? Please make sure that files are non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes