Ixoye Posted September 12, 2014 Share Posted September 12, 2014 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 12, 2014 Share Posted September 12, 2014 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. Cheers Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 12, 2014 Share Posted September 12, 2014 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 14, 2014 Share Posted September 14, 2014 This works as a test need a little bit more time to do pt list stuff, (setq pt (getint "\Pt num")) (command "ZTP" pt) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 15, 2014 Share Posted September 15, 2014 (edited) 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 October 2, 2014 by BIGAL setq lst vers 2.0 Quote Link to comment Share on other sites More sharing options...
Ixoye Posted October 1, 2014 Author Share Posted October 1, 2014 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 1, 2014 Share Posted October 1, 2014 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) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 2, 2014 Share Posted October 2, 2014 Fixed code in post above during testing dropped reseting the list of pt numbs. LST Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 2, 2014 Share Posted October 2, 2014 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 3, 2014 Share Posted October 3, 2014 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 Quote Link to comment Share on other sites More sharing options...
BlackBox Posted October 3, 2014 Share Posted October 3, 2014 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. Cheers Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 3, 2014 Share Posted October 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
Ixoye Posted December 11, 2014 Author Share Posted December 11, 2014 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. Quote Link to comment Share on other sites More sharing options...
JSYoung81 Posted December 12, 2014 Share Posted December 12, 2014 This is also a feature built-in. From tool space, go to your point group, select your point right click zoom to Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 12, 2014 Share Posted December 12, 2014 JsYoung81 the idea was just do next next next same as ZTP xx works but you have to enter a number. Quote Link to comment Share on other sites More sharing options...
Ixoye Posted September 11, 2015 Author Share Posted September 11, 2015 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. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 11, 2015 Share Posted September 11, 2015 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. Quote Link to comment Share on other sites More sharing options...
Ixoye Posted September 16, 2015 Author Share Posted September 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 17, 2015 Share Posted September 17, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.