Mysterious Bug [followme related]
-
@chris88 said:
Do you think the gaps could be the reason for the bug?
Don't think so. Just a sidenote. It is possible to create that shape in one operation.
-
Alright replace the load loop with this ...
# run when file loads # prevdir = Dir.getwd Dir.chdir Sketchup.find_support_file("Tools") tools = Dir["*.rb"] Dir.chdir(prevdir) if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities UI.start_timer(2.0, false){ LineA.create_line } else timer_LineA = UI.start_timer(2.0, true){ if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities UI.stop_timer(timer_LineA) LineA.create_line end #if } end tools = nil
-
And here's a version that makes sure the Tool Stack is ready ...
# run when file loads # prevdir = Dir.getwd Dir.chdir Sketchup.find_support_file("Tools") tools = Dir["*.rb"] Dir.chdir(prevdir) if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.start_timer(2.0, false){ LineA.create_line } else timer_LineA = UI.start_timer(2.0, true){ if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.stop_timer(timer_LineA) LineA.create_line end #if } end tools = nil
-
Let's step back to the very beginning...
Do you need this script to run automatically EVERY time EVERY SKP opens?
A. Yes.
Why for goodness sake ???
A. No.
Then what's the problem?
If it runs from a menu/toolbar then everything will be loaded by the time you think about using it anyway. Just do NOT include the code that runs it as it loads and everything is cushty!
-
Because he's generating ruby scripts (that build geometry,) from a C# program, which reads XML data.
A batch mode use of Sketchup.He's not that good with Ruby, or else he could use Ruby's XML libraries directly.
And I do have an API request in for an AppObserver "onReadyState" callback method.
-
Well, I tried the snippet - installed in my Plugins folder - now executing the command. It splatted. But wrapping the command in a timer that delay the operation with two seconds - no splat.
-
The processing of the Tools dir must complete, so that the menus and toolbars can all be built and displayed.
-
Isn't he doing it arse-before-face as we say in the UK ?
Open Sketchup.
Start_operation.
Run the external 'tool'...
Load the objects in turn, each one as an individual component.
When all objects are done Export those objects in turn as separate SKPs.
Abort_operation.
Close Sketchup [no save].That way nothing relies on something else 'opening in time' ?
-
@tig said:
Isn't he doing it arse-before-face as we say in the UK ?
We'll, he knows C#, and not much of Ruby.
Instead of using Sketchup in a hacked batchmode... he or someone needs to wrap the C++ Interfaces for SKPWriter.DLL for C#. (Likely someone has already done it.) Any way it would be better to directly create skps.
-
THANKS to all for your efforts!
Now it works!!! it's slower than before, but it runs and that's the main thing!
@Dan: Thank you, you're the best! ^^ -
No problem...
Just a note that the disposal of the tools filename array needs to be inside the conditional true blocks. (Otherwise we might get an error with the
&
method if tools gets set tonil
, prematurely.)# run when file loads # prevdir = Dir.getwd Dir.chdir Sketchup.find_support_file("Tools") tools = Dir["*.rb"] Dir.chdir(prevdir) prevdir = nil if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.start_timer(2.0, false){ LineA.create_line } tools = nil else timer_LineA = UI.start_timer(2.0, true){ if ( tools & $LOADED_FEATURES == tools ) && Sketchup.active_model && Sketchup.active_model.active_entities && Sketchup.active_model.tools.active_tool_id != 0 UI.stop_timer(timer_LineA) tools = nil LineA.create_line end #if } end
Advertisement