### Author Topic: Select COGO Points for point group by selecting closed polyline containing point  (Read 1566 times)

0 Members and 1 Guest are viewing this topic.

#### CHulse

• Bull Frog
• Posts: 457
##### Select COGO Points for point group by selecting closed polyline containing point
« on: November 01, 2019, 10:29:28 AM »
Good morning folks,
First let me say I apologize for the duplicate post. I posed this question in the Land Lubber forum a bit ago (https://www.theswamp.org/index.php?topic=55517.0) but it seems there is no out of the box way to do this in C3D, so I'm posting it again here in hopes that one of you gurus may have some clues to a solution.

Does anyone know a way to select all the cogo points inside a given closed polyline when creating a point group in Civil 3D?

Appreciate any direction y'all might be able to give here.

Thanks
Cary Hulse
Sr. Urban Forester
Wetland Studies and Solutions

Civil 3D 2020

#### Dlanor

• Bull Frog
• Posts: 263
##### Re: Select COGO Points for point group by selecting closed polyline containing point
« Reply #1 on: November 01, 2019, 02:09:06 PM »
Code - Auto/Visual Lisp: [Select]
1. (setq plist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car (entsel)))))) ;;Select Polyline
2. (setq ss (ssget "_CP" plist '((0 . "POINT"))))
3.

This will get all "points" inside a simple, no curved segment, lwpolyline. I don't work in Civil3D so have no idea what the type for a COGO Point is, but you can obtain it by running

Code - Auto/Visual Lisp: [Select]
1. (cdr (assoc 0 (entget (car (entsel)))))

and substituting that for "POINT" in the (ssget) statement.
« Last Edit: November 01, 2019, 02:15:15 PM by Dlanor »

#### BIGAL

• Swamp Rat
• Posts: 665
• 30 + years of using Autocad
##### Re: Select COGO Points for point group by selecting closed polyline containing point
« Reply #2 on: November 04, 2019, 12:43:35 AM »
Cogo points are

Code: [Select]
`;   ObjectName (RO) = "AeccDbCogoPoint" (0 . "AECC_COGO_POINT")(setq ss (ssget (list (cons 0 "AECC_COGO_POINT"))))(sslength ss)(setq plist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car (entsel)))))) ;;Select Polyline(setq ss (ssget "_CP" plist '((0 . "AECC_COGO_POINT"))))`
Point groups are based on a known fact and a polygon is not one of them, but you could then get the cogopoint numbers display it copy it and paste into the "Include"  if it will let you. Yep it did. 1,3,5,6,7,23,34,35, etc its a string of the selection ptnumbers separated by a , If you want shorthand version 1-3,45-56 etc way harder.

you can just make a pline on the fly does not have to exist it would be a choice.

Code: [Select]
`(defun c:ptspl ( / ss obj num ans)(setq plist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car (entsel)))))) ;;Select Polyline(setq ss (ssget "_CP" plist '((0 . "AECC_COGO_POINT"))))(setq ans "")(repeat (-(setq x (sslength ss)) 1)(setq obj (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))))(setq num (rtos (vlax-get Obj 'Number) 2 0))(setq ans (strcat ans num ",")))(setq obj (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))))(setq num (rtos (vlax-get Obj 'Number) 2 0))(setq ans (strcat ans num )))(c:ptspl)`
If nothing appears type !ans

Also have, rotate civ3d point, change description, label Z,  import new description key set.
« Last Edit: November 04, 2019, 01:09:16 AM by BIGAL »

#### BIGAL

• Swamp Rat
• Posts: 665
• 30 + years of using Autocad
##### Re: Select COGO Points for point group by selecting closed polyline containing point
« Reply #3 on: November 04, 2019, 08:17:03 PM »
Forgot to mention getting into CIV3d points can be done by program but is not straight forward. Will have a look though. The way CIV3d database works is complicated.
;   Name = "Group1"
;   PointCount (RO) = 5
;   PointLabelStyle = #<VLA-OBJECT IAeccLabelStyle 0000028229aa9d40>
;   Points (RO) = (1 2 3 4 5)

Found an answer watch this space.
« Last Edit: November 05, 2019, 12:01:53 AM by BIGAL »

#### BIGAL

• Swamp Rat
• Posts: 665
• 30 + years of using Autocad
##### Re: Select COGO Points for point group by selecting closed polyline containing point
« Reply #4 on: November 05, 2019, 12:30:41 AM »
Try this, the second lisp attached has all the civ3d stuff in it, save file into a search path or edit code to load correct.

Code: [Select]
`; add cogo pts inside plines to points group; By alan H Nov 2019; helped by ;Source code Just notes from opie;http://justopie.github.io/blog/2016/01/how-to-add-a-point-group-with-autolisp/(defun c:ptspl ( / ss obj num ans)(if (not OP:c3ddoc)(Load "add civ3d points to group.lsp")) ; change path if required(while (setq plent (car (entsel "pick pline Enter to exit")))(setq plist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))) ;;Select Polyline(setq ss (ssget "_CP" plist '((0 . "AECC_COGO_POINT"))))(setq gname (getstring "Enter point group name"))(if (= (setq newgroup (getpointgroup gname)) nil)(setq newgroup (AddPointGroup gname))(princ "group Exists"))(repeat (setq x (sslength ss))(setq obj (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))))(setq num (vlax-get Obj 'Number))(if (= (ContainsPoint newgroup num) nil)(AddPointToGroup num newgroup)))))(c:ptspl)`

#### CHulse

• Bull Frog
• Posts: 457
##### Re: Select COGO Points for point group by selecting closed polyline containing point
« Reply #5 on: November 05, 2019, 10:17:40 AM »
Thanks for the insight. This is just what I needed.
I also found Opie's blog quite helpful.