hello everyone,
i have a model like the picture bellow the blue model and i need to remove the intersection between the two faces indicated in the picture, and have a result like the green model.
i tried intersect_with but it works with groups and i have only faces, i also tried Geom.intersect_plane_plane but it returned a lot of lines (point and vectors).
how can i find and remove that intersection and get a result like the green model ?
thnx a lot in advance.
how can i delete the triangles created to get the result as the green model ? i tried your method by putting faces in a new group and use intersect_with but it doesn’t give any result only make groups i tried to erase one of the groups using erase! but it doesn’t work
It looks as if you are trying to create a hipped roof. If so, the fastest way of doing it is to draw a vertical triangle to create the profile of the roof and then use Follow Me to follow a defined eaves line. The only tidying up then needed is removal of unwanted vertical planes.
I don’t understand. In the drawing you attached, it IS a triangle (or would be if you drew a base line and then joined that up with the ridge point).
because the edge created after removing the extra edge after intersection is the only edge that may appear as a triangle side, so it is more of a Trapezoidal that a triangle
By using the Follow Me tool on the new face created within the triangle.
In your model, the pitches of the intersecting roofs are different by about 10 degrees. So the Follow Me tool wouldn’t work for that. However, it is a simple matter to use Intersect with Model and then trim the redundant triangles. See here:
yes actually that’s the method i used to create the green model using the blue one, but now i need to do the same thing automatically using ruby sketchup in my script.
@MR_ME, add comments to this code to explain what you think is happening…
# add your comments above every line...
ents = Sketchup.active_model.active_entities
#
faces = ents.grep(Sketchup::Face)
#
face_sizes = []
#
faces.each{|f| face_sizes << f.area}
#
small_faces = face_sizes.sort[0..1]
#
faces.each { |f| f.erase! if f.area == small_faces[0] or f.area == small_faces[1] }
#
edges = ents.grep(Sketchup::Edge){|e| e.erase! if e.faces.length == 0}
it should still run after you do that…
then, one line at a time, modify the comment to suit your needs, then modify the code to match to the comments…
for example the first few lines might be like this…
# this is everything in the model
ents = Sketchup.active_model.active_entities
# these are all Faces in the model not inside groups TODO: but I only want the new faces [in my group]...
faces = ents.grep(Sketchup::Face)
hello and thnx for your answer, the code you wrote only deletes the faces with small areas randomly, i joined the model on which i tested the code you shared:
# get all entities in the current model
ents = Sketchup.active_model.active_entities
#get all faces in the model
faces = ents.grep(Sketchup::Face)
#create a table to store all the sizes of the faces that exists in the model
face_sizes = []
#store the areas of each face in the new table created above
#TODO: the areas stored for the roofs part are the 2 areas (one for each roof) but not that of the two rectangles created after intersection
#as they are not considered as faces
faces.each{|f| face_sizes << f.area}
#get the two smalest areas in the table of areas
#TODO: it gets the smalest areas of all faces in the model, and because the two rectangles created after intersection of the two roofs
#aren't considered as faces there areas aren't taken into consideration, the areas taken into consideration are those of each roof
small_faces = face_sizes.sort[0..1]
#erase the two faces to which corresponds the two smalest areas.
#TODO :when tried in model it delets 2 faces with smalest areas but as the roofs don't have small areas they are not erased
#as the two small rectangles created because of the intersection aren't considered as faces.
faces.each { |f| f.erase! if f.area == small_faces[0] or f.area == small_faces[1] }
# erase any left edges if all faces in the model are erased (if model contains only two faces or all faces have the smalest areas)
edges = ents.grep(Sketchup::Edge){|e| e.erase! if e.faces.length == 0}