Issue getting correct appearance in API from assembly imported from STEP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have an issue getting the correct appearance from the API for an assembly that has been imported from STEP (I'm not sure if this is a general issue). To illustrate the problem I include TestColour.step.
To repeat issue:
1. Open the attached 'TestColour.step' in Fusion
2. Run the following python code as a script..
import adsk.core, adsk.fusion, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.activeDocument
des = adsk.fusion.Design.cast(app.activeProduct)
root = des.rootComponent
# red box
red_box_occ = root.occurrences.item(0)
# blue cyl
blue_cyl_occ = root.occurrences.item(1)
#red box body
red_box_body = red_box_occ.bRepBodies.item(0)
blue_cyl_body = blue_cyl_occ.bRepBodies.item(0)
ui.messageBox(red_box_occ.name + ' Appearance Name:' + red_box_body.appearance.name +"\n" +
blue_cyl_occ.name + ' Appearance Name:' + blue_cyl_body.appearance.name)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
It appears the api returns the same appearance for both the box and the cylinder, when obviously one is red (Opaque(247,66,66)) and one is blue (Opaque(97,122,201)). Their appearance names in Fusion are in brackets which I guess are auto generated.
The message box generated by the code shows that the api returns that they are both the same colour (Opaque(247,66,66)).
Please see attached screenshot at the foot of this message, and any advice would be appreciated as I need to get the colours of items that have been imported into Fusion via step files.
Thanks,
Tim.