Auto Offset Dimensions

Auto Offset Dimensions

W_T_
Advocate Advocate
896 Views
10 Replies
Message 1 of 11

Auto Offset Dimensions

W_T_
Advocate
Advocate

I'm using a LISP,
I want it to align while,
Automatically shift upwards or to the right by 10mm
Not sure if it can be fixed?
Thanks for all the help.

W_T__0-1693030539410.png

 

0 Likes
Accepted solutions (2)
897 Views
10 Replies
Replies (10)
Message 2 of 11

Sea-Haven
Mentor
Mentor

Post a dwg with before and after.

0 Likes
Message 3 of 11

W_T_
Advocate
Advocate

OK.

I added.

0 Likes
Message 4 of 11

ВeekeeCZ
Consultant
Consultant

Preselect them, DIMSPACE, pick the top/bottom one, type 10. Done.

Message 5 of 11

W_T_
Advocate
Advocate

thanks for the reply.
I know DIMSPACE.
But I would like to have a faster operation.
Because I have many operations like this. . .

0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor
Accepted solution

You can do say pick dim point 1, then dim point2, dim point2 dim point3 etc You would need say 2 versions of dim VER and dim HOR.

 

SeaHaven_0-1693115487015.png

 

(defun c:dimhorup (  / pt pt1 pt3 lst ymax x )
(setq lst '())
(while (setq pt (getpoint "\nPick dim points in order"))
(setq lst (cons pt lst))
)
(setq lst (reverse lst))
(setq pt1 (car lst))
(setq ymax -1000.0)
(foreach pts lst
(if (< ymax (cadr pts))(setq ymax (cadr pts)))
)
(setq pt3 (mapcar '+ (list (car pt1) ymax 0.0) (list 0.0 10 0.0)))
(setq x 1)
(repeat (- (length lst) 1)
(command "DIM" "HOR" pt1 (nth x lst) pt3 "" "exit")
(setq x (1+ x))
(setq pt3 (mapcar '+ pt3 (list 0.0 10 0.0)))
)
(princ)
)
(c:dimhorup)

 

 

Message 7 of 11

W_T_
Advocate
Advocate

Thank you so much.

But this LISP,
Quick labeling can only be achieved in the X direction,
Not in the Y direction

0 Likes
Message 8 of 11

Sea-Haven
Mentor
Mentor

Yes did say 4 versions needed. I only did 1 you should be able to work out the other 3.

0 Likes
Message 9 of 11

pendean
Community Legend
Community Legend
... and if I may add to the fray: creating what you want in the first place remains the best solution https://resources.imaginit.com/support-blog/autocad-ordinate-dimensions-setting-it-up-correctly-the-...
0 Likes
Message 10 of 11

ВeekeeCZ
Consultant
Consultant
Accepted solution

Perhaps it's about time to learn how to customize things... especially if you're obsessed with efficiency.

Try this one. Do the selection +- orthogonally. It works with orthogonal dims only. 

 

(defun c:DDT ( / *error* ort osm o p r s l a f d m) ; dim d=10
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'osmode osm))
    (if ort (setvar 'orthomode ort))
    (princ))
  
  (setq osm (getvar 'osmode)) 		(setvar 'osmode (boole 7 osm 16384))
  (setq ort (getvar 'orthomode))	(setvar 'orthomode 0)
  
  (while (and (setq p (getpoint "\rSelect from Base Dimension: "))
	      (setq r (getpoint p " ...all dimensions: "))
	      (setq s (ssget "_c" p r))
	      (> (sslength s) 1)
	      (setq l (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
	      (setq a (strcat "DimLinePoint/" (if (> (abs (- (car p) (car r))) (abs (- (cadr p) (cadr r)))) "X" "Y")))
	      (setq f ((if (> (abs (- (car p) (car r)))) car cadr) (trans p 1 0)))
	      (setq l (vl-sort l '(lambda (e1 e2) (< (abs (- (getpropertyvalue e1 a) f))
						     (abs (- (getpropertyvalue e2 a) f))))))
	      (setq f (getpropertyvalue (car l) a))
	      (setq d (if (> (getpropertyvalue (cadr l) a) (getpropertyvalue (car l) a)) 10 -10))
	      (setq m 0)
	      )
    (foreach e (cdr l)
      (setpropertyvalue e a (+ f (* d (setq m (1+ m)))))
      ))
  (*error* "end")
  )

 

Message 11 of 11

Kent1Cooper
Consultant
Consultant

@pendean wrote:
... creating what you want in the first place remains the best solution ....

I agree.  @W_T_ , if you are talking about Dimensions that are already drawn, this won't help, but for new Dimensions, @pendean's link mentions the way to get what you illustrate in the "after" situation, though in passing, and heading for describing a different approach.  You can get your illustration directly, if you first draw the closest-in Dimension, and then use DIMBASELINE for more of them.  They will automatically space their dimension-line locations equally, at the distance specified by the DIMDLI System Variable [= DIMension Dimension-Line Increment or may Interval].

Kent Cooper, AIA