Author Topic: Preset attribute values routine  (Read 2013 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Preset attribute values routine
« on: March 07, 2008, 11:19:27 AM »
I started a new job recently and have been doing minor revisions and most of them require me to fill in the same thing in the revision description(s). What I'm wondering is has anybody made a routine that will allow me to add common info to so I don't have to type these same things in over and over?

deegeecees

  • Guest
Re: Preset attribute values routine
« Reply #1 on: March 07, 2008, 11:25:46 AM »
Is the attribute and block the same name in each drawing?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Preset attribute values routine
« Reply #2 on: March 07, 2008, 11:27:59 AM »
Dan,

There are tons of attribute routines here :wink:
Search Results
« Last Edit: March 09, 2008, 09:46:51 AM by CAB »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ELOQUINTET

  • Guest
Re: Preset attribute values routine
« Reply #3 on: March 07, 2008, 12:03:07 PM »
Deeg i'm not really sure of that yet as i am revising old and new titleblocks. I would have to work with them more before I can say. Ron I did a search before I posted this hoping to someone would pull a rabbit out of a hat rather than having to search through 36 pages. I'll look through these over the weekend unless someone performs magic...

deegeecees

  • Guest
Re: Preset attribute values routine
« Reply #4 on: March 07, 2008, 12:08:13 PM »
Here's some magic that you could tinker with. As always my standard disclaimer applies: "It ain't pretty, but it works". Let me know if you need a nudge.

ELOQUINTET

  • Guest
Re: Preset attribute values routine
« Reply #5 on: March 07, 2008, 12:59:58 PM »
will do man thanks

deegeecees

  • Guest
Re: Preset attribute values routine
« Reply #6 on: March 07, 2008, 01:16:41 PM »
No problem Dan. It's a batch proceesor for multiple drawings. You'll need to tweak a few lines for your situation (i.e. directory, block/attribute name), and it will leave a couple text files on your C: drive. There are probably better ways to achieve what this does, but I thought it may be a good starting point for you.

ASMI

  • Guest
Re: Preset attribute values routine
« Reply #7 on: March 08, 2008, 03:39:18 PM »
Copy all attrributes from blok to block aslo between different drawings. CATT- copy, PATT- paste.


Code: [Select]
;**** Copy attributes values ****

(defun c:catt(/ sSet)

;;; written by ASMI (Alexander Smirnov) 3rd Sep 2007
;;; absolutely free to use and modify

  (vl-load-com)
  (princ "\n<<< Select block to copy attributes >>>")
  (if
    (setq sSet(ssget "_:S" '((0 . "INSERT")(66 . 1))))
    (progn
      (setq cBl(vlax-ename->vla-object(ssname sSet 0)))
      (vl-bb-set 'atLst(cons
(vla-get-Name cBl)
   (mapcar '(lambda(x)
    (vla-get-TextString x))
       (vlax-safearray->list
                 (vlax-variant-value
   (vla-GetAttributes
     cBl))))))
      (princ "\n<<< Attribute value(s) were copied >>>")
      ); end progn
    (princ "\n>>> This isn't block with attribute(s)! <<< ")
    ); end if
  (princ)
  ); end of c:catt



;**** Paste attributes values to multiple blocks ****

(defun c:patt(/ sDat dLst fLst blSet)
  (vl-load-com)
  (if
    (setq sDat(vl-bb-ref 'atLst))
    (progn
      (setq fLst(list '(0 . "INSERT")(cons 2(car sDat)) '(66 . 1))
    dLst(cdr sDat)
    ); end setq
      (princ(strcat "\n<<< Current block to paste is '" (car sDat) "' >>> "))
       (if
(setq blSet(ssget fLst))
  (foreach bl (mapcar 'vlax-ename->vla-object
                       (vl-remove-if 'listp
                         (mapcar 'cadr(ssnamex blSet))))
    (mapcar 'vla-put-TextString
    (vlax-safearray->list
     (vlax-variant-value
       (vla-GetAttributes bl)))dLst)
    ); end foreach
(princ "\n>>> Nothing selected! <<< ")
); end if
      ); end progn
    (princ "\n >>> There isn't attributes datas to paste! <<< ")
    ); end if
  (princ)
  ); end of c:patt

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Preset attribute values routine
« Reply #8 on: March 09, 2008, 10:01:29 AM »
Dan,
There is plenty of code on attributes to put this together.
Do you know the tag name & is it the same every time?
Is the block unique to the space you are in, i.e. only one occurrence?


Here is the pseudo code 1, tag name constant
  • User selects the block
  • Set default response string
  • User option to edit response string
  • Update the attribute
  • Refresh the object

Here is the pseudo code 2, block unique, but tag name varies
  • User selects the attribute, via nentsel
  • Set default response string
  • User option to edit response string
  • Update the attribute
  • Refresh the object

Here is the pseudo code 3, block unique & tag name constant
  • Get Block, Verifying Tag
  • Set default response string
  • User option to edit response string
  • Update the attribute
  • Refresh the object
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.

deegeecees

  • Guest
Re: Preset attribute values routine
« Reply #9 on: March 11, 2008, 03:12:44 PM »
>nudge< Anything pan out for you Dan?