Create a new line
-
Does the code create a new line next to a existing line?
model = Sketchup.active_model
entities = model.active_entities
pts = []
pts[0] = [0, 0, 0]
pts[1] = [x, 0, 0]
pts[2] = [x, y, 0]
pts[3] = [0, y, 0]Add the face to the entities in the model
face = entities.add_face pts
I just happen to know that the second and third entities in the
entities objects are edges.
entity1 = entities[1]
entity2 = entities[2]
edges = entity1.all_connected
if (edges)
UI.messagebox edges.to_s
else
UI.messagebox "Failure"
end -
No, it creates a rectangel on the xy plane.
-
You're making it too complex...
pt0=[0,0,0]
pt1=[1,0,0]
Sketchup.active_model.active_entities.add_line(pt0,pt1)
Adds a new line from the origin 1" long, to the right [i.e. X/red axis]
The entities.add_... methods are listed in the API guides and cover many aspects of adding lines, arcs, circles, polygons, clines, cpoints, faces, text etc... please read them and have a mess around...
Advertisement