How to determine if a straight line is parallel to the x or y axis in the plane, and there is also a method of approaching parallelism
What’s the purpose of the check?
It looks like you’ve got line segments in the picture, not lines.
You might consider the following approach:
Take the normal of the plane and compare it to the line segment vector
It’s a straight line. I can’t find a way in Python. Can you help me write a copy
It is to determine whether the straight line is parallel or inclined to be parallel to the x and y axes of the plane
Can you show us the inputs to the function you have?
Are they a Rhino.Geometry.Plane and a Rhino.Geometry.Line?
Try to translate this C# to P:
PS: Or use utol instead (as an user defined value). Say:
utol = (utol < atol)? atol : utol;
BTW: This is an entry level C# that does that:
Line_ParToPlaneXY_V1.gh (117.9 KB)
BTW: For testing if a Line is par to a Plane (in general) get pt1 as line.From clostest to plane and pt2 as line.To closest to plane and test Math.Abs(line.Direction.IsParallel(pt2-pt1, tol)) - provited that:
- either pt2.DistanceTo(pt1) > tol [else Line is perp to Plane]
- or Math.Abs(line.Direction.IsParallel(Plane.ZAxis, tol)) != 1 [else Line is perp to Plane] .
The RhinoCommon line, vector and plane structs provides all you’d need For instance, you could go:
myLine.Direction.IsParallelTo(myPlane.XAxis)
See this documentation.
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.line/direction
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.vector3d/isparallelto
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.plane/xaxis
Thank you for resolving it
yes, I am currently facing a problem where the parallelism and verticality of lines are different when the plane is different. I don’t know how to use Python to solve this problem
Two posters just gave you the exact reference to the functions you need to call.
How far did you get?
Creating a Python script?
Finding the line and plane with the script?
Checking whether they’re parallel?
Thank you, it has just been resolved
When the topic is solved, please click the solution box in one of the posts.