- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I'm having trouble using Line3D.intersectWithCurve(). It seems to miss intersections at certain points.
1. Consider this basic sketch; it has one curve (a SketchControlPointSpline -- created in Illustrator) and point Point3D, near the top left of the curve (shown blue, selected).
2. Some basic code creates a Line3D starting at the point and going to the right; it should intersect this curve two times, but the result is only one. Code (full example attached):
design: Design = app.activeProduct
sketch = design.rootComponent.sketches[0]
point = sketch.sketchPoints[3].geometry # hardcoded to the right one
print(point.x, point.y)
endPoint = point.copy()
endPoint.x += 100000
line = Line3D.create(point, endPoint)
curve = sketch.sketchCurves[0].geometry
intersects = line.intersectWithCurve(curve)
hitCount = intersects.count
# ui.messageBox(f'hitCount should be 1 but is: {hitCount}')
print(hitCount)
I attached the .f3d file and the basic script to reproduce it. It is hardcoded and extracted from my more complex plugin.
Moving the point around seems to give the right result when it isn't at the apex/top of the curve. If yo move it in the middle of the apex (convex side), it will show 0 hits.
I'm guessing this is some rounding error or a bug...I'm open to suggestions on how to solve line intersections with arbitrary curves!
Corbin
Solved! Go to Solution.