Hey guys,
I'm trying to set up a hight label for sections and elevations. I then want to update it with a shortcut.
I already tried it with a field that shows me the y coordinates, but it won't show me the "+-"0.00 sign,when I put it to zero level. It only writes "0.00".
So I guess I have to ork with attributes. Any solutions how I can manage that?
cheers
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Solved by hmsilva. Go to Solution.
hey, me again. 😉
I now tried to make the heightlabel to a dynamic block with a dropdownlist for different visibilities. Now it won't update anymore...
doesn't this work for this kind of scripts? I added the block to show you what I mean. Maybe you got a clue how to work with such blocks...
Hi klingi,
sorry for the late reply, but I didn't see your post
The code wasn't tested (I don't have AutoCAD in this pc), assuming that there is only one attribute in your block, you'll have to change the dynamic block name to the correct one (I left the old name)...
(defun c:test ( / *error* ATT ENT HND ITM NUM OLD_ZIN PT S1 TXT Y) (defun *error* ( msg ) (if Old_zin (setvar 'DIMZIN Old_zin)) (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\nError: " msg))) (princ) ) (if (setq s1 (ssget "_:L" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," "__Hoehenkote")) '(66 . 1) (cons 410 (getvar 'CTAB))))) (progn (setq Old_zin (getvar 'DIMZIN)) (setvar 'DIMZIN 0) (setq itm 0 num (sslength s1)) (while (< itm num) (setq hnd (ssname s1 itm)) (if (eq (vla-get-effectivename (vlax-ename->vla-object hnd)) "__Hoehenkote") (progn (setq ent (entget hnd) att (entget (entnext hnd)) pt (trans (cdr (assoc 10 ent)) 0 1) y (/ (cadr pt) 100.0)) (cond ((> y 0.0) (setq txt (strcat "+" (rtos y 2 2))) ) ((= y 0.0) (setq txt (strcat "±" (rtos y 2 2))) ) (T (setq txt (rtos y 2 2))) );; cond (entmod (subst (cons 1 txt) (assoc 1 att) att)) );; progn );; if (setq itm (1+ itm)) );; while (setvar 'DIMZIN Old_zin) );; progn );; if (princ) );; test
Try it, and let me know if it works as expected.
Hope that helps
Henrique