Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/10/2018 in all areas

  1. (defun c:foo (/ _c ad b bd bn d e p p2 s sc) ;; RJP » 2018-12-10 (defun _c (p r) (entmakex (list '(0 . "circle") (cons 10 p) '(8 . "detail") (cons 40 r)))) (cond ((and (setq p (getpoint "\nPick center of detail: ")) (setq d (getdist p "\nEnter radius: ")) (setq p2 (getpoint p "\nPick point to place detail: ")) (setq sc (cond ((getint "\nEnter scale of detail <2>: ")) (2) ) ) (setq s (ssget "_C" (list (+ (car p) d) (- (cadr p) d)) (list (- (car p) d) (+ (cadr p) d)))) (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq s (vl-remove-if '(lambda (x) (wcmatch (cdr (assoc 0 (entget x))) "INSERT,MTEXT,TEXT,DIMENSION")) s ) ) ) (setq bn (strcat "Detail_" (itoa sc) "_" (rtos (getvar 'cdate) 2 12))) (setq ad (vla-get-activedocument (vlax-get-acad-object))) (setq bd (vlax-invoke (vla-get-blocks ad) 'add p bn)) (vlax-invoke ad 'copyobjects (mapcar 'vlax-ename->vla-object s) bd) (setq b (vla-insertblock (vla-get-modelspace ad) (vlax-3d-point p2) bn sc sc sc 0.)) (_c p d) (_c p2 (* d sc)) (vla-put-layer b "detail") (command "_.polygon" 100 p2 "_I" (* d sc)) (setq e (entlast)) (command "_.xclip" (vlax-vla-object->ename b) "" "_New" "_Select" e) (entdel e) (entmakex (list '(0 . "line") (cons 10 (polar p (angle p p2) d)) (cons 11 (polar p (angle p p2) (- (distance p p2) (* d sc)))) '(8 . "detail") ) ) (entmakex (list '(0 . "TEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "detail") '(100 . "AcDbText") (cons 10 (setq p2 (polar p2 (* pi 1.5) (+ (* d sc) (* 2.5 (getvar "TEXTSIZE")))))) (cons 40 0.125) (cons 1 (strcat "sCALED:" (itoa sc) "x")) '(50 . 0.) '(41 . 1.) '(51 . 0.) '(71 . 0) '(72 . 1) (cons 11 p2) '(100 . "AcDbText") '(73 . 0) ) ) ) ) (princ) ) (vl-load-com) I tried to somewhat translate your code. It could still use some cleanup but hopefully will give you a working base.
    1 point
  2. Works great! I'm happy! =^.^= Thank you!
    1 point
  3. You can also use SSADD which adds objects to a selection set. If you want to save the 4 lines of the rectang individually. I would suggest you write a little defun that does just that makes 4 lines from the two corner points if you use ssadd then the lines would be 4 items in the selection set and you can get at each one for further action.
    1 point
×
×
  • Create New...