Update Block Definition without ATTSYNC

Update Block Definition without ATTSYNC

Fredrik.Karlsson2VZLJ
Explorer Explorer
1,029 Views
9 Replies
Message 1 of 10

Update Block Definition without ATTSYNC

Fredrik.Karlsson2VZLJ
Explorer
Explorer

I have the need to change the layers of the genometry inside a block definitions in order for the blocks to work with vpFreeze. The provided code works but I have to run ATTSYNC, which I can not do because all, or most, at least in my case, attributes will be returned to the orginal position which creates a way to big of a problem. How can I, if it is even possible, update the Block Definiton via the code so I dont have to use ATTSYNC?
Im using AutoCAD Lt 2024, and the blocks that are subject for this code contains attributes and visiblity states. An example block is providede in the attached dwg file. To clearify I am a noob in terms of AutoLisp but half decent AutoCAD user.

Update 2025-10-30:
Doing the same thing by going into the block editor for each Block Def. and changing the genometry layer works just fine without ATTSYNC 

0 Likes
1,030 Views
9 Replies
Replies (9)
Message 2 of 10

Moshe-A
Mentor
Mentor

@Fredrik.Karlsson2VZLJ  hi,

 

BATTMAN (or ATTSYNC) command update only the attributes of block (and that's  include attributes position)

where the BEDIT (Block Edit) command, handles the block definition (geometry). inside Block Edit session you can change the attributes but as you exist, the update process (regen) does not touch the attributes only BATTMAN (ATTSYNC) does that.

 

Moshe

 

 

0 Likes
Message 3 of 10

Fredrik.Karlsson2VZLJ
Explorer
Explorer

So when the block editor exits it runs regen?

0 Likes
Message 4 of 10

Moshe-A
Mentor
Mentor

YES and only the block geometric is update.

this behavior is known in AutoCAD since it's born (previous century around 1982) 😀

 

and why is that?

in these old days attributes where the only way to store textual data in a drawing to create BOM (Bill of Materials)

(no xdata, no Extended Data no Dictionaries where around) so careless Automatic updating blocks could led to disruption of BOM

so AutoCAD gave us BATTMAN\ATTSYNC command to handle attributes separately and even today these commands

does not touch the attribute value (only the graphics properties e.g position, layer, color, text size, text style and text angle.

 

Moshe

 

 

 

Message 5 of 10

paullimapa
Mentor
Mentor

Perhaps we can all gain some insight from the code in the free open source AttRedef.lsp packaged with AutoCAD since Release 10.

I briefly introduced this in my first Free Samples article here:

AUGIWORLD by AUGI, Inc. - Issuu


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 10

Fredrik.Karlsson2VZLJ
Explorer
Explorer

I tested doing REGEN and REGENALL manully and also adding  (vla-regen doc acAllViewports) and the end of of the function, that moves the block geomentry to another layer,  but nothing I tried works. I still cant get the block genometry to be frozen when the layer is frozen.

Is it possbile using LISP to redefine the blocks from the tool palette which is the idea anyways?

0 Likes
Message 7 of 10

Moshe-A
Mentor
Mentor

@Fredrik.Karlsson2VZLJ ,

 


@Fredrik.Karlsson2VZLJ wrote:

I tested doing REGEN and REGENALL manully and also adding  (vla-regen doc acAllViewports) and the end of of the function, that moves the block geomentry to another layerbut nothing I tried works. I still cant get the block genometry to be frozen when the layer is frozen.

Is it possbile using LISP to redefine the blocks from the tool palette which is the idea anyways?


first you say it works

next it does not

 

Editing the block with BEDIT than exit using save will drags auto regenerating drawing which update all that block references (but not the attributes)

if in BEDIT you changed an object layer (not attribute) this will reflect after regen. any object on frozen\off layer will be hidden.

 

does that more clear?

 

Moshe

 

 

0 Likes
Message 8 of 10

Fredrik.Karlsson2VZLJ
Explorer
Explorer

What works is that the LISP function moves the geometry to another layer, i.e. MyLayer. When the function is done and when you freeze the layer, in this case MyLayer, the geomentry does not get frozen. 

Doing the same thing, on the same block, in the same drawing, manualy, meaning going into the block editor, selecting the geometry and changing its layer, exiting the block editor, and then freezing the layer, in this case MyLayer, freeze the geometry works as intended, meaning the manual way works, the Lisp function does not.

After some more testing it seems to be related to block references meaning blocks with a, as i understand it, hidden name like *U310

0 Likes
Message 9 of 10

truongyen2442y
Observer
Observer

If you're only changing layers of block geometry, just:

Use BEDIT
Change the layer of geometry
Save and exit
No need to run ATTSYNC, and no attribute positions will be disturbed.

We take care of the future best by taking care of the present now. https://www.jewelerstoolsmall.com/
0 Likes
Message 10 of 10

Moshe-A
Mentor
Mentor

@Fredrik.Karlsson2VZLJ ,

 

i think i have it 😀

 

your problem is with this block reference \ insert, delete it and reinsert

changing a dynamic block after creation some times have problems with the already inserts

 

Moshe

 

 

0 Likes