Jump to content

Zoom to Cogo Point


Ixoye

Recommended Posts

I am working with C3D 2014 and want to find a Lisp code to help me sort through multiple Cogo Points. I know about the ZTP command but I have many point to go through, so that would be slow.

After importing survey points I would like to be able to go to each individual Cogo Point (to see, add, or change information) then, when done, I would be able to go to the next point and continue through to the end of the list

I assume that I would first have to create a list of the points. Then have it zoom to the first point in the list. At this time would I have to leave the routine, complete the command, and then re-inter the routine and have it go to the next point? If someone could g help me, I sure need all the help I can get.

Link to comment
Share on other sites

You're going to have to access the AeccXUiLand.AeccApplication.* External Object, and iterate the aforementioned Object's ActiveDocument.Database.Points Collection to obtain a list of the desired coordinates to zoom to, and store them to a global variable. With that complete, you can 'zoom to' the next in line, storing the current to compare against on your next 'zoom to' call. Don't forget to incorporate an option to 'reset' your stored list, and current in the event of COGO points being added/deleted.

 

You *should* be able to cull what you need from this post. :thumbsup:

 

Cheers

Link to comment
Share on other sites

Like black box I have played with the CIV3d points database but perhaps a simpler way run a lisp check for ptlist if nil create the list of pt numbers then get first save this as a temp variable remove from list then use the ZTP command do what you want, re run lisp as the list now exists -1 it will go to the next pt and so on. Will check back later and try to do something if know one provides an answer first.

Link to comment
Share on other sites

Try this

 

(defun C:zp ()
(vl-load-com)
(if (= lst nil)
 (progn
   (while (setq pt (getint "\enter pt num <Cr. to exit : "))
   (setq lst (cons pt lst))
   )
 (setq lst (reverse lst))
 )
)
(setq pt (nth 0 lst))
(setq lst (vl-remove (nth 0 Lst) Lst))
(if (= 0 (length lst))(setq lst nil))
(command "ZTP" Pt)

)

Edited by BIGAL
setq lst vers 2.0
Link to comment
Share on other sites

  • 3 weeks later...

I have run the routine you have given and I had entered the points, and it worked. But when I ran it again it replies with "nil". I entered the code line-by-line individually without success.

Link to comment
Share on other sites

This seems to be working... I'd like to add some functionality, but this is all I have time for at the moment:

 

(vl-load-com)

(defun c:ZoomToNextPoint (/ *error* acDoc cogo i cmdecho)

 (defun *error* (msg)
   (and cmdecho (setvar 'cmdecho cmdecho))
   (if acDoc
     (vla-endundomark acDoc)
   )
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
   )
   (princ)
 )

 (if (ssget "_x" '((0 . "AECC_COGO_POINT")))
   (progn
     (vla-startundomark
       (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
     )
     (vlax-for x (vla-get-activeselectionset acDoc)
       (setq cogo (cons (vlax-get x 'number) cogo))
     )
     (setq *PreviousCogoPoint* *LastCogoPoint*)
     (setq *LastCogoPoint*
            (if (and *LastCogoPoint*
                     (setq i (vl-position *LastCogoPoint* cogo))
                     (setq i (nth (1+ i) cogo))
                )
              i
              (progn
                (prompt "\n** End of list reached, starting over ** ")
                (car cogo)
              )
            )
     )
     (setq cmdecho (getvar 'cmdecho))
     (setvar 'cmdecho 0)
     (command "._ztp" *LastCogoPoint*)
   )
   (prompt "\n** No COGO Points found. ** ")
 )
 (*error* nil)
)

Link to comment
Share on other sites

Fixed code in post above during testing dropped reseting the list of pt numbs. LST

 

Be mindful of user adding/removing COGO Points between c:ZP calls. :thumbsup:

Link to comment
Share on other sites

Balck box as you know its hard to write a one case fits all, big problem here is wants to do something between zooms but keep going. Hint for Ixoye to randomly reset just type (setq lst nil) ZP

Link to comment
Share on other sites

Balck box as you know its hard to write a one case fits all, big problem here is wants to do something between zooms but keep going. Hint for Ixoye to randomly reset just type (setq lst nil) ZP

 

Not harping on you, just pointing out an observation, my friend.

 

My offering builds a list of all COGO Point numbers each time the routine is called, which ensures that any COGO Points added (or removed) are accounted for. Further, once the end of the list of COGO Point numbers has been reached, it notifies user, and starts over... UNDO Functionality supported as well... So you see, the user can perform work between ZTP, as the last point number is stored to global variable and compared against the list of current COGO Point numbers at runtime. :thumbsup:

 

Cheers

Link to comment
Share on other sites

Thats a good idea Blackbox only problem would be I have jobs with 10,000 pts maybe need a build range option so can inspect current days work. I think we both need to wait for OP to comment a bit more on exactly what the volume of points is like. We could get into only the points that are trees or edge of road etc.

Link to comment
Share on other sites

  • 2 months later...

Thanks, Black Box and BIGAL, I have tested the code and it seems to help my situation. I appreciate your help and the knowledge you have given me.. I also have learn alot about coding and am eager to continue keep at it. Again, thanks.

Link to comment
Share on other sites

  • 8 months later...

BIGAL,

I also have alot of Cogo Points. Is there a way to pick a certain cogo point and go to that position. Also could it be possible to restart the routine at any given time and continue from there. For example, I would like to go to the point at the four corners of the building, to a wind towers, and than to the lake.

Link to comment
Share on other sites

I also have alot of Cogo Points. Is there a way to pick a certain cogo point and go to that position.

 

The ZTP (zoom to point) Command is built-in to Civil 3D.

 

You can also simply select the Points node in Toolspace, right click the point, and select 'Zoom to' from the context menu.

 

 

 

Also could it be possible to restart the routine at any given time and continue from there. For example, I would like to go to the point at the four corners of the building, to a wind towers, and than to the lake.

 

This could easily be modified to accomplish that.

Link to comment
Share on other sites

I use the “ZoomToNextPoint” routine and works great thank you very much. And I use ZTP often.

There are many instances where I have used the routine and then have to exit my drawing. When I get back into the drawing I don’t want to start my search at the beginning again. Instead I want to start the search from where I left off. This would save time.

I have point numbers 1-100 for example. I would like to start my search at 55 and then to the next numbers following 55, with it returning to the beginning after I reached 100.

It probably is so simple, but I have spending too much time “racking my brain” over this on my own. Could someone help.

Link to comment
Share on other sites

You have a number of user defined variables that you can get within a dwg. I would suggest (setvar "useri1" ptnum) there are 5 integer values available. Userr1-5 is reals users1-5 are strings.

 

Word of warning though another lisp may use these variables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...