
- #Autocad lisp endless line loop how to#
- #Autocad lisp endless line loop code#
you can perform 3D operations on LWPOLYLINEs which makes them very important objects if you plan to work in 3D. each LWPOLYLINE segment can have a different Width (the width of other 2D objects is controlled with Lineweight instead). you can use Region to convert LWPOLYLINEs into REGION objects to perform an analysis (area, perimeter, centroid, etc.). you can select an entire shape by selecting only one segment (which makes it easier to Copy, Move, etc…). if you do not require the special properties of LWPOLYLINEs then you should probably use individual LINEs or ARCs instead. LWPOLYLINEs can require more effort to create & edit compared to using Line or Arc commands to make individual LINEs & ARCs. LW signifies that the method for storing polyline data requires less space (to be managed more efficiently by AutoCAD). Prior to AutoCAD Release 14 the Pline command created POLYLINE objects but now these objects are Light Weight (LW) as an example, the shape below could be made from 9 individual LINEs & one ARC or it could be made from one LWPOLYLINE. Pline (an abbreviation for PolyLINE) is used to create single objects that can be made up of multiple LINE & ARC segments. (setq circle_coords_2_Y (+ 0.One way to create a LWPOLYLINE is to use the Pline command but this approach can be tedious for complex shapes. (setq circle_coords_2 (cdr (assoc 10 circle_names_2))) (setq circle_coords_1 (cdr (assoc 10 circle_names_1))) taking coordinates of centers of the circles (setq circle_names_2 (entget (ssname circle_set_selection_1 circle_num_2))) (setq circle_names_1 (entget (ssname circle_set_selection_1 circle_num_1))) get entity name of every member of selection set (setq circle_num_1 (1+ circle_num_1)) new value of variable (repeat circle_set_selection_length_1 repeat loop as many times as written in the selection set length (setq circle_num_1 (- 1 )) just variable that will be used as startpoint of polyline (setq circle_set_selection_length_1 (sslength circle_set_selection_1)) O_o investigate how many objects are included into selection set (setq circle_set_selection_1 (ssget "x" (list (cons 0 (cdr (assoc 0 (setq entget_circle1 (entget (car (entsel))))))) (cons 8 (cdr (assoc 8 entget_circle1))) (cons 1 (cdr (assoc 1 entget_circle1)))))) O_o created selection set of all objects that contain DXF codes 0 and 8 on selection by user dwg, so the only thing you should do is to click on some TEXT (kolv5.h9.hdet122.etc) and it draws a lines between only specified circles but I want to close the "lines polygon" and then I could tranform it into polyline and then it is OK. #Autocad lisp endless line loop how to#
I try to figure out how to close those set of lines (difficult to explain, so I posted 2 pics how it should be)
#Autocad lisp endless line loop code#
I figured out how to combine them into polyline (this code is under comments and the end of loooong code)ģ. create selection set of some circles, get them centers and then draw single lines between circles with specified features only.Ģ. Yeah, sure, here it is, what code does is:ġ. You can perhaps post your code and I'll try to analyse what you're after. I'm finding it difficult to interpret what you're after though. (while (setq pt (getpoint "\nSpecify center : ")) And when I run code it doesn't occur any error, it just process the loop and ends code without "asking me to "specify center."Īnd I have no idea why i can't draw just a circle, when I end a loop of joining lines within ONE code (defun). Thank you very much guys, those routines are indeed perfectly act, but maybe I didn't explained my case clearly, the main problem of mine is that I have some other loop (REPEAT), actually this loop creates lines between circle centers, then loop ends with parenthesis and I want after create just simple circle in random (with getpoint) place on modelspace. (setq pt (getpoint "\nSpecify center : ")) (cons 10 (getpoint "\nSpecify center: "))
I always try to avoid (command …) so I would do: It draws the circle just fine for me with radius 0.5.
(vla-addcircle spc (vlax-3D-point (trans cen 1 0)) 0.5)Įach example will operate successfully under all UCS & View settings, though the Vanilla AutoLISP example is likely to be the fastest. (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace) (vla-get-activedocument (vlax-get-acad-object)) (while (setq cen (getpoint "\nSpecify circle center : ")) Per Jonathan's response, this could be achieved using entmake, though a basic command call should still operate successfully providing the syntax is correct.