TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jrr114 on October 07, 2021, 01:39:52 PM

Title: Dimension placement
Post by: jrr114 on October 07, 2021, 01:39:52 PM
Is there a LISP to toggle placement of dimension text with leader?  I would like to place text in a different quadrant about the dimension line and extension lines.
Title: Re: Dimension placement
Post by: BIGAL on October 07, 2021, 08:58:39 PM
Yes you can make the dim then alter its position. Hopefully this makes sense. There is lots of code wrapped around this.

Code: [Select]
(command "dim" "hor" pt1 p4 pt3 "" "exit")
(setq obj (vlax-ename->vla-object (entlast)))
(setq tpos (mapcar '+ (vlax-get obj 'TextPosition) (list 90 -18 0.0))) ; change list X Y Z of point
(vlax-put obj 'TextMovement 1)
(vlax-put obj 'TextPosition tpos)
[code]
Title: Re: Dimension placement
Post by: MSTG007 on October 08, 2021, 07:16:18 AM
Thats pretty slick.
Title: Re: Dimension placement
Post by: BIGAL on October 08, 2021, 07:19:23 PM
Thanks, just used dumpit and entget to look at what variables were changing. Had to do exactly what was asked for.
Title: Re: Dimension placement
Post by: jrr114 on October 12, 2021, 10:11:08 AM
Thanks BigAl.  You LISP writers are amazing.  What should I be typing in the command line?  Sorry to be so dumb.  I tried typing DIM and that didn't work.
Title: Re: Dimension placement
Post by: MSTG007 on October 12, 2021, 11:37:06 AM
Something Like this...

Code: [Select]
(defun C:DR () ;;Dim Right
(command "dim" "hor" pt1 p4 pt3 "" "exit")
(setq obj (vlax-ename->vla-object (entlast)))
(setq tpos (mapcar '+ (vlax-get obj 'TextPosition) (list 90 -18 0.0))) ; change list X Y Z of point
(vlax-put obj 'TextMovement 1)
(vlax-put obj 'TextPosition tpos)
(princ)
)
Title: Re: Dimension placement
Post by: BIGAL on October 12, 2021, 11:29:47 PM
Think of it more like this

(command "dim" "hor" pt1 pt2 pt3 "" "exit")

pt1 is left pick point
pt2 is right pick point
pt3 is dim line pick point
all are calulated in some way or picked

(list 90 -18 0.0)) move the point +90 in X direction -18 in Y direction Z no change

You could do a after making dim make a choice, LL UL UR LR for the 4 directions. For me I use a library program that makes a dcl on the fly.