How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2024 Autodesk Inc. All rights reserved
Hello,
I am working with AutoCAD 2016.
I opened some existing blocs(not dynamic) in bloc editor and deleted all attributes.
I updated attributes with “attsync” but attributes are still visible.
I jointed a simplified sample drawing with two incorrect bloc.
- Attributes are visible on model.
- I you open blocs with bloc editor, attributes are not present.
- I you type “attsync”, it say "This drawing contains no attributed blocks."
How can I delete all attributes of those blocks ?
Thank you in advance for your help.
Solved! Go to Solution.
Hi,
try to use ADDSELECTED command and select one of your blocks to found that it's OK !!! isn't it ? or you can insert it again from INSERT command .
Regards,
Imad Habash
Thank you for your answer.
It works on my sample with two blocks but in reality I have more than 400 blocks with this problem.
I cannot recreate all blocks one by one.
I can solve my problem with BLOCKREPLACE but it still takes time.
Does anyone know where this problem comes from and if there is another solution?
Hi TB
maybe this block was not created with autocad, so maybe this is the mess up, but nevertheless its weird, and strange behavior. I tried and I couldn't change anything with the Attributes.
So if I cant delete this Attributes then I change the value.
Isolate Layers (Insertion and BlockLayer) Select all blocks, use Quickselect > Block Definition > Name and select the Block name, use the Properties Window (STRG+1) and change or delete the attribute values, work is done .
Its not the solution to manage all the 400 different blocks at once, but maybe it speeds up the work , without redefining all the blocks.
The other possibility is to select all the blocks (Quickselect) and use "find" eg. find "AR" and replace with " ". with this method you could change all blocks with the same attribute value at once.
Franz
Hi Franz
I cannot select all blocks easily because many blocks are nested in other blocks
but I still can change texts with "find".
It is also a solution. Thanks.
However, I still prefer to completely clean the attributes because the plans will be used by a third-party program that will read attributes.
Hi
i found if you
there must be some error with the original drawing file
It is a bug in AutoCAD 2016.
I did a test:
1) Make a new empty drawing.
2) Create a new block with at least one attribute.
3) Update attribute with ATTSYNC
-> new drawing with new block
4) Delete all attributes with Block Editor.
5) Type ATTSYNC -> N(ame) -> *.
-> Attribute is still visible in model
But if you reopen block in Bloc Editor attribute is deleted.
If I INSERT this bloc in my drawing, I have a bloc with attribute and another without attribute.
It should not be possible.
I found a lisp called "fixbadattblocks" that fixed my drawing.
Can you please post the lisp?
I've found this, but it doesn't work, or I can't figure the command:
([color=BLUE]defun[/color] c:fixbadattblocks ( [color=BLUE]/[/color] bkc bln doc lst tmp )
([color=BLUE]setq[/color] doc ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color]))
bkc ([color=BLUE]vla-get-blocks[/color] doc)
)
([color=BLUE]vlax-for[/color] blk bkc
([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=BLUE]:vlax-false[/color] ([color=BLUE]vla-get-isxref[/color] blk))
([color=BLUE]vlax-for[/color] obj blk
([color=BLUE]if[/color] ([color=BLUE]and[/color] ([color=BLUE]=[/color] [color=MAROON]"AcDbBlockReference"[/color] ([color=BLUE]vla-get-objectname[/color] obj))
([color=BLUE]=[/color] [color=BLUE]:vlax-true[/color] ([color=BLUE]vla-get-hasattributes[/color] obj))
([color=BLUE]or[/color] ([color=BLUE]setq[/color] tmp ([color=BLUE]assoc[/color] ([color=BLUE]setq[/color] bln ([color=BLUE]vla-get-name[/color] obj)) lst))
([color=BLUE]and[/color] ([color=BLUE]setq[/color] tmp ([color=BLUE]cons[/color] bln (gettags ([color=BLUE]vla-item[/color] bkc bln))))
([color=BLUE]setq[/color] lst ([color=BLUE]cons[/color] tmp lst))
)
)
)
([color=BLUE]foreach[/color] att ([color=BLUE]vlax-invoke[/color] obj 'getattributes)
([color=BLUE]or[/color] ([color=BLUE]member[/color] ([color=BLUE]strcase[/color] ([color=BLUE]vla-get-tagstring[/color] att)) ([color=BLUE]cdr[/color] tmp))
([color=BLUE]and[/color] ([color=BLUE]vlax-write-enabled-p[/color] att)
([color=BLUE]vla-delete[/color] att)
)
)
)
)
)
)
)
([color=BLUE]vla-regen[/color] doc [color=BLUE]acallviewports[/color])
([color=BLUE]princ[/color])
)
([color=BLUE]defun[/color] gettags ( def [color=BLUE]/[/color] rtn )
([color=BLUE]vlax-for[/color] obj def
([color=BLUE]if[/color] ([color=BLUE]=[/color] [color=MAROON]"AcDbAttributeDefinition"[/color] ([color=BLUE]vla-get-objectname[/color] obj))
([color=BLUE]setq[/color] rtn ([color=BLUE]cons[/color] ([color=BLUE]strcase[/color] ([color=BLUE]vla-get-tagstring[/color] obj)) rtn))
)
)
rtn
)
([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])
The easiest way to get rid of attributes in a block (e.g. 'block1") is:
1. Make a copy of block1
2. Explode the copy of block1
3. Delete attributes
4. Redo the block with a different name (e.g. "block2")
5. Copy block2 to Clipboard
6. Open block1 in Blockeditor
7. Paste it over entities
8. Erase all entities in Blockeditor except "block2"
9. Close Blockeditor, now you have block2 in block1
10.Explode 'block1"
11. All done, you have a new block with no attributes (block2)
12. If you need to rename it to original name "block1", make a purge before
This is what I did to solve your issue... I inserted a block with an attribute ( that way you can run the command attsync). I invoked command "attsync" and selected your blocks, and all is well. I am re-attaching your dwg file for you with all attributes stripped from your blocks.
Not the easiest way.
For all:
Thats not a 2016 thing, it is how (stupid) attsync works in all versions (except the first versions where Attsync. Options Name, Value "*" NOT worked, for no blocks.
1. Attsync Option Name check as first if the blockdefintion have attributdefinition, if not -> no reason to attsync the blockreferences of this block (fail, bug, but usual for all the years, Adesk never fixed that)
2. Attsync Option Selection do not check the blockdefinition for attributdefinitions, so THIS IS YOUR SOLUTION!
If you want to attsync a block without attributdefinition, use ATTSYNC <selection>
Sebastian
I knowing that (and i know you too "..I inserted a block with an attribute ( that way you can run the command attsync)... ),
only TB_ACAD was a bit wrong half year ago with the description, but this was not the point in the story, the important point is the difference between both option and how they works.
Sebastian
@User_2011 wrote:
Can you please post the lisp?
I've found this, but it doesn't work, or I can't figure the command:
([color=BLUE]defun[/color] c:fixbadattblocks ( [color=BLUE]/[/color] bkc bln doc lst tmp )
...
Code fixed.
(vl-load-com) (defun c:FixBadAttBlocks ( / bkc bln doc lst tmp ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) bkc (vla-get-blocks doc)) (vlax-for blk bkc (if (= :vlax-false (vla-get-isxref blk)) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (= :vlax-true (vla-get-hasattributes obj)) (or (setq tmp (assoc (setq bln (vla-get-name obj)) lst)) (and (setq tmp (cons bln (gettags (vla-item bkc bln)))) (setq lst (cons tmp lst))))) (foreach att (vlax-invoke obj 'getattributes) (or (member (strcase (vla-get-tagstring att)) (cdr tmp)) (and (vlax-write-enabled-p att) (vla-delete att)))))))) (vla-regen doc acallviewports) (princ) ) (defun gettags ( def / rtn ) (vlax-for obj def (if (= "AcDbAttributeDefinition" (vla-get-objectname obj)) (setq rtn (cons (strcase (vla-get-tagstring obj)) rtn)))) rtn) (princ)
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2024 Autodesk Inc. All rights reserved
Type a product name