TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: sparky on September 13, 2004, 01:53:58 PM

Title: Pedit in Visual Lisp??
Post by: sparky on September 13, 2004, 01:53:58 PM
Have a heap of layers with lines and/or plines.  Want to go through them all turning all lines into plines and then join connecting segments into plines. I can do this with the pedit command but can't get the following to work...it crashes at the pedit command:

Code: [Select]

(setq layname (getstring T "Enter Layer name: "))
(setq layss (ssget "X" (list (cons 8 layname))))
(command "pedit" layss "" "Y" "J" layss "" "")



Wanted to use aloop to go through a list of layer names but that was a bit ambitios to start off with!

Any suggestions on availbale ActiveX methods to do the pedit->join bit??

Would save me a heap of time if I ever came to do it again (I've already done most of the layers manually, using a lisp selection set expression return value at the 'pick objects: ' prompt.  Works but need more automation!

Hope that above is clearly expressed.
Title: Pedit in Visual Lisp??
Post by: Mark on September 13, 2004, 03:32:13 PM
Try something like this.
Code: [Select]


(setq layname (getstring T "Enter Layer name: "))

;do lines first
(setq layss (ssget "X" (list (cons 8 layname)(cons 0 "LINE"))))
(command "_.pedit" "M" layss "" "Yes" "J" "" "")

;the plines
(setq layss (ssget "X" (list (cons 8 layname)(cons 0 "LWPOLYLINE"))))
(command "_.pedit" "M" layss "" "J" "" "")
Title: Re: Pedit in Visual Lisp??
Post by: Jeff_M on September 13, 2004, 03:48:50 PM
Quote from: sparky

Wanted to use aloop to go through a list of layer names but that was a bit ambitios to start off with!


Feed your layer names and fuzz factor to this routine. Such as:
(join-em "SampleLayer" 0.25) or
(join-em "Floor1-ducts" 0)

Code: [Select]

(defun join-em (layr fuzz / ss)
  (if (setq ss (ssget "x" (list '(0 . "LINE")(cons 8 layr))))
    (command "pedit" "m" ss "" "y" "")
    )
  (if (setq ss (ssget "x" (list '(0 . "*POLYLINE")(cons 8 layr))))
    (command "pedit" "m" ss "" "j" fuzz "")
    )
  )