Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to create a new steel material

1 REPLY 1
SOLVED
Reply
Message 1 of 2
brad.bylls
185 Views, 1 Reply

Trying to create a new steel material

I am using the new color properties code to create a new steel property.

The color code works very well, but I can't get the syntax correct for the new steel.

No help in the documentation for this that I can find.

 

This code works great.

    fusionMaterials = _app.materialLibraries.itemByName('Fusion 360 Appearance Library')
    appear = fusionMaterials.appearances.itemByName('Powder Coat (Blue)')
    yellowColor = design.appearances.addByCopy(appear'YellowColor')
    colorProp = adsk.core.ColorProperty.cast(yellowColor.appearanceProperties.itemByName('Color'))
    colorProp.value = adsk.core.Color.create(20420400)
    plateTCPbody.appearance = yellowColor
 
This code does not work.
    fusionMaterials = _app.materialLibraries.itemByName('Fusion 360 Material Library')
    metalProp = fusionMaterials.materials.itemByName('Copper')
    steel1030 = design.materials.addByCopy(metalProp'steel1030')
    metalPropty = adsk.core.Materials.cast(steel1030.materialProperties.itemByName('steel1030'))
    metalPropty.value = adsk.core.Material.create('N0. 1 Steel (SAE 1030)')
    plateTCPbody.material = steel1030
Brad Bylls
1 REPLY 1
Message 2 of 2
brad.bylls
in reply to: brad.bylls

Figured out from another post that Brian Ekins answer.

I just eliminated the line - 

metalPropty.value = adsk.core.Material.create('N0. 1 Steel (SAE 1030)')
and now it works.
Brad Bylls

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report