CoCreate User Forum

CoCreate User Forum (https://www.cocreateusers.org/forum/index.php)
-   Customization (https://www.cocreateusers.org/forum/forumdisplay.php?f=12)
-   -   sd-return-to-model-checkpoint function (https://www.cocreateusers.org/forum/showthread.php?t=8258)

kting 11-28-2016 07:58 PM

sd-return-to-model-checkpoint function
 
1 Attachment(s)
Hi~

I had programed one add-on apllication and used sd-set-model-checkpoint and sd-return-to-model-checkpoint functions to do return to the initial model state.When I to do that several time,the dialog pushing OK or CANCEL buttons did not to terminate the dialog and Modeling gave a Error message as below.Could anybody tell me why?
Attachment 1943

Andy Poulsen 12-02-2016 01:47 PM

Re: sd-return-to-model-checkpoint function
 
Hi kting,

How are you using it? I don't think I've seen that error message before, but I've seen similar messages when trying to return to a state that no longer exists. Perhaps with a little more detail we can solve it for you.

Thanks!

andy

kting 12-04-2016 04:05 PM

Re: sd-return-to-model-checkpoint function
 
1 Attachment(s)
Andy,

I tried to simplify the program code and found that would not appear the error again.See the attachmentAttachment 1944.
In the simplified code it only had to do command position_pa to translate one fixed length alone one direction.And in the old code it had to do command position_pa to translate and rotate and then to do subtract.
Maybe it's interrupted between the commands. I could not sure about that.

Andy Poulsen 12-05-2016 05:43 PM

Re: sd-return-to-model-checkpoint function
 
Thanks for the additional information.

I'm not totally sure why it would be giving you the error. However, one thing that I noticed that's different from the way I usually do things is that you're using sd-call-cmds to call your own function that then calls the Modeling commands.

The way I'd usually do that is in the push-action for doit_p, just call test_process, and then in the test_process function do something like this
Code:

(test_process ()
  (sd-call-cmds (position_pa ...  ))
  (sd-call-cmds (position_pa ...  ))
  (sd-call-cmds (other_modeling_function ....))
  )

This allows you to check the status at each step of the process to make sure you got the result you were expecting (and I believe it's more the way sd-call-cmds was intended to be used).

Also, I don't believe you need to include the :done in your position_pa function. Even though I don't believe it will cause an error, I don't think it does anything, either.

I hope this helps -- please let me know if you have more questions.

Thanks!

andy

kting 12-11-2016 03:52 PM

Re: sd-return-to-model-checkpoint function
 
1 Attachment(s)
Andy,

I tried to change the code as your suggestion to use sd-call-cmds in the test_process function and do not include the :done in the position_pa function.
Yes, the code was still work.
When I go to do that several time again,the dialog pushing OK or CANCEL buttons still did not to terminate the dialog and Modeling gave other Error message as below.
Attachment 1949

Andy Poulsen 12-12-2016 09:11 AM

Re: sd-return-to-model-checkpoint function
 
Interesting.

What do you have in ok-action and cancel-action? I wonder if something there is causing the error. Where do you set the initial state that you're trying to return to? That could be a potential cause of the problem as well.

kting 12-14-2016 06:15 PM

Re: sd-return-to-model-checkpoint function
 
The prolem is solved by Andy's warm-hearted help.
And the cause is not right way to use sd-set-model-checkpoint and sd-return-to-model-checkpoint functions in the code.

tom kirkman 12-19-2016 04:00 AM

Re: sd-return-to-model-checkpoint function
 
Can you share the code? I would like to learn from what you did.

Thanks

Tom


All times are GMT -8. The time now is 06:21 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.