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

0 Members and 1 Guest are viewing this topic.

CHulse

  • Swamp Rat
  • Posts: 504
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
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Dlanor

  • Bull Frog
  • Posts: 263
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: 1398
  • 40 + years of using Autocad
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 »
A man who never made a mistake never made anything

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
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 »
A man who never made a mistake never made anything

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
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)
A man who never made a mistake never made anything

CHulse

  • Swamp Rat
  • Posts: 504
Thanks for the insight. This is just what I needed.
I also found Opie's blog quite helpful.
http://justopie.github.io/blog/2016/01/how-to-add-a-point-to-a-point-group-with-autolisp-wrap-up/

Thanks
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023