Plugin infinite loop (intentional) causes Sketchup to hang
-
Hey,
So, I'm running the following code within a *.rb file":
UI.menu("Plugins").add_item("Test"){ sleep 1 puts "Testing" counter = 0 while true do puts counter counter = counter + 1 sleep 1 end }This is a simple script to just test the capabilities.
What happens, is that SU becomes unresponsive while this is running (which makes sense), but I'm curious as to how people get plugins to run code constantly. My end project is a plugin which receives real-time data and acts upon it, so this small step is very important.
Any help is appreciated and sorry if it seems like a silly question, thanks! -
I think that there are basically three ways to run things outside of the main process...
. Various Observers watch in the background waiting for some event to trigger an action.
' UI class timer runs a process in parallel.
' Animation class runs in parallel affecting the camera [typically]...What sort of 'continual process' did you have in mind ?
-
Basically, I'll be receiving a string via TCP constantly, interpreting the string, and then drawing shapes based upon the string. I don't think that falls into any of those categories, am I out of luck?
-
The fourth possibility...

Use a webdialog to receive your data-stream, running callbacks that do something inside the SKP...
There are a few video examples, if you search the web.
I've seen stock-prices streamed in to make a webdialog [off-screen] draw a 3d block graph in real time...
Perhaps start looking from here https://sites.google.com/site/sketchupsage/resources
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement