Jump to content

Help me to create series closed polylines


ksxdqn

Recommended Posts

I have many lines and polylines (In drawing). I want to convert them to closed polylines.

In past, i used command "Bpoly" - click into space in object.It get me many time.

Now i want convert them to closed-polylines ( Select all them ---> Enter----> To closed-polylines)

Help me to write cad lisp include only step!

Thanks!

Exp Closed Polylines.dwg

Link to comment
Share on other sites

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • ksxdqn

    10

  • Tiger

    4

  • rkmcswain

    3

  • eldon

    3

Top Posters In This Topic

Posted Images

What's problem with my request? It's difficult to write autolisp???
Take a look on Lee Mac's website. I am sure he probably has a FREE Lisp that will join groups of polylines together. i would also take note that this is a forum frequented by busy professionals who will not respond faster to demands than they will to polite requests that include complete information about the existing problem.
Link to comment
Share on other sites

I think that Bpoly is the best way to go. How much time are you wanting to save and how much is it worth to you?

 

Have you got a lazy clicking finger :shock:

Link to comment
Share on other sites

;;---------------------=={ Polyline Join }==------------------;;

;; ;;

;; Attempts to join all Lines, Arcs and LWPolylines in a ;;

;; selection. ;;

;;------------------------------------------------------------;;

;; Author: Lee Mac, Copyright © 2011 - http://www.lee-mac.com ;;

;;--

----------------------------------------------------------;;

 

 

Go to lee-mac.com and download the polyjoin.lsp file.

Link to comment
Share on other sites

Go to lee-mac.com and download the polyjoin.lsp file.

 

I hope that does what the OP wants, but I have a feeling that it is not quite what is wanted..... We shall see :cry:

Link to comment
Share on other sites

What's problem with my request? It's difficult to write autolisp???

 

 

 

We are all here on a voluntary basis, demanding someone to write YOU a LISP is a bit presumptuous of you. Be Patient.

 

 

eldon, you are right, I see now where the OP wants closed plines. Sounds simple enough to make a macro,

pedit;m;all;;join;;close;;

 

 

 

I don't believe that will work, the OP wants individual closed plines, the example shows they have a shared line, which would mean only a few would be as desired.

 

 

Seems to me the OP is looking for a BPOLY command that would use a window selection instead of picking each point with Island Detection.

Link to comment
Share on other sites

This simple program may speed up the process:

 

(defun c:test ( / *error* c p )

   (defun *error* ( msg )
       (if (= 'int (type c)) (setvar 'cmdecho c))
       (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )
   (setq c (getvar 'cmdecho))
   (setvar 'cmdecho 0)
   (while (setq p (getpoint "\nPick internal point: "))
       (vl-cmdf "_.-boundary" "_a" "_o" "_p" "" "_non" p "")
   )
   (setvar 'cmdecho c)
   (princ)
)

 

Thanks for all the recommendations guys :thumbsup:

Link to comment
Share on other sites

This simple program may speed up the process:

 

(defun c:test ( / *error* c p )

   (defun *error* ( msg )
       (if (= 'int (type c)) (setvar 'cmdecho c))
       (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
           (princ (strcat "\nError: " msg))
       )
       (princ)
   )
   (setq c (getvar 'cmdecho))
   (setvar 'cmdecho 0)
   (while (setq p (getpoint "\nPick internal point: "))
       (vl-cmdf "_.-boundary" "_a" "_o" "_p" "" "_non" p "")
   )
   (setvar 'cmdecho c)
   (princ)
)

 

Thanks for all the recommendations guys :thumbsup:

 

Dear LeeMac,

Thanks your help but i want quickly. not pick point. If i have milion lines or plines, it get many time from me. Can we pick point up left --->pick point down right to select all lines or polyline .Only step and result : to Closed - Polylines!

Thanks

Link to comment
Share on other sites

Hi everbody,

 

I come from a country where English is not mother language. Maybe i have mistake in write my idea. All of people forgive me , plz. Thanks.

My idea show in my drawing.

 

I have many many closed-plines

Step1 :Automatic Create point centroid closed polylines

Step2 :Automatic Create numbering and area

Step3: Automatic Split one by one parcel and publish it. (Contemporaneous )

 

Help me to write autolisp!

 

Thanks everybody!

Exp.dwg

Link to comment
Share on other sites

Good luck!

 

I'm constantly surprised by the patience and forbearance that you guys show to even the most blunt requests.

 

Really appreciate you being a part of this community - gold star for this thread.

 

:star:

Link to comment
Share on other sites

There is this bit of code by Marko Ribar.

 

It will transform a Selection Set of lines to region.

Once you have region It's probably easy to transform them in

LWPolylines.

 

It is not foolproof and you have to explode your polylines to lines.

 

By the way, "Quickly" missed the train, so I'm afraid he'll be late!

 

ymg

 

; Create regions in a grid of lines   by Marko Ribar                          ;
; Will join the lines of a Voronoi Diagram into regions                       ;
; To be integrated in the Voronoi Generation routine                          ;

(defun c:intlines2regions ( / *error* ms ss i lst )
 (vl-load-com)
 (or acDoc (setq acDoc (vla-get-activedocument (vlax-get-acad-object))))
 (setq ms (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)))
 (vla-startundomark acDoc)
 
 (defun *error* (msg)
   (and
     msg
     (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*"))
     (princ (strcat "\nError: " msg))
     )
   (vla-endundomark acDoc)
   (princ)
   )
 
 (if
   (setq ss (ssget '((0 . "LINE"))))
   (progn
     (repeat (setq i (sslength ss))
       (setq lst (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) lst))
     )
     (vlax-invoke ms 'AddRegion lst)
   )
   (princ "\nEmpty selection...Try again...")
 )
 (vla-endundomark acDoc)
 (princ)
)

Link to comment
Share on other sites

There is this bit of code by Marko Ribar.

 

It will transform a Selection Set of lines to region.

Once you have region It's probably easy to transform them in

LWPolylines.

 

It is not foolproof and you have to explode your polylines to lines.

 

By the way, "Quickly" missed the train, so I'm afraid he'll be late!

 

ymg

 

; Create regions in a grid of lines   by Marko Ribar                          ;
; Will join the lines of a Voronoi Diagram into regions                       ;
; To be integrated in the Voronoi Generation routine                          ;

(defun c:intlines2regions ( / *error* ms ss i lst )
 (vl-load-com)
 (or acDoc (setq acDoc (vla-get-activedocument (vlax-get-acad-object))))
 (setq ms (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)))
 (vla-startundomark acDoc)
 
 (defun *error* (msg)
   (and
     msg
     (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*"))
     (princ (strcat "\nError: " msg))
     )
   (vla-endundomark acDoc)
   (princ)
   )
 
 (if
   (setq ss (ssget '((0 . "LINE"))))
   (progn
     (repeat (setq i (sslength ss))
       (setq lst (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) lst))
     )
     (vlax-invoke ms 'AddRegion lst)
   )
   (princ "\nEmpty selection...Try again...")
 )
 (vla-endundomark acDoc)
 (princ)
)

 

Thanks ymg3. It true with series lines but failed with both lines and plines. Check again,plz.

Be omitted some closed-plines!

Many thanks!

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