by GWD » Sat Dec 24, 2011 7:03 am
I've a script that runs good on my PC. But when my friend uses it on his mac with the same model it's much slower (more than 10x). After a lot of testing to narrowed down the problem, adding a group with add_group on a big model is much slower on mac than on pc. How can we avoid this problem?
-
GWD
- PluginStore Author

-
- Posts: 91
- Joined: Sun Jun 28, 2009 6:44 pm
- Location: belgium
- Name: Guy Wydouw
- Operating system: Mac
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by thomthom » Sat Dec 24, 2011 1:11 pm
Are you sure it's add_group being slow? Are you by any chance also using Sketchup.status_text as well? Updating the progress of your script?
Do you have a sample script you're testing with?
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by GWD » Sat Dec 24, 2011 1:53 pm
thomthom wrote:Are you sure it's add_group being slow? Are you by any chance also using Sketchup.status_text as well? Updating the progress of your script?
Do you have a sample script you're testing with?
We use indeed the Sketchup.status_text in our script for updating the progress. But this isn't to problem because the problem also occurs with te following simple script. Create a model with 1000 solids and run the following script: model = Sketchup.active_model entities = model.entities for n in 1..1000 do g = entities.add_group g.name = n.to_s point1 = Geom::Point3d.new(n*10,0,0) c = g.entities.add_cpoint point1 g.explode end On PC this goes fast, on mac this takes a very long time.
-
GWD
- PluginStore Author

-
- Posts: 91
- Joined: Sun Jun 28, 2009 6:44 pm
- Location: belgium
- Name: Guy Wydouw
- Operating system: Mac
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by thomthom » Sat Dec 24, 2011 2:17 pm
hm... will have to have a look... as for status text: viewtopic.php?f=180&p=305388#p305248
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by th3lurker » Wed Jan 18, 2012 8:07 am
I've had the same problem. I wrote an import tool for a custom format, and add_group (if i create a group for each volume) or add_face/add_point(if i create just one main group, and keep adding to that) greatly slows down the import. It gets exponentially slower (1.2 secs for 100 volumes, 120 seconds for 1400, 0.02 secods/add_group in the beginning, ~0.2 seconds/add_group near the end). I tested this with the GWD's code, and even without all my other code, it is just as slow. Any ideas/ workarounds? I work on windows vista (not my fault  ).
-
th3lurker
-
- Posts: 20
- Joined: Tue Oct 18, 2011 7:25 am
- Name: th3lurker
- Operating system: Windows
- SketchUp version: 8
- License type: Free/Make
- SketchUp use: architecture
- Level of SketchUp: Intermediate
by Dan Rathbun » Wed Jan 18, 2012 12:13 pm
You might try saving the model to a temp file, after each group. That should clear the undo stack. The file must have a name other than "Untitled" or the save dialog will popup. Also use the disable_ui flag in an operation: - Code: Select all
model = Sketchup.active_model entities = model.entities disable_ui = true PC =( RUBY_PLATFORM =~ /(mswin|mingw)/ ? true : false ) save = true for n in 1..1000 do begin model.start_operation("Group#{n}",disable_ui) g = entities.add_group g.name = n.to_s point1 = Geom::Point3d.new(n*10,0,0) c = g.entities.add_cpoint point1 g.explode rescue model.abort_operation else model.commit_operation # opt save model here if save if PC Sketchup.send_action(57603) else # Mac Sketchup.send_action("saveDocument:") end end end end
Last edited by Dan Rathbun on Wed Jan 18, 2012 4:12 pm, edited 1 time in total.
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by thomthom » Wed Jan 18, 2012 12:28 pm
Dan Rathbun wrote:- Code: Select all
if PC Sketchup.send_action(57603) else # Mac # may be convoluted on Mac end
Why not use Model.save ? http://code.google.com/apis/sketchup/do ... .html#saveAnd I don't see how saving would free up the undo stack.  Seems to operate the same after a save... I don't think saving has any effect - it's SketchUp that process existing geometry whenever new is added in order for auto-merge to work.
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Dan Rathbun » Wed Jan 18, 2012 1:38 pm
thomthom wrote:Why not use Model.save ?
I was under the impression that the API would not let use use that method to overwrite the current file. But I just tested it and yes, it does work. thomthom wrote:And I don't see how saving would free up the undo stack.  Seems to operate the same after a save...
And, your're correct again. (Maybe I made an assumption.) On PC we can clear the undo stack by saving, then asking for a new model, then reloading the old model. (The API does not have a method to close the active model, yet. So it may be a no go on Mac.) Here's an updated example: - Code: Select all
model = Sketchup.active_model entities = model.entities disable_ui = true save = true if save path = UI.savepanel("Save Model to","*.skp") if path.nil? save = false else path = File.expand_path(path) end end
for n in 1..1000 do begin model.start_operation("Group#{n}",disable_ui) g = entities.add_group g.name = n.to_s point1 = Geom::Point3d.new(n*10,0,0) c = g.entities.add_cpoint point1 g.explode rescue => e model.abort_operation puts("Error #<#{e.class.name}: #{e.message}>") puts(e.backtrace) else model.commit_operation # opt save model here if save Sketchup.active_model.save(path) Sketchup.file_new Sketchup.open_file(path) end end end
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by Dan Rathbun » Wed Jan 18, 2012 1:55 pm
Is it explode that is slow ? Or adding group definitions ?
If making groups (and explode) is avoided, is it still as slow ?
Does turning off shadows and textures speed things up ?
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by TIG » Wed Jan 18, 2012 2:02 pm
There are issues with model.save. It only saves by name, but not path obtained using File from model.path etc. It does NOT save by the name of the current SKP, although it returns 'true'... To test this make a simple SKP and save it as 'aaa.skp'.
model=Sketchup.active_model Dir.pwd ### if not where aaa.skp is located use Dir.chdir(File.dirname(model.path)) ### now use model.save("xxx.skp")### it saves a copy as xxx.skp ### you are still inside aaa.rb model.save(File.basename(model.path))### saves as itself - aaa.skp [supposedly, as it returns 'true' !] ### Now edit the SKP with a noticeable change, and repeat model.save("xxx.skp") model.save(File.basename(model.path))
Exit without saving further... xxx.skp WILL show the changes aaa.skp will NOT show the changes, that it said were saved, BUT were not!
TIG
-

TIG
- Global Moderator
-
- Posts: 19916
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2018
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Wed Jan 18, 2012 2:03 pm
Dan Rathbun wrote:Is it explode that is slow ? Or adding group definitions ?
Both. Adding geometry gets slower and slower in SU. When you explode you take the entities from one context and add it to another - so it suffers from the same slowdown of adding them. Dan Rathbun wrote:Does turning off shadows and textures speed things up ?
It seems to be that SU processes all existing geometry when anything is added to a context.
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Dan Rathbun » Wed Jan 18, 2012 2:17 pm
TIG wrote:There are issues with model.save.
Thanks TIG... I knew you had expounded on this subject before.. and tried to get the Google team to fix this save BS. Well, the example above at least DOES clear the undostack on PC... which is why (ThomThom) I originally used the send_action for the PC menu's "Save" option. ( Which does work.)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by thomthom » Wed Jan 18, 2012 2:19 pm
Dan Rathbun wrote:which is why (ThomThom) I originally used the send_action for the PC menu's "Save" option. (Which does work.)
...under Windows only...  *sigh* the Ruby API makes my head ache all too often...
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Dan Rathbun » Wed Jan 18, 2012 2:20 pm
YUP. On PC, Sketchup.send_action("save:") returns false. I wonder what the standard action is for Mac ?
Dittos.. on the API.
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by thomthom » Wed Jan 18, 2012 2:26 pm
I wish that PolygonMesh had more features in the Ruby API. In the C++ SDK you can define more info when you create the mesh. Under the Ruby API you are more limited. One example, you can retrieve the mesh of any geometry - from that you can get info on hidden/soft edges and UV mapping. But you cannot create a mesh with UV mapping or control hidden/smooth. That severely limits the usability of PolygonMesh as a method of creating geometry. So either complex and very slow geometry creation, or simple and less slow creation. Or use the C++ API - ...which require C++ knowledge...  Slower development...
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by Dan Rathbun » Wed Jan 18, 2012 4:07 pm
Dan Rathbun wrote:YUP. On PC, Sketchup.send_action("save:") returns false. I wonder what the standard action is for Mac ?
Ok.. it's Sketchup.send_action("saveDocument:") (at least it works on PC, and is listed on the Apple site as an action for the NSDocument class.)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by GWD » Wed Jan 18, 2012 9:33 pm
Dan Rathbun wrote:Dan Rathbun wrote:YUP. On PC, Sketchup.send_action("save:") returns false. I wonder what the standard action is for Mac ?
Ok.. it's Sketchup.send_action("saveDocument:") (at least it works on PC, and is listed on the Apple site as an action for the NSDocument class.)
the Sketchup.send_action("saveDocument:") works on mac!
-
GWD
- PluginStore Author

-
- Posts: 91
- Joined: Sun Jun 28, 2009 6:44 pm
- Location: belgium
- Name: Guy Wydouw
- Operating system: Mac
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by TIG » Thu Jan 19, 2012 11:42 am
BUT saveDocument simply saves the current SKP and leaves the undo stack alone. IF we use pwd=Dir.pwd Dir.chdir(File.dirname(model.path))so we don't need to worry about full paths etc... Then use skp=File.basename(model.path) tmp=rand.to_s+File.basename(model.path) ### Sketchup.send_action("saveDocument:") model.save(tmp) Sketchup.open_file(tmp) Sketchup.open_file(skp)### on completion tidy up File.delete(tmp) if File.exist?(tmp) Dir.chdir(pwd)it will cause the "undo stack" to empty ! BUT at the expense of the time delay of saving/opening/etc etc... There seems no easy way to clear the "undo stack" otherwise... 
TIG
-

TIG
- Global Moderator
-
- Posts: 19916
- Joined: Mon Nov 12, 2007 7:24 pm
- Location: Northumbria UK
- Name: TIG
- Operating system: Windows
- SketchUp version: 2018
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
by thomthom » Thu Jan 19, 2012 12:33 pm
And we have no signs of "clearing the undo stack" will actually improve the performance of adding geometry, do we?
-

thomthom
- PluginStore Author

-
- Posts: 19335
- Joined: Tue Nov 13, 2007 12:47 pm
- Location: Trondheim, Norway
- Name: Thomas Thomassen
- Operating system: Windows
- SketchUp version: 2013
- License type: Pro
- SketchUp use: other
- Level of SketchUp: Advanced
-
by driven » Fri Jan 20, 2012 2:22 am
GWD wrote:the Sketchup.send_action("saveDocument:") works on mac!
Was this a query? if so, the answer is yes, normally, but the way Dan has used it in the earlier snippets, the Dialog appears, but fails to change the windows name and the script then really does strange things in 'no mans land' i.e. it's not 'Untitled Window', or your given name, just 'Sketchup'. The cursor pulses, the view disintegrates[holes appeared] then the whole computer freezes... repeatable, yes but I'll pass. In my curiosity to learn some ruby, I cobbled together some additional test scripts and ran them on my mac. Script 1: 1.52668809890747 and generates 2000 undo steps #### this is the original from this thread Script 2: 0.175029039382935 and generates 1001 undo steps Script:3: 0.419209957122803 and generates 2 undo steps Script 4: 0.0664420127868652 and generates 2 undo steps #### this uses disable_ui and draws after the timer stops, so add 0.04 maybe... My scripts a probably really badly constructed, but they reliably return this similar timings... john - Code: Select all
######################################################################### # timer snippet from http://stackoverflow.com/questions/2289381/how-to-time-an-operation-in-milliseconds-in-ruby def time now = Time.now.to_f yield endd = Time.now.to_f endd - now end
time{ # This code draws a line of points in 1.52668809890747 # and generates 2000 undo steps model = Sketchup.active_model entities = model.entities for n in 1..1000 do g = entities.add_group g.name = n.to_s point1 = Geom::Point3d.new(n*1,0,0) c = g.entities.add_cpoint point1 g.explode end } ######################################################################### def time now = Time.now.to_f yield endd = Time.now.to_f endd - now end time{ # This code draws a line of points in 0.175029039382935 # and generates 1001 undo steps model = Sketchup.active_model entities = model.active_entities centerpoint = Geom::Point3d.new full_group = entities.add_group() (0..1000).each do |i| # Create a line of points centerpoint = [i*1,10,0] full_group.entities.add_cpoint centerpoint end full_group.explode } ######################################################################### def time now = Time.now.to_f yield endd = Time.now.to_f endd - now end time{ # This code draws a line of points in 0.389806985855103 on mac # and generates 2 undo steps require 'sketchup.rb' require 'LangHandler.rb'
# Using language handler makes sure that the string "Create Line" gets translated. # This is important as this string is shown in undo menu. $make_cp_line_string = LanguageHandler.new("gettingstarted.strings");
def cp_line() model = Sketchup.active_model selection = model.selection # Create a transaction so the box is one undo model.start_operation($make_cp_line_string.GetString("Create cp_Line"))
entities = model.active_entities points_group = entities.add_group() centerpoint = Geom::Point3d.new entities = points_group.entities (0..1000).each do |i| # Create a line of points centerpoint = [i*1,20,0].to_a c_pl = points_group.entities.add_cpoint centerpoint points_group.name = "Points Group" points_group.description = "Example Group" selection.add points_group end #create model.commit_operation
end
cp_line model = Sketchup.active_model selection = model.selection selection.length selection.each { |entity| (entity.explode) } }
########################################################################## def time now = Time.now.to_f yield endd = Time.now.to_f endd - now end time{ # This code draws a line of points in 0.0667488574981689 with disable_ui on mac # and generates 2 undo steps require 'sketchup.rb' require 'LangHandler.rb'
# Using language handler makes sure that the string "Create Line" gets translated. # This is important as this string is shown in undo menu. $make_dcp_line_string = LanguageHandler.new("gettingstarted.strings");
def dcp_line() model = Sketchup.active_model selection = model.selection disable_ui = true # Create a transaction so the box is one undo model.start_operation($make_dcp_line_string.GetString("Create cp_Line"),disable_ui)
entities = model.active_entities dis_pnts_group = entities.add_group() centerpoint = Geom::Point3d.new entities = dis_pnts_group.entities (0..1000).each do |i| # Create a line of points centerpoint = [i*1,30,0].to_a dc_pl = dis_pnts_group.entities.add_cpoint centerpoint dis_pnts_group.name = "Dis Points Group" dis_pnts_group.description = "Example 2 Group" selection.add dis_pnts_group end #create model.commit_operation
end
dcp_line model = Sketchup.active_model selection = model.selection selection.length selection.each { |entity| (entity.explode) } disable_ui = false }
##########################################################################
learn from the mistakes of others, you may not live long enough to make them all yourself...
-
driven
- PluginStore Author

-
- Posts: 3034
- Joined: Fri May 01, 2009 11:50 pm
- Name: driven
- Operating system: Mac
- SketchUp version: 2015
- License type: Pro
- SketchUp use: engineering and mechanical design
- Level of SketchUp: Intermediate
by Dan Rathbun » Fri Jan 20, 2012 2:04 pm
Well, John, you've proved that disable_ui is much faster that not.
But the topic is about that add_group and explode group is slow. Which you've also proved, of course, by testing the same entity generation within only 1 group and then exploding it AFTER the loop.
I only speculated that Sketchup's writing to the Undo stack (and Undo Log file,) might slow things down.
There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default. There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)
But, regardless, ThomThom believes that it's not the undo stack, but instead the way the app seems to resort the model database, during add groups and explodes. What if all the temp groups, were first added to a master group (to separate them from the rest of the model, and then after the loop, the master group was exploded ?)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by Dan Rathbun » Fri Jan 20, 2012 2:22 pm
Dan Rathbun wrote:There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default. There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)
I just tried this.. set "MaxUndo" to 0 before SU start. The undo operations do NOT appear on the Edit menu. Sketchup still writes to the undo log, but after each tool operation, it writes a "Commit(0)" line. Changing the attribute back to 100 while Sketchup is running has no effect (as I suspected.) And Sketchup will rewrite it's "live" "MaxUndo" value of 0, back to the registry attribute. So you must change it back to whatever limit you wish, while Sketchup is closed, in order to turn the Undo feature back on.
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by Dan Rathbun » Fri Jan 20, 2012 2:25 pm
Also, note. When "MaxUndo" is 0, calling Sketchup.send_action("editUndo:") still returns true, but nothing happens. (At least it does not BugSplat, which I did fear.)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by driven » Fri Jan 20, 2012 2:44 pm
Dan Rathbun wrote:Well, John, you've proved that disable_ui is much faster that not.
But the topic is about that add_group and explode group is slow. Which you've also proved, of course, by testing the same entity generation within only 1 group and then exploding it AFTER the loop.
I only speculated that Sketchup's writing to the Undo stack (and Undo Log file,) might slow things down.
It appears to here, I can see a cursor image refresh as each group is created There is a registry entry on PC for "MaxUndo" (under the "Preferences" key,) which is set to 100 by default.There is no UI control to change this "on-the-fly." (And likely Sketchup would not see any change to the attribute while running.) But I wonder if setting it to 0 before startup would it disable the undo feature all together ?? (I don't know what it's called in the Mac plist.)
macSU .plist <key>SketchUp.Preferences.MaxUndo</key><string>100</string> I think if you write to, then touch, then read SU uses the update, but I need to check if it works for SU prefs, it does for 'user' ruby ones. But, regardless, ThomThom believes that it's not the undo stack, but instead the way the app seems to resort the model database, during add groups and explodes.
making a 1000 groups adds 2000 undoes, which is much slower than putting it in the langhandler (which I thought would have a big overhead) with only 1 undo +1 for the explode outside. What if all the temp groups, were first added to a master group (to separate them from the rest of the model, and then after the loop, the master group was exploded ?)
I'll try and work out a script to do a test, unless you want to... I wasn't really doing this to post back, it's just an exercise in me understanding SU ruby (on mac), but the results seemed to be relevant to the OP's mac/group inquiry. Yell at me if it's not. john
learn from the mistakes of others, you may not live long enough to make them all yourself...
-
driven
- PluginStore Author

-
- Posts: 3034
- Joined: Fri May 01, 2009 11:50 pm
- Name: driven
- Operating system: Mac
- SketchUp version: 2015
- License type: Pro
- SketchUp use: engineering and mechanical design
- Level of SketchUp: Intermediate
by driven » Fri Jan 20, 2012 2:54 pm
Dan Rathbun wrote:Also, note. When "MaxUndo" is 0, calling Sketchup.send_action("editUndo:") still returns true, but nothing happens. (At least it does not BugSplat, which I did fear.)
One thing I have found when modifying NIB files, is you often need to save, open/close SU then re-save 'manual' preference list changes, to clear SU's cache. Not sure if it's the same with coded writes and maybe it's only the SU ones that are cached? john
learn from the mistakes of others, you may not live long enough to make them all yourself...
-
driven
- PluginStore Author

-
- Posts: 3034
- Joined: Fri May 01, 2009 11:50 pm
- Name: driven
- Operating system: Mac
- SketchUp version: 2015
- License type: Pro
- SketchUp use: engineering and mechanical design
- Level of SketchUp: Intermediate
by Dan Rathbun » Fri Jan 20, 2012 3:29 pm
driven wrote:... which is much slower than putting it in the langhandler (which I thought would have a big overhead) ...
The LanguageHandler class has nothing to do with this subject (speed & groups.) It's just a wrapper for a Hash, that has English (the keys,) strings translated to the user's local language. Read the "langhandler.rb" file in the "Tools" dir, and you'll see it's quite simple. (I don't use this class, since it defaults to using the "Resources" path, and it's much simplier to just use plain old Hash of my own (which can be loaded from a UTF-8 encoded file.)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by Dan Rathbun » Sat Jan 28, 2012 4:54 am
For version 8.0M2, Sketchup Release Notes wrote:SketchUp Writer C++ API: In earlier versions, ISketchUpGroup::CreateGroup became slower each time it was called. This shouldn't slow down any longer.
I would think that this fix was added into the application code as well. @Guy: Is your friend's Mac running Sketchup version 8.0M2 ??
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by GWD » Sat Jan 28, 2012 1:42 pm
Dan Rathbun wrote:For version 8.0M2, Sketchup Release Notes wrote:SketchUp Writer C++ API: In earlier versions, ISketchUpGroup::CreateGroup became slower each time it was called. This shouldn't slow down any longer.
I would think that this fix was added into the application code as well. @Guy: Is your friend's Mac running Sketchup version 8.0M2 ??
We use on Mac and PC the latest version from google's website. (PC 8.0.11752/MAC 8.0.11.751) I did some more testing: - Code: Select all
model = Sketchup.active_model entities = model.entities puts '- Start test1 add_group bug on MAC -' start = Time.now for n in 1..1000 do #changed this setting for the testing g = entities.add_group g.name = n.to_s point1 = Geom::Point3d.new(n*10,0,0) c = g.entities.add_cpoint point1 end puts 'Total time: ' + (start - Time.now).to_s
Results: bugMAC.JPG At this moment we use a workaround. Place the groups in a new model (use the multiple documents on MAC), make a component of all the groups. Save this component and insert it in the model and explode it. The biggest problem of this workaround is that it's impossible to close the new temporary model with ruby. A other problem is that is still a lot slower than on PC. Anybody a solution?
-
GWD
- PluginStore Author

-
- Posts: 91
- Joined: Sun Jun 28, 2009 6:44 pm
- Location: belgium
- Name: Guy Wydouw
- Operating system: Mac
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Dan Rathbun » Sat Jan 28, 2012 9:30 pm
WoW! Excellent test report. Shows that the Mac still has a problem.
I wonder if the difference has to do with Ruby.? The Mac is still running the initial release of v1.8.5, and the PC was updated to v1.8.6-p287.
There is a thread on how to point the symbolic references for Sketchup Ruby to a "normal" full Ruby install elesewhere on the Mac's harddrive. (You need to backup the current links, so you can switch back if necessary. Perhaps a shell script?)
I'd be interested in seeing the comparison for the Mac, running v1.8.5-p0 and v1.8.6-p287, ... (and perhaps even the latest patchlevel for v1.8.7)
I'm not here much anymore. But a PM will fire email notifications.
-

Dan Rathbun
- PluginStore Author

-
- Posts: 5036
- Joined: Tue Oct 06, 2009 3:06 am
- Location: Florida, USA
- Name: Dan Rathbun
- Operating system: Windows
- SketchUp version: 2015
- License type: Pro
- SketchUp use: education
- Level of SketchUp: Advanced
by GWD » Sun Jan 29, 2012 12:22 pm
Dan Rathbun wrote:WoW! Excellent test report. Shows that the Mac still has a problem.
I wonder if the difference has to do with Ruby.? The Mac is still running the initial release of v1.8.5, and the PC was updated to v1.8.6-p287.
There is a thread on how to point the symbolic references for Sketchup Ruby to a "normal" full Ruby install elesewhere on the Mac's harddrive. (You need to backup the current links, so you can switch back if necessary. Perhaps a shell script?)
I'd be interested in seeing the comparison for the Mac, running v1.8.5-p0 and v1.8.6-p287, ... (and perhaps even the latest patchlevel for v1.8.7)
And here are the results for ruby 1.8.7 on mac: 100 - 0.58 sec 200 - 1.69 sec 400 - 10.55 sec 600 - 33.39 sec 1000 - 147 sec Almost no difference with ruby 1.8.5 
-
GWD
- PluginStore Author

-
- Posts: 91
- Joined: Sun Jun 28, 2009 6:44 pm
- Location: belgium
- Name: Guy Wydouw
- Operating system: Mac
- SketchUp version: 2013
- License type: Pro
- SketchUp use: architecture
- Level of SketchUp: Advanced
-
by Ad Machine » 5 minutes ago
-
Ad Machine
- Robot
-
- Posts: 2012
-
Return to Developers' Forum
|