sketch split and trim a line for laser cutting

sketch split and trim a line for laser cutting

donaldo3
Explorer Explorer
750 Views
2 Replies
Message 1 of 3

sketch split and trim a line for laser cutting

donaldo3
Explorer
Explorer

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

0 Likes
Accepted solutions (1)
751 Views
2 Replies
Replies (2)
Message 2 of 3

George-Roberts
Collaborator
Collaborator

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

0 Likes
Message 3 of 3

ekinsb
Alumni
Alumni
Accepted solution

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