Problem:
There are few 3d objects given.I want to select all of them at once and make them into straight lines or curves of same length and same distance between them.
The 3d objects are always straight but not on same axis(which looks like are on same axis if we see from top).But I have to produce the straight curves beside them on the same axis.The 3d object can also be divided,so the produced curves should also be.I want to do it with python code but I have no experience in 3d objects.
I am attaching the pictures.In the top view,below is the given and the aboves are the ones we need to produce.
import Rhino
def draw_line(ref_objects):
# Transformation to project the line to CPlane (XY Plane)
xform = Rhino.Geometry.Transform.PlanarProjection(Rhino.Geometry.Plane.WorldXY)
for object in ref_objects:
brep_edges = object.Geometry().GetWireframe(0.01)
# Sorting the edges by their length. Reverse=True: Longest line is the first element
sorted_edges = sorted(brep_edges, key=lambda curve: curve.GetLength(), reverse=True)
# Longest Edge needs to be drawn
drawing_edge = sorted_edges[0]
# Projecting to XY Plane
drawing_edge.Transform(xform)
# Adding Line to Rhino Document
Rhino.RhinoDoc.ActiveDoc.Objects.Add(drawing_edge)
if __name__ == '__main__':
# Select brep objects from Rhino Document
result, objects = Rhino.Input.RhinoGet.GetMultipleObjects('Pick <3D Geometry>', False, Rhino.DocObjects.ObjectType.Brep)
if result == Rhino.Commands.Result.Success:
draw_line(objects)
Thank you,sir.It worked,but partially.The straight lines or curves are producing beneath them not beside them.We have to produce the line beside the 3d objects as shown in the figure.I think it will be solved if you add a constant distance for every curve to the original drawing point.
Also I visited Chennai for 4 times.I stay somewhere beside.The culture is beautiful there.Can you finish the code for me as a Big Brother?