Deleted block attributes still visible (even after “attsync”)

Deleted block attributes still visible (even after “attsync”)

Anonymous
Not applicable
9,016 Views
19 Replies
Message 1 of 20

Deleted block attributes still visible (even after “attsync”)

Anonymous
Not applicable

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.

Accepted solutions (2)
9,017 Views
19 Replies
Replies (19)
Message 2 of 20

Anonymous
Not applicable

Hi,

 

Using the BURST command shows the attributes.

Delete the attributes and create the block again.

 

Thanks

0 Likes
Message 3 of 20

imadHabash
Consultant
Consultant

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

EESignature

0 Likes
Message 4 of 20

Anonymous
Not applicable

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.

0 Likes
Message 5 of 20

Anonymous
Not applicable

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?

 

0 Likes
Message 6 of 20

Anonymous
Not applicable

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

 

 

0 Likes
Message 7 of 20

Anonymous
Not applicable

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.

0 Likes
Message 8 of 20

smr
Contributor
Contributor

Hi

i found if you

  • insert an new attribute into the block
  • then copy it to a new drawing
    • Select all (ctrl A)
    • copy @0,0
    • paste into new drawing @0,0
  • then open block editor in new drawing and delete attribute, close block editor
  • then attsync

there must be some error with the original drawing file

 

0 Likes
Message 9 of 20

Anonymous
Not applicable

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 block2018-04-16 14_52_55-Autodesk AutoCAD 2016 - [Drawing5.dwg].png


4) Delete all attributes with Block Editor.

5)  Type ATTSYNC -> N(ame) -> *.

 

-> Attribute is still visible in model

2018-04-16 14_58_54-Autodesk AutoCAD 2016 - [Drawing5.dwg].png

 

But if you reopen block in Bloc Editor attribute is deleted.

2018-04-16 15_01_23-Autodesk AutoCAD 2016 - [Drawing5.dwg].png


If I INSERT this bloc in my drawing, I have a bloc with attribute and another without attribute.

2018-04-16 15_04_31-Autodesk AutoCAD 2016 - [Drawing5.dwg].png

 

It should not be possible.

Message 10 of 20

Anonymous
Not applicable
Accepted solution

I found a lisp called "fixbadattblocks" that fixed my drawing.

Message 11 of 20

User_2011
Advocate
Advocate

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])

0 Likes
Message 12 of 20

User_2011
Advocate
Advocate

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

0 Likes
Message 13 of 20

s.borello
Advisor
Advisor
Accepted solution

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. 

Message 14 of 20

s.borello
Advisor
Advisor

Not the easiest way. 

0 Likes
Message 15 of 20

cadffm
Consultant
Consultant

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

0 Likes
Message 16 of 20

s.borello
Advisor
Advisor
That will not work unless you have at least 1 block with attributes in the drawing.
0 Likes
Message 17 of 20

cadffm
Consultant
Consultant

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

0 Likes
Message 18 of 20

ВeekeeCZ
Consultant
Consultant

@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)
Message 19 of 20

jforrest472AD
Explorer
Explorer

Since I haven't seen the answer... After removing the attributes in the block editor and saving. Use the command BATTMAN and sync the block. It will update, removing the attributes.

0 Likes
Message 20 of 20

rjDGLM4
Explorer
Explorer

Thank you so much. Nothing else was working. 

0 Likes