Jump to content

Converting Lines To Polylines


MR MAN

Recommended Posts

I have just tried the LISP, and find that once completed, the extra lines form part of the whole polyline...

 

The LISP contains:

 

      (if
    (and pt (wcmatch (cdadr (entget (entlast))) "*POLYLINE*"))
     (command "_.pedit" ename "j" (entlast) "" "")))

 

Which joins the newly created polyline with the existing one.

Link to comment
Share on other sites

  • Replies 37
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    12

  • bagulhodoido

    8

  • lpseifert

    4

  • ReMark

    3

----> Width is 0.00; error: no function definition: VLAX-CURVE-GETSTARTPOINT

 

Suddenly, somehow this /\ started to happen... o.O what would that be?

Link to comment
Share on other sites

Ahh yes make sure that the Visual LISP console is loaded (vl-load-com).

 

Either add it to the ACADDOC.lsp file, or at the start of the LISP itself.

 

As for the new polyline being created. - I have no idea - :huh: I am not sure really what could go wrong in such a routine, its such a simple routine.

Link to comment
Share on other sites

After the (vl-load-com) placed in the beggining of the lisp this started to happen.

 

Select source polyline:

Width is 0*Cancel*

; error: Function cancelled

 

OBS.: on the previous error the command didn't even worked, now it works, I draw the polyline and everything it just bugs in the end, causing the polylines to be splitted, maybe the first time I had this same error prompt and I didn't saw it, which would be making the polylines be splitted.

----edit---

 

My acad version is 2009 btw

Link to comment
Share on other sites

Haha, I see your mistake... maybe you can get away with pressing esc with in-built ACAD commands, but custom LISPs are a bit more "fragile" :)

 

I would recommend setting up a "right-click" customisation, so you can right-click to signal enter and thus exit the command, - makes things much easier. :thumbsup:

Link to comment
Share on other sites

I'm just so used to the ESC pressing, it's involuntary heheh... I got one hand in the mouse the other one in the left upper corner of the keyboard, my thumb just goes around the keyboard and press the shortcuts while my pinky insanely press ESC ESC ESC ESC on every action. :D

Link to comment
Share on other sites

  • 7 years later...

Lee,

 

Thanks for the code. Was browsing the forum and this was exactly what i was looking for!

 

Cheers

 

Jd

 

I accounted for if the user only picks one entity also, and so two statements are needed instead of one... also, I have to set the variable values at start and end.

 

A minor update:

 

(defun c:pj (/ varlist oldvars ss1)
   (setq varlist (list "cmdecho" "peditaccept")
     oldvars (mapcar 'getvar varlist)
   ) ;_  end setq
   (mapcar 'setvar varlist (list 0 1))
   (setq ss1 (ssget '((0 . "LINE"))))
   (if    (> (sslength ss1) 1)
   (progn
       (vl-cmdf "_pedit" "_M" ss1 "" "J" "0" "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Lines Converted. "))
   ) ;_  end progn
   (progn
       (vl-cmdf "_pedit" ss1 "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Line Converted. "))
   ) ;_  end progn
   ) ;_  end if
   (mapcar 'setvar varlist oldvars)
   (princ)
) ;_  end defun

 

Forgot to localise some variables and added a filter list. :oops:

Link to comment
Share on other sites

  • 7 months later...
Just a quick one:

 

(defun c:pj (/ ss1)
   (setq varlist (list "cmdecho" "peditaccept")
     oldvars (mapcar 'getvar varlist)
   ) ;_  end setq
   (mapcar 'setvar varlist (list 0 1))
   (setq ss1 (ssget))
   (if    (> (sslength ss1) 1)
   (progn
       (vl-cmdf "_pedit" "_M" ss1 "" "J" "0" "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Lines Converted. "))
   ) ;_  end progn
   (progn
       (vl-cmdf "_pedit" ss1 "")
       (princ (strcat "\n" (itoa (sslength ss1)) " Line Converted. "))
   ) ;_  end progn
   ) ;_  end if
   (mapcar 'setvar varlist oldvars)
   (princ)
) ;_  end defun

 

 

Hello Lee Mac... What is the name of this command? Is it a lisp?

Link to comment
Share on other sites

baih: That would be "pj" which stands for Polyline Join. It is one of three lisp routines combined into one master routine that is included in Lee's PolyToolsV1-0.lsp. The other two are Polyline Close (pc) and Polyline Width (pw).

Link to comment
Share on other sites

baih: That would be "pj" which stands for Polyline Join. It is one of three lisp routines combined into one master routine that is included in Lee's PolyToolsV1-0.lsp. The other two are Polyline Close (pc) and Polyline Width (pw).

 

Thanks for responding in my absence ReMark :thumbsup:

 

@baih0000, Please refer to the link I posted here.

Link to comment
Share on other sites

Okay thank you... Hope that you can figure out a visual lisp for multi-stretch lines... If you have it, kindly introduce me a link to your art-work... Thanks once again...

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