getoint print

getoint print

Anonymous
Not applicable
1,333 Views
10 Replies
Message 1 of 11

getoint print

Anonymous
Not applicable

Bonjour, voici mon problème:

Je fais (setq a(getpoint "")), j'obtiens une coord x,y,z

Je fais (print a), j'obtiens deux fois le résultat (x,y,z) (x,y,z)

le lisp plante "bad argument"

Merci de répondre (voir image)

al

question.jpg

john.vellek has embedded your image(s) for clarity

0 Likes
1,334 Views
10 Replies
Replies (10)
Message 2 of 11

ronjonp
Mentor
Mentor

Wild guess...image.png

0 Likes
Message 3 of 11

Anonymous
Not applicable

Try this:

(setq a (getpoint))
(print a )(princ)
0 Likes
Message 4 of 11

Anonymous
Not applicable

Voici le lisp complet, il s'agit d'une routine inscrivant l'azimut sur la ligne tracée.

Merci de votre attention.

0 Likes
Message 5 of 11

Anonymous
Not applicable
Accepted solution

@Anonymous 

What is your goal ? Could it be a bit more clear? Robot Frustrated

0 Likes
Message 6 of 11

Anonymous
Not applicable
Accepted solution

Allô,

le but;

tracer une ligne entre deux points choisis, et obtenir inscrit sur le plan la distance et l'azimut sous la ligne. KC est un facteur échelle.

Meci

0 Likes
Message 7 of 11

ronjonp
Mentor
Mentor
Accepted solution

Post a drawing with the steps and result.

0 Likes
Message 8 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

Voici le lisp complet....


 

I started to look at it -- there is a variable called AR that is not set by anything.  Is that coming from outside the routine?

Kent Cooper, AIA
0 Likes
Message 9 of 11

Anonymous
Not applicable
Accepted solution

C'est l'arrondi entré manuellement ar=.0005

Désolé.

Le résultat doit être une ligne avec le gisement et la distance au dessus.

merci

0 Likes
Message 10 of 11

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

....

Je fais (print a), j'obtiens deux fois le résultat (x,y,z) (x,y,z)

....

question.jpg


 

Going back to the original message....

 

Getting the result two times is just how (print) works by itself [read about it and (prin1) and (princ) in the AutoLisp Reference -- it prints to the command line and returns the result to the command line [again] if no file destination is specified, and that return is the second one you see].  If it's used at the end of an AutoLisp routine, the (princ) with no arguments that was suggested is a way to "exit quietly" and not see the second copy of it.

 

Since there are no (print) functions in the code you posted, I don't understand what it has to do with that -- does the code not work?

 

By the way, you don't need to supply an empty string [""] as a prompt if you don't want one in a (getpoint) function.  Just use (getpoint) without anything about a prompt at all.

 

Also, in your GDSOLM.lsp code, there are many things you could simplify.  For example, in lines like this:

(IF (<= DID 1) (SETQ DEC (STRCAT "000" (ITOA DID))) (SETQ DID DID))

 

the (SETQ DID DID) part does nothing for you.  It is the 'else' expression, i.e. what to do if the test expression fails.  But it does nothing to set a variable to itself.  You do not need to supply an 'else' expression at all -- you can just leave it to do nothing if the test fails:


(IF (<= DID 1) (SETQ DEC (STRCAT "000" (ITOA DID))))

 

[Look into the (cond) function for a much more efficient way to set DEC depending on the possible ranges of the value of DID.]

Kent Cooper, AIA
0 Likes
Message 11 of 11

Anonymous
Not applicable
Accepted solution

Merci du temps consacré, ma grande interrogation est de savoir si cette routine lisp fonctionne sur votre autocad. Il me semble que mes routines lsp fontionnaient en Adad10 (2D) avant!!!! Merci encore

 

0 Likes