#1
|
||||
|
||||
Automate loading command reference?
Hi.
I found this command useful for making customized command. Code:
(oli:sd-online-reference) Thank you.
__________________
Toshi |
#2
|
||||
|
||||
Re: Automate loading command reference?
Place the line in your sd_customize file and it will load everytime
Tom
__________________
Tom Kirkman Creo Elements/Direct 20.1 Dell Precision 3581 https://www.o-i.com |
#3
|
||||
|
||||
Re: Automate loading command reference?
Thank you, Tom.
Best regards.
__________________
Toshi |
#4
|
||||
|
||||
Re: Automate loading command reference?
The loading was done as follow;
Code:
;; The Label be turned off at start up (set_show (oli:sd-inq-current-vp) :3dgeo_label :off) ;; Show lisp on line reference (oli:sd-online-reference) ;; for sd_customize: have a rigthmouse button context menu for sharing/copying parts (oli::sd-set-cmd-specific-context-menu-entries ------etc------ And this was the default action for the same command anyway. But is there any way I can disallow the pop-up dialogue box? Thank you for your attention.
__________________
Toshi |
#5
|
|||
|
|||
Re: Automate loading command reference?
Quote:
Code:
(display :hide) You can also clear the display box by using the command Code:
display :clear 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 v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#6
|
||||
|
||||
Re: Automate loading command reference?
Thank you, Andy.
I recoded what I do with the message box, then I got a line of this. (display :clear-hide ) Which is equivalent of pressing clear and close button. But by writing this even at the end of the sd_customize file, it does not erase the message box. I seem to need to lag the timing slightly behind than this sd_customize excursion. Any idea available? Thank you.
__________________
Toshi |
#7
|
|||
|
|||
Re: Automate loading command reference?
Quote:
As far as delaying the closing of the box, one way is to use events (which is really quite a bit beyond the scope of beginning programming... but I guess we can tale a look at it!) What you want is for Modeling to do something when it finishes loading, or in other words, when it is waiting for the user to enter a command. Modeling allows you to do this using events (actually, events are triggered for a bunch of different things, but we'll only worry about this one for now). The event that we are interested in is the *SD-ENTER-COMMAND-EVENT* which is triggered when Modeling returns to the "Enter Command" state i.e. waiting for the user to do something (at the top level -- no other commands are active). First, we'll need a function to call when this event is triggered, and then we'll need to subscribe that function to the correct event. Something like this should do the job: Code:
(defun my-clear-hide (&rest args) ;; unsubscribe this function from the enter-command event ;; so that the output box doesn't get hidden EVERY time a ;; a command finishes -- there may be useful information there! (display "test for you from function") (oli:sd-unsubscribe-event *SD-ENTER-COMMAND-EVENT* 'my-clear-hide) ;; now clear the display box and close it (display :clear-hide) ) ;; now subscribe the above function to the enter command event (oli:sd-subscribe-event *SD-ENTER-COMMAND-EVENT* 'my-clear-hide) This is getting into more advanced stuff, but if you keep it simple you should be fine! I hope this helps! 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 v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#8
|
||||
|
||||
Re: Automate loading command reference?
Hi, Andy.
Thank you for the effort. I saw the help and try to understand it at the section of SD-SUBSCRIBE-EVENT, but no avail. In fact your code pops up new error, and I could not solve it by myself. Any clue?
__________________
Toshi |
#9
|
||||
|
||||
Re: Automate loading command reference?
I used these instead and the above mentioned error message disappeared but the original issue persists.
Code:
;; Show lisp on line reference (oli:sd-online-reference) (defun my-clear-hide (&rest args) ;; unsubscribe this function from the enter-command event ;; so that the output box doesn't get hidden EVERY time a ;; a command finishes -- there may be useful information there! (display "test for you from function") (oli:sd-unsubscribe-event "*SD-ENTER-COMMAND-EVENT*" 'my-clear-hide) ;; now clear the display box and close it (display :clear-hide) ) ;; now subscribe the above function to the enter command event (oli:sd-subscribe-event "*SD-ENTER-COMMAND-EVENT*" 'my-clear-hide) Thank you.
__________________
Toshi |
#10
|
|||
|
|||
Re: Automate loading command reference?
Quote:
My apologies! When I posted the above (untested!) code, I forgot to reference the event definitions -- they are (I believe) in the oli package, which is why they threw an error. The reason quoting the event doesn't work is that when you do that, you've subscribed to a string value rather than to a defined event! So no error occurs, but the "event" (i.e. string you quoted) never occurs, so the function is never called. So, the way to fix this issue is: rather than quoting the event when subscribing/unsubscribing, you just need to reference the correct (i.e. oli) package where the event is defined: Code:
;; Show lisp on line reference (oli:sd-online-reference) (defun my-clear-hide (&rest args) ;; unsubscribe this function from the enter-command event ;; so that the output box doesn't get hidden EVERY time a ;; a command finishes -- there may be useful information there! (oli:sd-unsubscribe-event oli:*SD-ENTER-COMMAND-EVENT* 'my-clear-hide) ;; now clear the display box and close it (display :clear-hide) ) ;; now subscribe the above function to the enter command event (oli:sd-subscribe-event oli:*SD-ENTER-COMMAND-EVENT* 'my-clear-hide) By the way, if you're writing code using your own lisp package, if you have the line (use-package :oli) at the top of your file, you don't need to put the "oli:" in front of your function and variable references. With what we're doing here, we need to reference the oli: package because the sd_customize file is executed using the default lisp package... Merry Christmas one and all! 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 v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#11
|
||||
|
||||
Re: Automate loading command reference?
Merry Christmas!
Hi, thanks for your last response. But it seems it does not erase the dialog box, yet. How about changing the approach to time lag command launch? Is there any way I can time bomb the command after certain time is elapsed? If it does, all I need to do is to shorten the time so it won't let user to see the dialog. Any idea...? Perhaps, next year....
__________________
Toshi |
#12
|
||||
|
||||
Re: Automate loading command reference?
One more thing which destroy my time bomb idea...
I put (display :clear-hide) in am_customized with which I hoped to erase the output dialog. But it was in vain. It seems that your code also is working fine, but writing this (display :clear-hide) in any where may not be working toward hiding the dialog at all. Am I not at the right track?
__________________
Toshi |
#13
|
||||
|
||||
Re: Automate loading command reference?
Hi there,
a different, though probably *unsupported* approach could be to directly insert the action command into the toolbox, without a display message: Code:
(ADD_TOOLBOX_BUTTON :ACTION "online_reference" :LABEL "Online Reference ...") This might not be supported. Last edited by ChrisE; 12-28-2009 at 05:06 PM. Reason: Solution "might" not be supported (rather than "it is") |
#14
|
||||
|
||||
Re: Automate loading command reference?
Regarding the event trigger approach by Andy:
In my case, oli:*SD-ENTER-COMMAND-EVENT* gets called 10 times, after loading my personal sd_customize ! The online reference display message gets shown after the n-th event, not directly after the first event triggered. Trying to inquire the status of the display box using e.g. Code:
(when (oli:sd-dialog-shell-visible-p "OUTPUT-BOX") (oli:sd-unsubscribe-event oli:*SD-ENTER-COMMAND-EVENT* 'my-clear-hide) (display :clear-hide) ) |
#15
|
|||
|
|||
Re: Automate loading command reference?
Quote:
In fact, I put the call to load the online reference as the first thing in my sd_customize file, then loaded a bunch of other things (some of which added output to the display box). Sure enough, the online reference was the very last thing done, even though it was called first... So this is indeed a very curious situation... At this point, I think Chris' solution just to add the button directly to the toolbox is your best bet, and shouldn't create any problems... (though I thought that "add_toolbox_button" was a supported function, even though I didn't see it in a quick glance through the help files...)
__________________
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 v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|