Kablamtron Posted May 28, 2008 Share Posted May 28, 2008 Hey, I have multiple .dxf files of local surveys and I move them all to a common elevation inside one big dwg drawing. The program I currently use assigns an elevation marker in the form of a single line text box to the points shot with the survey equitment when I dxf them out. Unfortunatly, these elevation markers are all wrong because the survey program only deals with local surveys. So I have to move all the points to the correct elevation in autocad then re-import them back into the survey program then dxf them out again so the elevation markers are correct this time around. I was wondering if it was possible to make an autolisp to either create a single line of text that has the elevation beside the points, or modify the current markers to the correct elevation once I have moved them. Keeping in mind that some surveys contain thousands of these points. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 29, 2008 Share Posted May 29, 2008 You could simply just re label all the "points" in a dwg after you have adjusted there elevation by lisp. Q1 are you using Civil 3d ? Q2 are the points actually ACAD "Points" ? if so then just globaly edit the points adjusting the z by a fixed amount if on one layer just MOVE 0,0,0 then 0,0,23.456 ie added 23.445 to heights. In a lisp you would just write the Z value as text with the insert point as the x,y of the point. Put it on a unique layer then just delete layer if you have to do it again. Quote Link to comment Share on other sites More sharing options...
Kablamtron Posted January 29, 2009 Author Share Posted January 29, 2009 Solved it! Didn't have much time to work on it for a couple months but I got it done. Feel free to look over/correct anything I've done wrong. Works fine in 2002 and R14 haven't tried any others. ;ReCalculate Levs by Bradley Linscott (prompt "type rlev to activate") (defun *error* (msg) (princ msg) (princ) ) (defun loop () ;loop (setq singlepnt (entget (ssname pnts LoopCount))) ;get one point (setq zcoord (cadddr (assoc 10 singlepnt))) ;get z co-ord (setq zcoordstr (rtos zcoord 2 1)) (setq zcoordstr (cons 1 zcoordstr)) ;format z coordinate (setq name (assoc 1 singlepnt)) ;get name (entmod (subst zcoordstr name singlepnt)) ;update database ) (defun c:rlev (/ txtstr pt1 pnts) (prompt "select text") (setq pnts (Ssget (List'(0 . "TEXT")))) ;selection set (Setq SSL (Sslength pnts)) ;get length of ze selection set (Setq LoopCount 0) ;Initialize loop counter (Repeat SSL ;Loop (loop) (Setq LoopCount (1+ LoopCount)) ;Count Loop ) ; close repeat ) ; close defun Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 29, 2009 Share Posted January 29, 2009 Hi Kablamtron, Just a few things I would maybe change in your LISP (nothing against your LISP, but just a few improvements in my opinion) ;ReCalculate Levs by Bradley Linscott (prompt "type rlev to activate") (defun c:rlev (/ ss i eLst zcoord) (prompt "\nSelect Text > ") (if (setq ss (ssget (list (cons 0 "TEXT")))) (progn (setq i (sslength ss)) (while (not (minusp (setq i (1- i)))) (setq eLst (entget (ssname ss i)) zcoord (rtos (cadddr (assoc 10 eLst)) 2 1)) (entmod (subst (cons 1 zcoord)(assoc 1 eLst) eLst)))) (princ "\n<!> No Text Selected <!> ")) (princ) ) I would use an IF statement with the ssget, in case the user doesn't pick anything, which excludes the need for an error handler. also, I would use a while command instead of a repeat - as repeat can only handle selection sets up to 32767 entities - (integer limit). Also, you can combine most of the variables together, and localise them in the defun function. Just a few pointers Hope this helps somewhat Cheers Lee Quote Link to comment Share on other sites More sharing options...
Kablamtron Posted January 29, 2009 Author Share Posted January 29, 2009 Cool, thanks for those suggestions haha makes it a lot more compact(still learning!). Thanks again lee Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 30, 2009 Share Posted January 30, 2009 Cool, thanks for those suggestions haha makes it a lot more compact(still learning!). Thanks again lee No probs, happy to help out. If you have any queries about my modifications, just ask 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.