Request: Group to Component Plugin
-
@kmead said:
Should per chance I end up in Trondheim, I will be more than happy to proffer a cookie or more likely a beer.
Karl
-
I think an ideal user workflow is to pick the object you want to use as your component and identify it. If it is a group convert it to a component. Once you have identified that, then manually pick all of the groups you want to be replaced with the component, and then have the script automate that.
I hadn't realized that a group acted like a component until I tried to copy a group into inside, and SketchUp wouldn't let me.
-
thomthom - nice tools!
how have i lived so long without them?thanks.
-
@davidboulder said:
I think an ideal user workflow is to pick the object you want to use as your component and identify it. If it is a group convert it to a component. Once you have identified that, then manually pick all of the groups you want to be replaced with the component, and then have the script automate that.
I hadn't realized that a group acted like a component until I tried to copy a group into inside, and SketchUp wouldn't let me.
If you have selected a bunch of components you can use the Component Browser to replace all selected with the one you right-click in the browser and choose "Replace".
You can also use this plugin to replace any selected groups / components with one that you pick in the model: http://forums.sketchucation.com/viewtopic.php?f=323&t=26008&p=223994
The catch here is that often the group/component insertion point differs.
-
I had pretty good success find matching groups inside a model just by comparing geometry. # of faces, edges, types of materials, lengths of all edges, area of all faces. Just that alone starts to find many groups that are identical that could be collapsed into the same component. The next step was to test edge vectors and compare them to make sure all edges were in the same direction. I never got that worked out because that then requires working out the rotation of the group, and potentially the scaling. Or maybe it ends up helping to identify what the rotation is. Again, I never quite got that worked out in my mind.
But the idea is do-able. I'm just slowly working on a few other scripts so I will not have time to touch this one any time soon. But I think it would be a great one.
Chris
-
@chris fullmer said:
I had pretty good success find matching groups inside a model just by comparing geometry. # of faces, edges, types of materials, lengths of all edges, area of all faces. Just that alone starts to find many groups that are identical that could be collapsed into the same component. The next step was to test edge vectors and compare them to make sure all edges were in the same direction. I never got that worked out because that then requires working out the rotation of the group, and potentially the scaling. Or maybe it ends up helping to identify what the rotation is. Again, I never quite got that worked out in my mind.
I was scribbling down time ideas earlier today (before I even saw this thread). I was thinking that one could start with one vertex in the source, and then look for a vertex in the target that has the same number of edges, faces, face areas, edge lengths.
Then when you find a match for that, pick an edge in the source and then a matching edge in the target. Now useTransformation.axis
to transform the 3D coordinates of all the vertices of the target into the coordinate system of the source. Now it should be possible to iterate them all to ensure they are identical. If they are you can replace the target with the source and account for the different insertion point and axis. -
Maybe you could do some pre-testing with the bounding box, but to deal with rotation you would want to get the relative bounding box of the entities in the group (from within the group) vs. the global bounding box.
If two groups have the same bounding box then you can do further testing to see if they are the same.
Of course if SU could just turn groups into components on import that would be great.
-
@davidboulder said:
Of course if SU could just turn groups into components on import that would be great.
You'd still have the same problem very often.
When I import from Revit, many windows that are in reality the same come in with various insertion points. And some are mirrored.The pre-checks are one thing, good for speeding up comparison - but it's determining the difference between the local co-ordinates of the two objects that is the core problem to tackle.
-
such a tool would be of tremendous help! especially when importing models with excessively recurring objects (like trees with thousands of leaves).
taking the example of a tree again it is important for the script not only to identify the orientation of similar groups, but to evaluate the scaling as well (defining the scale of the source component as 1).and to make everything perfect this plugin should be able to work on components as well as on groups (because some importers make every object a component, leaving you with a mess and an unaccessible component browser).
big task ahead there, thomthom...
-
@plot-paris said:
and to make everything perfect this plugin should be able to work on components as well as on groups (because some importers make every object a component, leaving you with a mess and an unaccessible component browser).
Revit grumble grumble
Advertisement