How to make face transparent for selection

Anonymous

How to make face transparent for selection

Anonymous
Not applicable
It need make some faces transparent and transparent for selection in my command. Like other bodies in create body command.
0 Likes
Reply
1,708 Views
4 Replies
Replies (4)

Anonymous
Not applicable
Can I realize it?
0 Likes

ekinsb
Alumni
Alumni

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
1 Like

Anonymous
Not applicable

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

0 Likes

ekinsb
Alumni
Alumni

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
0 Likes