Jump to content

Linking end point lines - creating a contour.


CafeJr

Recommended Posts

Hello guys,

 

I again, needing a help...

 

Some one knows how do a link with lines as the picture bellow? I have on a drawing lines that need to be closed to make one area, but, to do it it's necessary to get some lines and do a contour line, linking the points...

 

Thanks...

 

Linking lines.jpg

Link to comment
Share on other sites

Hello guys,

 

I again, needing a help...

 

Some one knows how do a link with lines as the picture bellow? I have on a drawing lines that need to be closed to make one area, but, to do it it's necessary to get some lines and do a contour line, linking the points...

 

Thanks...

 

What are those circles? are they part of the "drawing lines" or just a guide to link the contours? as always you need to provide a drawing sample.

 

The link troggarf posted looks promising.

Link to comment
Share on other sites

What are those circles? are they part of the "drawing lines" or just a guide to link the contours? as always you need to provide a drawing sample.

 

The link troggarf posted looks promising.

 

The circles are only to show what points I need to link!...

Link to comment
Share on other sites

My version :)

 

(defun c:Test (/ ss in en st nd up dn u d)
 ;;     Tharwat 18.Oct.2013    ;;
 (if (setq ss (ssget '((0 . "LINE"))))
   (progn
     (repeat (setq in (sslength ss))
       (setq en (entget (ssname ss (setq in (1- in))))
             st (cdr (assoc 10 en))
             nd (cdr (assoc 11 en))
       )
       (if (> (cadr st) (cadr nd))
         (setq up (cons st up)
               dn (cons nd dn)
         )
         (setq dn (cons st dn)
               up (cons nd up)
         )
       )
     )
     (setq u (vl-sort up '(lambda (a b) (< (car a) (car b))))
           d (vl-sort dn '(lambda (j k) (< (car j) (car k))))
     )
     (while (> (length u) 1)
       (entmakex
         (list '(0 . "LINE") (cons 10 (car u)) (cons 11 (cadr u)))
       )
       (setq u (cdr u))
     )
     (while (> (length d) 1)
       (entmakex
         (list '(0 . "LINE") (cons 10 (car d)) (cons 11 (cadr d)))
       )
       (setq d (cdr d))
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

And this one draw LWpolylines .

 

(defun c:Test (/ _LW ss in en st nd up dn u d)
 ;;     Tharwat 18.Oct.2013    ;;
 (defun _LW (lst)
   (entmakex
     (append (list '(0 . "LWPOLYLINE")
                   '(100 . "AcDbEntity")
                   '(100 . "AcDbPolyline")
                   (cons 90 (length lst))
                   '(70 . 0)
             )
             (mapcar (function (lambda (p) (cons 10 p))) lst)
     )
   )
 )
 (if (setq ss (ssget '((0 . "LINE"))))
   (progn
     (repeat (setq in (sslength ss))
       (setq en (entget (ssname ss (setq in (1- in))))
             st (cdr (assoc 10 en))
             nd (cdr (assoc 11 en))
       )
       (if (> (cadr st) (cadr nd))
         (setq up (cons st up)
               dn (cons nd dn)
         )
         (setq dn (cons st dn)
               up (cons nd up)
         )
       )
     )
     (setq u (vl-sort up '(lambda (a b) (< (car a) (car b))))
           d (vl-sort dn '(lambda (j k) (< (car j) (car k))))
     )
     (if (> (length u) 1)
       (_LW u)
     )
     (if (> (length d) 1)
       (_LW d)
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

The circles are only to show what points I need to link!...

 

Arent there two sets of lines to select , the white lines on top and the red lines at the bottom?

Link to comment
Share on other sites

Yes pBe, there are two lines blue and red, I need to execute the code twice, but it's working as good as I need!...

 

Ok then, save us time to write a code for that condition :)

 

Cheers CafeJr.

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