Jump to content

Hide attributes in a particular block without using ATTDISP?


YZ

Recommended Posts

I thought ATTDISP solved my issue, but then I discovered some blocks we use that need ATDISP to be on.

 

So I am asking the forum.

 

We use surveying software to export dwg as a starting point for our models.

 

Last month with their new version it changed the way it exported blocks. Now the blocks have visible attributes, but the attribute text is at 0,0 and nowhere near the block geometry.

 

It did not used to do this, but the attribute information was in there. I still need the information in, but I'd prefer it hidden.

 

Any ideas how I can do this?

 

I tried BATTMAN, but it won't list these blocks as an option, and if I try selecting on with that tool it says "this block does not contain attributes".

 

Weird.

 

A sample block is attached. Thanks!

New Software Export Format.dwg

Link to comment
Share on other sites

Wierd, the attribute doesn't show up in Block Editor, If you double click on the block and go to the properties tab of the Enhanced Attribute Editor you can change the layer of the "attribute", if you create a new layer for these attributes, you can then freeze the layer, they won't be visible, but will still show the values when selected. I just don't know if this will be a usable solution as you probably have more than a few blocks.

 

 

EDIT @RobDraw

You missed the point:) (there is a point in there as well), but indeed the actuall block definition has no attributes

Link to comment
Share on other sites

Interesting pretty sure I know what produced this dwg,

 

; try these 2 lines on the cross and height is revealed
(setq ss1 (ssget))
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes)(princ (vla-get-textstring att)))

 

Some more info for Steven-g as no lisp

 

This is the block att details, note the insertion pt for the attribute text.

 

(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes) (vlax-Dump-Object att) )

; IAcadAttributeReference: AutoCAD Attribute Reference Interface
; Property values:
;   Alignment = 0
;   Application (RO) = #<VLA-OBJECT IAcadApplication 000000013f8f3f10>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "909317E"
;   HasExtensionDictionary (RO) = -1
;   Height = 0.02
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000005eaec2c8>
;   InsertionPoint = (-1.13687e-013 1.13687e-013 18.4561)

Maybe use vla-put-insertionpoint to 0,0,0 on the "block definition" and attsync to realign all of them. A further ??? note the attribute text has a Z value implied of 18.456 why ?

Edited by BIGAL
Link to comment
Share on other sites

This may be the answer http://www.cadtutor.net/forum/showthread.php?97861-Replace-block-but-keeping-old-attributes

 

In a new dwg I made a new block "YZ" 2 lines same as POINT_CROSS plus a single attribute = POINT_HEIGHT at 0,0 placed the attribute slightly of 0,0 etc copy and pasted to 0,0 in problem dwg. Used the code in the link change "master" to "YZ" run attsync and all should be good. You should be able to delete point_cross then rename YZ back to Point_cross.

 

Send all the details about the incorrect stuff in the block to the software guys, they need to fix it. If I am right their in Sydney I use to work for them.

Edited by BIGAL
Link to comment
Share on other sites

Found it. Run ATTSYNC.

 

Thanks Rob. When I try ATTSYNC I just get this message, "The selected block has no attributes.".

 

The third party software seems to create an attribute-ish object that does not behave, or get recognised as an attribute.

Link to comment
Share on other sites

Wierd, the attribute doesn't show up in Block Editor, If you double click on the block and go to the properties tab of the Enhanced Attribute Editor you can change the layer of the "attribute", if you create a new layer for these attributes, you can then freeze the layer, they won't be visible, but will still show the values when selected. I just don't know if this will be a usable solution as you probably have more than a few blocks.

 

Thanks Steven, I don't have too many blocks, perhaps 30-40. I am happy to alter them all. Putting it in a frozen layer does seem to work (though it still zooms to it when zooming extents, which is frustrating).

 

I am now testing whether I can do this once in our template title block, or if it must be done each new time the software exports. Will let you know.

Link to comment
Share on other sites

The "Enhanced Attribute Editor" method only works on the individual instance of blocks that are manually changed in the Properties tab. Not my solution because I was really hoping for a global fix.

Link to comment
Share on other sites

This may be the answer http://www.cadtutor.net/forum/showthread.php?97861-Replace-block-but-keeping-old-attributes

 

In a new dwg I made a new block "YZ" 2 lines same as POINT_CROSS plus a single attribute = POINT_HEIGHT at 0,0 placed the attribute slightly of 0,0 etc copy and pasted to 0,0 in problem dwg. Used the code in the link change "master" to "YZ" run attsync and all should be good. You should be able to delete point_cross then rename YZ back to Point_cross.

 

Send all the details about the incorrect stuff in the block to the software guys, they need to fix it. If I am right their in Sydney I use to work for them.

 

Thanks so much for your response Bigal. You are correct, the software I am using is Magnet (formerly CivilCAD). Though I think the development happens in the US now.

 

Your solution looks good, but I have to admit I get a bit lost before the end. For me what you are writing is very advanced, though for you I'll be it is easy.

 

Do you think I could use that code to redefine all the blocks in my template once and then the template will override all the other settings?

Link to comment
Share on other sites

It seems that I can workaround it with this hack:

1. if I recreate the blocks in AutoCAD to have attributes,

2. and then set those to be "Invisible"

 

It does not allow me to force the attributes in to a different layer and control if by freezing. But it does allow to control visibility within the attribute property of the block definition.

 

Frustratingly I will have to rebuild all my blocks.

 

Does anyone know if it is possible to add attributes to a block retrospectively? I'd rather not have to rebuild all my dynamic block symbols!

Link to comment
Share on other sites

I will try to explain slower

 

In a new dwg I made a new block "YZ" 2 lines same as POINT_CROSS plus a single attribute = POINT_HEIGHT at 0,0 placed the attribute slightly of 0,0 etc copy and pasted to 0,0 in problem dwg. Used the code in the link change "master" to "YZ" run attsync and all should be good. You should be able to delete point_cross then rename YZ back to Point_cross.

 

Look at the point cross block measure the length of the two lines appears to be .135 as block is at 0.3 scale

In a new drawing, draw the two lines with the centre of the lines at 0,0 0.135 units long

BLOCK select the two lines block editor should open

Add a attribute POINT_HEIGHT with insert point a 0,0 and text set to Left centre say 0.25 high

Save block as YZ

 

Go and get the lisp in the link above and save to notepad change "master" to "YZ" in the code

Save the lisp as say BLockchange.lsp

 

Copy block into your survey drawing

(load "Blockchange")

Type Attsync all should be fixed now.

You can create a macro etc to make it simpler.

 

Side comment we use Civilcad, export out save in our Civ3d DWT and run a clean up routine that sets some layers and linetype removing the SHX requirement "No Solid Linetype" as a priority.

 

Again send an email to the Magnet guys as something is not right. Copy the dump above that shows the extreme difference in the attribute co-ords 1.02e-13 v's survey co-ords and has a height of 18.456 which should be 0.0

Link to comment
Share on other sites

Please send me a magnet export file I would like to see what they produce as I said we clean them up removing problems like this.

 

It is possible to redo the block and fix the erronous data.

Link to comment
Share on other sites

Thanks Rob. When I try ATTSYNC I just get this message, "The selected block has no attributes.".

 

The third party software seems to create an attribute-ish object that does not behave, or get recognised as an attribute.

 

It worked for me.

Link to comment
Share on other sites

It worked for me.

 

Thanks for persisting. And you're definitely trying the ATTSYNC command on the dwg I uploaded?

 

It does not work for me, just says:

Command: ATTSYNC

Enter an option [?/Name/Select] <Select>: s

Select a block:
The selected block has no attributes.
Select a block:
The selected block has no attributes.

Link to comment
Share on other sites

Please send me a magnet export file I would like to see what they produce as I said we clean them up removing problems like this.

 

It is possible to redo the block and fix the erronous data.

 

16-005A.dwg

 

This is an export file. Many things we fix with macros, but they need user input. I am rebuilding them in to LISP atm, so that they can be even more automated.

 

But for this thread, I'm mainly interested in the visible attributes, and making them invisible. I am confident that the best move is to redefine all my blocks with invisible attributes.

 

Google gets muddled with something like this. I'm trying to search "autocad add attributes to block retrospectively" but drawing a blank. Does anyone know if it is possible?

Link to comment
Share on other sites

Thanks for persisting. And you're definitely trying the ATTSYNC command on the dwg I uploaded?

 

It does not work for me, just says:

Command: ATTSYNC

Enter an option [?/Name/Select] <Select>: s

Select a block:
The selected block has no attributes.
Select a block:
The selected block has no attributes.

 

I can't get it to work again, sorry.

Link to comment
Share on other sites

Here is a fix for the block problem I would look at it as part of a bigger clean up routine.

 

(defun ccadx ( / ss x inspt att) 
(setq ss (ssget "x"  (list (cons 0 "INSERT") (cons 2 "CCAD_SYMBOL_*"))))
;  (setq ss (ssget "x"  (list (cons 0 "INSERT") (cons 2 "CCAD_SYMBOL_POINT_CROSS"))))
(repeat (setq x (sslength ss))
(setq blk (vlax-ename->vla-object (ssname SS (setq x (- x 1)))))
(setq inspt2 (vlax-safearray->list (vlax-variant-value (vla-get-insertionpoint blk))))

(setq inspt (vlax-3d-point (list (car inspt2) (cadr inspt2) 0.0)))
(foreach att (vlax-invoke blk 'getattributes)
(vla-put-InsertionPoint att inspt)
;(vla-put-TextAlignmentPoint att inspt)
) ; foreach

) ; repeat

) ;defun
(ccadx)

Link to comment
Share on other sites

Re Solid linetypes try to remove link back to the Magnet SHX file.

 

(defun remsolid ( / doc)
(setq  doc (vla-get-activedocument (vlax-get-acad-object))) ; open database
(setq layer (vla-get-layers doc))
(vlax-for each layer
 (setq ltype (vla-get-linetype each))

 (If (or (= Ltype  "solid" )(= ltype "SOLID"))
   (vla-put-linetype each "Continuous")
 )

 (If (= Ltype  "dash" )
   (vla-put-linetype each "DASHED")
 )

 (If (= Ltype  "903" )
   (vla-put-linetype each "FENCE")
 )

 (If (= Ltype  "VEGETATION" )
   (vla-put-linetype each "TREE")
 )
) ; end for

(Alert "Layer line types changed")

; converts civilcad blocks to bylayer proerties 
* (vlax-for block allblocks 
* (if* *(not (wcmatch (strcase (vla-get-name block) t) "*_space*")) 
* (vlax-for* *ent block 
* *(vla-put-color ent 0) 
* *(vla-put-linetype ent "Bylayer") 
* *(vla-put-lineweight ent aclnwtbyblock) 
* *) ;_ end of vlax-for 
* * * ) ;_ end of if 
* * ) ;_ end of vlax-for 
* (vla-regen doc acactiveviewport) 

(Alert "Solid line in blocks removed")
)
(remsolid)

Edited by BIGAL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...