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: 

sketch split and trim a line for laser cutting

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
donaldo3
442 Views, 2 Replies

sketch split and trim a line for laser cutting

Past: I have had posted this one within Design, Validate & Document. The proposed solutions are fine, but they take to much time and besides - we have Fusion 360 which is very potential, though please...

 

I want to laser cut a huge amount of different small parts. If there is no small bridge between the sheet and the part after being cut, let's say 1 mm, then the part falls out of the sheet down to the basket within the machine.

Therefore I would like to have a feature which brakes any line open by a certain distance when clicking on the line within the sketching environment. Thank you in advance - Don

2 REPLIES 2
Message 2 of 3
George-Roberts
in reply to: donaldo3

Are you using the Laser functionality within CAM environment of Fusion to create the code for the laser? I'm thinking the tabs option may do what you are after..

Message 3 of 3
ekinsb
in reply to: donaldo3

Try out this little script.  It will prompt for the gap and then allow you to pick any number of sketch entities and will split them at the selection point. The sketches do not have to be active.

 

import adsk.core, adsk.fusion, traceback

_app = adsk.core.Application.cast(None)
_ui  = adsk.core.UserInterface.cast(None)

def run(context):
    try:
        global _app, _ui
        _app = adsk.core.Application.get()
        _ui = _app.userInterface
        
        des = adsk.fusion.Design.cast(_app.activeProduct)
        
        gap = 0
        keepGoing = True
        while keepGoing:
            (gapStr, isCancelled) = _ui.inputBox('Enter gap distance', 'Gap Distance', '1 mm')
            if isCancelled:
                return
            else:
                if des.unitsManager.isValidExpression(gapStr, des.unitsManager.defaultLengthUnits):
                    gap = des.unitsManager.evaluateExpression(gapStr, des.unitsManager.defaultLengthUnits)
                    keepGoing = False

        keepGoing = True
        while keepGoing:
            # Have a curve selected.
            try:
                curveSel = _ui.selectEntity('Select a curve at the location to split', 'SketchCurves')
            except:
                return
                
            curve = adsk.fusion.SketchCurve.cast(curveSel.entity)

            # Get the parent sketch of the curve.
            sk = curve.parentSketch

            # Get the point in sketch space.
            pnt = sk.modelToSketchSpace(curveSel.point)
          
            # Draw a circle at the selection point that is the diameter of the gap.
            circ = sk.sketchCurves.sketchCircles.addByCenterRadius(pnt, gap/2)
            
            # Trim the curve using the point as the location so the circle will
            # limit the trim extents.
            curve.trim(pnt, True)
            
            # Delete the circle.
            circ.deleteMe()
    except:
        if _ui:
            _ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

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