default text

I've done this, but I have forgotten.

I want to have a default text input for a lisp routine. I am wanting a routine that draws an arrow and places text for roof pitches. If I remember, I have before set a global variable the first time through a routine and if the variable IS SET the getstring uses it in the prompt with a simple return using the default.

but the exact syntax escapes me at the moment.

make me feel real stupid. sample code snippet handy?

thanks.

roy

Reply to
roy
Loading thread data ...

I believe we have what you're looking for at

formatting link
It's not Lisp but it should serve your purpose. All the features are described on the site. The software is free to use for 30 days.

Regards, snipped-for-privacy@caddproductivity.com

roy wrote:

Reply to
mark

Hello, i can give you a sample code :

*/;/**/****************************************************************************/* */;/**/;§**/divers//**/ modified /**/getstring/**/ /**/ to keep las value in memory and purpose it as default /**//msg/**/ /**/var/* */;/**/**/**/ /**/argument/**/ /**/:/**/ /**/"message"/**/ /**/"varname"/* */;/**/** return : the variable value /**/

/*(*defun* pw_getstringmem ( msg var / tmp iget strdef ) (*if* (*eval* (*read* var)) (*setq* strdef (*eval* (*read* var)) iget *0*) */;/**/;/**/ /**/0/**/ value don't change anything /* (*setq* strdef *"**"* iget *1*) */;/**/;/**/0/**/ value suppress the possibility of return/* ) (*initget* iget) (*setq* msg (*strcat* msg *"**** **:"*)) (*while* (= *"**'"* (pw_1stcara (*setq* tmp (*getstring* 't msg)))) */;/**/;if the user zoom inside the command /*(*Prompt* *"**\ncannot** **enter** **zoom** **command"*) ) (*if* (/= tmp *"**"*) (*set* (*read* var) tmp) ) (*eval* (*read* var)) )

*/;/**/;end code***************************************************************************/*

This routine contains also pw_1stcara that is defined in Powerclic library if you don't wish to install powerclic, you can remove the possibility to intercept zoom command Now this is a sample using pw_getstringmem and creating an aligned dimension:

*/;/**/;sample/**/ /**/of/**/ /**/routine/**/ /**/using/**/ /**/pw_gestringmem/* (*defun* c:mydim ( ) (*if* (*not* mydimtext) (*setq* mydimtext *"**Mydefaultvalue"*) ) (*command* *"**_dim"* *"**_aligned"* pause pause pause) (pw_getstringmem *"**\nDimension** **texte** **value** **?"* *"**mydimtext"*)*/;/**/;note/**/ /**/that/**/ /**/mydimtext/**/ /**/is/**/ /**/entered/**/ /**/as/**/ /**/string/* (*command* mydimtext) (*command* *"**_exit"*) )

What you must also note is that varname used by *pw_getstringmem* are global variable, don't give it a short name like "str" ... PowerClic library contains several commands like pw_getstringmem :

*pw_getintmem pw_getkwordmem pw_getrealmem pw_getdistmem * They can be used the same way

Gérald

Reply to
gegematic

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.