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: 

Is there a way to batch delete curves?

4 REPLIES 4
Reply
Message 1 of 5
ross.korsky
433 Views, 4 Replies

Is there a way to batch delete curves?

I find that deleting (many) curves via the API is extremely slow (on the order of 200ms to 250ms per curve). Is there an API call I can make that will delete a list of curves?

 

If I can't batch delete I'm going to have to collect the lines i want to keep and project them into a new sketch instead which is silly Smiley Frustrated

4 REPLIES 4
Message 2 of 5
ekinsb
in reply to: ross.korsky

This is a good request and something I've added to our backlog and I hope we can provide it soon.


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

Deleting curves is still insanely slow.

 

I have a situation where I construct geometry, offset it, and then want to delete the original geometry.

 

In some cases before I was able to directly construct the offset geometry, but in this case that is proving ... awkward.

 

Is there a fast way to delete a set of curves?

 

Message 4 of 5
marshaltu
in reply to: edwinBN4C3

Hello,

 

Did you try "Product::deleteEntities" to batch delete curves? The following sample demos how to delete lines and arcs from a sketch.

 

Thanks,

Marshal

 

import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        design = adsk.fusion.Design.cast(app.activeProduct)
        root = design.rootComponent
        
        sketch = root.sketches.item(0)
        entities = adsk.core.ObjectCollection.create()
        
        for line in sketch.sketchCurves.sketchLines:
            entities.add(line)
            
        for arc in sketch.sketchCurves.sketchArcs:
            entities.add(arc)
            
        design.deleteEntities(entities)
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 5 of 5
edwinBN4C3
in reply to: marshaltu

Cool, I'll have to give it a try. Thanks!

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