What I wish to do is to assign a set of points a sequence of point numbers (or custom properties) of my choosing. For example, I have the following points:
100
102
104
105
107
I wish to assign point 100 -> 1000, 105 to 1001, 107 to 1002, 104 -> 1003, and 102 ->1004. Basically, I am looking for a command or utility that implements the "TCOUNT" (using select-order) command, but for Cogo points instead of text. The renumber points command appears to only work with offsets, and does not eliminate gaps. I can sequence the points if I select the points I want, then copy them -> set duplicate points to sequence from the range I choose, but this does not allow for reordering of point numbers. I tried individually selecting them in the order I wanted, but didn't change the order in which they were numbered.
Alternatively, I can leave the point numbers the same, and assign a user defined property that I can use to sequence the points in the order of my choosing. However, I'm not sure how to go about assigning the sequence I wish short of typing in each value individually; obviously non-ideal.
A third possibility that presented itself to me was to create new, correctly sequenced points that overlap exactly with the old ones, and then somehow merge the two sets together. Would there be a way to merge the old points and the new ones based on the fact that the two points have the same X-Y coordinates? Preferably done in CAD itself; the last resort would be to export both sets of points out to excel, then do some fancy manipulation in excel, then reimport into CAD.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
neilyj (No connection with Autodesk other than using the products in the real world)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
It works with 2015! Thanks Jeff!
There are a few questions/requests in regards to the command options:
Is there a way to renumber to a lower number?
eg. I have a group of points in the 7000s range and want them to be in the 1000s range.
Is there a way to do a window selection instead of going one by one or with a fence line?
I know that the order will probably be a bit random but it is not a real priority for point #1 to be next to point #2.
hmartinez5, This lisp was origianlly written for a specific task. It was then edited over the years by myself and Gavin to the point it is today. The reason for using point numbers as we do is to avoid any numbering conflicts. So it forces you to use a starting number larger than the current highest number. If you then want them to be renumbered from 7000+ to 1000+, just use the stock C3D Renumber points command after you've used this routine.
As for the windowing, that goes against what this command's intent is...that is to assign numbers in a specific order to points. It wouldn't be too difficult to write another lisp to select by window and renumber accordingly. I don't have time to write such a lisp at this point, perhaps someone else would like to?
(defun c:renumpoints (/ cntr cntrOut selectedPnts offset pnts newpnts) ;;Authored by: Noah Walters;; ;;Date: September 4th ;;
;;Version checking by others ;; ;;*************************;; (defun *error* (msg) (princ "Break!\nExiting...") (vla-endundomark c3ddoc) ) (vl-load-com) (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) ) C3D (vl-registry-read C3D "Release") C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1)) ) C3D (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D) ) ) (setq C3Ddoc (vla-get-activedocument C3D)) (vla-startundomark c3ddoc) ;;Point Setup;; ;;***********;; (setq pnts (vlax-get c3ddoc 'points) selectedpnts (vlax-invoke c3ddoc 'selectPoints) ) (initget 7) (setq cntrOut (getint "\nEnter Starting Number:\t") selectedPnts (vl-sort selectedpnts '<) cntr 0 offset 80000 ) ;;Renumber Pnts;; ;;*************;; (setq newpnts (mapcar '(lambda (x) (+ x offset) ) selectedPnts ) ) (foreach pnt selectedPnts (setq debug pnt) (vlax-put-property (vlax-invoke-method pnts 'find pnt) 'number (nth cntr newpnts) ) (setq cntr (+ cntr 1)) ) (setq cntr 0) (foreach pnt newpnts (setq debug pnt) (vlax-put-property (vlax-invoke-method pnts 'find pnt) 'number cntrOut ) (princ (strcat "\nPoint Number [" (itoa (- pnt offset)) "] Changed to [" (itoa cntrOut) "]" ) ) (setq cntrOut (+ cntrOut 1)) ) (vla-endundomark c3ddoc) (setq *error* nil) (princ) )
Will break if point numbers are already taken for points not in selection set. It could probably be a bit more robust but it's a start if you're just trying to blanket renumber a large group of points. Mind the offset for conflicts.
Here's another way to re-number(re-sequence) points:
Dave
Dave Stoll
Las Vegas, Nevada
Hi Jeff,
Any idea how to look up the vlr-string for 2016?
e.g. 2014
;;2014
((vl-string-search "\\R20.0\\" prod)
".10.4"
How does one find this?
Cheers
Allan
Allan, one way to find this info is usually in the Help:
http://help.autodesk.com/view/CIV3D/2016/ENU/?guid=GUID-6D41D043-4958-40B7-9C7E-45A6D780955B
However, since this routine was written, I was shown a far better way of getting the interface object that does not require editing the code with every release. I made this change in the version 7 of the lisp:
http://forums.autodesk.com/t5/autocad-civil-3d-general/renumbering-points/m-p/5248369#M257157
Thanks Jeff for the Reply,
the file I have to scale objects but not the z below:
(vl-load-com) (defun c:go() (getdoc) ;select points to scale (prompt "\nSelect points to scale: ") (setq ss (ssget)) (setq len (sslength ss) ctr 0) ;get basepoint (setq p1 (getpoint "\nPick BasePoint: ")) (setq sc (getreal "\nEnter Scale Factor: ")) (while (< ctr len) (setq curpt (ssname ss ctr)) (setq obtyp (cdr (assoc 0 (entget curpt)))) (if (= obtyp "AECC_COGO_POINT") (progn (setq vpt (vlax-ename->vla-object curpt)) (setq curz (vlax-get-property vpt 'Elevation)) (vl-cmdf "Scale" curpt "" p1 sc) (vlax-put-property vpt 'Elevation curz) );end progn );end if (setq ctr (1+ ctr)) );end while (vl-cmdf "REGEN") (princ) ) ;end GO (defun getdoc () (setq prod (vlax-product-key)) (setq aecappno (strcat "AeccXUiLand.AeccApplication" (cond ((vl-string-search "\\R17.0\\" prod) ".4.0" ) ;;2007 ((vl-string-search "\\R17.1\\" prod) ".5.0" ) ;;2008 ((vl-string-search "\\R17.2\\" prod) ".6.0" ) ;;2009 ((vl-string-search "\\R18.0\\" prod) ".7.0" ) ;;2010 ((vl-string-search "\\R18.1\\" prod) ".8.0" ) ;;2011 ((vl-string-search "\\R18.2\\" prod) ".9.0" ) ;;2012 ((vl-string-search "\\R19.0\\" prod) ".10.0" ) ;;2013 ((vl-string-search "\\R19.1\\" prod) ".10.3" ) ;;2014 ((vl-string-search "\\R20.0\\" prod) ".10.4" ) ;;2016 ((vl-string-search "\\R21.1\\" prod) ".10.5" ) ) ) ) (setq acadapp (vlax-get-acad-object) c3dapp (vla-getinterfaceobject acadapp aecappno) C3Ddoc (vla-get-activedocument C3Dapp) ) )
BUt I have no idea to add your new code. I dont expect you to anyway as you have done enough for me, I am just trying to find out the R version and I have only guessed to no avail!
I'll keep looking.
Thanks again.
Cheers
Allan
hi all
I have a point group, it contain point no. 1000 to 1500. When I am trying to use this lisp for changing the point number it is asking the next number. Eg: 1501 as start number. But I need to change 1000 as 1, 1001 as 2, and 1002 as 3 respectively… any help please…
ever since the civil 3d 2015 service pack 3 came out i am getting an error when running this
Select point to change to #820000: ; error: Civil 3D API: Unspecified error
Right, but within this thread there have been several different recipes to renumber points. Which technique are you using.
https://www.dropbox.com/s/4wvt95ndn4z4nbv/213103.B.Staking%20-%20Level%20L2%20-%20Standard.zip?dl=0
HERE IS THE DRAWING I AM USING
Can't find what you're looking for? Ask the community or share your knowledge.