Jump to content

Recommended Posts

Posted

Hello All!!!

I am a road engineer and I know that many people have this problem: my topographical survey is in 2d with points and polylines not having Z elevation, the points are blocks with elevation as an atribute.

 

I managed with the help of EATTEXT command in Autocad to extract a field report data containing X, Y, Z, and Point Code. With a lisp I inserted the points into Autocad and now are all 3D points.

 

The lines are still 2D polylines(road edges, retaining walls, ditches etc) and I want to ask your help in writing a lisp ( my knowledge of composing lisps is 0 :() to elevate these polyline to the levels of the points(the polyline vertexes matches the points) for obtaining the DTM.

I know one way that I can draw the 3D poly is by snaping to the points but i want to use an automatic mode as the number of polylines is high.

Posted (edited)

Welcome to CADTutor Alex :)

 

Below is a rough draft of a possible program, but the code should hopefully perform as required:

(defun c:poly23dpoly ( / enx idx lst pll ptl sel )
   (princ "\nSelect points & 2d polylines: ")
   (if (setq sel (ssget '((0 . "LWPOLYLINE,POINT"))))
       (progn
           (repeat (setq idx (sslength sel))
               (setq enx (entget (ssname sel (setq idx (1- idx)))))
               (if (= "POINT" (cdr (assoc 0 enx)))
                   (setq ptl (cons (cdr (assoc 10 enx)) ptl))
                   (setq pll (cons (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) enx)) pll))
               )
           )
           (foreach grp pll
               (foreach vtx grp
                   (if (setq vtx (car (vl-member-if '(lambda ( a ) (equal vtx (list (car a) (cadr a)) 1e-4)) ptl)))
                       (setq lst (cons vtx lst))
                   )
               )
               (if (cdr lst)
                   (progn
                       (entmake '((0 . "POLYLINE") (70 . 8)))
                       (foreach vtx lst
                           (entmake
                               (list
                                  '(00 . "VERTEX")
                                  '(70 . 32)
                                   (cons 10 vtx)
                               )
                           )
                       )
                       (entmake '((0 . "SEQEND")))
                   )
               )
               (setq lst nil)
           )
       )
   )
   (princ)
)
 
Edited by Lee Mac
Posted

Hello Lee Mac, i tried this lisp but doesnt work for me. When I select 2d polyline or polyline & points it says nothing selected. ??? I also need that kind of lisp I am a road engineer also, and this is very big problem for me an waist of time when i have big drawings.

So i attached dwg drawings to se the point & the elements and i hopu you tried to workout with this drawing.

 

thx lift up polylines.jpg

polylines to 3d point.dwg

Posted

Are you trying to go backwards that is make a surface model from the blocks elev value, if so then you can ignore the line work, we actually turn our 3d line work in to 2d but keep the surface model intact. Stops all the hassles about 2d/3d problems list a line that 99 long when its actually 2.47.

 

A lot of people say we have a 3d plan because the plines have a elevation lable. When in fact their flat.

 

If you have converted the blocks to points then just load straight into CIV3d and create a surface, Autocad Points are a direct input option in a couple of ways as a point group or as Autocad objects.

 

The only real advantage you may gain is by introducing more pts along the lines and arcs to make a better surface model. CIV3d does not support curved breaklines (our other software does) so wasting time with arcs, not sure if they even get added as part of using Autocad objects doubtful. A last comment a suface TIN is made up of 3 pts so extra lines will make no difference as it goes from start to end of THE LINE.

Posted

Bigal, i dont have surface jet. I have geodethic drawing witch is flaten 2d. So i extract my atribut (blocks) to xyz file, to have point in 3d, xyz. Now im trying to draw a breaklines between these point to have a right surface when i created from point and breaklines. Thats not a problem to do by hand from point to point. But when i have circle or curved polyline i cant do that in civil except if i do aligment and the extract to polylines etc..... Second is that that i have a big drawing with a lot of points to make breaklines between them. So i was thinking to do that with lisp program if its possible. So i need lift up to 3d point these geodethic curves, wich are line, polylines, circle, ......

 

thx for response..

Posted
i tried this lisp but doesnt work for me. When I select 2d polyline or polyline & points it says nothing selected. ???

 

This is because your 'points' are not POINT objects, but instead appear as Proxy Entities (likely created by third-party or vertical software), and your '2d polylines' are not Lightweight [LW]Polylines, but old-style 2D [Heavy] Polylines (you can convert these using the CONVERTPOLY command).

Posted

Also again arcs are not supported nor can you just replace with line segments as each would require a elevation to be worked out.

 

Would it not be better to go back to who supplied the info and get a surface or at least a 3dface mesh ?

Posted
This is because your 'points' are not POINT objects, but instead appear as Proxy Entities (likely created by third-party or vertical software), and your '2d polylines' are not Lightweight [LW]Polylines, but old-style 2D [Heavy] Polylines (you can convert these using the CONVERTPOLY command).

But i dont understand i have cogo point inserted from xyz file, this is not a point object ? I understand about polyline & i converted them no problem, but points und polyline to z coordinat from point?

Would it not be better to go back to who supplied the info and get a surface or at least a 3dface mesh ?

No i dont have this option. Only in that kind of drawing can supllied to me??

 

So if i understand , that cant be done with lisp ?

 

Thy for replay,

 

Iztok

Posted

Thank you Lee!!! The lisp works fine for me, I had no problem converting the polylines into 3d polyline. I have to add a comment: polylines should be simple polylines not 2d polylines ( when you bring the propreties tab on check to see in description if they are Polyline). The 2d polylines can be easily converted into Polylines with the CONVERTPOLY command.

Posted
But i dont understand i have cogo point inserted from xyz file, this is not a point object ?

 

Unfortunately not - Coordinate Geometry (COGO) Point objects are objects native to vertical applications such as Civil 3D; whereas POINT objects (aka 'nodes') are those created in Vanilla AutoCAD by the POINT command.

 

Thank you Lee!!! The lisp works fine for me, I had no problem converting the polylines into 3d polyline.

 

Excellent to hear - you're very welcome Alex.

Posted

Lee I am trying to find pretty sure you can ssget a IAeccPoint see code below, You can get NORTHING EASTING ELEVATION also a property using direct VL-get-Northing etc

 

some code !!
 (alert "Pick CIV3D points press ESC or pick nothing to exit")
 (while (setq obj (vlax-ename->vla-object  (car (entsel))))
; vl 3d point convert to plain lisp 
 (setq pt1 (vlax-safearray->list (vlax-variant-value (vlax-get-property obj "Location"))))
 (setq ht (rtos (nth 2 pt1) 2 3)) ; Z val
 (setq ptx (nth 0 pt1))
(setq pty (nth 1 pt1)) 

Posted

Thx to BIGAL & LEE MAC for bouth of u who replay.

Maybe is this question dum, but i dont now how to interpolate vertices between 2 point. So if i need to create an arc i simply do more vertices. But these vertices have 0 z coordinaters. Is there any possible way to interpolate when create vertices between two point automatical?

  • 6 months later...
Posted

Hi, is that possible to update that lisp to work with cases where the points are not exactly on the polylines, but in some very small distance (I often get maps from surveyors with that situation, the points are very slightly moved, don't have idea why, maybe during transformation the points are not moved exactly to the polylines). It would be perfect if the lisp worked with some tolerance which could be chosen (for example, in road designs 0.05m) and newly created 3dpolylines would pick the elevation from all the points within that tolerance along picked polyline (2d).

 

Or maybe there is a way I can move that points (nodes) to the closest point on the polyline automatically?

Posted
is that possible to update that lisp to work with cases where the points are not exactly on the polylines, but in some very small distance ... It would be perfect if the lisp worked with some tolerance

 

The tolerance in my current code is 1e-4 (i.e. 0.0001), you can change this to suit your requirements.

  • 2 years later...
Posted
On 2/15/2015 at 1:35 PM, Lee Mac said:

Welcome to CADTutor Alex :)

 

Below is a rough draft of a possible program, but the code should hopefully perform as required:

 


(defun c:poly23dpoly ( / enx idx lst pll ptl sel )
   (princ "\nSelect points & 2d polylines: ")
   (if (setq sel (ssget '((0 . "LWPOLYLINE,POINT"))))
       (progn
           (repeat (setq idx (sslength sel))
               (setq enx (entget (ssname sel (setq idx (1- idx)))))
               (if (= "POINT" (cdr (assoc 0 enx)))
                   (setq ptl (cons (cdr (assoc 10 enx)) ptl))
                   (setq pll (cons (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) enx)) pll))
               )
           )
           (foreach grp pll
               (foreach vtx grp
                   (if (setq vtx (car (vl-member-if '(lambda ( a ) (equal vtx (list (car a) (cadr a)) 1e-4)) ptl)))
                       (setq lst (cons vtx lst))
                   )
               )
               (if (cdr lst)
                   (progn
                       (entmake '((0 . "POLYLINE") (70 . ))
                       (foreach vtx lst
                           (entmake
                               (list
                                  '(00 . "VERTEX")
                                  '(70 . 32)
                                   (cons 10 vtx)
                               )
                           )
                       )
                       (entmake '((0 . "SEQEND")))
                   )
               )
               (setq lst nil)
           )
       )
   )
   (princ)
)
 

 

Why i'm getting this error: extra right paren on input? 

Posted
32 minutes ago, drdownload18 said:

Why i'm getting this error: extra right paren on input? 

 

I would hazard a guess that this line :

 

(entmake '((0 . "POLYLINE") (70 . ))

needs an extra ) at the end of it.

Posted
2 hours ago, dlanorh said:

 

 

Needs an extra ) at the end of it.

I'm still getting same error :(

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