Jump to content

Recommended Posts


Hi all, new here!

I need some help creating and displaying unique IDs for all of my block references in a drawing.

I'm self-taught CAD and self taught Filemaker and now I'm trying to figure out how to get the two to work together (I think I can, I think I can).

My database is tracking trees and the CAD drawing locates those trees but I need a unique ID that can help translate information between formats. I have set up blocks with attributes and successfully extracted data into filemaker but I can't figure out how to get CAD to create and display a unique ID for each block reference.

I can extract the "handles" of the references but I can't display those on the drawing.


Any thoughts?

Share this post

Link to post
Share on other sites
Patrick Hughes

No two trees will occupy the same space. Perhaps incorporate the coordinates into an ID? 25x34, 42x51 etc...

Share this post

Link to post
Share on other sites

Thanks, Patrick.

That was one of my initial thoughts but I guess I was keeping my hopes up that there was something else out there. It doesn't make sense to me for AutoCAD to assign handles to my objects and allow me to extract them as data but no allow me to display them on the actual drawing.

I think the xy coordinate could work as an ID, I'll just have to bring my drawing up to actual size so that the points are farther apart and I don't have to include multiple decimal places to differentiate.

I'm still open to other ideas if anyone out there has them!

Share this post

Link to post
Share on other sites

I use this lsp to search for and display handles within the drawing. Perhaps it can be adjusted to pull the handle from the block, and insert it into an attribute.


;BY PRODUCT OF HN.This looks for existing handle name in a dwg. 
;If handle name exists, it create a layer called
;TEMP-HN,prints handle name, draw a circle around it & zoom in
;to magnify object. Previous settings(System variables layer,textstyle
; textsize) are restored after routine.  
(defun c:hn ()
(setq gl  (getvar "clayer"))
(setq gt  (getvar "textstyle"))
(setq gs  (getvar "textsize"))
(setq wn  (getstring "\nEnter Handle Name:"))
(setq hn  (handent wn))
(IF (=  HN NIL) 
(setq e1  (entget hn))
(setq ip  (cdr (assoc 10 e1)))
(command "layer" "m" "TEMP-HN" "c" "3" "" "")
(command "circle" ip "d" "6.0")
(command  "Style" "STANDARD"  "S0"  "1" "1" "0" "N" "N")
(command "text"  ip  "0" wn )
(command "._SETVAR" "clayer" gl)
(command "._SETVAR" "textstyle" gt)
(command "._SETVAR" "textsize" gs)
(setq zw1  (list  (- (car ip)  8.0)  (+ (cadr ip)  8.0)  )  )
(setq zw2  (list  (+ (car ip)  8.0)  (- (cadr ip)  8.0)    )  )
(command "zoom" "window" zw1 zw2 )

Share this post

Link to post
Share on other sites

Hmm... food for thought DNK. The problem is that your code only displays the handles temporarily (as I understand it from my very very limited understanding of code). What I'm looking for is something that displays permanently with the object, like a visible attribute, so that when I plot the drawing, the handle info will be part of it. I'm starting to think that Patrick's solution is really going to be the best one and I just have to adapt my drawing to make it work correctly.


Share this post

Link to post
Share on other sites

Well, it's a temporary as the text it creates at the handle's position. But with some manipulation by those above my pay grade, I thought it would be possible to put it into an attribute in the block.


Alas, if you're going with the x,y position, using a field would be your best bet. When you build (or modify) the block, perhaps I could suggest you insert a node at the insertion point of the block, then define the default value of your visible attribute as a field, using Objects as the Field category, Object as the Field name, select the node as the Object type, then set the property as position. You can then define the format as you need. Using 2010LT, you must regen to update the fields if they change.

Share this post

Link to post
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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...