Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hight Label LISP

23 REPLIES 23
SOLVED
Reply
Message 1 of 24
Klingi162
943 Views, 23 Replies

Hight Label LISP

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

23 REPLIES 23
Message 21 of 24
Klingi162
in reply to: hmsilva

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...

Message 22 of 24
hmsilva
in reply to: Klingi162

Hi klingi,

sorry for the late reply, but I didn't see your post Smiley Embarassed

 

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

EESignature

Message 23 of 24
Klingi162
in reply to: hmsilva

Hey henrique,

 

works great. Now it can do every trick! Thanks again

 

cheers Klingi

Message 24 of 24
hmsilva
in reply to: Klingi162

You're welcome, klingi

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost