Jump to content
CafeJr

Linking end point lines - creating a contour.

Recommended Posts

CafeJr

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

Share this post


Link to post
Share on other sites
pBe
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.

Share this post


Link to post
Share on other sites
CafeJr
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!...

Share this post


Link to post
Share on other sites
Tharwat

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

Share this post


Link to post
Share on other sites
Tharwat

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

Share this post


Link to post
Share on other sites
CafeJr

:thumbsup: Tharwat, This code LWpline is that I need!... Thank you a lot!!!...

 

 

And this one draw LWpolylines .

Share this post


Link to post
Share on other sites
Tharwat
:thumbsup: Tharwat, This code LWpline is that I need!... Thank you a lot!!!...

 

You're welcome anytime . :)

Share this post


Link to post
Share on other sites
pBe
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?

Share this post


Link to post
Share on other sites
CafeJr

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

Share this post


Link to post
Share on other sites
pBe
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.

Share this post


Link to post
Share on other sites
CafeJr
Ok then, save us time to write a code for that condition :)

 

Cheers CafeJr.

 

I'm grateful, about your help!!!...

 

:thumbsup:

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