jrr114 Posted April 9 Posted April 9 Does anyone have a LISP that will toggle dimensions with a leader into different quadrants? Quote
BIGAL Posted April 10 Posted April 10 When you do a dimension it will default to the position of the dim text, but you can override it and change the dim text point. So its a 2 step process. If you look at the 15 & 25 they have been moved. What do you know about lisp ? This is sample code you would have 4 versions of this to move the dim text. So for me a dcl with choice orientation also. ; do a dim (setq obj (vlax-ename->vla-object (entlast))) (setq tpos (mapcar '+ (vlax-get obj 'TextPosition) (list 125.0 (- 120.0) 0.0))) (vlax-put obj 'TextPosition tpos) Could do as 4 defuns but stored in one lisp program. DUL, DUR, DLL, DLR Quote
jrr114 Posted April 10 Author Posted April 10 BIGAL I'm not at all good with writing LISPs. It is all Greek to me. Can you write one that has the 4 functions in one LISP? Quote
BIGAL Posted April 11 Posted April 11 Ok I have something but I can not post, the move values for the dim text depends on your dimension style, so I need a real dwg so can work out these offset values. Part 2 the code at moment links to the mid point is that OK, not sure have to dig deeper to see if can move it closer to an end. Please post a dwg. Quote
jrr114 Posted April 11 Author Posted April 11 BIGAL I appreciate your help with this. DIM_sample.dwgFetching info... Quote
Nikon Posted April 12 Posted April 12 (edited) On 4/9/2025 at 2:42 PM, jrr114 said: Does anyone have a LISP that will toggle dimensions with a leader into different quadrants? Expand Is such an algorithm possible for this task? Select dimension: 1st click on the dimension - dimtext moves along with the leader Top Left 2 st click - dimtext moves along with the leader Top right 3 st click - dimtext moves along with the leader Bottom left 4 st click - dimtext moves along with the leader Bottom right. The offset from the dimension line should be equal to the height of the text (or two text heights). Edited April 13 by Nikon Quote
BIGAL Posted April 12 Posted April 12 Multi radio buttons.lspGive this a try. ; https://www.cadtutor.net/forum/topic/97280-toggle-dimension-lisp/ ; dim_sample.dwg move dime to one of the 4 quadrants ; By AlanH April 2025 (defun c:dodimcorner ( / ent obj dotl dotr dobl dobr) (defun dotl ( / ) (setq tpos (mapcar '+ (cdr (assoc 13 entg))(list 0 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dotr ( / ) (setq tpos (mapcar '+ (cdr (assoc 14 entg))(list 0.5 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobl ( / ) (setq tpos (mapcar '+ (cdr (assoc 13 entg))(list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobr ( / ) (setq tpos (mapcar '+ (cdr (assoc 14 entg))(list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (if (not AH:Butts)(load "Multi radio buttons.lsp")) ; loads the program if not loaded already (setq ent (car (entsel "\nPick a dim "))) (setq entg (entget ent)) (setq obj (vlax-ename->vla-object ent)) (setq dimsc (vlax-get obj 'scalefactor)) (if (= but nil)(setq but 1)) (ah:butts but "V" '("Choose a corner" "Top Left" "Top right" "Bottom left" "Bottom right" )) (cond ((= but 1)(dotl)) ((= but 2)(dotr)) ((= but 3)(dobl)) ((= but 4)(dobr)) ) (princ) ) (c:dodimcorner) 1 Quote
Nikon Posted April 13 Posted April 13 (edited) On 4/12/2025 at 11:01 PM, BIGAL said: ; dim_sample.dwg move dime to one of the 4 quadrants ; By AlanH April 2025 (defun c:dodimcorner ( / ent obj dotl dotr dobl dobr) Expand This is great code, but Top Left and Top right does not move the leader up. Is it possible to sort through the placement options by clicking on the dimension (without using the dialog box)? Edited April 13 by Nikon Quote
Steven P Posted April 13 Posted April 13 While the sun floats around the globe till BIgAl wakes again, look into his code, there is a section (cond ((= but 1)(dotl)) ((= but 2)(dotr)) ((= but 3)(dobl)) ((= but 4)(dobr)) ) that can be changed to a while loop, something like below for the order of things: (Sunday, CAD is off, no testing or checks from me today) (setq counter 1) (While ((ssget '((0 . "*DIM*"))) : +E+S ; select any dimension else do by entity name from previous dimension, (car entg ) (cond ((= counter 1)(dotl)) ..... ) setq counter (+ counter 1) (if (= counter 5)(setq counter 1) ) ; end while Pretty sure you can have a go at that today, then show off later Quote
Nikon Posted April 13 Posted April 13 On 4/13/2025 at 7:57 AM, Steven P said: that can be changed to a while loop Expand I refuse the dialog box, but I have to select the same size twice, then I can change the leader position in the loop by pressing lmb/rmb... The problem with the top location remains... (defun c:dodimcorner-while (/ ent obj entg dimsc but counter) (defun dotl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dotr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.5 dimsc 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobl (/) (setq tpos (mapcar '+ (cdr (assoc 13 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (defun dobr (/) (setq tpos (mapcar '+ (cdr (assoc 14 entg)) (list 0.0 (- dimsc) 0.0))) (vlax-put obj 'TextMovement 1) (vlax-put obj 'TextPosition tpos) ) (if (not AH:Butts) (load "Multi radio buttons.lsp") ) (setq ent (car (entsel "\nPick a dim "))) (setq entg (entget ent)) (setq obj (vlax-ename->vla-object ent)) (setq dimsc (vlax-get obj 'scalefactor)) (if (= but nil) (setq but 1)) ; (ah:butts but "V" '("Choose a corner" "Top Left" "Top right" "Bottom left" "Bottom right")) (setq counter 1) (while (ssget '((0 . "*DIMENSION*"))) (cond ((= counter 1) (dotl)) ((= counter 2) (dotr)) ((= counter 3) (dobl)) ((= counter 4) (dobr)) ) (setq counter (+ counter 1)) (if (= counter 5) (setq counter 1)) ) (princ) ) Quote
Steven P Posted April 13 Posted April 13 Try setting (setq counter ... ) to 2 - I'm assuming here that the initial text position is top left, so when you click dimension to move it on, the first position change will be to set position to top left - the third click will move it on to TR. 1 Quote
Nikon Posted April 13 Posted April 13 (edited) On 4/13/2025 at 11:12 AM, Steven P said: Try setting (setq counter ... ) to 2 Expand It doesn't change anything... Probably, the program contains only these 4 positions of the text with the leader depending on the distance from the dimension line. Edited April 13 by Nikon Quote
BIGAL Posted April 13 Posted April 13 (edited) I dont know why its not working this is what I got just now copied code from here as an extra check. There is some code out there for use arrows I will leave that for you to find. Edited April 14 by BIGAL Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.