CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 12-20-2007, 11:15 PM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 378
Lisp tool for coloring ALMOST perfect...

Hi,

By using Tools > Customize > New.... I made a simple button in OSD that will give the Active Part a random color each time I click it. Saves some time when doing a quick and dirty modeling job
It works great, except for the fact that I have to click in the Viewport before anything happens. So, I press my new button AND click somewhere in the Viewport, and then my Active Part has a new color.
Is there a trick to make the button work without the 2nd click???
Here's the code that's used in the button:

Code:
(ELAN::SET_PART_COLOR (OLI::SD-INQ-CURR-PART) :RGB
    (FRAME2::GPNT3D (LISP::RANDOM 1.0) (LISP::RANDOM 1.0)
        (LISP::RANDOM 1.0))
    :DONE)
Thanks!
Regards,
Jaap
Reply With Quote
  #2  
Old 12-21-2007, 10:54 AM
Andy Poulsen Andy Poulsen is offline
Administrator
 
Join Date: Apr 2003
Location: Fort Collins, Colorado
Posts: 256
Re: Lisp tool for coloring ALMOST perfect...

Hi Jaap,

I believe this will do the trick for you:
Code:
(progn
  (ELAN::SET_PART_COLOR (OLI::SD-INQ-CURR-PART) :RGB
    (FRAME2::GPNT3D (LISP::RANDOM 1.0) (LISP::RANDOM 1.0)
        (LISP::RANDOM 1.0))
    :DONE)
  (update_screen))
You just need to tell OSM to update the screen (which clicking in the viewport will also do).

The other thing to note is that when you assign code to a button, it expects a single command, which is why the "progn" statement (along with its closing parenthesis) is needed -- the (progn ...) statement allows your color randomizer and the update_screen call to be passed as a single command to the customization interface. (I know you're aware of what (progn ...) does, but maybe this will help some others who are just getting started!)

I hope this helps!

Merry Christmas and Happy New Year everyone!

andy
__________________
Andy Poulsen
AI MAXTools: Dream. Design. Done. It's that easy!
Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v15-v20!
See them in action at www.ai-maxtools.com and then try them for yourself!
Reply With Quote
  #3  
Old 01-07-2008, 01:30 AM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 378
Re: Lisp tool for coloring ALMOST perfect...

Hi,

YES!! This is working perfectly :-)
Thanks!
Regards,
Jaap
Reply With Quote
  #4  
Old 01-16-2008, 09:00 AM
tom kirkman's Avatar
tom kirkman tom kirkman is offline
Registered User
 
Join Date: Oct 2002
Location: Perrysburg, Ohio
Posts: 369
Re: Lisp tool for coloring ALMOST perfect...

Jaap

Out of curiosity, what is Elan: used for? What does it mean.


Thanks

Tom
__________________
Tom Kirkman

Creo Elements/Direct 19.0
DELL Precision 7510
Reply With Quote
  #5  
Old 01-16-2008, 11:22 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Lisp tool for coloring ALMOST perfect...

Quote:
Originally Posted by tom kirkman View Post
Jaap
Out of curiosity, what is Elan: used for? What does it mean.
These are package specifications, the Lisp equivalent to "namespaces" in other programming languages. And package names such as "ELAN" or "FRAME2", as in the example above, mean that undocumented and unsupported functionality is used, which I'd definitely recommend to stay away from.

Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #6  
Old 01-16-2008, 11:25 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 704
Re: Lisp tool for coloring ALMOST perfect...

Quote:
Originally Posted by tom kirkman View Post
Out of curiosity, what is Elan: used for? What does it mean.
It is a lisp package. Same as OLI or LISP or my-package. But in most of the cases the package specification is not needed, because the functions are exported.

so:
PHP Code:
(in-package :my-tools)
(use-
package :oli)
(
progn
  
(SET_PART_COLOR (SD-INQ-CURR-PART) :RGB
    
(GPNT3D (RANDOM 1.0) (RANDOM 1.0) (RANDOM 1.0)) :DONE)
  (
update_screen)) 
would be the same. But then you need a lisp file.. or so. But jaap put it into a new available command, created interactively. Then all the lisp-packages are added explicit.
Reply With Quote
  #7  
Old 01-16-2008, 11:35 AM
tom kirkman's Avatar
tom kirkman tom kirkman is offline
Registered User
 
Join Date: Oct 2002
Location: Perrysburg, Ohio
Posts: 369
Re: Lisp tool for coloring ALMOST perfect...

Thanks

This clears up several other lisp programs I had questions with.

Tom
__________________
Tom Kirkman

Creo Elements/Direct 19.0
DELL Precision 7510
Reply With Quote
  #8  
Old 01-17-2008, 12:04 AM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 378
Re: Lisp tool for coloring ALMOST perfect...

Hi,

thanks Wolfgang, now I understand it myself
It was recorded in the Tools > Customize menu, indeed, because I knew from earlier experiments that some of the package specifications seem to be necessary.
Kind regards,
Jaap
Reply With Quote
  #9  
Old 03-04-2008, 12:46 PM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 704
Re: Lisp tool for coloring ALMOST perfect...

To colorize all parts within an assembly, or a selected set of parts, by using a random color (or one set) there an old and a new tool available at http://osd.cad.de/index.en.htm

Have a look to
Reply With Quote
  #10  
Old 03-05-2008, 04:48 AM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 378
Re: Lisp tool for coloring ALMOST perfect...

Hi,

that's a nice tool! We use a tool that's very similar, but your tool has more options.
Thanks for the hint!
Kind regards,
Jaap
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:11 PM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
You Rated this Thread: