Triangulate triangles ?
-
4 ? Like what ? Please an image! You speak of a quadrangle hidden on a triangle ?
No 3 triangles!
A simple triangle(s)( any number ) with this simple construction of 3 medians -
Adding the feature to slit multiple face by automatically finding the center point will be great addition! This should triangulate any type of face aka trig, quad, ect... Because your connecting a line from center to every other vertex. Maybe adding things like skip one vertex every time you add a line will be interesting to see.
Rich O Brian that would be great as well!
-
It is Artisan subdivide. Thank you Catmull Clark
-
So no! And why not the connections with middles ?
Medians are wanted!
But if you a have the plugin why not, that can be used for other thing -
Yep cool, but not like the first post
And I should know it! -
Alas I have deserted the Ruby language for a while!
If you can make a little plugin that will be wonderful
-
Here is an example code for achieving what you want Pilou...
model = Sketchup.active_model ents = model.active_entities sel = model.selection faces = ents.grep(Sketchup;;Face) faces.each do |face| vertices = face.vertices bbox = face.bounds cpoint = bbox.center vertices.each do |vertex| p1 = cpoint p2 = vertex line = ents.add_line p1,p2 end end
Note: Some very pretty geometry start appearing when you keep splitting!
-
I will do that!
-
Beat me to it
You might want to change the
faces = ents.grep(Sketchup::Face)
to
faces = **sel**.grep(Sketchup::Face)
So then the user changes only selected faces ?
OR perhaps
faces = sel.grep(Sketchup::Face) faces = ents.grep(Sketchup::Face) **unless faces[0]**
so it works on a selection OR everything if there is no selection...Also you want to make it undoable, so add
**model.start_operation('subtri')** faces.each... ...end **model.commit_operation**
-
Hahaha!
TIG I would be very happy if you modify your existing plugin to add Pilou is feature request.
I am interested in making this for learning and I have some additional ideas I want to explore. I consider you my mentor TIG and there will never be competition between you and me I promise!
By the way thanks for the suggestion!
Here is updated code...
model = Sketchup.active_model ents = model.active_entities sel = model.selection faces = sel.grep(Sketchup;;Face) model.start_operation('csplit') faces.each do |face| vertices = face.vertices bbox = face.bounds cpoint = bbox.center vertices.each do |vertex| p1 = cpoint p2 = vertex line = ents.add_line p1,p2 end end sel.clear model.commit_operation
-
OK
I'll make a simple script and publish it shortly... -
Thank you TIG!
-
Thanks Pilou !
You convinced TIG...
And Thanks TIG, I think it's a must have ! -
Try this http://sketchucation.com/forums/viewtopic.php?p=495430#p495430
TriangulateAllFaces
... -
I think the triangulation is not the same...
-
Both of these are very useful so maybe add an option to choose between the two.
-
To do the former you need to first triangulate all faces, then find each triangle's center using the angles' bisectors' intersections...
-
Not as easy as using the center of face.bounds.center is it.
If I find the best way to do it with code I'll let you know...Best of luck!
-
I sure don't call the code below a success but its definitely interesting...
model = Sketchup.active_model ents = model.active_entities sel = model.selection faces = sel.grep(Sketchup;;Face) model.start_operation('csplit') faces.each do |face| vertices = face.vertices edges = face.edges bbox = face.bounds cpoint = bbox.center edges.each do |e| e1 = e.start.position e2 = e.end.position x = (e2.x + e1.x) / 2 y = (e2.y + e1.y) / 2 z = (e2.z + e1.z) / 2 vertices.each do |vertex| p1 = [x, y, z] p2 = vertex line = ents.add_line p1,p2 end end end sel.clear model.commit_operation
Note: I also find strange that new edges don't intersect with each othere making a new vertex...why is this?
-
If the second time you apply script you do each face individually inside a group, then you get very pretty geometry.
Advertisement