Sketch Spline handle lines exported as curves

Anonymous

Sketch Spline handle lines exported as curves

Anonymous
Not applicable

Hi,

 

I am playing with exporting sketch curves through the API and came across some weird behaviour.

 

spline.png

 

Say I have a sketch spline and manipulate the handles of a spline point, like shown above.

 

If this is the case, then the API also returns these two extra lines as curves, and I have not found any way to detect that they're related to the spline so I can safely ignore them.

 

I'd expect Fusion to never return these at all from the API as they are just for manipulation from the sketch editor. 

 

Is this a bug?

0 Likes
Reply
Accepted solutions (1)
857 Views
3 Replies
Replies (3)

marshaltu
Autodesk
Autodesk

Hello,

 

Unfortunately the tangent handle line is treated as a real curve in Fusion 360. For example: when we select the line, it shows a sketch curve is selected in right-bottom corner.

 

As you said, it did be not easy to distinguish tangle handle lines from "normal" lines. What I see is the tangle lines are always invisible. I am not sure if you can make use of "isVisible" property of sketch line? I will check with our sketch experts and see if we can improve that a little bit.

 

Thanks,

Marshal

 

Screen Shot 2017-10-12 at 5.49.23 PM.png



Marshal Tu
Fusion Developer
>
0 Likes

Anonymous
Not applicable

Hey, thanks for the reply.

 

I tried your suggestion, unfortunately isVisible is true in the cases I am trying.

0 Likes

marshaltu
Autodesk
Autodesk
Accepted solution

Hello,

 

When tangent handle lines are selected, isVisible is true. Otherwise, it should always return false. 

 

The following codes use different approach to judge if line is tangent handle. The assumption is the mid point of tangent handle line is one of fit points in spline.

 

BTW: I talked to our sketch experts. We will do improvements in future updates.

 

Thanks,

Marshal

 

import adsk.core, adsk.fusion, traceback

def run(context):
    
    ui = None
    
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)
        rootComp = design.rootComponent;
        
        sketch = rootComp.sketches.itemByName('Sketch1')
        spline = sketch.sketchCurves.sketchFittedSplines.item(0)
        fitpts = spline.fitPoints
        startsplinept = spline.startSketchPoint.geometry
        endsplinept = spline.endSketchPoint.geometry
        for line in sketch.sketchCurves.sketchLines:
            startpt = line.startSketchPoint.geometry
            endpt = line.endSketchPoint.geometry
            midpt = adsk.core.Point3D.create((startpt.x + endpt.x)/2, (startpt.y + endpt.y)/2, (startpt.z + endpt.z)/2)
            iscontrolline = False
            if midpt.isEqualTo(startsplinept) or midpt.isEqualTo(endsplinept):
                iscontrolline = True
            else:
                for point in fitpts:
                    if midpt.isEqualTo(point.geometry):
                        iscontrolline = True
                        break
            if iscontrolline:
                ui.messageBox('It is control line')  
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


Marshal Tu
Fusion Developer
>
0 Likes