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: 

How is an EllipticalArc created?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
julian.tilbury
599 Views, 5 Replies

How is an EllipticalArc created?

How do I create a 90 degrees arc of an orthogonal ellipse?

 

If it was the same pattern as circular arc it would be something like:-

 

Ptr<SketchCurves> curves = sketch->sketchCurves();

Ptr<SketchEllipticalArcs> e_arcs = curves->sketchEllipticalArcs();

e_arcs->addOrthogonalBySweep ( CentrePoint, MinorAxis, MajorAxis, StartAngle, EndAngle );

// e.g.  add ( [0,0], 2.0, 5.0, M_PI/2, M_PI );

// c.f. arc->addByCentreStartSweep( Centre, Bgn, M_PI/2 );

 

but SketchEllipticalArcs doesn't have an add methods though the documentation

states the class "supports the methods to create new elliptical arcs." (https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c136fbd1-592e-4dc3-8a96-4d8454fd174e)

 

 

 

 

 

 

5 REPLIES 5
Message 2 of 6
BrianEkins
in reply to: julian.tilbury

Unfortunately, you can't directly create an elliptical arc. The API has the same limitation as the UI. Notice that there isn't a command to create an elliptical arc. The workaround is to create a full ellipse and draw lines that cross the ellipse where the ends of the arc should be and then use the trim method of the ellipse to get an elliptical arc.
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 6
julian.tilbury
in reply to: BrianEkins

I've tried, and I've failed. Can you tell me what is wrong with this code please?

 

      static void SketchEllipseTop
//    ============================
      (
        Ptr<Sketch> &      sketch,
        double const       Width,
        double const       Height
      )
      {        
        Ptr<SketchCurves>      Curves   = sketch->sketchCurves();
        Ptr<SketchLines>       Lines    = Curves->sketchLines();

        Ptr<SketchEllipses>    Ellipses = Curves->sketchEllipses();
        Ptr<SketchPoints>      Points   = sketch->sketchPoints();

        Ptr<Point3D>           Bot      = Point3D::create (      0, -Height, 0 );
        Ptr<Point3D>           Mid      = Point3D::create (      0,       0, 0 );
        Ptr<Point3D>           Lft      = Point3D::create ( -Width,       0, 0 );
 
        Ptr<SketchPoint>       MidPnt   = Points->add ( Mid );

        Ptr<SketchEllipse>     Ellipse  = Ellipses->add ( MidPnt, Bot, Lft );
                               
        Ptr<SketchPoint>       FarLft   = Points->add ( Point3D::create ( -Width*2, 0, 0 ) );        
        Ptr<SketchPoint>       FarRgt   = Points->add ( Point3D::create (  Width*2, 0, 0 ) );

                               Lines->addByTwoPoints ( FarLft, FarRgt );
                              
        Ptr<ObjectCollection>  List     = Ellipse->trim ( Bot );

        Ptr<SketchPoint>       KillPnt  = Points->add ( Bot );        

                               assert ( List ); // No!!
      }

 

When I look at the generated sketch in the GUI I can trim the bottom half of the ellipse.

Message 4 of 6
BrianEkins
in reply to: julian.tilbury

There does appear to be a bug in the API implementation of the trim method.  However, if I delete the construction lines that represent the major and minor axes and then do the trim, it's working for me.  In the UI it works ok with the line present.  Deleting them doesn't lose anything because they're deleted anyway when the trim operation is performed.  Here's my Python test code.

 

def run(context):
    ui = None
    
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)
        root = design.rootComponent
        
        sk = root.sketches.add(root.xYConstructionPlane)
        center = adsk.core.Point3D.create(0,0,0)
        major = adsk.core.Point3D.create(4,0,0)
        minor = adsk.core.Point3D.create(0,-2,0)
        ellipse = sk.sketchCurves.sketchEllipses.add(center, major, minor)
        
        ellipse.majorAxisLine.deleteMe()
        ellipse.minorAxisLine.deleteMe()
        linePnt1 = adsk.core.Point3D.create(-5,0,0)
        linePnt2 = adsk.core.Point3D.create(5,0,0)
        line = sk.sketchCurves.sketchLines.addByTwoPoints(linePnt1, linePnt2)
        
        ellipse.trim(minor)
    except:  
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))    
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 6

Hi,

 ... try to create a 'normal' arch and scale it.

I have not attempted this in API but, ... fingers cross ... it should work.

 

Regards

MichaelT

 

PS.

Requires conversion to fittedSpline first .... so there will be an approximation only.

Perhaps it could be better to start wit fS in the first place?

 

 

 

MichaelT
Tags (2)
Message 6 of 6

Can you confirm if this bug was ever fixed? I seem to run into this frequently and have a really hard time using BreakCurve/Split/Trim with my ellipses in sketch space.

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