Intersection between two faces

how can i use it i did download the RoofHelp document but it says “Select a face. Pick
the tool on the menu” but i can’t seem to find it on the menu even though i clicked on the roof ? i just want to test the tool u suggested

Don’t worry about faces in the model.
Let’s look at these steps…
The face forming the roof is base is ‘selected’.
This gives you the ents=model.active_entities context.
You can add a new group using the selected face’s outer_loop’s edges:
group=ents.add_group(face.outer_loop.edges) gents=group.entities
Now do all of your work in that entities context.
Make the vertical triangle against one of those edges and do a followme around the edges [perhaps ‘ordering’ them for safety]
Intersect the gents to make the ‘hips’ and ‘ridges’.
The resultant faces have aspects which allow you to delete the unwanted ones…
Read my Roof code to see what it does, by a series of erasures it methodically removes unwanted geometry.
Because its possible to contrive a face which cannot receive a single surface hipped roof you also need to trap…

1 Like

thnx for your response but how can i read your code it’s in .rbz format so when i open it’s encrypted ?

If you install the RBZ then there is an RB file put into Plugins named Roof.rb
Alternatively add .zip to the end of the RBZ file name and extract the Roof.rb file from that…

It is an old script [~9yrs] so it has many poor practices etc that are not recommended, but it has a useful core of ideas…

1 Like

oky thank you soo much i’ll see it and try to get ideas from it and i’ll get back to u if i find any difficulty again thank you for your help

My reply is a response to post’s where you havn’t ask very good questions, and I’m unsure if your grasping the advice offered…

if you do a similar ‘commenting’ exercise on Tig’s script, you can come back with question like “what’s happening in this line”

# Tig,  is this where my group entities array gets created? 
gents=group.entities

Now, a couple of things about the script that fails…

your not creating tables, it’s an Ruby Array, so you should always call them that so we all ‘speak’ the same language…

that one was your third new Array, your first was ents = , then face and later small_faces, edges

when you see array << something it’s same as asking array.push(something)

the Class Array has lots of power, so I suggest reading up on it to help understand other peoples scripts… [like Tig’s]

why your code fails…

where is the intersect? You haven’t made one, so your #TODO add code for intersecting before here…

a quick test to show that’s what’s missing, would be to run this first…

  Sketchup.send_action('selectAll:')  
 # Sketchup.send_action('intersectSelected:')  ## after With Selection actually only removed one face...
  Sketchup.send_action('intersectWithModel:') ## but WithModel did both...

BTW: do it manually if the send_actions don’t work… [I’m on a mac]

then you start re-writing ruby to achieve the result your after…

john

1 Like

oh thnx a lot i get your advice sorry for the mistakes as English isn’t my native language, i’ll follow your advice and reply to you.
yes indeed there is no intersection in my model, but i meant by “intersection” the form of the two roofs, and my question was how to create an intersection and delete the extra edges left, as i tried > intersect_with but didn’t work.

if you use the model you posted, select everything then, Right Click >> Intersect with Model

then run your code, it should work…

but, you still need to work it out for the ruby version…

john

yeah exactly i did use the Right Click >> Intersect with Model… to create the green model, but now i need to do it using ruby without clicking.