Jump to content
lucky9

Create lines between sequence of points positions one after another

Recommended Posts

lucky9
Posted (edited)

Hi, I have this survey Dfx cad file which has coordinates and  levels, I want to connect them (points) with polylines, although it can be done manually but it would take lot of time. Is there a way to connect these points to each other automatically?  

Cad file is attached. 

S1.DXF

Edited by lucky9

Share this post


Link to post
Share on other sites
eldon

I think you would be better doing the connecting up manually.

 

There are a lot of RE coded points, but how would a programme know which side of the road they represent? and where to join up at a junction?

  • Like 2

Share this post


Link to post
Share on other sites
rlx

Probably AI , ET , Quantum computer , Google Maps or TomTom would be best for your need but found a few routines that may or may not help you. Have zero experience with this sort of stuf and none of the code is mine so in case of questions ask the authors...

Don't think any of them offer one click and score but you could try to select one branch at the time and join them as you see fit.


; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-draw-polyline-across-multiple-center-points/m-p/8041066

(defun c:connect ( / ss i e plist p nextpt plist-sorted rtn pp )
  (while (or (prompt "\nSelect blocks or circles...") (not (setq ss (ssget '((0 . "INSERT,CIRCLE"))))))
    (prompt "\nEmpty sel. set...")
  )
  (repeat (setq i (sslength ss))
    (setq e (ssname ss (setq i (1- i))))
    (setq plist (cons (cdr (assoc 10 (entget e))) plist))
  )
  (setq p (getpoint "\nPick or specify start point - use osnap cen or ins : "))

  (defun nextpt ( p plist / car-sort pp )

    (defun car-sort ( l f / removenth r k )

      (defun removenth ( l n / k )
        (setq k -1)
        (vl-remove-if '(lambda ( x ) (= (setq k (1+ k)) n)) l)
      )

      (setq k -1)
      (vl-some '(lambda ( a ) (setq k (1+ k)) (if (vl-every '(lambda ( x ) (apply f (list a x))) (removenth l k)) (setq r a))) l)
      r
    )  

    (setq plist (vl-remove-if '(lambda ( x ) (equal x p 1e-3)) plist))
    (setq pp (car-sort plist '(lambda ( a b ) (<= (distance p a) (distance p b)))))
    (list pp plist)
  )

  (if p
    (progn
      (while (cadr plist)
        (setq plist-sorted (cons p plist-sorted))
        (setq rtn (nextpt p plist))
        (setq pp (car rtn) plist (cadr rtn))
        (setq p pp)
      )
      (setq plist-sorted (cons (car plist) plist-sorted))
      (setq plist-sorted (reverse plist-sorted))
      (entmake
        (append
          (list
            '(0 . "LWPOLYLINE")
            '(100 . "AcDbEntity")
            '(100 . "AcDbPolyline")
            (cons 90 (length plist-sorted))
            (cons 70 (if (= 1 (getvar 'plinegen)) 128 0))
            '(38 . 0.0)
          )
          (mapcar '(lambda ( p ) (cons 10 p)) plist-sorted)
          (list '(210 0.0 0.0 1.0))
        )
      )
    )
  )
  (princ)
)


(defun c:CreateShortPath (/ GetMidPoints SortPointList CSP_Point CSP_Selection CSP_PointList)

   (defun GetMidPoints (GMP_Selection / GMP_Object GMP_Point1 GMP_Point2 GMP_Return)
      (if
         (and
            (= (type GMP_Selection) 'PICKSET)
            (> (sslength GMP_Selection) 0)
         )
         (progn
            (foreach GMP_Object (vl-remove-if '(lambda (GMP_Item) (listp (cadr GMP_Item))) (ssnamex GMP_Selection))
               (if
                  (vlax-method-applicable-p (setq GMP_Object (vlax-ename->vla-object (cadr GMP_Object))) 'GetBoundingBox)
                  (progn
                     (vla-GetBoundingBox GMP_Object 'GMP_Point1 'GMP_Point2)
                     (setq GMP_Return
                        (cons
                           (mapcar '(lambda (GMP_Value1 GMP_Value2) (/ (+ GMP_Value1 GMP_Value2) 2.0)) (vlax-safearray->list GMP_Point1) (vlax-safearray->list GMP_Point2))
                           GMP_Return                        
                        )
                     )
                  )
               )
            )
         )
      )
      GMP_Return
   )

   (defun SortPointList (SPL_PointList / SPL_Point SPL_Return)
      (setq SPL_PointList (vl-sort SPL_PointList '(lambda (SPL_Item1 CSPCSP_Item2)(< (distance SPL_Item1 (car SPL_PointList))(distance CSPCSP_Item2 (car SPL_PointList))))))
      (repeat (length SPL_PointList)
         (setq SPL_Return (cons (setq SPL_Point (car SPL_PointList)) SPL_Return))
         (setq SPL_PointList (cdr SPL_PointList))
         (setq SPL_PointList (vl-sort SPL_PointList '(lambda (SPL_Item1 CSPCSP_Item2)(< (distance SPL_Item1 SPL_Point)(distance CSPCSP_Item2 SPL_Point)))))
      )
      (reverse SPL_Return)
   )
   
   (if
      (and
         (setq CSP_Selection (ssget))
         (setq CSP_Point (getpoint "\nIndicate startpoint: "))                  
      )
      (progn         
         (setq CSP_PointList (SortPointList (cons CSP_Point (GetMidPoints CSP_Selection))))
         (vla-StartUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
         (entmake
            (append
               (list
                  '(0 . "LWPOLYLINE")
                  '(100 . "AcDbEntity")
                  '(100 . "AcDbPolyline")
                  (cons 90 (length CSP_PointList))
                  (cons 70 (if (= 1 (getvar 'PLINEGEN)) 128 0))
                  '(38 . 0.0)
               )
               (mapcar '(lambda (CSP_Item) (cons 10 CSP_Item)) CSP_PointList)
               (list '(210 0.0 0.0 1.0))
            )
         )         
         (vla-EndUndoMark (vla-get-ActiveDocument (vlax-get-acad-object)))
      )                
   )
   (princ)
)


(defun c:path (/ _daisychain a ll p pt s ur)
  ;; RJP - 6.1.2018
  ;; Creates a path using the midpt of bounding box of blocks
  (defun _daisychain (pt l / tmp out dsort)
    (defun dsort (pt l / d1 d2)
      (vl-sort l (function (lambda (d1 d2) (< (distance pt d1) (distance pt d2)))))
    )
    (setq tmp (dsort pt l))
    (while (setq tmp (dsort (car tmp) tmp)) (setq out (cons (car tmp) out)) (setq tmp (cdr tmp)))
    (reverse out)
  )
  (cond    ((and (setq p (getpoint "\nPick point to sort from: "))
          (setq s (ssget '((0 . "insert") (2 . "Poste_Concreto"))))
          (setq s
             (mapcar '(lambda (x)
                (vla-getboundingbox (vlax-ename->vla-object x) 'll 'ur)
                (mapcar    '(lambda (a) (/ a 2.))
                    (apply 'mapcar (cons '+ (mapcar 'vlax-safearray->list (list ll ur))))
                )
                ;; If your block had an insertion point at the center of the circle then the line below would be enough
                ;; (vlax-get x 'insertionpoint)
                  )
                 (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
             )
          )
          (setq s (_daisychain p s))
     )
     (entmakex (append (list '(0 . "LWPOLYLINE")
                 '(100 . "AcDbEntity")
                 '(100 . "AcDbPolyline")
                 '(8 . "Netell-Aerial-Network_Authorized (Real-Built)")
                 (cons 90 (length s))
                 '(38 . 0.0)
               )
               (mapcar '(lambda (x) (cons 10 x)) s)
               (list '(210 0.0 0.0 1.0))
           )
     )
    )
  )
  (princ)
)
(vl-load-com)

 

  • Thanks 1

Share this post


Link to post
Share on other sites
BIGAL

You need to start a step prior to dxf and work on the actual data points, any good Civil/survey software out there has a join the points routine.

 

Did your points as a data file look something like. Ptnum, X, Y, Z, description.

 

The description is the key to joining the dots.

 

 

 

 

ScreenShot033.jpg

Share this post


Link to post
Share on other sites
lucky9
Posted (edited)
On 4/22/2019 at 4:27 AM, BIGAL said:

You need to start a step prior to dxf and work on the actual data points, any good Civil/survey software out there has a join the points routine.

 

Did your points as a data file look something like. Ptnum, X, Y, Z, description.

 

The description is the key to joining the dots.

 

 

 

Sorry,  for late responding to this thread....

 

I have this data file  (.ASC) from the surveyor. How can it be used for joining points. can you please suggest any survey software.  

 

 

0.ASC 1.ASC 2.ASC 3.ASC

Edited by lucky9

Share this post


Link to post
Share on other sites
BIGAL

There is plenty out there here is one link to look at www.civilsurveysolutions.com.au look at Stringer. Obviously CIV3D but the link has lots more options than just downlod points.

 

You would set up a Library of your description codes so it knows what to do with them a point, a block symbol, or join into lines. As well as is point contourable?

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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