Author Topic: Problem with attribute matching  (Read 5337 times)

0 Members and 1 Guest are viewing this topic.

drumbald

  • Guest
Problem with attribute matching
« 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

 

Code: [Select]
(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
« Last Edit: December 07, 2005, 05:24:20 PM by CAB »

deegeecees

  • Guest
Re: Problem with attribute matching
« Reply #1 on: December 07, 2005, 05:21:06 PM »
Please elaborate.

whdjr

  • Guest
Re: Problem with attribute matching
« Reply #2 on: December 07, 2005, 05:25:56 PM »
Try this MatchAtts.lsp

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Re: Problem with attribute matching
« Reply #3 on: December 07, 2005, 05:40:49 PM »
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.
Code: [Select]
"This Lisp program was \nwritten by Craig Petersen \nThis is shareware:"
Thanks.
TheSwamp.org  (serving the CAD community since 2003)

LE

  • Guest
Re: Problem with attribute matching
« Reply #4 on: December 07, 2005, 05:45:10 PM »
What language is that for the functions names..... ?

deegeecees

  • Guest
Re: Problem with attribute matching
« Reply #5 on: December 07, 2005, 05:52:46 PM »
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Problem with attribute matching
« Reply #6 on: December 07, 2005, 05:57:02 PM »
guys,

this is what happens when peeps use obscure nick names.

Have a look at the posters email address ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Bob Wahr

  • Guest
Re: Problem with attribute matching
« Reply #7 on: December 07, 2005, 06:10:04 PM »
Eyes like an eagle (or is that an e-gull)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Problem with attribute matching
« Reply #8 on: December 07, 2005, 06:15:40 PM »
Heh, bob,

Someone who uses the undocumented defunct function can't be all bad. :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Serge J. Gianolla

  • Guest
Re: Problem with attribute matching
« Reply #9 on: December 07, 2005, 06:15:57 PM »
This maybe LISP but not Auto or Visual, I think that's what Luis meant DGC. :angel:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Problem with attribute matching
« Reply #10 on: December 07, 2005, 06:21:26 PM »
Here is a translation.
Code: [Select]
(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)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Problem with attribute matching
« Reply #11 on: December 07, 2005, 06:26:14 PM »
Well, that ruins my theory. I thought he was a guy from Portland or  Anaheim having some fun.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Serge J. Gianolla

  • Guest
Re: Problem with attribute matching
« Reply #12 on: December 07, 2005, 06:33:09 PM »
Very good Alan, you are now officially bilingual! :kewl:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Problem with attribute matching
« Reply #13 on: December 07, 2005, 06:38:57 PM »
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. :-(
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Problem with attribute matching
« Reply #14 on: December 07, 2005, 08:04:06 PM »
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..
« Last Edit: December 07, 2005, 08:10:57 PM by Andrea »
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Problem with attribute matching
« Reply #15 on: December 07, 2005, 08:21:02 PM »
Code: [Select]
;| ;
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:
Keep smile...