Author Topic: Reading attribute Value before insertion.  (Read 2151 times)

0 Members and 1 Guest are viewing this topic.

Shade

  • Guest
Reading attribute Value before insertion.
« on: March 20, 2006, 07:48:38 AM »
Is there a way of getting an attributes value from a block before the block has been inserted or do I have to insert the block first read the attributes value then erase the block and insert it again?

I wish to store the following info in the attributes of a block;
-Unit type = Metric or Imperial
-Layer group = Default layer placement

I am writing a lisp that will insert a block in the proper units and place that block on the layer I choose by default.

Any help would be appreciated...



Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Reading attribute Value before insertion.
« Reply #1 on: March 20, 2006, 08:10:09 AM »
Yes, you could read the tag values from the block in the BlockTable/blockCollection,

but, you could also change the scale and Layer after the INSERT is placed, which may be simpler.
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.

FengK

  • Guest
Re: Reading attribute Value before insertion.
« Reply #2 on: March 21, 2006, 02:29:34 AM »
If the block definition is in the drawing, you can easily examine it.
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq blkDef (vla-item (vla-get-blocks doc) blkName))

If not, you can open the block drawing with ObjectDBX and step through the objects.  There should be many examples of using ObjectDBX in Autodesk ng.