tony farrar Posted July 23, 2024 Posted July 23, 2024 Have map data imported into autocad, contains hundreds of contour lines that all have elevation levels of 0. Need to enter real elevation values of each polyline ( contour line), can do this by clicking polyline and changing elevation in properties, this can take days of laborious work depending on the size map data. Is it possible to write code through lisp where by I can click on a polyline set the increase in elevation, then from there I click on the next polyline and automatically that polylines elevation is move one higher than the previous selected polyline. The purpose is to have a 3d model of contour lines for civil based software. Quote
fuccaro Posted July 23, 2024 Posted July 23, 2024 Welcome in the Forum! I moved your question here in the Lisp forum. Quote
fuccaro Posted July 23, 2024 Posted July 23, 2024 And here is my answer: (defun c:pp() (setq current (getreal "starting elevation? ") step (getreal "step? ")) (princ "\n keep selecting or ESC to terminate") (setq pl t) (while pl (princ (strcat "\nSelect polyline for elevation: " (rtos current))) (setq pl (entget (car (entsel))) pl (subst (cons 38 current) (assoc 38 pl) pl) pl (entmod pl) current (+ current step)) ) ) Quote
Steven P Posted July 23, 2024 Posted July 23, 2024 With the polylines are there any height markers referencing what is at what height - if there is one for each contour it might be possible to select all contours and height texts for a little more automation. We'd need to see a sample drawing though to work that out. Fuccaros LISP should save a lot of time I think. Quote
SLW210 Posted July 24, 2024 Posted July 24, 2024 There might be something in CadTools (glamsen.se) for that. As Steven P stated, provide a drawing and relevant information and something more custom might be possible. Quote
fuccaro Posted July 25, 2024 Posted July 25, 2024 @tony farrar Are there arcs too in those contour polylines, or straight line segments only? Quote
fuccaro Posted July 26, 2024 Posted July 26, 2024 Probable OP forgot his password for this site I wrote a Lisp to help even more the creation of the 3D terrain model. It works when a contour contains exactly one contour at the next elevation. As shown in the image, the program can process the white polylines. For the red ones you will need to run it again. It’s the user’s responsibility to make the right selection when the program prompts. So, enter the step, the elevation for the first contour and select at once all the objects, the selection order doesn’t count. The program will place the largest contour line at the starting elevation and will rise the others, each one with one step. Enjoy! (defun c:pp() (setq step (getreal "\nStep? ") current_elev (- (getreal "Starting elevation? ") step) ss (ssget) list1 nil) (repeat (setq i (sslength ss)) (setq list1 (cons (list (setq ent (ssname ss (setq i (1- i)))) (vla-get-area (vlax-ename->vla-object ent))) list1)) ) (setq ss nil list1 (vl-sort list1 '(lambda(x y) (> (cadr x) (cadr y))))) (foreach elem list1 (setq poly (entget (car elem)) poly (subst (cons 38 (setq current_elev (+ current_elev step))) (assoc 38 poly) poly) poly (entmod poly) ) ) (strcat "Ended at elevation " (rtos current_elev)) ) Quote
troggarf Posted July 28, 2024 Posted July 28, 2024 Did you bring these contours in by using Civil 3D and import a .shp file? You can tell if these contours are from an imported shape file if you select them and you see extra properties in the bottom of the properties palette. One of the properties will be "Elevation" If so, refer to this article using C3D and Map 3D commands to apply the elevation to the contours: https://blogs.rand.com/civil/2010/03/using-esri-contours-from-a-shp-file-to-create-a-civil-3d-surface.html 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.