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: 

Unassign and Delete appearance via API

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Fliegende-Rehe
163 Views, 1 Reply

Unassign and Delete appearance via API

When I import new component to current design and apply appearance, color do not change. I try to get current appearance and using usedBy method replace every cur_appearance  with tar_appearance like Unassign and Delete button work. But I get an error that original component appearance still in use.

def set_appearance(component, color_name):
tar_appearance: adsk.core.Appearance = get_appearance(color_name)

for body in component.bRepBodies:
cur_appearance = body.appearance

for entity in cur_appearance.usedBy:
entity.appearance = tar_appearance

if not cur_appearance.isUsed: # isUsed return true, but useBy.count return 0
cur_appearance.deleteMe()

body.appearance = tar_appearance
Labels (1)
1 REPLY 1
Message 2 of 2

I found a solution. I tried to change the appearance of the component, but because this component was imported, some appearances were associated with the original geometry. The problem can be solved by moving the bodies from this component to another component (in my case, the root componet) and removing unused appearances. Then the connection between the body and the original component is removed.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report