Is there a way to batch delete curves?

Is there a way to batch delete curves?

Anonymous
Not applicable
918 Views
4 Replies
Message 1 of 5

Is there a way to batch delete curves?

Anonymous
Not applicable

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

919 Views
4 Replies
Replies (4)
Message 2 of 5

ekinsb
Alumni
Alumni

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
0 Likes
Message 3 of 5

edwinBN4C3
Participant
Participant

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
Autodesk
Autodesk

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 Developer
>
0 Likes
Message 5 of 5

edwinBN4C3
Participant
Participant

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

0 Likes