Hi Chris,
Try your routine in a new file, whit a few conected lines or arcs,
what it does is to search in the entire drawing to see if some lines or
arc is conected to the one you were prompted to select, in large files
this can take a loooooooooooooong time to do.
Saludos
Marco Jacinto
"Chris Tellers" escribió en el mensaje
news:D8EC188F3CC3847335BEA7CAD48689F4@in.WebX.maYIadrTaRb...
> I found this lisp on the interenet. It seems like it should work I just
> need some help tweaking it in to work in 2004. Could someone please take
a
> look at it and tell me what I need to fix to get it working.
>
> It basically looks like it gets stuck in the loop.
>
> Thanks in advance
>
> Chris
>
>
----------------------------------------------------------------------------
----
;CHAIN.LSP By Brian Carlson 5/18/88
;Selects a group by finding all chained endpoints
;-------------------------------------------------------------------------
; Return contents of the entity field "num".
(defun fld (num)
(cdr (assoc num d))
)
;-------------------------------------------------------------------------
(Defun C:CHAIN ()
(setvar "cmdecho" 0)
(setq snapsav (getvar "snapmode"))
(setq ss (ssadd))
(setq Z (entsel "\nPick an object in the chain: "))
(setq ss (ssadd))
(setq ss (ssadd (car Z)))
(setq d (entget (car Z)))
(if (or (= (fld 0) "LINE")(= (fld 0) "ARC")) ;look for lines,arcs
(progn
(setq OA (fld 10))
(setq OB (fld 11))
)
(*error* "Entity selected was not a line or arc")
)
(prompt "\n Scanning For Objects in Chain: ")
(setq x (entnext))
(while x
(setq e (entnext)) ; First object in drawing
(while e
(setq d (entget e)) ; Get entity's data groups
(if (or (= (fld 0) "LINE")(= (fld 0) "ARC")) ;look for lines,arcs
(progn
(setq A (fld 10)) ;get endpoint
(setq B (fld 11)) ;get endpoint
(if (or (equal A OA 0.015) (equal B OB 0.015)
(equal B OA 0.015) (equal A OB 0.015))
(progn (ssadd e ss)
(setq OA A) (setq OB B))
) ;close if
) ;close progn
) ;close IF
(setq e (entnext e)) ;not a line or arc get next entity
(prompt ".") ;let us know its working
) ;close while e
(setq x (entnext x)) (prompt "\nnew X ")
) ;close while x
(setq O (getstring "\nOperation to perform: "))
(setvar "snapmode" snapsav)
(command O ss "")
(setvar "cmdecho" 1)
(princ) ;leave quietly
)