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: 

DXF Import utility - extrude problem

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
damien.huvelle
426 Views, 5 Replies

DXF Import utility - extrude problem

Hi everyone, 

I'm having some troubles with the addin, when I bulk import DXFs and choose to automatically extrude them with the addin it always hide the sketch after extruding. I need to keep all the sketches visible (I import a lot of DXF in one project and I can't spend my time to manually unhide all the sketches. It is more than 100 dxf per project).

 

I have unchecked in my preferences the "auto hide sketches on feature" so it's not that. even after restarting fusion it doesn't work.

 

thanks for you help.

 

@prainsberry @kandennti 

5 REPLIES 5
Message 2 of 6
kandennti
in reply to: damien.huvelle

Hi @damien.huvelle .

 

I think you are talking about this add-in.

https://apps.autodesk.com/FUSION/ja/Detail/Index?id=3146198746757677787&appLang=en&os=Win64 

 

Since I can't change the add-in, I made a script to show/hide all sketches.

# Fusion360API Python script
import adsk.core, adsk.fusion, traceback

def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app :adsk.fusion.Application = adsk.core.Application.get()
        ui = app.userInterface

        # get all sketch
        skts = getAllSketch(app.activeProduct)

        if len(skts) < 1:
            ui.messageBox('There are no sketches.')
            return

        # query
        msg = f'Show/Hide all sketches. (Sketch count {len(skts)})\n\n'
        msg += 'Yes : All Show\nNo : All Hide\nCancel : Cancel'
        query = ui.messageBox(
            msg,
            '',
            adsk.core.MessageBoxButtonTypes.YesNoCancelButtonType,
            adsk.core.MessageBoxIconTypes.QuestionIconType)

        # exec
        if query == adsk.core.DialogResults.DialogYes:
            setLightBulbOn(skts, True)
        elif query == adsk.core.DialogResults.DialogNo:
            setLightBulbOn(skts, False)

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

def setLightBulbOn(skts :list, value :bool):
    for skt in skts:
        skt.isLightBulbOn = value

def getAllSketch(des :adsk.fusion.Design) -> list:

    lst = []
    for comp in des.allComponents:
        lst.extend([skt for skt in comp.sketches])

    return lst


Someone else may have made a more useful add-in.

Message 3 of 6

Hi, thank you for taking the time to make all this.

maybe I would be able to add this to the add-in ?

I will try all this as soon as possible or just run this script as a standalone if I can’t achieve what I want.

thanks a lot

maybe the addin could be modified by the author to add this ? @prainsberry 

Message 4 of 6

Hey sorry for being late to this conversation.  That script is great.  I'm not sure why the sketches are still hiding if you have that option set.   I think I could fairly easily add that as an option to the app.  But getting it re-published to the store will take a little time.  I'll post back here when I get it integrated.  That script should work also for immediate results.

 



Patrick Rainsberry
Developer Advocate, Fusion 360
Message 5 of 6

I made the change to add this as an option.  Going to make a few more small changes before going through the submission process again.  But you can get the latest with the change here:
https://github.com/tapnair/DXFImporter/raw/master/build/__LATEST__/DXFImporter.zip

 



Patrick Rainsberry
Developer Advocate, Fusion 360
Message 6 of 6

@prainsberry

it works fine thank you !

just one little thing that can also be usefull. I see in files of the add-in that it may be possible to change the way that "extrude"works (largest profil, profil with bigger holes numbers). In my case I have DXF files with different layers an the first one is always the profil of the piece the others are some drilling.

How and where, can I only have the first layer extrude (the largest) and not the others ?

 

I have tried several changes in the "code" to enable or disable the "largest profil" and "profil with bigger number of holes" but never achieved to make it change anything (but the add-in kept working ...)

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