PDA

View Full Version : attribute reference problem



j_r_auden
9th Feb 2005, 03:47 pm
I have a program that creates a block, adds the block to the drawing, and adds 2 attributes to the block. This works fine if I insert just one block. However, if I insert more than one block, when I try to change the attribute values for one block by using attedit from modelspace I have a problem. The pop up dialogue box will have more than just 2 attributes listed.

Here's a rough example of my code:

Define my block here.
set myBlock = thisdrawing.addblock(insertPt, "PIPETAG")
' what does the insert point here do ???????

Define first attribute
add to block

Define second attribute
add to block

set ObjRefObj = thisdrawing.insert (the block)

Here is an example of what my attribute reference box should look like

-----------------------
|
| Pipe Length:
|
| Pipe Size:
|
------------------------

It looks like that when i have one block inserted. This is what I want. I want to be able to edit each block independently.

But if I insert, lets say 3 blocks, I have three sets of attributes like below. I think it is letting me edit the attributes of every block I insert. So, if I insert 25 blocks, then I will be able to edit all 25 blocks by using the attedit command on just one. I do not want this.

------------------------
| Pipe Length:
|
| Pipe Size:
|
| Pipe Length:
|
| Pipe Size:
|
| Pipe Length:
|
| Pipe Size:
|-----------------------

Any idea why this is happening??

I am being allowed to edit every attribute in my drawing, but I just want to edit the attributes of one particular block.

Please help, my brain hurts from trying to figure this out !!!!!!!!

hendie
9th Feb 2005, 05:00 pm
the insert point is the insertion point of the block i.e. where you want the block to go in the drawing.

and without seeing your code it's impossible to tell where you are going wrong. But at a guess...
Once you insert ONE block you no longer need to add attributes ~ they are already defined in the drawing. You just need to insert the block (which is already in the drawing)

you need an error check to see if the block already exists and if it does then just insert, if not, then create from new