LISP for dimension text position

LISP for dimension text position

bigcarl5000kg
Advisor Advisor
2,406 Views
6 Replies
Message 1 of 7

LISP for dimension text position

bigcarl5000kg
Advisor
Advisor

Dear community,

 

I have two separate LISPs for optional setting of the text position in the selected dimension, without the person having to change these values in the properties of the dimension each time.

 

The first LISP changes the value of the system variable DIMGAP (text gap) between 1.5 or 5.5. The second LISP changes the value of the system variable DIMTAD (vertical text position) between above or below.

 

The initial value of the text position in the dimension is DIMTAD = above, DIMGAP = 1.5.

 

Please, it is possible to somehow combine these two LISPs so that the position of the text in the selected dimension changes in "this order":

1) DIMTAD = above, DIMGAP = 5.5
2) DIMTAD = under, DIMGAP = 1.5
2) DIMTAD = above, DIMGAP = 5.5
2) DIMTAD = above, DIMGAP = 1.5

bigcarl5000kg_0-1642576746970.png

 

 

The sample data and the two LISPS see attachment.

 

Thank you in advance for your help and have a nice day.

 

 

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes
Accepted solutions (2)
2,407 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Here you go. Type in or pick on numbers 1-4. Edit: seeing that, you should probably flip 3 with 4 to have it sorted from up to down.

 

(defun c:DTO ( / sel tad gap)
  (or *dto-key*
      (setq *dto-key* "1"))
  (if (and (ssget "_:L" '((0 . "DIMENSION")))
	   (not (initget "1 2 3 4"))
	   (setq *dto-key* (cond ((getkword (strcat "\nSpecify type [1 a55/2 a15/3 u55/4 u15] <" *dto-key* ">: "))) ("1")))
	   (cond ((= *dto-key* "1") (setq tad acabove gap 5.5))
		 ((= *dto-key* "2") (setq tad acabove gap 1.5))
		 ((= *dto-key* "3") (setq tad acunder gap 5.5))
		 ((= *dto-key* "4") (setq tad acunder gap 1.5))
		 ))
    
    (progn
      (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
	(vla-put-verticaltextposition obj tad)
	(vla-put-TextGap obj gap))
      (vla-delete sel)))
  (princ)
  )
(vl-load-com) (princ)

 

Message 3 of 7

bigcarl5000kg
Advisor
Advisor

Hi @ВeekeeCZ ,

 

many thanks, that's great 👍👍👍👍.

 

Have a nice week

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes
Message 4 of 7

bigcarl5000kg
Advisor
Advisor

Hi @ВeekeeCZ ,

 

The original LISP was designed for a text height of 3.5 mm only (therefore those variants with a 5.5 gap). Please, can you adjust your LISP so that for option "1" and "3", the gap size is equal to the text size of the selected dimension +2.5.

 

For option "2" and "4" it will always be 1.5 (basic gap from the dimension styles)

 

Many thanks in advance

 

 

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes
Message 5 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution
(defun c:DTO ( / sel tad gap)
  (or *dto-key*
      (setq *dto-key* "1"))
  (if (and (ssget "_:L" '((0 . "DIMENSION")))
	   (not (initget "1 2 3 4"))
	   (setq *dto-key* (cond ((getkword (strcat "\nSpecify type [1 a+25/2 a15/3 u+25/4 u15] <" *dto-key* ">: "))) ("1")))
	   (cond ((= *dto-key* "1") (setq tad acabove))
		 ((= *dto-key* "2") (setq tad acabove))
		 ((= *dto-key* "3") (setq tad acunder))
		 ((= *dto-key* "4") (setq tad acunder))
		 ))
    
    (progn
      (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))
	(vla-put-verticaltextposition obj tad)
	(if (vl-position *dto-key* '("1" "3"))
	  (vla-put-TextGap obj (+ (vla-get-TextHeight obj) 2.5))
	  (vla-put-TextGap obj 1.5)))
      (vla-delete sel)))
  (princ)
  )
(vl-load-com) (princ)
Message 6 of 7

Sea-Haven
Mentor
Mentor

Maybe something like this for input been playing with a new library function. Just ask if you want it. Does multi column radio buttons.

 

SeaHaven_0-1642587419877.png

 

Message 7 of 7

bigcarl5000kg
Advisor
Advisor

Hi @Sea-Haven ,

 

thank you, I already have a solution. Yours also looks interesting 😀

+++ impossible immediately and miracles within 3 days +++
+++ the only constant is the change +++ stay tuned for more +++
+++ since 03/2023 is Advance Steel in maintenance mode, no further development +++
0 Likes