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: 

How to make face transparent for selection

4 REPLIES 4
Reply
Message 1 of 5
VitautTryputsin
1248 Views, 4 Replies

How to make face transparent for selection

It need make some faces transparent and transparent for selection in my command. Like other bodies in create body command.
4 REPLIES 4
Message 2 of 5

Can I realize it?
Message 3 of 5
ekinsb
in reply to: VitautTryputsin

The API doesn't currenlty support anything beyond what you can do inside Fusion interactively.  Fusion supports setting the appearance on a face-by-face basis, so you can set the appearance of a face to a transparent appearance.  Below is some code that does this on a selected face.  To be able to assign an appearance it first has to be copied from the library into the current design.  This is done automatically when you assign an appearance in the UI but you need to do the step when using the API.

 

def setAppearance():
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface

        des = adsk.fusion.Design.cast(app.activeProduct)
        face = adsk.fusion.BRepFace.cast(ui.selectEntity('Select a face', 'Faces').entity)
        
        if face:
            clearApp = des.appearances.itemByName('Glass (Clear)')
            if clearApp == None:
                lib = app.materialLibraries.itemByName('Fusion 360 Appearance Library')
                if lib:
                    libraryClearApp = lib.appearances.itemByName('Glass (Clear)')
                    clearApp = des.appearances.addByCopy(libraryClearApp, libraryClearApp.name)

            face.appearance = clearApp            
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 4 of 5
VitautTryputsin
in reply to: ekinsb

Thank you for answer. Can I make clean faces unselectable? It need select faces under clean faces. Why other faces seems like clean under clean face?

Image 2.png

Message 5 of 5
ekinsb
in reply to: VitautTryputsin

If the selection is happening within your command, you can control what is selectable.  See the overview topic for commands and especially look at what's said relative to the SelectionEvent.

http://help.autodesk.com/view/NINVFUS/ENU/?guid=GUID-3922697A-7BF1-4799-9A5B-C8539DF57051

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog

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