Coordinates on sketch on YZ plane

Coordinates on sketch on YZ plane

Anonymous
Not applicable
858 Views
4 Replies
Message 1 of 5

Coordinates on sketch on YZ plane

Anonymous
Not applicable

I created a sketch on YZ Plane.

When I add a circle to the sketch I have troubles on coordinates of the center point

design = app.activeProduct
rootComp = design.rootComponent
keyCapOcc = rootComp.occurrences.addNewComponent(adsk.core.Matrix3D.create())
keyCap = keyCapOcc.component
sketches = keyCap.sketches
yzPlane = keyCap.yZConstructionPlane
sketch  = sketches.add(yzPlane)
circles = sk.sketchCurves.sketchCircles
pt = adsk.core.Point3D.create(0, 1, 1)
circles.addByCenterRadius(pt, 2)

When the circle is drawn, the center is on (1, 1, 0) on the component based coordinates.

For sure I'm missing something, maybe I need some transformation......

0 Likes
859 Views
4 Replies
Replies (4)
Message 2 of 5

OceanHydroAU
Collaborator
Collaborator

I'm pretty sure sketches use their own coordinate system (XY?) independent of the plane you put them on.  They're translated onto the parent plane (YZ in your case) of the sketch afterwards.

0 Likes
Message 3 of 5

Anonymous
Not applicable

This is my opnion too.

The ploblem is how to get and trasform this coordinates system.

It should be a pretty common operation in creating sketches....

0 Likes
Message 4 of 5

Anonymous
Not applicable

I found the solution myself:

 

pt = sk.modelToSketchSpace(adsk.core.Point3D.create(0, 1, 1))

 

Message 5 of 5

OceanHydroAU
Collaborator
Collaborator

Thanks for posting!! As it happens, I've got the exact same issue, and your solution looks like a life-saver!!  (I'm creating 3d sketch elements, on any plane, in any orientation - total mind bender...)

0 Likes