Jump to content

Adjustment Dimension'sText : "Above Dim Line" for selection


vuxvix

Recommended Posts

Hi!
Is there any way I can apply the command " Above Dim Line" to the dimensions I have selected!? Currently I am to tweak each one, after I made the Mirror command.

Thanks for all the help.Pictured is an example.

Sample.png

Link to comment
Share on other sites

Hi Zwonko!
You can only edit the properties when the Text's postion is default ( At home). Once you've edited the Dim's text, the " pos hor, vert" entries will be disabled. Unfortunately your suggestion is not the solution.

Link to comment
Share on other sites

Sorry, I'm not using autocad right now, and even don't have AC version that can do like You.

But i see that on the grip there is also option to reset text position. I think that after It should work, but I can't check. And maybe that isn't exacly what You looking for :)

Link to comment
Share on other sites

Hi!
Since this example is quite simple, it's somewhat not clear what the problem is when the Dimension Line changes its position。I have large drawings with many overlapping horizontal and vertical dimensions. when changing "Dimension Text movement" according to your suggestion. Then I will have to reposition it again. In addition, it also changes the way Dim is expressed. Thanks for your suggestion

Link to comment
Share on other sites

Quote

(defun c:AboveDimLine ( / s i e c10 c11 c13 c14 c100 p11 n11)
  
  (if (setq s (ssget "_:L" '((0 . "DIMENSION"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (and (mapcar '(lambda (x) (set (read (strcat "c" (itoa x))) (cdr (assoc x (reverse (entget e)))))) '(10 11 13 14 100))
       (vl-position c100 '("AcDbAlignedDimension" "AcDbRotatedDimension"))
       (setq x09 (inters c10 (polar c10 (+ (angle c14 c10) (/ pi 2)) 1) c13 (polar c13 (angle c14 c10) 1) nil))
       (setq p11 (inters c11 (polar c11 (+ (angle x09 c10) (/ pi 2)) 1) x09 c10 nil))
       (setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
       (not (setpropertyvalue e "TextPosition/X" (car n11)))
       (not (setpropertyvalue e "TextPosition/Y" (cadr n11))))))
  (princ)
  )

I got a solution for this. It does "mirror" Dim text with axis as Dim Line. So if all Dim is selected, it will also push the Dim text from the above to the bellow. Is there any solution for it to ignore  Dim text above. Thanks

Edited by vuxvix
Link to comment
Share on other sites

found this code below which can adjust text to "below" dim line

what here is actually specifying it to be "below"? ive tried adjusting few things to get it change to 'above' but unsure what i should be changing to do this?

 

(defun c:bdl (/ ss i eo)
(princ "\nSelect dimension object > ")
(setq ss (ssget '((0 . "*dimension"))) i -1)
(cond
    ((and ss)
        (while
            (< (setq i (+ i 1))(sslength ss))
            (if
                (vlax-property-available-p (setq eo (vlax-ename->vla-object (ssname ss i))) 'VerticalTextPosition)
                (vlax-put  eo 'VerticalTextPosition 4)
            )
        )
    )
)
(princ)
)

 

Link to comment
Share on other sites

Hi Masterfal and Zwonko!
 

Thanks for your Solutions.

I tried your lsp. But it seems to only work with DimTexts at the Default ( Centered ) position. And then I noticed the Dimtext that responds to the command will be "Locked" Dimtext. You cannot apply Other Tweaks with lisp or cmd (buttons or popups still work). As for Dimtext that you have changed position before, Lisp will not work.

 

-With other approaches. Is it possible to select all Dimensions with DimText at Defaul (or non-default) position!?

Edited by vuxvix
Link to comment
Share on other sites

Try this

 

(defun c:dimupd ( / sel )
   (if (ssget "_:L" '((0 . "DIMENSION")))
       (progn
           (vlax-for obj
               (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
               (if (= acunder (vla-get-verticaltextposition obj))
                   (vla-put-verticaltextposition obj acabove)
                   (vla-put-verticaltextposition obj acunder)
               )
           )
           (vla-delete sel)
       )
   )
   (princ)
)
(vl-load-com) (princ)

 

It is changing above/under, to other.

found on: 

 and modded just one line

 

Or just change the one before (BDL.lsp) to (vlax-put  eo 'VerticalTextPosition acUnder)

  • Confused 1
Link to comment
Share on other sites

First lsp is changing:

-if position od above lsp change to under

-if IT is under lsp change to above

 

Second if You do (vlax-put  eo 'VerticalTextPosition acUnder) it always changing to under. Or if it is (vlax-put  eo 'VerticalTextPosition acAbove) change always to above.

 

I dont know what else You want

For me all od them working. Event on Your sample drawing with locked vertical position. 

 

If You want firstly select all dimensions with above or under just use qselect command.

 

 

 

Edited by zwonko
Link to comment
Share on other sites

Hi Zwonko!

sorry for wasting your time. English is not my native language, my expression may be confusing.
the result I want to achieve is the same as "Above Dim line" does (in the picture). However, this command only applies to editing each statue
I tried your lisp. It behaves inconsistently on all selected objects. I also tried using a combination of MacLee's Lisp.
You can try on this example I provided. And help me understand, how should I use your Lisp.

Sample.dwg

image.JPG

Edited by vuxvix
Link to comment
Share on other sites

On 9/8/2021 at 7:59 AM, vuxvix said:

(defun c:AboveDimLine ( / s i e c10 c11 c13 c14 c100 p11 n11)
  
  (if (setq s (ssget "_:L" '((0 . "DIMENSION"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (and (mapcar '(lambda (x) (set (read (strcat "c" (itoa x))) (cdr (assoc x (reverse (entget e)))))) '(10 11 13 14 100))
       (vl-position c100 '("AcDbAlignedDimension" "AcDbRotatedDimension"))
       (setq x09 (inters c10 (polar c10 (+ (angle c14 c10) (/ pi 2)) 1) c13 (polar c13 (angle c14 c10) 1) nil))
       (setq p11 (inters c11 (polar c11 (+ (angle x09 c10) (/ pi 2)) 1) x09 c10 nil))
       (setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
       (not (setpropertyvalue e "TextPosition/X" (car n11)))
       (not (setpropertyvalue e "TextPosition/Y" (cadr n11))))))
  (princ)
  )

I also use this lisp to move Text to Above.

Link to comment
Share on other sites

Ok, check this one:

(defun c:AboveDimLine ( / s i e c10 c11 c13 c14 c100 p11 n11)
  
  (if (setq s (ssget "_:L" '((0 . "DIMENSION"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (and (mapcar '(lambda (x) (set (read (strcat "c" (itoa x))) (cdr (assoc x (reverse (entget e)))))) '(10 11 13 14 100))
       (vl-position c100 '("AcDbAlignedDimension" "AcDbRotatedDimension"))
       (setq x09 (inters c10 (polar c10 (+ (angle c14 c10) (/ pi 2)) 1) c13 (polar c13 (angle c14 c10) 1) nil))
       (setq p11 (inters c11 (polar c11 (+ (angle x09 c10) (/ pi 2)) 1) x09 c10 nil))
       ;;(setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
(setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
;;(setq n11 (polar c11 (/ 3.1415 2) (* -2 (distance c11 p11))))

;;changes
(progn
	(if (> (car c11) (car p11))
       		(not (setpropertyvalue e "TextPosition/X" (car n11)))
	)

	(if (< (cadr c11) (cadr p11))
       		(not (setpropertyvalue e "TextPosition/Y" (cadr n11))))))
)

)


;end of changes


;;(command "circle" c11 "400"  "") ;;c11 is old dimtext point
;;(command "circle" n11 "400"  "") ;;n11 is new dimtext point
;;(command "circle" p11 "400"  "") ;;p11 is point on dimline
;;(command "circle" x09 "400"  "") ;;x09 is start point of dimline
  (princ)
  )

 

The problem was that i wasn't seeing Your fonts, must change it. The property "above" "under" was changing but the text real position not.

Modded the code which was working to check if dim is below line.

 

NOTE: there are still some dimensions for which the code is not working, but the orginal code which You gave also didn't. The problem is in dimensions, becouse the center of dimtext is not parpendicular to dimline center.

image.thumb.png.163e162b0f677e2f27b8baccd69fe615.png

  • Like 1
Link to comment
Share on other sites

For rest opurtonities use this one:

(defun c:AboveDimLineREST ( / s i e c10 c11 c13 c14 c100 p11 n11 entity edata)
  
  (if (setq s (ssget "_:L" '((0 . "DIMENSION"))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (and (mapcar '(lambda (x) (set (read (strcat "c" (itoa x))) (cdr (assoc x (reverse (entget e)))))) '(10 11 13 14 100))
       (vl-position c100 '("AcDbAlignedDimension" "AcDbRotatedDimension"))
 ;;   (setq x09 (inters c10 (polar c10 (+ (angle c14 c10) (/ pi 2)) 1) c13 (polar c13 (angle c14 c10) 1) nil))
;;(if (= c10 x09)
 ;;  (setq x09 (car (- x09 2000)) (cadr (- x09 2000)))

(setq entity e)
(setq edata (entget entity))
(setq 1st (cdr (assoc 13 edata)))
(setq 2nd (cdr (assoc 14 edata)))
(setq x09 1st)
(setq c10 2nd)


       (setq p11 (inters c11 (polar c11 (+ (angle x09 c10) (/ pi 2)) 1) x09 c10 nil))
       ;;(setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
(setq n11 (polar c11 (angle c11 p11) (* 2 (distance c11 p11))))
;;(setq n11 (polar c11 (/ 3.1415 2) (* -2 (distance c11 p11))))

;;changes
(progn
	(if (> (car c11) (car p11))
       		(not (setpropertyvalue e "TextPosition/X" (car n11)))
	)

	(if (< (cadr c11) (cadr p11))
       		(not (setpropertyvalue e "TextPosition/Y" (cadr n11))))))
)

)


;end of changes


;;(command "circle" c11 "100"  "") ;;c11 is old dimtext point
;;(command "circle" n11 "200"  "") ;;n11 is new dimtext point
;;(command "circle" p11 "300"  "") ;;p11 is point on dimline
;;(command "circle" x09 "400"  "") ;;x09 is start point of dimline
;;(command "circle" c10 "500"  "") ;;c10 is end point
  (princ)
  )

 

NOTE: Use ONLY ON REST OF DIMENSION, which the first lisp doesn't give result

  • Like 1
Link to comment
Share on other sites

My font is the same font you modified for the Dimension style.
Since I still need to check the results again, I think solving 90% of the real problem would be a great result. Thank you so much.
Also, as in the example I changed the color of the Dims that edited the position of the Text. I think I owe this nice guy a lot, so I just wanted to ask if it is possible to selection Dimensions with Text Dim (centered or non-centered)?

Edited by vuxvix
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...