How to remove attributes from materials?

There is a huge number of nearly identical materials. Do you know if they are created by PlusSpec? I don’t use it so I can’t see how it works.

it seems to me that there is an issue in PlusSpec that makes it create duplicated materials instead of fetching an existing one, as the only difference between most of them appears to be the counter.

I extracted a list of the material names to show how similar they are, but it was about 5 times as long as the forum engine allowed to be posted. I wouldn’t expect SketchUp to handle such a long material list and find such list rather unreasonable. Although I wouldn’t mind if SketchUp could handle it, I think this is first and foremost something for the plugin author to fix.

Yes, most likely PlusSpecs could stop the problem from occurring. The part I’m investigating is why it opens instantly on my Mac if I run SketchUp in a Windows 10 emulator, but completely locks up my Mac if I open it in Mac OS. There is something in Mac OS SketchUp that isn’t coping with such models, that’s the thing I’m interested in.

My MaterialConsolidator: 4598 Materials Purged
Leaving 11 unique materials !

So it is fixable - by PlusSpec et al…

Ruby is implemented differently on the two platforms…

it opens in SU Viewer instantly on my mac, but not in Pro, so it’s a SU Ruby issue,

os x does have a cap for bulk operations from sub-procceses and throttles back when this is exceeded…

it appears to ‘kick in’ when reading the excessive number of attributes some extensions add or when using ruby to create ‘to much’ geometry in a bulk operation…

it’s obviously not an issue on windows as bulk operations are actively encouraged by the many of the extensibility team [who use windows]…

I did stumble on a mac dev article about this in the past, but have never managed to re-find it…

john

I’ve been looking for ways around this for years, but as most the extension devs run windows there has never even been an acknowledgement that it is an issue…

1 Like

Thanks for the tip about Viewer opening the file ok.

The Material Consolidator was a good test to do, it gave me a way to purge materials without purging components. Once I had done that the file is fine on Mac, even though the components are still around. Is there a way to remove unused components without removing any materials? That would be to test whether the materials are only processed because they are in use by components, that are not currently in the model.

A side clue, perhaps, if on Windows I look at colors in model, with that set to list view, it does lock up Windows for a few minutes.

My PurgeAll tool [previously linked] allows you to choose just one kind of unused thing to Purge.
You just choose the appropriate kind[s] of thing from the initial dialog options…
So if you choose to delete only your unused component-definitions, then they are removed from the models definitions list, BUT now any materials or layers they might have had are kept in the model - although they are now ‘unused’.
Alternatively choosing to purge just unused materials, will NOT remove any of the materials that are only used within unused-components…

1 Like

maybe @AndrewRubySketch can shed some light…

john

1 Like

This is not Ruby thought but in the SketchUp core.

Thanks for pointing that out. I now have a model that only has four edges, one face, one layer, no attributes of any kind, no components, no section cuts/planes, one style, and still shows the problem.

I’ve thought of the next thing to try, I’ll report back…

Reporting back…

Just wrote my first bit of Ruby:

model = Sketchup.active_model
materials = model.materials
m1 = materials.count
toggle = false
materials.reverse_each do |i|
toggle = !toggle
if(toggle)
materials.remove(i)
end
end
m2 = materials.count
puts (m1-m2)

I now have versions of the SKP that have 144, 288, 576, 1152, 2304, and 4608 materials. Opening the ones up to 576 materials is instant, but 1152 takes a while, and 2304 takes significantly longer.

Not sure if it’s all just proportionate, or if there is a magic number between 576 and 1152 where it starts to get slow. I’ll know soon though.

1 Like

There is only one that I know of, and that is the number of the beast…:smiley:

I did some timings. The amount of time to close increases too, so I included that:

Material Count Time to Open Time to Close
144 1.3 <1
288 1.4 <1
576 1.8 <1
768 2.0 <1
968 3.5 1.0
1152 6.1 1.9
1476 9.3 3.1
1844 14.3 4.5
2304 31.9 10.1
4608 122.2 38.5
2 Likes

Hi guys, thanks for CC me in @john_drivenupthewall. :smile: . As mentioned previously Colin, I need to see the original file so I can figure out what is happening, yet looking at the file you have attached it appears as though either the file has been exploded and materials have been made unique & I can only assume this has been done by a Plugin, (as it is very unlikely the end user manually made materials unique 4000 times).

There is also a chance that the user exported the model and then reimported the model, or used a rendering engine that has a plugin that explodes and makes unique but I do not know for sure. One thing I am 100% sure of is PlusSpec does not replicate materials. Colin PlusSpec has a built-in Purge tool, in fact, I ran the purge tool, and it cleaned the materials up in 2 seconds, that is longer than it took to open the file. Mate, ideally, the client reaches out to us, as support is included with PlusSpec.
The easiest way to get to the bottom of it is to tell the client to 1 restart SketchUp using a blank template, (no material or components). Then draw several walls, add a window roof rafters and trusses ect etc and then see if the materials are replicated. I can tell you now they are not.
I can not tell you why Mac opens slower than windows, there are many reasons I do not use Mac and this just added one more to the list :grimacing:. In saying that we have many Mac users and not one has ever come to me/us with this problem.
Sorry mate, I can not help you out on this one. I’m sure if you talk with the client, you will get to the bottom of it.

BTW I tested a large model OBJ and 3Ds export and import on SU 19 and I could not replicate the issue on Mac or PC

1 Like

You may need to read the whole page. PlusSpecs was let off the hook a while ago! The textures becoming unique is a oddity, and it’s good that your extension has a purge feature, in case that happens.

My main interest is the time it takes to load those textures on Mac. And there’s a much more serious problem that is affecting a lot of Mac users, whether they’re using extensions or not. This slow loading is a related problem, which if it could be fixed will hopefully fix the much more serious problem.

The list of materials in that model is absolutely ridiculous and unreasonable. I don’t think the problem is that SketchUp for Mac can’t handle it, but that something somewhere creates such a humongous list to begin with. I don’t expect SKetchUp for Mac to be tweaked, with the risk of adding other performance issues, just in case an unknown third party tool out there goes berserk and adds literarily thousands of materials.

I think the best person to ask is the model author. What other extensions are they using? Have they exported and re-imported the model?

This is just one example model that shows the problem. It’s just a very handy one, to quickly try combinations to see at what point it becomes too much.

By the way, the problem affects Windows as well. Try opening SketchUp with a new document, set Materials to In Model, then File/Open my test document. In Parallels it took over 7 minutes to open. On a colleague’s real PC it took over 14 minutes to open.

how is that, yours isn’t?:grinning:

Do you have an example that you would consider a valid, reasonable use case? The heavier a model is, the slower SketchUp will perform. While I wouldn’t mind optimization in any place in SketchUp, I fair it is misguided to focus on optimizing something may not be a problem.