the_real_ptb Posted February 21, 2013 Posted February 21, 2013 Any way to convert a line into a point? I have a topo drawing that appears to have the ground shots that I want to bring into Civil3D to create a surface. The problem is that the points are actually lines with the start and end at the same location. Why they are this way I do not know, but these 'lines' are worthless to me for what I am trying to do. Any simple way to convert a line with a start and end at the same location into just a point at that same location? Thanks. Quote
neophoible Posted February 21, 2013 Posted February 21, 2013 You can try this. It's smth I originally wrote ages ago, but have found very useful over the years. It generally replaces any objects with a 10-pt (base point) with another object with a 10-pt. I apologize that there is no error checking, Undo reset, etc., but I'm set up to handle those things through a single setup that merely calls my special routines each time needed. Perhaps someone would help clean it up for you, if needed. I did add back in the OSMODE handling, as it may not even work otherwise. Hopefully, I didn't mess it up doing that. (defun C:Replace ( / Copy_obj Ins_pt Repl_set Set_index Ins_list OSMODE_save ) (while (and (setq Copy_obj (car (entsel "Select object to copy: "))) (not (setq Ins_pt (cdr (assoc 10 (entget Copy_obj))))) ) (prompt "\nObject must have a base point.\n") ) (cond ( (not Copy_obj) ) ( (redraw Copy_obj 3) ) ( (prompt "\nSelect objects to replace...") ) ( (not (setq Repl_set (ssget (list (cons -4 "*") (cons 10 '(0 0 0)))) ) ) (prompt "\nNo objects (with base points) found to replace.\n") ) (T(setq Set_index (sslength Repl_set)) (prompt (strcat "\nPlease wait...Replacing " ; (rtos Set_index 2 0) " object(s)." ) ) (while (<= 0 (setq Set_index (1- Set_index))) (setq Ins_list (cons (cdr (assoc 10 (entget (ssname Repl_set Set_index)) ) ) Ins_list) ) ) (setq OSMODE_save (getvar "OSMODE")) (setvar "OSMODE" (logior 16384 OSMODE_save)) (command "._ERASE" Repl_set "" "._COPY" Copy_obj "" "_M" Ins_pt) (foreach Ins_pt Ins_list (command Ins_pt)) (command "") (setvar "OSMODE" OSMODE_save) ) ) (if Copy_obj (redraw Copy_obj 4)) (princ) ) (C:Replace) Quote
neophoible Posted February 21, 2013 Posted February 21, 2013 Perhaps I should add that one point object you mention would need to already exist in the drawing; you would then select it as the object to be copied. The routine I submitted merely copies such an object into all the places where your existing zero-length lines are. Quote
Murph_map Posted February 21, 2013 Posted February 21, 2013 Any way to convert a line into a point? I have a topo drawing that appears to have the ground shots that I want to bring into Civil3D to create a surface. The problem is that the points are actually lines with the start and end at the same location. Why they are this way I do not know, but these 'lines' are worthless to me for what I am trying to do. Any simple way to convert a line with a start and end at the same location into just a point at that same location? Thanks. sounds like someone did know how to use the Survey database tools. One way is use the dataextration tool and get the startx,y,z and end x,y,z to an excel file then use the point tools in Civil3D to add a point group. A few things to watch for are dupicate points (the ep of one line is the same as the SP of another line) and if it was a topo and they are now lines you may of lost the elevation values. Quote
BIGAL Posted February 22, 2013 Posted February 22, 2013 here is a slighlty different answer but same problem this takes text representing levels and creates a point, I have changed the old text option to line so should work. not tested ; converts text to a point with xyz ; z value equal to text ; by Alan H Nov 99 (setq oldsnap (getvar "osmode")) (setvar "osmode" 0) (while (not (setq ss (ssget)))) ; needs a improve ssget layer and line (command "layer" "new" "txthts" "") (setvar "clayer" "txthts") (setvar "pdsize" 3) (setvar "pdmode" 35) (while (setq en (ssname ss 0)) ; Entity type (setq entyp (cdr (assoc 0 (entget en)))) (if (= entyp "LINE") ;(if (= entyp "TEXT") (progn (setq xyz (cdr (assoc 10 (entget en)))) (setq txtht (nth 2 xyz)) ;(setq txtht (cdr (assoc 1 (entget en)))) (princ txtht) (setq txtz (atof txtht)) (setq ptxyz (list (car xyz)(cadr xyz) txtz)) (command "point" ptxyz) ) ) ; Delete each measured entity from set (ssdel en ss) ;end while ) (setvar "osmode" oldsnap) (princ) Quote
the_real_ptb Posted February 22, 2013 Author Posted February 22, 2013 Thanks all. I tried neophoible's solution and it worked like a charm, so I didn't have to try the others. Quote
neophoible Posted February 22, 2013 Posted February 22, 2013 Thanks all. I tried neophoible's solution and it worked like a charm,.... Glad it worked. It works for a lot more things besides, basically anything with a basepoint. Quote
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.