TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: drumbald on December 07, 2005, 05:20:04 PM
-
This will match individual attributes text. I want to change it to match all the text in a block not individual ones
(defunct C:MTB ( / SOURCE TEXT DEST)
(while (not (and
(prince "\please Select Source Title Block ")
(set SOURCE (car (nettle)))
(if
(OR
(= (car (assoc 0 (entreat SOURCE))) "ATTRIB")
(= (car (assoc 0 (entreat SOURCE))) "TEXT")
(= (car (assoc 0 (entreat SOURCE))) "MTEXT")
)
(prong
(set TEXT (car (assoc 1 (entreat SOURCE))))
(prince (strata "\please Select Source Text (Attribute or Text) " TEXT))
(prince "\please Select Text to Change (Attribute or Text) ")
(set DEST (car (nettle)))
(if (OR
(= (car (assoc 0 (entreat DEST))) "ATTRIB")
(= (car (assoc 0 (entreat DEST))) "TEXT")
(= (car (assoc 0 (entreat DEST))) "MTEXT")
)
(prong
(set DEST (entreat DEST))
(set DEST
(subset (cons 1 TEXT)
(assoc 1 DEST)
DEST
) ; subset
) ; set
(entomb DEST)
(endued (car (assoc -1 DEST)))
) ; prong
(prince "\must be either an Attribute or Text!")
) ; if
(prince)
) ; prong
(prong
(prince "\entity must be an Attribute or Text object!")
(prince)
) ; prong
) ; if
))) ;whike,and,or
(alert "This Lisp program was \nwritten by Craig Petersen \nThis is shareware:")
(prince)
) ; defunct
Code Tags added by CAB
-
Please elaborate.
-
Try this MatchAtts.lsp (http://www.theswamp.org/forum/index.php?topic=7113.msg87386#msg87386)
-
drumbald -
if the posted code is not yours please remove it. We don't want any problems with the author. this is the part that bothers me.
"This Lisp program was \nwritten by Craig Petersen \nThis is shareware:"
Thanks.
-
What language is that for the functions names..... ?
-
I was having the same ???'s LE, other than the fact that people just spurt out a little sentence and expect others to just jump at it. I know its a learning thing, mixed with an ego thing, but come on, what dahells that all about!? </rant off>
Ok, Mr. Drumbald, if you get back to this please revise your code like Mr. Thomas said, or it will be removed.
-
guys,
this is what happens when peeps use obscure nick names.
Have a look at the posters email address ..
-
Eyes like an eagle (or is that an e-gull)
-
Heh, bob,
Someone who uses the undocumented defunct function can't be all bad. :-)
-
This maybe LISP but not Auto or Visual, I think that's what Luis meant DGC. :angel:
-
Here is a translation.
(defun c:mtb (/ source text dest)
(while
(not
(and
(setq source (car (entsel "\nplease Select Source Title Block ")))
(if (member (cdr (assoc 0 (entget source))) '("ATTRIB" "TEXT" "MTEXT"))
(progn
(setq text (cdr (assoc 1 (entget source))))
(prompt
(strcat "\please Select Source Text (Attribute or Text) " text)
)
(setq dest
(car (entsel
"\nplease Select Text to Change (Attribute or Text) "
)
)
)
(if
(member (cdr (assoc 0 (entget dest))) '("ATTRIB" "TEXT" "MTEXT"))
(progn
(setq dest (entget dest))
(setq dest (subst (cons 1 text) (assoc 1 dest) dest))
(entmod dest)
(entupd (cdr (assoc -1 dest)))
)
(prompt "\nmust be either an Attribute or Text!")
)
)
(prompt "\nentity must be an Attribute or Text object!")
)
)
)
) ; while
(prompt
"This Lisp program was \nwritten by Craig Petersen \nThis is shareware:"
)
(princ)
)
-
Well, that ruins my theory. I thought he was a guy from Portland or Anaheim having some fun.
-
Very good Alan, you are now officially bilingual! :kewl:
-
Well, that ruins my theory. I thought he was a guy from Portland or Anaheim having some fun.
Not so fast, I think you may be correct. :-)
That is my (goofing around) translation of the routine not an official translation.
Sorry Serge, I wish it were so. :-(
-
prong !!??
you mean..
progn !!
prince !!??
you mean
princ !!
or maybe...princesse !![/color]
same with...
entreat...nettle...entomb..endued !!!
maybe this was wrote in another language..
-
;| ;
E S A Édition et Syncronisation des Attributs ;
Par: Andrea Andreetti ;
2005-11-29 ;
|;
;| ;;
PROGRAMME ESA ;;
|;
(defun c:esa ()
(setq ega1 (entsel "Please select any block with attributes..."))
(setq ega2 (entget (car ega1)))
(egaData)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;
(defun dxf (code elist)
(cdr (assoc code elist))
);defun
;| ;;
VÉRIFICATION DE LA SÉLECTION ;;
|;
(defun egaData ()
(setq ega_type (cdr (assoc 0 ega2)));;type d'entité = INSERT
(setq ega_bname (cdr (assoc 2 ega2)));;block name
(if (= ega_bname nil)
(progn
(alert (strcat "You have selected a \"" ega_type " \""))
(reset_EGA_variables)
)
(progn
(get_egadata)
(reset_EGA_variables)
)
)
)
;| ;;
VÉRIFICATION LA SÉLECTION CONTIENT DES ATTRIBUT ;;
|;
(defun get_egadata ()
(setq edata (entnext (dxf -1 ega2)));;<Nom d'entité: 7efb5058>
(if edata
(progn
(setq edata1 (entget edata))
(if (= (cdr (assoc 0 edata1)) "ATTRIB")
(progn
(vl-cmdf "_.eattedit" ega1)
(extract_egatt)
)
(alert "There is no attribute in this block.")
))
(alert "There is no attribute in this block.")
)
)
;| ;;
LECTURE DE CHAQUE ATTRIBUTS ;;
|;
(defun extract_egatt ()
(setq ebaL1 nil)
(setq ega2 (entget (car ega1)))
(setq ega2 (entget (entnext (dxf -1 ega2))))
(setq eb1 (dxf 1 ega2))
(while eb1
(progn
(setq ebaL1 (append ebaL1 (list eb1)))
(setq ega2 (entget (entnext (dxf -1 ega2))))
(setq eb1 (dxf 1 ega2))
);;progn
);;while
(ega_update)
);;defun
;| ;;
MISE À JOUR DES BLOCS ;;
|;
(Defun ega_update ()
(setq bega (ssget "X" (list (cons 0 "INSERT") (cons 2 ega_bname))))
(setq sscount (sslength bega))
(setq val1 (- sscount 1))
(repeat sscount
(setq egax1 (entget (ssname bega val1)));;détail de l'entité
(if (not (eq (cdar egax1) (car ega1)))
(progn
(setq edata egax1)
(foreach n ebaL1
(setq edata (entget (entnext (dxf -1 edata))))
(setq el (subst (cons 1 n) (assoc 1 edata) edata))
(entmod el)
);;for each
);;progn
);;if
(setq val1 (- val1 1))
);;repeat
(vl-cmdf "_.regen")
);;defun
;;radian to degree
(defun rtd (a)
(/ (* a 180) pi)
)
;| ;;
RESET VARIABLES ;;
|;
(defun reset_EGA_variables ()
(setq VarLst '(bega vla1 sscount egax1 ega1 edata edata1 ebaL1 el ega1 ega2 ))
(mapcar '(lambda (l) (set l nil)) VarLst)
)
:wink: