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)
Solved! Go to Solution.
Solved by BrianEkins. Go to Solution.
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.
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()))
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?
Can't find what you're looking for? Ask the community or share your knowledge.