adding a attribute to an existing dynamic block

adding a attribute to an existing dynamic block

Anonymous
Not applicable
4,089 Views
5 Replies
Message 1 of 6

adding a attribute to an existing dynamic block

Anonymous
Not applicable

Hi all,

 

I ran into a strange problem with an attribute in a dynamic block. First I made a dynamic block, containing lines, a (symbol) block, text and text with fields. After defining, I added a single attribute. Using attsync, the block works fine in that drawing. I WBLOCK the block to the BIB-directory.

 

Now, when I insert the block in a new drawing, it comes with the attribute, working fine. BUT: when I use a LISP-routine to insert the block, it comes with the block without the attribute. In the LISP-routine there's no path or whatsoever for the block. When the block isn't already inserted, the LISP-routine shows me the message "Block 'a-glas' not found in this drawing...". When the block (including the attribute) is already inserted in the drawing, the LISP returns the block without the attribute.

 

Even more weird: In the same drawing, when I doubleclick the attributed block, it comes up with the attribute editor, when I doubleclick the block without the attribute, it comes up with the edit block definition pop-up. When I type ATTSYNC, AutoCAD gives me the message: "This drawing contains no attributed blocks."

 

I now have the attributed block added to my drawing template, but this makes no difference. The block in itself works fine. When inserted using the LISP-routine, it again comes without the attribute.

 

For a better understanding, I added a screenshot (showing the blocks and the prop-manager), the LISP I use and the drawing with the two 'identical' blocks.

 

Any thoughts (other than not using the LISP-routine anymore....)?

0 Likes
4,090 Views
5 Replies
Replies (5)
Message 2 of 6

Libbya
Mentor
Mentor

The block definition for a-glas within that drawing does *not* contain any attributes.  It obviously did contain an attribute at one point in time, but then the definition was changed to eliminate the attribute.  The attribute still visible in the one version of the block is because attsync has not been run, and it cannot be run on the current file because there are not any attributed blocks left.  When I altered the block definition to contain an attribute and then ran the foo lisp, it inserted the block WITH the attribute just fine.  When I ran attsync after adding the attribute, the attribute appeared in the existing iterations.  I would conclude that the issue is with the existing block definition in the current file or the template used.  Open the template file, insert the a-glas block, run attsync on it to see if the template definition actually includes the attribute.  Post the template file up also if you have further questions.  

 

 

0 Likes
Message 3 of 6

Anonymous
Not applicable

Tried your solution, but can't get it to work. When I place the block using insert it places the block and comes up with the attribute editor. when I accept the default value and run attsync, it gives me the message that there are no attributes present in the block. Doubleclicking it again, it opens the attribute editor again.

0 Likes
Message 4 of 6

Libbya
Mentor
Mentor

I'll post another screencast showing the last file you posted.  I add an attribute to the block definition.  Then insert another block of that definition and the attribute is present.  I then load your foo lisp and add a couple more and each of them has the attribute.  If that is not the behavior you are seeing then download Autodesk Screencast and take a step-by-step screencast showing your process of adding the attribute to the block definition, saving the block,  and inserting blocks using the foo lisp.  Without more information from you on what exactly you are doing, all I can say is that it works fine for me and I don't know what is different about either your process or your setup.  

 

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

Hello Lybbya,

 

Thnx again for your effort. I still don't get what goes wrong, but I build up the block again, including the attribute and now it works fine. However, when I exploded the block (to reuse the components for the new block), the attribute was gone, though it worked fine before exploding. Strange. Somehow the attsync didn't do the job.

0 Likes
Message 6 of 6

jtohill
Advocate
Advocate

type battman select block sync block. Attributes will be added to blocks in the drawing which did not have them. redefining the block only adds attribute to new blocks since redefinition.

John Tohill