Author Topic: True Global Attrubute Edit  (Read 11189 times)

0 Members and 1 Guest are viewing this topic.

cparnell

  • Guest
True Global Attrubute Edit
« on: November 20, 2003, 05:31:17 PM »
I have looked all over the place for a routine that is a true Global Attribute Edit command. Express Tools has GATTE, Help describes it as: GATTE - Globally changes attribute values for all insertions of a specific block. I am looking for a True Global Attribute Edit command, one that will update any block that has the common name TAG no matter what the block name is. This current command "GATTE" is only for command line entry and therefore only effects one attribute TAG at a time. I am looking for a routine that is dialog based like the Edit Attributes dialog box. I have about 15 or so model space borders, sized to match Plot Scale in the plot dialog box; each border has 10 Tags that will have values that need to be updated. However I'm looking for a routine that will allow me, via this routine, to update only the first five attributes. I’m looking for a routine that is adjustable, (check box by each?) meaning that if I later change the border and I only need to update four of the attributes, or change the number of total attributes I can still use it for what I need.

I found a routine by (Tony Hotchkiss called MATTC) that will do something like what I want. However it would only list 6 of my total 10 attrubutes, these were not in the order that they were created in.

I also have a routine called "Change Every Attribute" I don't have the name of the author. It will change every TAG but if the value has a space it will not comply.

I am aware of the FIND command however it would be nice to be able to have all of the attributes in one dialog box and to be able to change the attributes that need to be updated.

Has any one seen a routine like this, or some on would like to share.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
True Global Attrubute Edit
« Reply #1 on: November 20, 2003, 05:37:51 PM »
Sounds like a good group project. Anybody want to jump in?  I'll take anything but the DCL code. :D
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
True Global Attrubute Edit
« Reply #2 on: November 20, 2003, 06:24:38 PM »
I'll take the any block with the same tagname. I just did one for 42 over in Cad General. One function I used is yours. As far as dcl driven, it would be fun to do it in a vba form. Trev made one for me. I could post it in vba forum and we could modify it. Let me know what you think? Charles, if we do the vba route, would that be a problem?

DParcon

  • Guest
True Global Attrubute Edit
« Reply #3 on: November 20, 2003, 06:31:03 PM »
If you're talking about mattc.lsp, it could work for unlimited
  number of attributes with minimal changes.

cparnell

  • Guest
True Global Attrubute Edit
« Reply #4 on: November 20, 2003, 06:45:05 PM »
I know very little about LISP. I have been able to change some variables for the default hatch pattern etc, and have found other LISP routines that have helped out a great deal. I know nothing about VBA. Any thing that will get the job done and make my job easier and anyone else who would like to use this routine to imporve there productivity.

DParcon:

I was able to modify MATTC.lsp to list only the first 5 attributes, and it worked well, however it would update more than the first 5 attributes and mess my other borders up. I then went back to DDATTE which I shortened to AE in my ACAD.PGP file.

Many thanks to any one who offers solutions for there time and efforts. I try to answers and give tips when I am able.

By the way The University of Alabama and Auburn University play foot ball this week end.

ROLL TIDE!!!!!

hendie

  • Guest
True Global Attrubute Edit
« Reply #5 on: November 21, 2003, 04:04:11 AM »
Quote from: Daron
... it would be fun to do it in a vba form. .


's'bout time we had some VBA action in here instead of these archaic languages  :P

sounds like a good project. I can chip in if time permits.

right.. now, where's that Project Request/Requirements form that Mark was working on....

daron

  • Guest
True Global Attrubute Edit
« Reply #6 on: November 21, 2003, 09:19:25 AM »
Quote
right.. now, where's that Project Request/Requirements form that Mark was working on....

NO KIDDING!

As far as the program goes, if we do keep it in lisp, I was thinking we take all the modular code and give it to Andre' as a challenge to putting the pieces together so he can begin to understand how reusable functions work.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
True Global Attrubute Edit
« Reply #7 on: November 21, 2003, 09:25:00 AM »
>I was thinking we take all the modular
>code and give it to Andre' as a challenge

Easy there Daron, let him digest what he has.

>now, where's that Project
>Request/Requirements form that
>Mark was working on

Dunno..........
TheSwamp.org  (serving the CAD community since 2003)

daron

  • Guest
True Global Attrubute Edit
« Reply #8 on: November 21, 2003, 09:36:35 AM »
That guy is cool. I like his pro-active approach to getting code.

SMadsen

  • Guest
True Global Attrubute Edit
« Reply #9 on: November 21, 2003, 11:48:40 AM »
Why resort to a language that is usually invoked by an archaic language, anyway?

cparnell, here's a skeleton of a routine that might do the job you describe. Load and run it with command CHATTE:

Code: [Select]

;; lsp (save as e.g. "chatte.lsp")
(defun getAttrib (ent atttag / bl entl att f_att)
  (setq bl ent)
  (while (and ent (/= "SEQEND" (cdr (assoc 0 (setq entl (entget ent))))))
    (if (= atttag (setq att (cdr (assoc 2 entl))))
      (setq f_att (list ent (cdr (assoc 1 entl)) bl))
    )
    (setq ent (entnext ent))
  )
  f_att
)

(defun chgAllAttribs (tagname newval / lst sset ent entl a c)
  (setq c 0)
  (cond ((setq sset (ssget "X" '((0 . "INSERT") (66 . 1))))
         (setq a 0)
         (repeat (sslength sset)
           (setq ent  (ssname sset a)
                 entl (entget ent))
           (if (setq att (getattrib ent tagname))
             (setq lst (cons att lst)))
           (setq a (1+ a)))
         (foreach n lst
           (cond ((setq entl (entget (car n)))
                  (if (entmod (subst (cons 1 newval) (assoc 1 entl) entl))
                    (setq c (1+ c)))
                  (entupd (caddr n))))
         ))
  )
  c
)

(defun C:CHATTE (/ dcl_id tag new action)
  (setq dcl_id (load_dialog "chatte.dcl")
        new    "" tag "")
  (cond ((new_dialog "chatte" dcl_id)
         (mode_tile "tag" 2)
         (action_tile "tag" "(setq tag $value)")
         (action_tile "txt" "(setq new $value)")
         (setq action (start_dialog))
         (cond ((and (= action 1) (snvalid tag))
                (mapcar 'princ (list "\n" (chgAllAttribs (strcase tag) new)
                                     " attributes changed"))))
         )
  )
  (princ)
)

;; dcl (save as "chatte.dcl")
chatte : dialog {
  label = "Change all attributes";
  : column {
    : edit_box {
      key = "tag";
      label = "Attribute tag";
      edit_width = 20;
    }
    : edit_box {
      key = "txt";
      label = "New text";
      edit_width = 20;
    }
    : spacer_1 {}
  }
  ok_cancel;
}

SMadsen

  • Guest
True Global Attrubute Edit
« Reply #10 on: November 21, 2003, 11:56:22 AM »
Ok, so I only read the first few lines of the first post in this thread  :oops:
Oh well.

daron

  • Guest
True Global Attrubute Edit
« Reply #11 on: November 21, 2003, 12:16:10 PM »
I only suggested vba because I'm trying to learn it.

cparnell

  • Guest
True Global Attribute Edit
« Reply #12 on: November 21, 2003, 12:30:49 PM »
SMadsen

I loaded and saved your routine as chatte.lsp in my A2K4 support path which is like 9 levels down in my C:\ drive. I also went to my acad.lsp and entered (load "chatte"), I also went to my A2K4 screen and typed appload and loaded the routine via my Startup Suite, and I as well rebooted my computer. All I get at my command prompt when I enter chatte is

Command: chatte

Command:

I DON'T even get Unknown command "chatte", Press f1 for help.

Am I doing something wrong?

cparnell

  • Guest
True Global Attribute Edit
« Reply #13 on: November 21, 2003, 12:32:44 PM »
SMadsen

By the way THANKS for your responce!!!!!!!

DParcon

  • Guest
True Global Attrubute Edit
« Reply #14 on: November 21, 2003, 01:47:27 PM »
CParnell,

  The skeleton routine posted by Stig
  works perfectly. Sometimes, it's a lot
  easier to just read & follow instructions.

  In case you're not aware of it, you
  have to save a separate dcl file as
  per instructions written as a commnet
  in the code and watch out for the
  commented instruction.