Jump to content

Tough Questions - Polyline Lisps Needed


Recommended Posts

Posted

Tough Questions - Polyline Lisps Needed

 

 

AutoCAD 2007

I have a quite a few tough questions/requests and I am currently looking for some lisps to solve them. I have been doing some searching online to find the lisps I need, and although I have been able to find some stuff, I still have some things that I can't seem to find exactly what I am looking for. I would like to take the opportunity ahead of time to thank every who views my questions and for any help that is given.

 

 

1.) Global Width Polyline - Looking for a lisp that will ask the desired polyline global width needed and then ask you to select the polylines you need to set at that particular width.

 

2.) Polyline Join (In One Step) - Looking for a lisp that will allow you to select multiple lines, arcs, existing polylines and automatically convert them all to polylines, set join fuzz to 0, and join all the pieces selected to form one joined polyline all in one step.

 

3.) Add Arc Grip To Polyline - Looking for a list that will allow you to add both vertices grips and arc grips to a polyline. I have found a .vlx file that will allow me to add vertices to polylines, but I would like to be able to have one lisp that will allow me to do this, but also add arc grips as well.

 

4.) Polyline Close - Looking for a one step lisp to close polyline

Posted

1)

 

(defun c:pwid  (/ i ss ent)
 (vl-load-com)
 (or *wid (setq *wid 0.0))
 (if (and (setq i -1 ss (ssget "_:L" '((0 . "LWPOLYLINE"))))
          (not (initget 4))
          (setq *wid (cond (  (getdist (strcat "\nSpecify New Width <"
                                               (vl-princ-to-string *wid) "> : "))) (*wid))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (vla-put-ConstantWidth (vlax-ename->vla-object ent) *wid)))
 (princ))
          

Posted

4)

 

(defun c:cls (/ i ss ent)
 (vl-load-com)
 (if (setq i -1 ss (ssget "_:L" '((0 . "*POLYLINE"))))
   (while (setq ent (ssname ss (setq i (1+ i))))
     (vla-put-closed (vlax-ename->vla-object ent) :vlax-true)))
 (princ))

Posted

Thank you all for all your help.

Damn, Lee Mac, you are good. Thank you so much for your help.

I now have an answers to 3 out of 4 of my polyline questions.

The polyline join in one step is the final one. Believe me I have searched, and I have found quite a few, but none I have found work 100%. This is the best one I found but for some reason it only works with straight lines. Anytime I try to join an arc to my lines the lisp kicks back. Which is what lead me to the forums. I see "ARC" in the lisp.

Sorry don't know how to enclose the lisp with a window. Code: I was told to enclose the text with [] but didn't work

 

 

 

(defun c:polyjoin (/ sspj frstent frstentdat)

(princ "nPL join...")

(princ "nSelect objects...")

(setq sspj (ssget))

(setq frstent (ssname sspj 0)

frstentdat (entget frstent)

) ;_ end of setq

(cond

((= (cdr (assoc 0 frstentdat)) "POLYLINE")

(command "_pedit" frstent "_j" sspj "" "")

)

((= (cdr (assoc 0 frstentdat)) "LWPOLYLINE")

(command "_pedit" frstent "_j" sspj "" "")

)

((= (cdr (assoc 0 frstentdat)) "LINE")

(command "_pedit" frstent "_y" "_j" sspj "" "")

)

((= (cdr (assoc 0 frstentdat)) "ARC")

(command "_pedit" frstent "_y" "_j" sspj "" "")

)

(T (princ "nCan't join this!!..."))

) ;_ end of cond

(princ)

) ;_ end of defun

Posted
(defun c:pljoin (/ *error* vl ov ss)

 (defun *error* (msg)
   (and ov (mapcar 'setvar vl ov))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ))

 (setq vl '("CMDECHO" "PEDITACCEPT") ov (mapcar 'getvar vl))
 (mapcar 'setvar vl '(0 1))
 
 (if (setq ss (ssget "_:L" '((0 . "LINE,ARC,LWPOLYLINE"))))
   (vl-cmdf "_.pedit" "_M" ss "" "_J" 0.0 ""))

 (mapcar 'setvar vl ov)
 (princ))

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