Trying to create a new steel material

Trying to create a new steel material

brad.bylls
Collaborator Collaborator
363 Views
1 Reply
Message 1 of 2

Trying to create a new steel material

brad.bylls
Collaborator
Collaborator

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
0 Likes
Accepted solutions (1)
364 Views
1 Reply
Reply (1)
Message 2 of 2

brad.bylls
Collaborator
Collaborator
Accepted solution

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