LISP - dimension text offset property

LISP - dimension text offset property

Anonymous
Not applicable
1,145 Views
3 Replies
Message 1 of 4

LISP - dimension text offset property

Anonymous
Not applicable

Dear community,

 

I'm trying to adapt another LISP for my purpose. I would like to set the text offset of the selected dimensions (via TextGap) to two possible variants (5.5 and 1.5). Please let me know what is wrong here, because unfortunately it does not work.

 

(defun c:DimTextOffset ( / 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-TextGap obj))
                   (vla-put-TextGap obj 5.5)
                   (vla-put-TextGap obj 1.5)
               )
           )
           (vla-delete sel)
       )
   )
   (princ)
)
(vl-load-com) (princ)

 

Many thanks in advance 

0 Likes
Accepted solutions (1)
1,146 Views
3 Replies
Replies (3)
Message 2 of 4

dlanorh
Advisor
Advisor
Accepted solution

two things I see.

 

1. acunder = nil. It is never set anywhere so instead of

 

(= acunder (vla-get-TextGap obj))

 

you could

(not (vla-get-TextGap obj))

 

2. You're not updating the object

 

(vla-update obj)

 

after the if statement.

 

I am not one of the robots you're looking for

Message 3 of 4

ahsattarian3
Enthusiast
Enthusiast

Do we have such a thing for Text Objects  ????

0 Likes
Message 4 of 4

Kent1Cooper
Consultant
Consultant

@ahsattarian3 wrote:

Do we have such a thing for Text Objects  ????


To do what with them?  The TextGap property is part of Dimension objects, defining the space between the dimension line and the text part.  Since Text Objects have no other component to have a distance from, what do you want to do?

Kent Cooper, AIA
0 Likes