Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/24/2020 in all areas

  1. If you still want to know the name of the system variable it is PICKADD.
    2 points
  2. Here are three examples demonstrating how to construct a blue circle under any UCS/View settings, using either command calls, Vanilla AutoLISP using entmake, or Visual LISP using ActiveX methods: Command Calls: (defun c:com-cir ( / cec cen rad ) (if (and (setq cen (getpoint "\nSpecify circle center: ")) (setq rad (getdist cen "\nSpecify circle radius: ")) ) (progn (setq cec (getvar 'cecolor)) (setvar 'cecolor "5") (command "_.circle" "_non" cen rad) (setvar 'cecolor cec) ) ) (princ) ) Vanilla AutoLISP using entmake: (defun c:al-cir ( / cen rad ) (if (and (setq cen (getpoint "\nSpecify circle center: ")) (setq rad (getdist cen "\nSpecify circle radius: ")) ) (entmake (list '(000 . "CIRCLE") '(062 . 5) (cons 010 (trans cen 1 (trans '(0 0 1) 1 0 t))) (cons 040 rad) (cons 210 (trans '(0 0 1) 1 0 t)) ) ) ) (princ) ) Visual LISP using ActiveX: (defun c:vl-cir ( / cen obj rad ) (if (and (setq cen (getpoint "\nSpecify circle center: ")) (setq rad (getdist cen "\nSpecify circle radius: ")) ) (progn (setq obj (vla-addcircle (vlax-get-property (vla-get-activedocument (vlax-get-acad-object) ) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace ) ) (vlax-3D-point (trans cen 1 0)) rad ) ) (vla-put-color obj acblue) ) ) (princ) ) (vl-load-com) (princ)
    1 point
  3. Or, if the object is already in the drawing, you can do: (vla-put-color (vlax-ename-vla-object <entity_here>) acBlue) If you don't prefer using ActiveX, then: (entmod (if (assoc 62 (setq ent (entget <entity_here>))) (subst '(62 . 5) (assoc 62 ent) ent) (append ent (list '(62 . 5))) ) ) Whichever works easier for you.
    1 point
  4. (entmake (list '(0 . "CIRCLE") '(62 . 5) (cons 10 (getpoint "\nSpecify center of circle: ")) (cons 40 (getint "\nSpecify radius of circle: ")) ) ) Use entmake to create an entity. You can replace '(62 . 5) into "(cons 62 acBlue)" because the color index for blue is 5 as returned by acBlue. If you want to understand how AutoLISP interprets entities, you can always do the below on the entity you'd like to make (like I always do) if I don't know what to include while making new entities. (entget (car (entsel)))
    1 point
  5. Post a sample drawing of what you're trying to accomplish ... perhaps this will help you? (defun c:foo (/ b c d p) ;; RJP » 2020-01-24 (defun _foo (c / r) (entmake (list '(0 . "BLOCK") '(100 . "AcDbEntity") '(67 . 0) '(8 . "0") '(100 . "AcDbBlockReference") (cons 2 (setq r (strcat "foo-" (vl-princ-to-string c)))) '(10 0. 0. 0.) '(70 . 0) ) ) (entmake (append '((0 . "HATCH") (100 . "AcDbEntity") (8 . "hatch") (100 . "AcDbHatch") (10 0. 0. 0.) (210 0. 0. 1.) (2 . "SOLID") (70 . 1) (71 . 0) (91 . 1) (92 . 1) (93 . 1) (72 . 2) (10 0. 0. 0.) (40 . 0.5) (50 . 0.) (51 . 6.283185307179588) (73 . 1) (97 . 0) (75 . 1) (76 . 1) (98 . 1) (10 0. 0. 0.) (450 . 0) (451 . 0) (460 . 0.) (461 . 0.) (452 . 0) (462 . 0.) (453 . 2) (463 . 0.) (63 . 5) (421 . 255) (463 . 1.) (63 . 2) (421 . 16776960) (470 . "LINEAR") ) c ) ) (entmake (append '((0 . "CIRCLE") (100 . "AcDbEntity") (67 . 0) (8 . "0") (62 . 5) (100 . "AcDbCircle") (10 0. 0. 0.) (40 . 0.5) ) c ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) (princ) r ) (if (setq c (acad_truecolordlg 1)) (while (and (setq p (getpoint "\nPick center point: ")) (or d (setq d (getdist p "\nPick radius: "))) (setq b (_foo c)) ) (entmakex (list '(0 . "INSERT") '(100 . "AcDbEntity") '(67 . 0) (cons 8 b) '(100 . "AcDbBlockReference") (cons 2 b) (cons 10 p) (cons 41 (* 2 d)) (cons 42 (* 2 d)) (cons 43 (* 2 d)) '(50 . 0.0) ) ) ) ) (princ) ) Will create circle blocks with different colored hatches.
    0 points
×
×
  • Create New...