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: 

addDistanceDimension between organ and SketchPoint

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
StephenCim-001
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

4 REPLIES 4
Message 2 of 5
p.seem
in reply to: StephenCim-001

Stephen,

 

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
StephenCim-001
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
BrianEkins
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
Website/Blog: https://EkinsSolutions.com
Message 5 of 5
StephenCim-001
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