[Plugin] CleanUp
-
ThomThom,
just ran the "delete coplanar edges" function from SU and got a crazy message in SketchUp with an ACAD file sent to me from the States...THEN I ran your cleanup on it, and this scrip was like I mean like so
you get a and a couple ok, and one more
It did in 5 seconds what would have taken half an hour!Thanks
-
Ouch! That's a nasty error message! Don't think I've seen that one before. The only ones I've seen have only said "Don't Panic" - this seem to say the opposite!
I'm glad that my plugins didn't cause that. -
Thom,
Thank you for this ruby. I have been working on a huge model - 120MB - for a downtown facade restoration program. Lots of geometry and textures. I tried the script on a previously saved model to test it and nothing was missing except the junk lines etc. per your specifications. Tried it on the final model with the same fine results. Didn't dramatically reduce the size - 123MB down to 120MB but every bit helps.
Thanks again.
-
@unknownuser said:
I tried the script on a previously saved model to test it and nothing was missing except the junk lines etc. per your specifications.
If you use the latest version you can now make it not erase lonely edges. Untick the Erase Lonely Edges item in the menus. And you also have a option for this for the tool that runs over your entire model
As for file size - what contributes the most is textures and backgrounds. I was thinking the other day that I'd write a little tool that'd list the model's materials along with it's texture sizes so you could quickly find materials with large textures.
-
AdamB's already written a similar tool caled Goldilocks, although it judges the size of your textures by their relative position to the camera, i.e. large close textures are marked as good, large textures far away are bad etc.
-
I was using your cleanup tool on a CAD model sent to me by a firm I work with... it has a bunch of Groups... they are exact copies of each other in CAD, but in SU, it doesn't 'see' that they are exact copies.
now... I was thinking... I can select all the groups that I know are supposed to be instances of a component... I could manually convert each to a component, then replace them all with the good one...but there's no tool that automates the process in my case with a CAD model import:
I choose 60 similar "group" objects,
Activate "Groups to Component tool" (G2Ctool)
G2Ctool says "I know these each should all be instances of the same component"... and then the tool would ask... "Select the desired object to be the base component" ... then I would click one of the 60 group objects I clicked before
and then the tool would ask... "Enter new component name"
then the tool would turn each one of those groups into some nebulous numbered component, then it would replace all of them with that first component with a new name.that would, IMHO, be the "missing link" tool in your cleanup tool arsenal.
-
Yea, I've been thinking of something like that. Get that kind of stuff importing from revit. But the problem there is that the axis, insertion point, is different. So I can't just go by that. I'd have to compare the geometry...
-
I think about this too from time to time. And one of the problems is that it might be easy enough if all components were inserted with the same rotation, but it gets tricky if all components are rotated differently.
To help compare, you could take all edges from comp1 and compare its length against all edge lengths in comp 2. They should have all the same amount, of the same lengths if they are possibly the same component. That would help determine if you should continue comparing the two components.
Also, you could compensate for components that are the same, with different scale factors by the same idea. Get all edge lengths for each. Then take each comps shorteest edge, and scale it up to be the length of the other comps smallest edge. Get that scale factor, and scale all edges the same. THen compare to see if the newly scaled lengths all equal the target component's edge lengths. And voi-la, theres a way to test for scale differences.
Just some ideas while they were still in my mind.
Chris
-
I was thinking of taking the source object and start of with an entity, compare it and it's connected faces and edges (length and angle betweens) and then iterate through the target object and look for matches. Once a match is found, iterate to next entity in the source and see if it compares to any of the potential next entities in the target.
...too complicated...?
-
I think something like that is what you would end up having to do, but I was imagining you could cut out a lot of groups by first testing them with whay I was suggesting. If for example, you have 100 groups. And you don't know if they are possibly same components or not, you could test them based on their entity number.
All groups with the same amount of entities, then get tested together for the same amount of edges, same amount of faces. Those that still have matching numbers move on to the next round of comparisons. Maybe we are down to 10 that have the same amount of entities, same number of edges and faces.
Then compare those 10 based on all edge lengths. If their edge lengths don't match up, maybe try adjusting the scale using them method I outlined. Then if by chance you end up with any components that match entity.length, and edge amounts, and face amounts, and their edge lengths all match, then maybe you have a good chance of them being the same component.
Then at that point, I was thinking you could look for any edge length that only has 1 identical edge length match in the other group. Then you have a starting point for aligning axes, using the identical edges. Just take one component and transform it to its one edge would be aligned to the other edge. Then you could compare all their point3d positions and see if they all are the same.
Of course, that would all be done with temporary groups or proxy Point3d objects or something.. The original group would need to remain unaffected. But I think you could identify groups that appeared to be identical based on entity counts, edge lengths, etc. Then take those and try to aligned them, you could then just test their points against eachother. And if their points are identical, you've got a match!
That is how I would forsee it happening. What I like about this method is that there is no looping through the model looking for angles. Just compare point positions.
Just a thought,
Chris
-
wanna connect to my notepadd++ and work on it? PM me
Chris
-
That's be cool - to make some real use of that Np++ feature! But I'm off to bed. Should have been there least an hour ago.
How many hours behind GMT are you?
-
+8 I think. I am still at work - 16:50 here.
Chris
-
You mean -8 .
A full workday in difference. Could be tricky to try this outside the weekends... -
Ahh yes, -8. Yeah, I normally catch you when you wake up and I'ts like midnight here. Or in the middle of the day for me and its the middle of the night for you. So maybe this weekend we'll try it.
Actualyl though, I already most ofthe code. I got the part that sorts all entities and makes an arrayof all the groups to compare. Now you can just finish up everything after that
Chris
-
I'll connect it to my magic 8-ball.
-
Kind of very useful this plugin ; i ve tried it on version 6 and it s pretty good (if u re setting well the variable debug).
So,thank you!Take care!
Elisei
-
guys, that new idea of the 'convert groups to components' plugin sounds exciting. I wanted such a script ever since i first importet my first model from 3Ds...
can't wait to see some first results -
@ely862me said:
Kind of very useful this plugin ; i ve tried it on version 6 and it s pretty good (if u re setting well the variable debug).
So,thank you!Take care!
Elisei
Regardless of the variable, you will run into a Sketchup bug where it's impossible to delete some edges, even if they are 100% planar.
-
Brilliant Plugin ThomThom!!! Perfect!!!
Advertisement