Need a book? Engineering books recommendations...

Return to index: [Subject] [Thread] [Date] [Author]

RE: AutoCAD blocks with attributes

[Subject Prev][Subject Next][Thread Prev][Thread Next]
Chris:

> Is there a way to insert a block with attributes that 
> show predefined values?
> Example:  In a lisp file, I define x=3D2 and I insert a 
> block with an attribute, say y.  Is there a way to make 
> attribute y show 2?

I don't fully understand what you're trying to do (perhaps because the "=3" is supposed to be something else?). 

When you create an attribute definition (with ATTDEF or DDATTDEF), you can assign it a default value, or you can give it a Preset or Constant value (see AutoCAD's on-line help for the difference). The choice you make controls what prompts the user sees when he inserts the block containing that attribute definition, and likewise controls what your AutoLISP program "sees" if it inserts the block with (command "_.INSERT" ...). Your AutoLISP program can respond to the prompts with fixed values or variables.

After the block is inserted, you can use AutoLISP's standard entity access functions (entget, entmod, etc.) to read and/or change attribute values.

- Mark Middlebrook