Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Chain Picking Again

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
291 Views, 8 Replies

Chain Picking Again

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
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

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
)
Message 3 of 9
Anonymous
in reply to: Anonymous

Would it be easy to make it just look for entities that are touching the
selected entity.

Thanks
Chris

"Marco Jacinto" wrote in message
news:9A85A01B11901AB806E659170E276F47@in.WebX.maYIadrTaRb...
> 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
> )
>
>
Message 4 of 9
Anonymous
in reply to: Anonymous

Chris Tellers wrote:

> Would it be easy to make it just look for entities that are touching the
> selected entity.

Yes.

Terry
Message 5 of 9
Anonymous
in reply to: Anonymous

Here is a routine that was give to me by J.H.
Message 6 of 9
Anonymous
in reply to: Anonymous

Would you care to give me a nudge in the right direction?

Thanks
Chris

"Terry W. Dotson" wrote in message
news:3FCE8780.2C7E0063@.soft.com...
> Chris Tellers wrote:
>
> > Would it be easy to make it just look for entities that are touching the
> > selected entity.
>
> Yes.
>
> Terry
Message 7 of 9
Anonymous
in reply to: Anonymous

For starters, get the endpoints of the selected object. Then use an (ssget)
filter to select any other objects that share those endpoints.
___

"Chris Tellers" wrote in message
news:6C81A312406EB8AA0918002D46AEE648@in.WebX.maYIadrTaRb...
> Would you care to give me a nudge in the right direction?
Message 8 of 9
Anonymous
in reply to: Anonymous

Chris,

Look at what Bill posted. I think it's the answer to your question. BTW, it can
be modified to work with plines.

Joe Burke


"Chris Tellers" wrote in message
news:6C81A312406EB8AA0918002D46AEE648@in.WebX.maYIadrTaRb...
> Would you care to give me a nudge in the right direction?
>
> Thanks
> Chris
>
> "Terry W. Dotson" wrote in message
> news:3FCE8780.2C7E0063@.soft.com...
> > Chris Tellers wrote:
> >
> > > Would it be easy to make it just look for entities that are touching the
> > > selected entity.
> >
> > Yes.
> >
> > Terry
>
>
Message 9 of 9
Anonymous
in reply to: Anonymous

OK

I will give it a look and see what I can come up with.

Thanks everyone for the help.

Chris

"Joe Burke" wrote in message
news:FD20352A8F0176307342BF3BF9C81A91@in.WebX.maYIadrTaRb...
> Chris,
>
> Look at what Bill posted. I think it's the answer to your question. BTW,
it can
> be modified to work with plines.
>
> Joe Burke
>
>
> "Chris Tellers" wrote in message
> news:6C81A312406EB8AA0918002D46AEE648@in.WebX.maYIadrTaRb...
> > Would you care to give me a nudge in the right direction?
> >
> > Thanks
> > Chris
> >
> > "Terry W. Dotson" wrote in message
> > news:3FCE8780.2C7E0063@.soft.com...
> > > Chris Tellers wrote:
> > >
> > > > Would it be easy to make it just look for entities that are touching
the
> > > > selected entity.
> > >
> > > Yes.
> > >
> > > Terry
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report