What is the diameter of circles or what is the name of the block ?


Registered forum members do not see this ad.
hello
can any one help to add a predefined circle or block to each end and start of all arcs in the drawing
thanks
What is the diameter of circles or what is the name of the block ?
- 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


hello tharwat
any diameter(optional)any block in the drawing
command line:
select arcs: all arcs selected even polyline if contain circles
enter radius of circle or name of block:
Try this at the moment ....
Code:(defun c:Test (/ ss i sn ins d bname) ;;; Tharwat 08. June. 2012 ;;; (if (and (setq ss (ssget "_x" '((0 . "ARC")))) (progn (initget "Circle Block") (setq ins (getkword "\n Choose one [Circle/Block] :")) ) ) (progn (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) '(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") (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
My version for fun:
Code:(defun c:carc ( / b c d e f i p r s x ) (if (setq s (ssget "_X" '( (-4 . "<OR") (0 . "ARC") (-4 . "<AND") (0 . "LWPOLYLINE") (-4 . "<>") (42 . 0.0) (-4 . "AND>") (-4 . "OR>") ) ) ) (progn (initget "Block Circle") (if (eq "Circle" (getkword "\nBlock or Circle? <Block>: ")) (if (setq r (getdist "\nSpecify Circle Radius: ")) (setq f (lambda ( p ) (entmake (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r))))) ) (progn (while (not (or (eq "" (setq b (getstring t "\nSpecify Name of Block: "))) (tblsearch "BLOCK" b) (and (setq d (findfile (strcat b ".dwg"))) (progn (setq c (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.-insert" d nil) (setvar 'cmdecho c) ) ) ) ) (princ "\nBlock not found.") ) (if (tblsearch "BLOCK" b) (setq f (lambda ( p ) (entmake (list '(0 . "INSERT") (cons 10 p) (cons 2 b))))) ) ) ) (if f (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i)))) x nil ) (if (eq "ARC" (cdr (assoc 0 e))) (foreach a '(50 51) (f (polar (cdr (assoc 10 e)) (cdr (assoc a e)) (cdr (assoc 40 e)))) ) (while (setq p (assoc 10 e)) (setq e (cdr (member p e))) (if (or x (not (equal 0.0 (cdr (assoc 42 e)) 1e-8))) (progn (f (cdr p)) (setq x (/= 0.0 (cdr (assoc 42 e)))) ) ) ) ) ) ) ) (princ "\nNo Arcs or PolyArcs found.") ) (princ) )
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper


thank you for tharwat thank you Lee Mac for reply
code of Lee Mac works fine but there is a problem at tharwat code
thank you both
what is the error message that you have received ?
- 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
@motee-z: Just add the line below to Tharwat's code:
Code:(vl-load-com)
Regards,
Mircea
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3


it works tharwat after adding (vl-load-com)
but polylines arcs not considered
thank you very much


Registered forum members do not see this ad.
mr Lee Mac
i tried to add these lines in all possible places to create layer named(markarc) to lay circles on but i failed
(command "layer" "make" "arcmark" "")
(command "layer" "c" "3" "arcmark" "")
(command "color" "bylayer")
any suggestion
Bookmarks