Author Topic: Spltting Dimensions  (Read 3941 times)

0 Members and 1 Guest are viewing this topic.

ahsattarian

  • Newt
  • Posts: 113
Re: Spltting Dimensions
« Reply #15 on: November 07, 2023, 07:12:27 AM »
Have a look at this  :





Code - Auto/Visual Lisp: [Select]
  1. (defun c:a ()
  2.   (setq fuzzy 0.01)
  3.   (defun sub1 (sj)
  4.     (setq enj (entget sj '("*")))
  5.     (setq po1 (cdr (assoc 10 enj)))
  6.     (setq po2 (cdr (assoc 11 enj)))
  7.     (setq po3 (cdr (assoc 13 enj)))
  8.     (setq po4 (cdr (assoc 14 enj)))
  9.   )
  10.   (defun sub2 ()
  11.     (cond (s1 (entdel s1) (setq s1 nil) (entmod en)))
  12.     (sub1 s)
  13.   )
  14.   (defun myortho (poj angj ptj)
  15.     (polar poj angj (* (distance poj ptj) (cos (- (angle poj ptj) angj))))
  16.   )
  17.   (setq s (car (entsel "\n Select Dimension to Split or Continue : ")))
  18.   (setq en (entget s '("*")))
  19.   (setq ang (cdr (assoc 50 en)))
  20.   (defun *error* (msg) (sub2)) ;| #error |;
  21.   (princ "\n Pick New Dimension Point : \n")
  22.   (setvar "cursorsize" 1)
  23.   (setq s1 nil)
  24.   (setq txt "")
  25.   (setq g 1)
  26.   (while (= g 1)
  27.     (setq gr (grread t 15 0)) ;|  #grread  |;
  28.     (setq code (car gr))
  29.     (setq po (cadr gr))
  30.     (cond
  31.       ((= code 5) ;|  Bedune Click  |;
  32.        (cond (s1 (entdel s1) (setq s1 nil) (entmod en)))
  33.        (redraw)
  34.        (sub1 s)
  35.        (setq po33 (myortho po1 ang po3))
  36.        (setq po44 (myortho po1 ang po4))
  37.        (setq dl (distance po33 po44))
  38.        (setq ponn (myortho po1 ang po))
  39.        (if (< (distance ponn po33) (distance ponn po44))
  40.          (progn (setq as1 13) (setq as2 14) (setq pot po3) (setq pott po33))
  41.          (progn (setq as1 14) (setq as2 13) (setq pot po4) (setq pott po44))
  42.        )
  43.        (cond
  44.          ((/= txt "")
  45.           (setq di (atof txt))
  46.           (if (and (>= di dl) (not (equal (angle ponn po33) (angle ponn po44) fuzzy)))
  47.             (setq ponn (polar pott (angle pott ponn) (- di)))
  48.             (setq ponn (polar pott (angle pott ponn) di))
  49.           )
  50.           (setq po (myortho ponn (angle pott pot) po))
  51.          )
  52.        )
  53.        (if (not (equal (angle ponn po33) (angle ponn po44) fuzzy))
  54.          (entmod (subst (cons as1 po) (assoc as1 en) en))
  55.        )
  56.        (setq asli (list -1 2 5 102 310 300 330 331 340 350 360 410))
  57.        (setq en1 (vl-remove-if '(lambda (a) (member (car a) asli)) en))
  58.        (setq s1 (entmakex (subst (cons as2 po) (assoc as2 en1) en1)))
  59.        (sub1 s1)
  60.        (princ (strcat "\r   Dimension Distance = " str "   :   " txt))
  61.       )
  62.       ((= code 3) (setq s s1) (setq s1 nil) (setq en (entget s '("*"))))
  63.       ((= code 2)
  64.        (cond
  65.          ((member po '(13 32)) ;|  Enter  Space  |;
  66.           (cond ((= txt "") (cond (s1 (entdel s1) (setq s1 nil) (entmod en)))))
  67.           ;;(setq s1 nil)
  68.           (setq g 0)
  69.          )
  70.          ((= po 8) (setq txt (substr txt 1 (1- (strlen txt)))) (princ txt)) ;|  #Backspace  #substr  |;
  71.          ((member po '(43 45 46 48 49 50 51 52 53 54 55 56 57)) (setq txt (strcat txt (chr po)))) ;|  + - . 0 1 2 3 4 5 6 7 8 9  |;
  72.        )
  73.       )
  74.       ((= code 25) (cond (s1 (entdel s1) (setq s1 nil) (entmod en))) (setq g 0)) ;|  #mouse #right-click  |;
  75.     )
  76.   )
  77.   (sub2)
  78. )






BIGAL

  • Swamp Rat
  • Posts: 1429
  • 40 + years of using Autocad
Re: Spltting Dimensions
« Reply #16 on: November 07, 2023, 05:36:14 PM »
Just a comment for house type plans have drag a line over walls and it makes the dims. All wall lines auto dimmed, is that what your trying to do rather than pick points. Part of a house package so yes a fee.
« Last Edit: November 07, 2023, 05:39:42 PM by BIGAL »
A man who never made a mistake never made anything

ScottMC

  • Newt
  • Posts: 193
Re: Spltting Dimensions
« Reply #17 on: November 09, 2023, 10:45:26 AM »
Very nice and certainly adding to my library. Have not figured it out yet, but the (princ.. Dimension Distance) on line 60, causes it to quit, vlide highlighted it and runs fine without/commented. Thanks