Mac and Materials (with textures)
-
Hi everyone,
I have another problem with SketchUp, but this times its with Mac and materials(textures). I have a lot of textures which I'm adding via the API. But it seems that Sketchup on Mac stops the execution before it is finished without showing a warning or an error.
An simple example code (only adding a new material with a texture)
@unknownuser said:
materials = Sketchup.active_model.materials matname = "set a custom matfile here" rnd_width = 3 rnd_height = 2 begin for i in 0..1000 puts "test texture"+i.to_s mat = materials.add "test"+i.to_s mat.texture = matname texture = mat.texture end rescue => e puts "something interrupted"+e.to_s end
this ends after inserting "test texture 257", but it isn't catched by the rescue method, it only stops. Now for example, if I'm adding a scaling to the materials texture ..
@unknownuser said:
materials = Sketchup.active_model.materials matname = "set a custom matfile here" rnd_width = 3 rnd_height = 2 begin for i in 0..1000 puts "test texture"+i.to_s mat = materials.add "test"+i.to_s mat.texture = matname texture = mat.texture texture.size = [(1.m/rnd_width),(1.m/rnd_height)] rnd_width += 0.01 rnd_height += 0.01 end rescue => e puts "something interrupted"+e.to_s end
.. it stops already after texture 104. I can now do more and more resizing of the texture and it will always stops earlier (with 2 texture.size it stops after 65 textures and so on)
Is there anything I'm doing wrong on adding materials? Or is this simply a bug on Mac (On windows I can add the 1000 materials without any problems)?Greetings
Alex -
What version of Mac, what os version, what version of SU (please fill out your profile so we can tell without having to ask!). I just tried your code on my MBP Retina, OS X 10.9.4, SU 2014 Pro, and it added all 1000 textures just fine (though slowly).
Steve
-
It shouldn't stop the loop early, that would be a bug. But as mentioned, it'd be nice with more info. Also have you tried with other extensions disabled?
Why do you need to create 1000 materials? Currently SketchUp will become quite slow when scripts add a high volume of materials - at least under Windows the Material Browser isn't scaled for such numbers. Just a warning.
-
@slbaumgartner said:
What version of Mac, what os version, what version of SU (please fill out your profile so we can tell without having to ask!). I just tried your code on my MBP Retina, OS X 10.9.4, SU 2014 Pro, and it added all 1000 textures just fine (though slowly).
Steve
Sorry I always forget to say which system I use (it's always another one ) It is a Mac Mini (2012 Version), Mac OS X 10.9.2 and SU Pro 2014 (Version 14.0.4899).
I also disabled all Extensions and tested the ruby code again, it stops after 257 materials without any warning, error or anything else.
@tt_su said:
Why do you need to create 1000 materials? Currently SketchUp will become quite slow when scripts add a high volume of materials - at least under Windows the Material Browser isn't scaled for such numbers. Just a warning.
This code was only for testing and give an example. I don't need that much materials, but on some elements there could a lot of different textures (especially same texture with different scalings to fit on components).
PS: I made an update of SU to Ver. 14.1.1283, but the problem also occurs on this version
-
hmm... I'm testing your script on OSX 10.9.4, SU2014 M0/M1 and I cannot reproduce this. Every time all the 1000 materials are created.
How large are the textures you are using? How much RAM does your system has? (though I would have expected a crash if it ran out...)
-
@hooch said:
I also disabled all Extensions
And everything in your Plugins folder implements the SketchupExtension interface? There is a good number of older extensions that doesn't do this.
You can use
Sketchup.plugins_disabled = true
and restart SketchUp to prevent everything from loading - that way be 100% sure of a clean environment. -
@tt_su said:
And everything in your Plugins folder implements the SketchupExtension interface? There is a good number of older extensions that doesn't do this.
You can use
Sketchup.plugins_disabled = true
and restart SketchUp to prevent everything from loading - that way be 100% sure of a clean environment.I cleared the complete plugin folder so that nothing can load, but it didn't help. The Mac has 4gb DDR 3 RAM, that should be enough. The texture has 186kb. May this problem occur due to the high resolution of the image? It is 1920x1024px.
-
@hooch said:
May this problem occur due to the high resolution of the image? It is 1920x1024px.
Yea, file size is of little relevance when you use image format that compress it. Pixel size is what I mean. Have you tried, just for the sake of it, a smaller size. If that makes a difference we will have a clue.
-
@tt_su said:
Have you tried, just for the sake of it, a smaller size. If that makes a difference we will have a clue.
Yes, I tried it some minutes ago with a resolution of 260x512 and it worked even with two times "texture.size" (of course it needed a lot of time, but worked).
-
I'll try again with some very large textures on my machine and see if I can reproduce it. If I can't I'll forward it to the QA team and see if they can reproduce it in the lab.
-
@tt_su said:
I'll try again with some very large textures on my machine and see if I can reproduce it. If I can't I'll forward it to the QA team and see if they can reproduce it in the lab.
hi,
could you reproduce it? Is there anything new that you can tell me about this problem?
Greetings
Alex -
I can reproduce what you see when I use a larger texture. I also notice that the Console output is odd. lots of empty lines and a strange order of the lines.
I'm not sure what it is yet.
Advertisement