Edit
Attach
Printable
topic end
<!-- * Set TOPICTITLE = #define private public - And... Action! (31 Aug 2009) --> <style type="text/css"> pre {background-color:#ffeecc;} </style> %STARTINCLUDE% <a name="31"></a> ---+++ [[DefinePrivatePublic20090831AndAction][And... Action!]] (31 Aug 2009) <summary> Duck and cover! Another mini-series approaching! My apologies to users of <nop>CoCreate Modeling who tried to find some _meat_ for them in the <a href="http://www.clausbrod.de/Blog/DefinePrivatePublic20090828PackageRiddle4">package riddle</a> series for them - there wasn't any, as that series was strictly meant for Lisp geeks. Sorry! This new series covers programming fundamentals as well. If you ever wanted to understand how Common Lisp functions like =print= and <nop>CoCreate Modeling commands such as =extrude= differ and how they interact, you've come to the right place. </summary> Reader highway45 recently came up with a [[http://ww3.cad.de/foren/ubb/Forum92/HTML/000548.shtml][very interesting observation]] (abridged and translated from German): <blockquote><i> Usually, I call a dialog like this: <tt>(set_pers_context "Toolbox-Context" function)</tt> Or like this: <tt>function</tt> As soon as I add parentheses, however, the "ok action" will be called: <tt>(function)</tt> </i></blockquote> <img src="%ATTACHURLPATH%/extrude.png" alt="extrude.png" width="152" height="259" style="float:right;" /> When highway45 talks of "functions" here, he actually means commands like =extrude= or =turn=. So, <tt>(set_pers_context "Toolbox-Context" extrude)</tt>? Really? Wow! =set_pers_context= is an internal <nop>CoCreate Modeling function dealing with how UI elements for a given command are displayed and where. I was floored - first, by the fact that an end user found a need to call an internal function like this, and second, because that magic incantation indeed works "as advertised" by highway45. For example, try entering the following in <nop>CoCreate Modeling's user input line: <pre> (set_pers_context "Toolbox-Context" extrude) </pre> Lo and behold, this will indeed open the =Extrude= dialog, and <nop>CoCreate Modeling now prompts for more input, such as extrusion distances or angles. What's so surprising about this, you ask? If you've used <nop>CoCreate Modeling for a while, then you'll know that, as a rule of thumb, code enclosed in parentheses won't prompt for more input, but will instead expect additional parameters in the command line itself. For example, if you run =(extrude)= (with parentheses!) from the user input line, Lisp will complain that the parameter "DISTANCE is not specified". But in highway45's example, there clearly _was_ a closing parenthesis after =extrude=, and yet the Extrude command started to prompt! So is =set_pers_context= some kind of magic potion? Try this: <pre> (print extrude) </pre> The Extrude dialog opens and prompts for input! Seems like even =print= has magic powers, even though it's a plain ol' [[http://l1sp.org/cl/print][Common Lisp standard function]]! Well, maybe there is something special about all built-in functions? Let's test this out and try a trivial function of our own: <pre> (defun foobar() 42) (foobar extrude) </pre> Once more, the dialog opens and awaits user input! So _maybe_ it is neither of =set_pers_context=, =print= or =foobar= that is magic - but instead =extrude=. We'll tumble down that rabbit hole next time. [[DefinePrivatePublic20090908AndActionPart2][<i>To be continued...</i>]] --- %STOPINCLUDE% %COMMENT{type="below" nonotify="on"}% ---
to top
End of topic
Skip to action links
|
Back to top
Edit
|
Attach image or document
|
Printable version
|
Raw text
|
Refresh
|
More topic actions
Revisions: | r1.4 |
>
|
r1.3
|
>
|
r1.2
|
Total page history
|
Backlinks
You are here:
Blog
>
DefinePrivatePublic20090831AndAction
r1.4 - 08 Sep 2009 - 21:26 -
ClausBrod
to top
Blog
This site
2017
:
12
-
11
-
10
2016
:
10
-
7
-
3
2015
:
11
-
10
-
9
-
4
-
1
2014
:
5
2013
:
9
-
8
-
7
-
6
-
5
2012
:
2
-
10
2011
:
1
-
8
-
9
-
10
-
12
2010
:
11
-
10
-
9
-
4
2009
:
11
-
9
-
8
-
7
-
6
-
5
-
4
-
3
2008
:
5
-
4
-
3
-
1
2007:
12
-
8
-
7
-
6
-
5
-
4
-
3
-
1
2006:
4
-
3
-
2
-
1
2005:
12
-
6
-
5
-
4
2004:
12
-
11
-
10
C++
CoCreate Modeling
COM & .NET
Java
Mac
Lisp
OpenSource
Scripting
Windows
Stuff
Changes
Index
Search
Maintenance
Impressum
Datenschutzerklärung
Home
Webs
Atari
Blog
Claus
CoCreateModeling
Klassentreffen
Main
Sandbox
Sommelier
TWiki
Xplm
Jump:
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback