Registered forum members do not see this ad.
Use this line to add the new layer:
To get the circles/blocks in desired layer just adjut:Code:(if (not (tblsearch "LAYER" "arcmark")) (entmakex '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "arcmark") (70 . 0) (62 . 3) (6 . "Continuous"))) )
Code:(entmake (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r) '(8 . "arcmark"))) ... (entmake (list '(0 . "INSERT") (cons 10 p) (cons 2 b) '(8 . "arcmark")))
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
I considered the first post , and I was writing the code when the OP replied to my first post .
Anyway , You did a very good routine that I learned how to include Polyline 's arc within the selection set filtration system.![]()
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said
Try it now ....
Code:(defun c:Test (/ ss i sn ins d bname) ;;; Tharwat 10. June. 2012 ;;; (vl-load-com) (if (and (setq ss (ssget "_x" '((-4 . "<OR") (0 . "ARC") (-4 . "<AND") (0 . "LWPOLYLINE") (-4 . "<>") (42 . 0.0) (-4 . "AND>") (-4 . "OR>") ) ) ) (progn (initget "Circle Block") (setq ins (getkword "\n Choose one [Circle/Block] :")) ) ) (progn (if (not (tblsearch "LAYER" "arcmark")) (entmakex '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "arcmark") (70 . 0) (62 . 3) (6 . "Continuous") ) ) ) (if (eq ins "Block") (progn (setq bname (getstring t "\n Enter name of Block :")) (tblsearch "BLOCK" bname) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (foreach p (list (vlax-curve-getstartpoint sn) (vlax-curve-getendpoint sn) ) (entmakex (list '(0 . "INSERT") (cons 2 bname) (cons 10 p) '(8 . "arcmark") '(41 . 1.0) '(42 . 1.0) '(43 . 1.0) ) ) ) ) ) (progn (if (setq d (getdist "\n Specify Diameter of Circle :")) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (foreach p (list (vlax-curve-getstartpoint sn) (vlax-curve-getendpoint sn) ) (entmakex (list '(0 . "CIRCLE") '(8 . "arcmark") (cons 10 p) (cons 40 d) ) ) ) ) ) ) ) ) (princ) ) (princ) )
- When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said


thank you tharwat for your effort
Lee I like these constructs:Though, what would be the difference if you simply used a normal defun statement instead of setq+lambda?Code:(setq f (lambda ( p ) (entmake (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))))
Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!
Registered forum members do not see this ad.
Thank you Irné
To my knowledge, a negligible difference in performance, though, since the function 'f' is different for each option and is created during runtime I felt it more suitable to use an anonymous lambda function rather than using a defun expression. I tend to reserve defun expressions for cases in which the function is static and isolated from the main function (i.e. does not share local variables with the main function).
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
Bookmarks