Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

How to change appearanceSourceType of a face?

rolandas_vegis
Advocate

How to change appearanceSourceType of a face?

rolandas_vegis
Advocate
Advocate

Hello,

In some cases faces of a component have appearanceSourceType of OccurrenceAppearanceSource. When assigning the material to the component the faces do not show it. Even though the occurrence has no appearance assigned to it.

 

I found that you can override it by assigning the appearance to each face individually, however this approach is very slow performance wise.

 

So I was wondering is there a faster way to change it so that faces would show the material assigned to the component?

0 Likes
Reply
488 Views
6 Replies
Replies (6)

BrianEkins
Mentor
Mentor

The way it should work is that if you get the appearance from a BRepFace object you'll get the appearance that is currently being used to render that face. If there isn't an appearance assigned to the body or the face, the appearance returned by the face will be what is assigned to the component. If there is an appearance assigned to the body and not the face, the appearance returned by the face will be the one assigned to the body since it overrides the component appearance. If there's an appearance assigned to the face, that overrides everything and is what is returned.

 

The appearanceSourceType is read-only and indicates where the appearance is coming from.  If there are no overrides it will return that the source is the component. If you've assigned an appearance to a face it will return that the source is the face.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes

rolandas_vegis
Advocate
Advocate

Thank you for explaining it I understand it better now, however still running into a problem.

 

https://a360.co/3AiNmTF

 

In this model the faces have OccurrenceAppearanceSource even though the occurrence itself does not have appearance assigned, setting the occurrence appearance to null does nothing.

 

From what you said setting the occurrence appearance to null should make the faces take appearance from component, but it does not happen. They still take it from occurrence which doesn't even have an appearance.

 

When setting the appearance to the component or its body, it is not shown.

 

Is this a bug or is there a way to reset so that the faces would take the appearance from component or its body again?

0 Likes

BrianEkins
Mentor
Mentor

Ignore

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes

rolandas_vegis
Advocate
Advocate

Did you have a chance to take a look at my model?

0 Likes

BrianEkins
Mentor
Mentor

I've looked at this for a while and have come to the conclusion that the API is incomplete. Either it was incorrect when it was first implemented or changes have been made in Fusion and the API wasn't updated to reflect this.

 

My research indicates that it is possible in the UI to assign an appearance override to the root component. The root component is acting like an occurrence as far as the appearance override. The API doesn't provide this. On a component, you can only set the material, which has an associated appearance.

 

The way I figured this out is if you right-click on a node in the browser you'll see the "Remove Appearance Override" command if that object has an appearance override. Remember that if you have multiple levels in an assembly, an override can be on any of the occurrences in the tree and will affect everything beneath it.

 

I am able to run the "Remove Appearance Override" command on the root component to remove the override. The code below does that. I don't know if that's helpful or not.

 

remCmd = ui.commandDefinitions.itemById('RemoveOverrideCommand')
ui.activeSelections.clear()
ui.activeSelections.add(root)
remCmd.execute() 

  

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
1 Like

rolandas_vegis
Advocate
Advocate

I see, thanks for finding out the problem. Your suggestion was not helpful. At least the problem is now known.

0 Likes