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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

addDistanceDimension between organ and SketchPoint

Message 1 of 5
400 Views, 4 Replies

addDistanceDimension between organ and SketchPoint

Hi All


I wanted to add a DistanceDimension between the origin (0,0,0) and a SketchPoint , but I could not get it to work. 

In the end I had to add a Sketch point on the origin and then I could add the distanceDimension between the 2 sketch points..., It works and I can drive the point from my user prams. 

Here is the code I'm using:


Origin = adsk.core.Point3D.create(0, 0, 0)

dims = sketch.sketchDimensions

sketchPoints = sketch.sketchPoints

point = adsk.core.Point3D.create(0, -(UserStoneFinalHeight.value) , 0)

SketchPointOrigin = sketchPoints.add(Origin)

sketchPoint = sketchPoints.add(point)

stoneDim = dims.addDistanceDimension(sketchPoint, SketchPointOrigin, 0 , adsk.core.Point3D.create(3,-3,0))

stoneDim.parameter.expression = 'StoneFinalHeight'



How do I should I declare the Origin in the addDistanceDim... statement, I tried Origin and adsk.core.Point3D.create(0, 0, 0)


Cheers, Stephen

Message 2 of 5
in reply to: StephenCim-001



The origin isn't itself a sketch object, but you could probably project it in using the sketch.Project method.  But then you've got the added complexity of working out which coordinate system you care about, and finding that particular origin point to project.  But that all just seems like a more cumbersome version of your own "adsk.core.Point3D.create(0, 0, 0)" 


So if you'll forgive a stupid questions, what's wrong with your current method?



Message 3 of 5
in reply to: p.seem

I guess there is nothing wrong with it, I just thought since I could select the origin using the GUI I could do it in API 🙂


Cheers, Stephen

Message 4 of 5
in reply to: StephenCim-001

When a new sketch is created,  Fusion automatically projects the origin point into the sketch. You can access the created sketch point using the origin originPoint property on the Sketch object. 

Brian Ekins
Inventor and Fusion 360 API Expert
Message 5 of 5
in reply to: BrianEkins

Thanks Brian


That worked 🙂

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