Jump to content

Looking to Create or Modify Elevation Markers from x,y,z points


Kablamtron

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 8 months later...

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

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...