Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am trying to get the sketchpoint with the the lowest Z value, relative to a different coordinate system. I have tried using the solution provided by @BrianEkins here:
I use a construction axes and then try to generate any perpendicular vector. then try and build a coordinate system using the cross products.
here is what I have, but the lowPoint seems to still be defined in the original coordinate system
origin = design.activeComponent.constructionPoints.itemByName("PartOrigin").geometry
xAxis:adsk.core.Vector3D = design.activeComponent.constructionAxes.itemByName("partAxis").geometry.getData()[2]
#Get any perpendicular Vector
yAxisZ = ((xAxis.x*1+xAxis.y*1)/xAxis.z*-1)*-1
yAxis = adsk.core.Vector3D.create(1,1,yAxisZ)
zAxis = xAxis.crossProduct(yAxis)
yAxis = xAxis.crossProduct(zAxis)
transformMatrix = adsk.core.Matrix3D.create()
transformMatrix.setWithCoordinateSystem(origin, xAxis, yAxis, zAxis)
transformMatrix.invert()
zLow = 999999
for point in sketchSpline.fitPoints:
# Transform the point.
point:adsk.fusion.SketchPoint
point.geometry.transformBy(transformMatrix)
if zLow > point.geometry.z:
zLow = point.geometry.z
lowPoint = point.geometry
Solved! Go to Solution.