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: 

Get all curvatures

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
pewpewpew2131
413 Views, 2 Replies

Get all curvatures

I am trying to write a script that would loop through all the curves in all sketches in the document and find the largest curvature value.

        var app = adsk.core.Application.get();
        ui = app.userInterface;
        var doc = app.activeDocument;
        var ds = doc.design;
        var comp = ds.activeComponent;
        
        for (var i = 0; i < comp.sketches.count; ++i)
        {
            var sketch = comp.sketches.item(i);
            console.log("got sketch");
            for (var k = 0; k < sketch.sketchCurves.count; ++k)
            {
                var curve = sketch.sketchCurves.item(k);
                console.log("got curve");
            }
        }

The issue is that I don't understand how having a curve get its curvature information. As far as I understood, I need a CurveEvaluator2D object to get the curvature information, which I can get from Curve2D object and here is where disconnect happens: the curves that I get are not Curve2D objects, they are of SketchFittedCurve or SketchConicCurve or SketchCircle or similar types. How do I get Curve2D out of those?

2 REPLIES 2
Message 2 of 3
ekinsb
in reply to: pewpewpew2131

The curve entities you get back from a sketch are things like you listed; SketchCircle,, SketchArc, SketchFittedSpline, etc.  You can get the geometric description of the entity by using it's geometry property.  This will return things like Circle3D, Arc3D, and NurbsCurve3D.  You'll notice that these are all 3D curves and not 2D.  All sketch geometry in Fusion is 3D.  It's just that typically you just draw on the X-Y plane of the sketch.  The CurveEvaluator3D object also supports the abilty to get the curvature.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 3
pewpewpew2131
in reply to: ekinsb

Thanks, it works.

 

Do I understand correctly, that curvature's units are [1/cm]? I.e. value of the curvature at some point is the 1/R where R is the curve's radius at that point.

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