[Plugin] Superglue
-
My last thought is that in original model was some small deviation from "coplanar" ... because as i said before, I wrapped everything in a component, I saved as new file, then opened and it cut hole by copying and by placing from Component Browser.
In original model it did not cut hole by copying, just by placing new component from Component Browser. When I copied I was on face with the cursor. I tested that by exploding the component and it merged with the face. -
If the component has non-coplanar parts you might get the cursor no longer being in the face when the copy is snapped.
Can you save_as the component and post it so we can have a better idea of what's going on... -
Great little plugin!
Found it thanks to the new Extention Warehouse, should have seen this years ago!It would be great if you could add a "glue" option to the context menu(below the standard "unglue" option).
Cheers!
Jan -
@brewsky said:
It would be great if you could add a "glue" option to the context menu(below the standard "unglue" option).
Good idea!
-
Though... not quite sure how to work out what face to glue it to...
-
The re-glue tool in my HolePunch tool works out the instance.transformation and gets the .origin and .zaxis and looks for a face in the instance.parent.entities that shares the same normal as the .zaxis and also that has a good classify_point result for the .origin ... So it is possible...
-
@thomthom said:
Though... not quite sure how to work out what face to glue it to...
Checking every face in the active collection for a common plane with the component could probably get slow...
http://www.sketchup.com/intl/en/developer/docs/ourdoc/geom.php#intersect_plane_plane
If that's too slow, maybe only check if a cutting component AND a face are selected? -
@tig said:
a good classify_point result for the .origin ...
Didn't think of that, you are right, you need a classify_point otherwise it could glue to a face on the same plane a mile off!
-
Wonder what performance that has. ..but I guess it doesn't need to be fast...
-
You don't need to iterate every face in the array from:
faces=instance.parent.entities.grep(SketchUp::Face)
The loop canbreak
when a face with a matchingnormal
&&classify_point
match is found and you do the re-glue.
That means on average you only need to look at ~50% of the faces to get a re-glue.
On a bad day you need to look through all of the faces, only to find it's the last one == slowest possible re-glue; or there are no suitable faces at all == a "no-glue" !
On your lucky day you might look at the first face and find it's a match == instant re-glue... -
True that. Will give it a bash. Thanks.
Advertisement