I've never tried to approach the attribute text in a block in a format like I am facing.
I was curious if anyone had some idea's of what I may need to look for.... :ugly:
I have a set of blocks with a list of text attributes.
When I insert them, I was hoping to have the text always rotate to level "0" rotation regardless of how the block is positioned.
I'm trying to avoid losing the specific settings of the block attribute data other than adjusting "The Text's" rotation relative to the block itself.
I want the "Block's" position to stay as is, just the "Text's" rotation so it always reads level.
Is this possible without exploding the block like the code below:
(defun c:tstat()
;=========================================================================================
;; L o c a l F u n c t i o n s
;=========================================================================================
;; error function & Routine Exit
(defun *error* (msg)
(if
(not
(member
msg
'("console break" "Function cancelled" "quit / exit abort" "")
)
)
(princ (strcat "\nError: " msg))
) ; endif
(restore_sys_vars); reset vars
)
;; Function to save system variables in global variable
;=========================================================================================
(defun save_sys_vars (lst)
(setq *sysvarlist* '())
(repeat (length lst)
(setq *sysvarlist* (append *sysvarlist* (list (list (car lst) (getvar (car lst))))))
(setq lst (cdr lst))
)
)
;; Function to reset system variables
;=========================================================================================
(defun restore_sys_vars ()
(repeat (length *sysvarlist*)
(setvar (caar *sysvarlist*) (cadar *sysvarlist*))
(setq *sysvarlist* (cdr *sysvarlist*))
)
)
;=========================================================================================
; Begin conditions
;=========================================================================================
(save_sys_vars '("clayer" "osmode" "orthomode" "autosnap" "polarang" "snapang")) ; Get User Settings
;=========================================================================================
(setq sc (getvar "dimscale"))
(setq usersnaps (getvar "osmode")) ; -----------------------Get User Osmode Settings
(setq userlayer (getvar "clayer")) ; -----------------------Get User Layer Settings
;(alert "\nNew Thermostat routine, watch the prompts.")
(setvar "osmode" 695)
(setvar "autosnap" 13)
;==========================================================================================================================================Control Line Scaling
(command "PSLTSCALE" 0)
(command "MSLTSCALE" 0)
(command "LTSCALE" sc)
;==========================================================================================================================================
(prompt "\nMSpace & PSpace LTScale Varaibles set to 0!! Defaults to LTSCALE settings now!")
(setq inspt(getpoint "\nSelect Wall (Line, Polyline, Arc, Circle) ESC to EXIT:"))
(command "-insert" "mechanical/kta_mdv005" "s" sc inspt pause)
(command "._explode" "last") ;
(setq tst (entlast))
(setq rotpt (cdr (assoc 10 (entget tst))))
(command "rotate" tst "" rotpt 0)
(setq en (entlast))
(while ;1
(setq en (entnext en))
(setq ed (entget en))
(if ;2
(equal (cdr (assoc 0 (entget en))) "ATTRIB")
(progn ;3
(setq ed ;4 rotate attribute to 0
(subst (cons 50 0) ;5
(assoc 50 ed)
ed
) ;-4
) ;-3
(entmod ed)
(entupd en)
) ;-2
) ;-1
)
;========================================== Layer Set For TStat Wire
(command "Expert" 3)
(command "linetype" "Load" "SML-DASH" "kta.lin" "")
(command "layer" "m" "M-CONT-WIRE" "l" "SML-DASH" "M-CONT-WIRE" "c" 7 "M-CONT-WIRE" "LW" 0.35 "M-CONT-WIRE" "" )
(command "Expert" 0)
(prompt "\n M-CONT-WIRE layer set!!")
;==========================================
(prompt "\nChoose the wire path.... Tap the spacebar three times when done!!")
(command "spline")
(WHILE (WCMATCH (GETVAR "CMDNAMES") "*SPLINE*") (COMMAND pause))
(command "osmode" usersnaps); -----------------------Return User Osmode Settings
(command "clayer" userlayer); -----------------------Return User Layer Settings
(command "regen")
(prompt "\n Thermostat Osnaps & Layer Returned.")
(*error* "") ; restore variables
(princ)
)