View Full Version : Create new entity group
2004-08-07, 09:38 AM
Hello all AUGI members;
I am wondering whether it is possible to create a new entity group in ACAD. For example, the POINT entity type is defined by the group codes 10,50,29 and 210. So is it possible to create another POINT entity type whereby it is defined by the group codes 10 and say a new group to define a point number. So this new POINT entity actually consists of only X,Y,Z coordinates and the point number.
If no new group code can be created, is it possible to edit and add any the existing POINT entity group code?
It's possible to create new entity definitions, but you need to write an extension to Autocad (like Land Dev Desktop or Architectural Desktop) that knows how to work with the new entity. I don't think you want to go that route...
Why can't you just use the standard Autocad points?
2004-08-09, 02:36 PM
The standard Autocad consist of entity type 50,29 and 210 which are of no use to me and I thought that by creating a new group with the x,y,z and point number, it will help me in plotting lines/polylines by just calling the point numbers rather than to search for the points itself.
2004-08-09, 04:05 PM
You could put all of your XYZ values with point numbers as data in a dictionay and then call the values from that.
2004-08-10, 07:38 AM
How about creating a block consisting of a POINT with an invisible attribute?
Or if you want a coded solution you could attach an index number to each point using XDATA. Here's a link to some useful info on XDATA:
2004-08-10, 08:56 AM
csgoh, this is the kind of task that extended data was invented for. So I'd go with David's suggestion without a doubt.
Of course, you could travel some really unorthodox paths. You mention some codes that are of no use to you. AutoCAD sees it another way because those codes mean alot to the software that handles the points. But - and this will probably make some shake their heads - some codes are more critical than others. For example, code 50 is used for orienting the visual point styles but if you couldn't care less how your points are shown (and only use the points for temporary purposes!) you can actually put a counter into it. Starting with e.g. 0.001 you can squeeze 6283 numbers into it (and only affect the display of point styles).
How about code 420? This can hold approx. 1.6 million values and only affect the color on screen. So again, if you couldn't care less how the points display, it could be a candidate for a quick solution :)
Ok, forget I ever said this .. go with David's solution
2004-08-10, 11:10 AM
I hope this helps. I think for your purposes lisp data is a quick solution.
; Set Point Data
(setq entSelection (car (entsel "\nSelect POint: "))
lstEntity (entget entSelection)
objSelection (vlax-ename->vla-object entSelection)
(vlax-ldata-put objSelection "PointData"
(list (cons "X" (cadr (assoc 10 lstEntity)))
(cons "Y" (caddr (assoc 10 lstEntity)))
(cons "Z" (cadddr (assoc 10 lstEntity)))
; Get point data
(vlax-ldata-get objSelection "PointData")
2004-08-10, 02:42 PM
Peter, I don't see how using LData addresses the original question.
To everyone reading this thread, be aware that LData is not compatible with VBA so if you plan to have your data available in the future, you may want to consider a true dictionary/xrecord structure.
Softdesk implemented points as a blocks before the addition of the AeccPoint entity in LDD. It works, if not as well as the AeccPoint entity.
2004-08-11, 10:37 AM
Thanks for all the suggestions. I don't have experience in Xdata but looking at the link that is provided David, it has given me some great info into learning how to write xdata.
2004-08-11, 07:37 PM
The original question included creating a new point object and adding a point name to the point.
Ldata is much easier to use than xdata. It is a simple valid solution to add information to an object like a point.
Here is simple Xdata solution to help keep our vba collegues happy ... :)
(of course my example uses entity methods for those collegues who prefer lisp.)
(defun C:ADDXDATA ( / ELST EXDATA STR)
(setq ELST (entget
(car (entsel "\nSelect graphical entity: "))
STR (getstring "\nEnter text: ")
(setq EXDATA (list -3 (list "MYDATA" (cons 1000 STR)))
ELST (append ELST (list EXDATA))
(princ "\nSelect that entity to retrieve the xdata: ")
(cdr (assoc -3 (entget (car (entsel)) '("MYDATA"))))
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.