Author Topic: Pedit in Visual Lisp??  (Read 2841 times)

0 Members and 1 Guest are viewing this topic.

sparky

  • Guest
Pedit in Visual Lisp??
« 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.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Pedit in Visual Lisp??
« Reply #1 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" "" "")
TheSwamp.org  (serving the CAD community since 2003)

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: Pedit in Visual Lisp??
« Reply #2 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 "")
    )
  )