R. Clayton Harrison, PE, shares a few LISP routines in response to CAD Tip No. 4129 that will help draw lines and polylines and keep them in two dimensions.
"If you just need to draw 2D lines when snapping to points or other entities that have a Z elevation other than zero, you can use this LISP routine to accomplish that.
(defun c:2d (/ p1 p2)
(setq p1 (getpoint " From Point: "))
(setq p2 (Getpoint " To Point: " p1))
(command "LINE" ".xy" p1 0.0 ".xy" p2 0.0 "")
(setq p1 p2)
(while (setq p2 (getpoint " To Point: " p1))
(command "LINE" ".xy" p1 0.0 ".xy" p2 0.0 "")
(setq p1 p2)
)
);end defun
"To draw a PLINE at elevation 0: If you need a polyline at Z=0, I would suggest using the Point Filter .xy. When prompted for a point, type .xy then press Enter; apply the osnap that you want and pick the point. AutoCAD will respond with (need Z): type 0 and press Enter."
Notes from Cadalyst tip reviewer Brian Benton: It can be a pain to work in a mixed environment of 2D and 3D objects. Sometimes it is too time-consuming to fully convert from one to another. These routines and tips can help you work in this hybrid state of data. |