Author Topic: COGO Point default description  (Read 8993 times)

0 Members and 1 Guest are viewing this topic.

CHulse

  • Swamp Rat
  • Posts: 504
COGO Point default description
« on: December 20, 2012, 12:26:42 PM »
Hi folks,
In the Create Points dialog, under the default settings - is there a way to set the default description value to automatically increment up as you add points (manually in my case)? I have a rough old survey showing tree locations (as simple circles) and I'd like to add cogo points to each having them number themselves in the description (ie "TREE ##").
Is this possible?
Thanks
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

BlackBox

  • King Gator
  • Posts: 3770
Re: COGO Point default description
« Reply #1 on: December 20, 2012, 12:47:31 PM »
You could always simply use a LISP routine to export the circle's center point to an auto-incrementing ASCII file, and import as COGO points... Then there's no need for manual COGO point specification.  :wink:
"How we think determines what we do, and what we do determines what we get."

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #2 on: December 20, 2012, 12:51:32 PM »
You could always simply use a LISP routine to export the circle's center point to an auto-incrementing ASCII file, and import as COGO points... Then there's no need for manual COGO point specification.  :wink:

I like that idea. Unfortunately, I need them in a specific order so I thought clicking each one in sequence would be easiest.
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

BlackBox

  • King Gator
  • Posts: 3770
Re: COGO Point default description
« Reply #3 on: December 20, 2012, 12:56:35 PM »
You could always simply use a LISP routine to export the circle's center point to an auto-incrementing ASCII file, and import as COGO points... Then there's no need for manual COGO point specification.  :wink:

I like that idea. Unfortunately, I need them in a specific order so I thought clicking each one in sequence would be easiest.

Fair enough.  :-)
"How we think determines what we do, and what we do determines what we get."

huiz

  • Swamp Rat
  • Posts: 919
  • Certified Prof C3D
Re: COGO Point default description
« Reply #4 on: December 20, 2012, 01:52:04 PM »
If you only want to see the point number next to TREE, you can edit the label style showing the Full Description and the Point Number in one label.
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #5 on: December 20, 2012, 02:56:46 PM »
If you only want to see the point number next to TREE, you can edit the label style showing the Full Description and the Point Number in one label.

That's what I ended up doing - just using the point number instead of the description. In this case, these were the only points I had, so I was able to have the point number match the tree number. What I wanted was to have the tree number auto increment in the description, so the point number could be different (as it might be if I had other objects as cogo points in the same dwg).
Thanks for the suggestions.
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: COGO Point default description
« Reply #6 on: December 20, 2012, 03:14:55 PM »
While not completely automated, this (or some facsimile thereof) might help for the next time. This little lisp will add a number to the end of point's raw description, so if you auto-add the points with a preset description of "Tree #", this will change that to "Tree #21". Selecting by window/crossing should select the points in the same order in which they were created, or you can select them one at a time and the number will be applied in that order. Fairly simple and basic:
Code: [Select]
(defun c:addtreenums (/ ss ctr idx ent pt desc)
  (vl-load-com)
  (if (and (setq ss (ssget '((0 . "AECC_COGO_POINT"))))
   (not (initget 7))
   (setq ctr (getint "\nStarting tree #: "))
   )
    (progn
      (setq idx -1)
      (while (setq ent (ssname ss (setq idx (1+ idx))))
(setq pt (vlax-ename->vla-object ent)
      desc (vlax-get pt 'rawdescription))
(vlax-put pt 'rawdescription (strcat desc (itoa ctr)))
(setq ctr (1+ ctr))
)
      )
    )
  (princ)
  )

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #7 on: December 21, 2012, 08:21:54 AM »
That looks awesome! I will have to try that next time. That would be much easier than what I have been doing.
Thanks and Merry Christmas  :kewl:
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #8 on: January 02, 2013, 10:52:00 AM »
Jeff,
This works wonderfully. Thank you!

One question though is the selection order - if I select them one by one in order, it works correctly, but using a window, it doesn't get the order correct. Any thoughts?
This is still a vast improvement, even if I need to select them one at a time... Thanks again
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: COGO Point default description
« Reply #9 on: January 02, 2013, 11:24:12 AM »
Sorry about that, Cary. I should've tested it for the window/crossing scenario. At one time, I'm pretty sure, the ssget added objects to the selection set in the order in which they were created. Looks like it now adds them in order, but by newest first. I'm not sure of a good, if any, way to remedy this. I'll have a look around and see what I can come up with.

Otherwise, I'm glad you can still make use of it.

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #10 on: January 02, 2013, 11:55:00 AM »
Sorry about that, Cary. I should've tested it for the window/crossing scenario. At one time, I'm pretty sure, the ssget added objects to the selection set in the order in which they were created. Looks like it now adds them in order, but by newest first. I'm not sure of a good, if any, way to remedy this. I'll have a look around and see what I can come up with.

Otherwise, I'm glad you can still make use of it.

Very useful, thanks again!
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #11 on: January 02, 2013, 12:13:54 PM »
If it adds them by newest to oldest, perhaps the SS could be reversed?
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: COGO Point default description
« Reply #12 on: January 02, 2013, 12:19:23 PM »
Yes, Cary, it could. Except....since the selection can be made one at a time it must be assumed that those individual selections are in the order the user wants the numbering to be done. SO the trick is to only reverse the part of the SS when the user used a window/crossing to make the selection(s). I posted a query regarding this in the lisp forum. It's been too long since I've done any in depth lisp coding for me to be able to just bang something out...hopefully someone there will have a quick solution.

CHulse

  • Swamp Rat
  • Posts: 504
Re: COGO Point default description
« Reply #13 on: January 02, 2013, 12:34:49 PM »
Good point. Thanks for following up.
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: COGO Point default description
« Reply #14 on: January 02, 2013, 01:51:24 PM »
Here's a revised version that seems to work pretty well. You can select individual points, or multiple window/crossing selections....each window/crossing will be sorted within itself only, so if you select, by window, points 5-9, then select, by window, points 1-4, and use a staring number for the trees of 21, then pt 5 will be 21 and pt 1 will be tree 26. Make sense?
Code: [Select]
(defun c:addtreenums (/ ss ctr idx ent pt desc)
  (vl-load-com)
  (defun getss_by_order (ss / idx newss ent poly enames)
    (setq idx -1
  newss (ssadd)
    )
    (while (setq ent (ssnamex ss (setq idx (1+ idx))))
      (if (or (= (caar ent) 2)
      (= (caar ent) 3)
  )
(progn
  (if (not poly)
    (progn
      (setq poly (cadr ent))
      (setq enames (list (cadar ent)))
    )
;else
    (if (equal poly (cadr (ssnamex ss (1+ idx))))
      (setq enames (append enames (list (cadar ent))))
      ;;else add the items to the newss
      (progn
(setq enames (append enames (list (cadar ent))))
(foreach e (reverse enames)
  (ssadd e newss)
)
(setq poly nil
      enames nil
)
      )
    )
  )
)
;else
(ssadd (cadar ent) newss)
      )

    )
    newss
  )
  (if (and (setq ss (ssget '((0 . "AECC_COGO_POINT"))))
   (not (initget 7))
   (setq ctr (getint "\nStarting tree #: "))
      )
    (progn
      (setq doc (vla-get-activedocument (vlax-get-acad-object)))
      (vla-startundomark doc)
      (setq ss (getss_by_order ss))
      (setq idx -1)
      (while (setq ent (ssname ss (setq idx (1+ idx))))
(setq pt   (vlax-ename->vla-object ent)
      desc (vlax-get pt 'rawdescription)
)
(vlax-put pt 'rawdescription (strcat desc (itoa ctr)))
(setq ctr (1+ ctr))
      )
      (vla-endundomark doc)
    )
  )
  (princ)
)