TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: myloveflyer on January 27, 2010, 10:24:03 PM
-
How to do this as the right of the mark use lisp?
-
That is an empty file.
It should be a lisp or DWG file and not both. :-o
-
sorry! CAB
Annex has been updated!
-
CAB, how can do automatic dimensioning?such as the center point coordinates and line intersections are found, how to find these points arranged, so to automate the labeling, can be a reference for an example of this map on the good, in this first thank the
-
How to do this as the right of the mark use lisp?
This one will do it what you want
(defun C:DRC (/ osm p1 p2 p3 p4 pt_list ss xlist ylist)
(setq osm (getvar "osmode"))
(setvar "osmode" 1)
(if (and
(setq p1 (getpoint "\nPick lower left point of the rectangle: " )
p3 (getpoint p1 "\nPick upper right point of the rectangle: ")
p2 (list (car p3) (cadr p1)(caddr p1))
p4 (list (car p1) (cadr p3)(caddr p1))
)
(setq ss (ssget "_W" p1 p3 (list (cons 0 "CIRCLE"))))
)
(progn
(setq pt_list
(mapcar (function (lambda (x)
(cdr (assoc 10 x))))
(mapcar 'entget
(vl-remove-if
'listp
(mapcar 'cadr
(ssnamex ss)
)
)
)
)
)
(setq pt_list
(vl-sort pt_list
(function (lambda (a b) (>= (car a) (car b)))
)
)
)
(setq xlist
(vl-sort
(vl-remove-if
(function (lambda (a)
(not (equal (car a) (caar pt_list) 0.001))))
pt_list
)
(function (lambda (p q)
(> (cadr p) (cadr q)))))
)
(setq xlist (append (list p3) xlist)
xlist (append xlist (list p2))
xlist (mapcar (function (lambda(x)(list (car p2)(cadr x)(caddr x))))
xlist
)
)
(setq pt_list
(vl-sort pt_list
(function (lambda (a b) (<= (cadr a) (cadr b)))
)
)
)
(setq ylist
(vl-sort
(vl-remove-if
(function (lambda (a)
(not (equal (cadr a) (cadar pt_list) 0.001))))
pt_list
)
(function (lambda (p q)
(< (car p) (car q)))))
)
(setq ylist (append (list p1) ylist)
ylist (append ylist (list p2))
ylist (mapcar (function (lambda(x)(list (car x)(cadr p1)(caddr x))))
ylist
)
)
(command "._undo" "_begin")
(mapcar (function (lambda (x y)
(command "._dimlinear" "_non" x "_non" y "V"
"_non" (mapcar '+ (list 250. 0. 0.)
(mapcar (function (lambda(a b)
(/ (+ a b) 2.)))
x
y
)
)
)
)
)
(cdr xlist)
xlist
)
(mapcar (function (lambda (x y)
(command "._dimlinear" "_non" x "_non" y "H"
"_non" (mapcar '+ (list 0. -250. 0.)
(mapcar (function (lambda(a b)
(/ (+ a b) 2.)))
x
y
)
)
)
)
)
(cdr ylist)
ylist
)
(command "._dimlinear" "_non" p3 "_non" p2
"_non" (mapcar '+ (list 500. 0. 0.)
(mapcar (function (lambda(a b)
(/ (+ a b) 2.)))
p3
p2
)
)
)
(command "._dimlinear" "_non" p1 "_non" p2
"_non" (mapcar '+ (list 0. -500. 0.)
(mapcar (function (lambda(a b)
(/ (+ a b) 2.)))
p1
p2
)
)
)
(command "._undo" "_end")
)
)
(setvar "osmode" osm)
(princ)
)
~'J'~
-
fixo,Nice work!
Thank you very much !
For the outside box is not rectangular can also perform (in CAD2004, the other did not test)!
-
fixo,Nice work!
Thank you very much !
For the outside box is not rectangular can also perform (in CAD2004, the other did not test)!
Glad if that helps
Cheers :0
~'J'~