Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Renumbering Points

82 REPLIES 82
SOLVED
Reply
Message 1 of 83
kevinsbane
12212 Views, 82 Replies

Renumbering Points

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.

82 REPLIES 82
Message 41 of 83
neilyj666
in reply to: Am_enk

Did you use the version 7 of the lisp - it works correctly in my 2014 both with and without points in the dwg

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.

EESignature


AEC Collection 2024 UKIE (mainly Civil 3D UKIE and IW)
Win 11 Pro x64, 1Tb Primary SSD, 1Tb Secondary SSD
64Gb RAM Intel(R) Xeon(R) W-11855M CPU @ 3.2GHz
NVIDIA RTX A5000 16Gb, Dual 27" Monitor, Dell Inspiron 7760
Message 42 of 83
hmartinez5
in reply to: neilyj666

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.

Message 43 of 83
Jeff_M
in reply to: hmartinez5

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?

Jeff_M, also a frequent Swamper
EESignature
Message 44 of 83
ngwalters
in reply to: kevinsbane

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

Message 45 of 83
hmartinez5
in reply to: ngwalters

Works Great!

Message 46 of 83
allanbsteven
in reply to: hmartinez5

I like it!

Many thanks.

 

Message 47 of 83
Pointdump
in reply to: hmartinez5

Here's another way to re-number(re-sequence) points:

 

HolyGrail2.png

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2024
Message 48 of 83
allanbsteven
in reply to: Jeff_M

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

Message 49 of 83
Jeff_M
in reply to: allanbsteven

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

 

Jeff_M, also a frequent Swamper
EESignature
Message 50 of 83
allanbsteven
in reply to: Jeff_M

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

Message 51 of 83
dilsmails1
in reply to: kevinsbane

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…

Dileep
Message 52 of 83
troma
in reply to: dilsmails1

Do it the normal way.
Don't use the lisp.

Mark Green

Working on Civil 3D in Canada

Message 53 of 83
dilsmails1
in reply to: troma

good idea thanks
Dileep
Message 54 of 83
htls69
in reply to: Jeff_M

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

 

Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 55 of 83
ngwalters
in reply to: htls69

Allen,

 

Which "this" are you running? The built-in renumbering points, mine, the previous one...

Message 56 of 83
htls69
in reply to: ngwalters

I am running civil 3d 2015 service pack 3
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 57 of 83
ngwalters
in reply to: htls69

Right, but within this thread there have been several different recipes to renumber points. Which technique are you using. 

Message 58 of 83
htls69
in reply to: ngwalters

The reordernumbers v7
Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.
Message 59 of 83
Jeff_M
in reply to: htls69

Allen, I'm not seeing any issue with this in C3D2015, SP3. If you could provide the drawing and the steps you take to get the error, I can try to reproduce it.
Jeff_M, also a frequent Swamper
EESignature
Message 60 of 83
htls69
in reply to: Jeff_M

https://www.dropbox.com/s/4wvt95ndn4z4nbv/213103.B.Staking%20-%20Level%20L2%20-%20Standard.zip?dl=0

 

HERE IS THE DRAWING I AM USING

Allen Robberson
Credit where credit is due! Give kudos or accept as solution whenever you can.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report