Lisp Question
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Lisp Question

 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD
Author Message
John
Guest





Posted: Sat Jan 15, 2005 10:00 am    Post subject: Lisp Question Reply with quote

I have a lisp question for you guys.

I am making a simple gcode generator. When I come to an arc I want to get
the end point by clicking on it, then I want to click the arc so I can
extract the radius information. I do this two step end then radius so that
I make sure I'm getting the endpoint I want and not the one Autocad thinks
it should be.

Here is how I am doing it:
(setq point (getpoint "Select Arc End:")) ;Prompt the
user to specify the arcs end point
(setq px (car point))
;Extract the X dimension
(setq py (cadr point))
;Extract the Y dimension
(setq pz (caddr point))
;Extract the Z dimension
(setq enam (car (entsel "\nSelect ARC: "))) ;Prompt the
user to select the arc
(Setq pr (cdr (assoc 40 (entget(entlast))))) ;Extract the
Radius dimension of selected arc

The darned thing isn't working though. Well it does and it doesn't.
When I select the arc with the entsel command it pretends to do something.
I don't get a nil or an error.
If I type in (entget(entlast)) I see whatever I edited last. If it was a
line I see the line, if it was mtext I see that.

If I type in (entsel "\nselect an object") then select an object, it still
doesn't choose that object. It gives no error, just keeps hanging onto
whatever I'd edited last.

So tell me, what the heck is the deal? Is it some environment variable I
need to set? Is my aperature to large? Why the heck will this stupid thing
not entsel what the heck I'm clicking on.
I even click on the arc using the midpoint osnap and it still
(entget(entlast)) whatever I last edited.

If you guys could help me with this I would be greatly appreciative. I'm
sure I've left some important info out, if so let me know.

Thanks,
John

Back to top
Jürgen Palme
Guest





Posted: Sat Jan 15, 2005 10:00 am    Post subject: Re: Lisp Question Reply with quote

Try this:

(setq pr (cdr (assoc 40 (entget enam))))


HTH
Juergen
Back to top
John
Guest





Posted: Sun Jan 16, 2005 7:14 am    Post subject: Re: Lisp Question Reply with quote

Yup, that did it. I kept trying to do the same thing, but in my ignorance I
kept trying to do it as:
(setq pr (cdr (assoc 40 (entget(enam))))) I see now why I shouldn't have
been putting teh variable into the parenthesis.

Thanks for your help. It did the trick for me.

John
"Jürgen Palme" <juergenDEL.palmeALL@kabelleipzigCAPS.de> wrote in message
news:34s7pbF4eckcoU1@individual.net...
Quote:
Try this:

(setq pr (cdr (assoc 40 (entget enam))))


HTH
Juergen



Back to top
Jürgen Palme
Guest





Posted: Sun Jan 16, 2005 10:00 am    Post subject: Re: Lisp Question Reply with quote

"John" <jwheasi@hotmail.com> schrieb im Newsbeitrag
news:6OqdneN0QYloUHTcRVn-pw@coosahs.net...
Quote:
Yup, that did it. ...

You're welcome

Juergen
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB