how to make a lisp to let the Text from Rotated dimension dodge collissions from lines and stand closest to the center

how to make a lisp to let the Text from Rotated dimension dodge collissions from lines and stand closest to the center

MEV75E4
Participant Participant
2,005 Views
13 Replies
Message 1 of 14

how to make a lisp to let the Text from Rotated dimension dodge collissions from lines and stand closest to the center

MEV75E4
Participant
Participant

I use Autocad (normal) 2023,

I put measurements of the same size/ dimstyle on a certain frame.  when i am done i always have to finish with repositioning the texts along the lines to make it Readable.is there a way to make a lisp that see's the collision and puts the text (with a certain offset) from above the colliding lines and objects tot the "open space" along the rotated dimension line? and a way to set the offset distance for the "open space"?    with kind regards, Martin  

0 Likes
Accepted solutions (1)
2,006 Views
13 Replies
Replies (13)
Message 2 of 14

john.uhden
Mentor
Mentor

@MEV75E4 :

It's an opposite approach, but have you tried the DIMBREAK command?

It doesn't break anything except the display.  I love it.

John F. Uhden

0 Likes
Message 3 of 14

MEV75E4
Participant
Participant

it breaks the lines quite nice. but i can't seem to move the text with this. 
nice to see the program can find the collission on a dimline. 
so all i need now is to move the text above the remaining dimlines, but preferably rather not break the dimlines. 

thanks for thinking along

0 Likes
Message 4 of 14

ВeekeeCZ
Consultant
Consultant

Did you do the current dimensioning? How is possible that the dim lines are literally lying over the actual frame construction lines?

0 Likes
Message 5 of 14

dbroad
Mentor
Mentor

Several practices in your non-edited work, make your task more difficult.

  1. Drawing dimension lines in-line with object lines is a no-no.
  2. Choosing the dimension line location in-line with the extension line origins means that you can't easily move the dimenison line. Having separate grips for dimension lines and extension line origins makes things easy to tweak.

Adding a backround fill to the dimension text in the style would fix most readability problems.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 6 of 14

john.uhden
Mentor
Mentor

@MEV75E4 

Check out the DIMTMOVE drawing variable.

DIMTMOVE (System Variable)

Sets dimension text movement rules.

Type: Integer
Saved in: Drawing
Initial value: 0

Value

Description

0

Moves the dimension line with dimension text

1

Adds a leader when dimension text is moved

2

Allows text to be moved freely without a leader

 

It's included in a dimension style but can be overwritten using SETVAR.  Or, in the properties palette look at the bottom of the FIT properties.

I like @dbroad 's suggestion of turning on text masking in the dimstyle, but I don't see where you can change the setting of an existing dimension.

John F. Uhden

0 Likes
Message 7 of 14

MEV75E4
Participant
Participant
  1. Drawing dimension lines in-line with object lines is a no-no. 
    True.. hehe
  2. Choosing the dimension line location in-line with the extension line origins means that you can't easily move the dimenison line. Having separate grips for dimension lines and extension line origins makes things easy to tweak.
    Correct i just do it in these drawing because the lines are quite close to one another, and makes it more easy to view which line belongs to the correct bar, and i have to use 'move with dim line' now. 

Thanks for your reaction, i think it will be Background fills as easiest workaround indeed. 

0 Likes
Message 8 of 14

MEV75E4
Participant
Participant

Thanks for the ideas 
i often select multiple texts and then use the fill color/ background mask option to make it easier to read. 

DimTmove thanks for the explanation. 

it is just 10 -15 texts i have to move each time, so i will keep moving them or adding Background masks. 
not the biggest task, but thought to myself: "if it can be automated easily, let's do it." 🙂 

0 Likes
Message 9 of 14

MEV75E4
Participant
Participant
Yes i did them myself, sorry for that, love your fire for my mistake 🙂
could you show me how it's done neatly ( 1 or 2 lines?)
it's a little cramped when printed on A3 paper. or it gets really "full" for the eye
0 Likes
Message 10 of 14

dbroad
Mentor
Mentor

@john.uhden As long as the dimension style isn't overridden for dimensions, modifying the dimension style to include the mask affects all the dimensions drawn with that style.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 11 of 14

ВeekeeCZ
Consultant
Consultant
Accepted solution

Sorry, not the right guy. I don't do this kind of drawings.

 

Anyway, try this routine. It's just quickly adjusted some older one...

It's not automated at all... but it could speed up the text adjustments significantly.

 

(vl-load-com)

(defun  c:DimTextMove ( / *error* :getDimHeadPoints s l mn mx p osm)
  
  (defun :getDimHeadPoints (e / d x09 c10 x10 c11 c13 c14 c15 c100)
    (mapcar '(lambda (x) (set (read (strcat "c" (itoa x))) (cdr (assoc x (reverse (entget e)))))) '(10 11 13 14 15 100))
    (cond ((vl-position c100 '("AcDbAlignedDimension" "AcDbRotatedDimension")) ; linear
	   (if (equal c14 c10 1e-6)
	     (setq x09 c13)
	     (setq x09 (inters c10
			       (polar c10 (+ (angle c14 c10) (/ pi 2)) 1)
			       c13
			       (polar c13 (angle c14 c10) 1)
			       nil)))
	   (if (< (distance c11 c10) (distance c11 x09))
	     (list e c11 c10 x09)
	     (list e c11 x09 c10)))))
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osm (setvar 'osmode osm))
    (princ))
  
  ; --------------------------------------------------------------------------------------------------------------------
  (setq osm (getvar 'osmode))
  (setvar 'osmode 0)
  
  (while (setq s (car (entsel "\nSelect DIM to adjust its text: ")))
    
    (and
      ;;;      (princ "\nSelect LINEAR or ALIGNED dims , ")
      ;;;      (setq s (cond ((ssget "_:L" '((0 . "DIMENSION") (-4 . "&") (70 . 128))))))  ; 128 = text manually placed
      ;;;      ((ssget "_P" '((0 . "DIMENSION") (-4 . "&") (70 . 128))))))
      (setq s (ssadd s))
      (setq l (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
      (mapcar '(lambda (e) (redraw e 3) T) l)
      (setq l (mapcar ':getDimHeadPoints l))
      (setq mn (apply 'min (mapcar '(lambda (x) (distance (cadr x) (caddr x))) l)))
      (setq mx (apply 'max (mapcar '(lambda (x) (distance (cadr x) (last x))) l)))
      (if (and (setq p (getpoint (trans (cadar l) 0 1) "\nSpecify new place: "))
	       (setq p (trans p 1 0)))
	(foreach e l
	  (setpropertyvalue (car e) "UsingDefaultTextPosition" 0)
	  (setpropertyvalue (car e) "TextPosition" (inters (caddr e) (last e) p (polar p (+ (angle (caddr e) (last e)) (/ pi 2)) 1.) nil)))
	(foreach e l
	  (setpropertyvalue (car e) "UsingDefaultTextPosition" 0)
	  (setpropertyvalue (car e) "TextPosition" (polar (cadr e) (angle (caddr e) (last e)) (+ mn mx)))))
      ))
  (*error* "end")
  )

 

Message 12 of 14

MEV75E4
Participant
Participant

Wow, thanks. 

This is great! I just have to select them all then click on the text and it follows its own dim line. 
This will save me a lot of time!  thank you very much 
indeed not automated but a lot faster, thank you. 

0 Likes
Message 13 of 14

EagleWatch_
Participant
Participant

Hi, I would like the text keep its original distance with dimline. Is that  possible? 

0 Likes
Message 14 of 14

ВeekeeCZ
Consultant
Consultant

Hard to imagine, probably yes.

0 Likes