Lips to add description to blocks in drawing

Lips to add description to blocks in drawing

Bart_Dheere
Advocate Advocate
6,455 Views
25 Replies
Message 1 of 26

Lips to add description to blocks in drawing

Bart_Dheere
Advocate
Advocate

Adding different descriptions to multiple multiple blocks in a drawing seems to be a challenge to cast in a lisp. Is there anyone who can support me in this?

0 Likes
Accepted solutions (1)
6,456 Views
25 Replies
Replies (25)
Message 2 of 26

pendean
Community Legend
Community Legend
descriptions to multiple blocks ? Please explain in more detail.
Message 3 of 26

Bart_Dheere
Advocate
Advocate
Some 300 blocks in a drawing are in a particular layer and all have their own block name and description.

These blocks are used when processing a measurement in Trimble Business Center.
After processing, the blocks lose the description property. To further process the measurement in Civil3d, these descriptions are essential.

Therefore, I would like to add these descriptions to these blocks in a smooth way. Lisp seems the most efficient way to do this.
0 Likes
Message 4 of 26

Kent1Cooper
Consultant
Consultant

Where are the descriptions coming from to add [add back?] to the Blocks?  Depending on the answer, maybe >this< will at least give you a start.

 

EDIT:  Oddly, I find that if I BEDIT a Block and change/add/delete content in the Description slot in Properties, that change is not recognized as a change if it's the only thing I did, and in Closing the Block Editor, it doesn't ask if I want to save changes, and the change doesn't stick.  If I do any other kind of editing change in addition, triggering the question on Closing, then it does stick.

Kent Cooper, AIA
Message 5 of 26

Bart_Dheere
Advocate
Advocate

Hi Kent, 

Thanks for replying!

In my search for a course of action, all options are open.
Through an excel file it would indeed be easy to do. However, skills are lacking in me to do this. Besides the day-to-day works, it is useful to use a lisp occasionally to make certain operations faster.

I thought via a lisp to add the descriptions.


For deepening programming and writing lisps I lack the time....

 

0 Likes
Message 6 of 26

komondormrex
Mentor
Mentor

what is exact description to a certain block before it gets lost?

Message 7 of 26

Bart_Dheere
Advocate
Advocate

At the time, the description was added manually by me in the Block Editor.

I attach an image of it.

0 Likes
Message 8 of 26

Kent1Cooper
Consultant
Consultant

@Bart_Dheere wrote:

.... Through an excel file it would indeed be easy to do. ....


And what would be the nature of the content of such a file?  Would it somehow pair up Block names with the Descriptions to be given to them?  Would it be built somehow by extraction from the Blocks before they are processed in a way that loses their Descriptions?

Kent Cooper, AIA
Message 9 of 26

pendean
Community Legend
Community Legend
@Bart_Dheere What you seek is not a feature of AutoCAD blocks. Are these features only found in the Trimble tools you use or some custom Civil3D AEC tools/objects by chance?
Message 10 of 26

Bart_Dheere
Advocate
Advocate
All blocks contained in the original dwg file logically have a block name. Descriptions were added to these block names to create a legend of the blocks and lines present in the drawing with a final lisp.

This legend cannot be created now because this description is lost during conversion by Trimble Business Center.

I am now looking for a way to add the descriptions back to the block each time after processing in TBC.

0 Likes
Message 11 of 26

komondormrex
Mentor
Mentor

so you need to save all descriptions before dwg is going to TBC and then restore them afterwards ? 

Message 12 of 26

Bart_Dheere
Advocate
Advocate

All descriptions disappear in TBC, so all work to add them initially was unnecessary. 😞
So I wish to add/modify them afterwards in Civil3d once the drawing is converted in TBC.

0 Likes
Message 13 of 26

Kent1Cooper
Consultant
Consultant

@pendean wrote:
.... What you seek is not a feature of AutoCAD blocks. ....

I'm not sure what you mean by that.  Descriptions certainly are.  You can give a Block a description when creating it:

 

Kent1Cooper_0-1679420293704.png

 

and if you use BEDIT to edit the definition, with the Block name selected, it shows the description:

 

Kent1Cooper_1-1679420742248.png

 

and inside BEDITing, it shows in the Properties palette:

 

Kent1Cooper_2-1679420781599.png

 

and you can get it from the Block table entry's entity data:

 

Command: (cdr (assoc 4 (entget (tblobjname "block" "test"))))
"This is my Description of this Block"

 

But I tried this to change it [with 'bdata' being the entity data from the Block table entry]:

 

Command: (entmod (subst '(4 . "whatever") (assoc 4 bdata) bdata))
nil

 

No dice, nor with the (append) approach.  And as I said before, changing it in Properties within BEDIT doesn't work if it's the only change I make.  I assume there must be a way, given a list or .csv file or something of Block names and the Descriptions that should go with them, but I haven't hit on it yet.  It may need something more complicated than it ought to be, such as in my first link above.

Kent Cooper, AIA
Message 14 of 26

komondormrex
Mentor
Mentor

it seems the lisp ain't fully supported in civil3d. how then you plan to add descriptions to your 300 blocks? 

Message 15 of 26

ВeekeeCZ
Consultant
Consultant

@Kent1Cooper wrote:
... And as I said before, changing it in Properties within BEDIT doesn't work if it's the only change I make.  ....

 

Don't have such an issue. Having C3D as ACAD 2022 and 2020. Both fain.

Message 16 of 26

Sea-Haven
Mentor
Mentor

Civ3d when importing data to say a point supports just that "Description" but its part of the cogo point Num,X,Y,Z,DESC. If it exists as a Description in the cogo point you can get at it then update your block attribute. 

 

Else you can export the description key sets out of CIV3D to excel so would start there making a 2 column answer Blockname and description. No Idea about your Trimble software always used CIV3D to import data from survey instruments.

Description key set

SeaHaven_0-1679454261352.png

 

Message 17 of 26

ronjonp
Mentor
Mentor

@Bart_Dheere 

 

Here's an example to set the description as the name of the block. It could be easily modified to retrieve the comment and the blockname then use that info to repopulate the information after it gets borked.

(defun c:foo nil
  ;; Adds block definition description as name of block
  (vlax-for b (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (if	(= 0 (vlax-get b 'isxref) (vlax-get b 'islayout))
      (vla-put-comments b (vla-get-name b))
    )
  )
  (princ)
)
Message 18 of 26

Sea-Haven
Mentor
Mentor

You need to make say a csv file Blockname,description then post a dwg with matching block names. Only need a few for testing.

Message 19 of 26

Bart_Dheere
Advocate
Advocate

@Sea-Haven 
I placed a few blocks without description in attached drawing. 
The csv is also attached. 

 

Many thanks!
Bart

 

0 Likes
Message 20 of 26

Bart_Dheere
Advocate
Advocate

@Sea-Haven 
I placed a few blocks without description in attached drawing. 
The csv is also attached. 

 

Many thanks!
Bart

0 Likes