Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/06/2025 in Posts

  1. (defun C:ChDimTxtCol1 (/ int sel ent obj DimTextColor) (vl-load-com) (setq DimTextColor 1) (and (setq int -1 sel (ssget '((0 . "*DIMENSION"))) ) (while (setq int (1+ int) ent (ssname sel int)) (setq obj (vlax-ename->vla-object ent)) (if (/= (vla-get-textHeight obj) (getvar'DIMTXT)) (vla-put-TextColor obj DimTextColor)) ) ) (princ) )
    1 point
  2. I have this for a metric system, I don't know if it would be suitable for a foot system...! But it can be a start for you. (defun C:SLOPE ( / blp pt_o pt_f frac_prec sv_osmd e_last dxf_o slope slope_h slope_v nx sv_ortho pt_start pt_x t2_slope t1_slope pt_mid pt_text pt_int ed_1) (setvar "cmdecho" 0) (setq blp (getvar "blipmode")) (setvar "blipmode" 0) (initget 9) (setq pt_o (getpoint "\nSpecify the starting point: ")) (cond (pt_o (initget 41) (setq pt_f (getpoint pt_o "\nChoosing the end point: ")) (cond (pt_f (command "_.undo" "_group") (cond ((and (not (eq (getvar "USERI1") 1)) (not (eq (getvar "USERI1") 10)) (not (eq (getvar "USERI1") 100))) (initget "Unit Dozen Hundred") (setq frac_prec (getkword "\nFraction accuracy [Unit/Dozen/Hundred]<Dozen>: ")) (if (not frac_prec) (setq frac_prec "Dozen")) (cond ((eq frac_prec "Unit") (setq slope_v 1)) ((eq frac_prec "Dozen") (setq slope_v 10)) ((eq frac_prec "Hundred") (setq slope_v 100)) ) (setvar "USERI1" slope_v) ) (T (setq slope_v (getvar "USERI1"))) ) (setq sv_osmd (getvar "osmode")) (setvar "osmode" 0) (command "_.ray" pt_o pt_f "") (setq e_last (entlast) dxf_o (trans (cdr (assoc 11 (entget e_last))) 0 1 T) ) (entdel e_last) (setq slope (abs (if (zerop (cadr dxf_o)) 0.0 (/ (car dxf_o) (cadr dxf_o)))) slope_h (fix (* slope_v slope)) nx (if (zerop slope_h) 0 (gcd slope_h slope_v)) sv_ortho (getvar "orthomode") ) (while (> nx 1) (setq slope_h (/ slope_h nx) slope_v (/ slope_v nx) nx (gcd slope_h slope_v)) ) (setvar "orthomode" 1) (setq pt_start (mapcar '/ (mapcar '+ pt_o pt_f) '(2.0 2.0 2.0)) pt_start (list (car pt_start) (cadr pt_start) 0.0)) (initget 9) (setq pt_x (getpoint pt_start "\nSpecify the size of the symbol: ") pt_x (list (car pt_x) (cadr pt_x))) (if (equal (car pt_x) (car pt_start) 1E-12) (setq t2_slope (rtos slope_h 2 0) t1_slope (rtos slope_v 2 0)) (setq t2_slope (rtos slope_v 2 0) t1_slope (rtos slope_h 2 0)) ) (repeat 2 (command "_.dimordinate" pt_start "_text" t1_slope pt_x) (setq pt_mid (mapcar '/ (mapcar '+ pt_start pt_x) '(2.0 2.0 2.0))) (if (equal (car pt_x) (car pt_start) 1E-12) (setq pt_int (polar pt_x 0.0 (distance pt_start pt_x))) (setq pt_int (polar pt_x (/ pi 2.0) (distance pt_start pt_x))) ) (setq pt_start (inters pt_o pt_f pt_x pt_int nil) t1_slope t2_slope ) (if (null pt_start) (setq pt_start pt_x)) (setq pt_text (polar pt_mid (angle pt_start pt_x) (getvar "dimtxt")) ) (command "_aidimtextmove" "_2" (entlast) "" pt_text) (if (not ed_1) (setq ed_1 (entlast))) ) (command "_.-group" "_create" "*" "" (entlast) ed_1 "") (setvar "orthomode" sv_ortho) (setvar "osmode" sv_osmd) (command "_.undo" "_end") ) ) ) ) (setvar "blipmode" blp) (setvar "cmdecho" 1) (prin1) )
    1 point
×
×
  • Create New...