Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,440
Registered: ‎11-24-2009
Message 11 of 12 (182 Views)

Re: Lisp for changing text in an attributed block

12-29-2012 08:29 PM in reply to: TROYDAWES

TROYDAWES wrote:
In the block, there are 2 separate attributes

1st attribute is the Fixture units, in the block I use, the TAG = FU, PROMPT = Number of fixture units, DEFAULT = (x)

2nd attribute is the Pipe size, in the block I use, the TAG = PS, PROMPT = Pipe Size, DEFAULT = y

 


Another approach:

 

(defun c:demo ( / table blks i e fu ps)
(vl-load-com)
;;; This is where you add additional values ;;; (min max string) ;;; (1 10 "value")
(setq table '((0.5 1.0 "½")(1.5 7.0 "3/4") (7.5 17.0 "1")(17.5 36.0 "1¼")))

;;;
(if (setq blks (ssget "_X" '((0 . "INSERT") (2 . "FU-PS-RIGHT,FU-PS-LEFT")))) (repeat (setq i (sslength blks)) (setq val (vlax-invoke (setq e (vlax-ename->vla-object (ssname blks (setq i (1- i))))) 'GetAttributes)) (if (and (setq fu (car (read (vla-get-textstring (Car val))))) (setq ps (vl-some '(lambda (x) (if (<= (Car x) fu (cadr x)) (last x) nil)) table))) (vla-put-textstring (Cadr val) ps)) ) )(princ) )

 

 

HTH

 

*Expert Elite*
3wood
Posts: 990
Registered: ‎03-25-2009
Message 12 of 12 (150 Views)

Re: Lisp for changing text in an attributed block

01-10-2013 08:31 PM in reply to: TROYDAWES

Now you can use formula in ALTEXT.

Please try attached ALTEXT.vlx, and select "Use formula" and the bottom. When it prompts to select a lisp file as the formula, pick up ALTEXT_formula.lsp

You can expand/modify the condition defined in ALTEXT_formula.lsp as you like.

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community