Missing intersect edges after intersect_with

I’ve been trying to get intersect edges by using intersect_with method but it seems like there are edges missing from this method.

trans1 = Geom::Transformation.new
trans2 = @first_group.transformation
g1_temp = @first_group.copy
edge = @ents.intersect_with(true, trans1, g1_temp.entities, trans2, false, @sec_group)


The red lines is edges that I got after using intersect with and this matter only appeared when face not fully touching.

It’s work properly in this case.

So, I wonder if i make any mistake on intersect_with method or there are conditions in intersection that I’m not aware of.

Note: I have to copy group since I have to delete the intersection edges after I have done in this process.

Although you did not publish a proper code and an example model that could help analyse the specific case…
I assume some similarities were reported here:
Face insensitive to the intersect_with method · Issue #786 · SketchUp/api-issue-tracker · GitHub

Anyway the #intersect_with method is “difficult” and not “perfectly” documented:
Add better examples for entities.intersect_with · Issue #741 · SketchUp/api-issue-tracker · GitHub

… so I can imagine mistakes from both parties (API vs. you ) :wink:

2 Likes

In this case do you have any suggest solution to find intersect edges instead of using intersect with or there’s any ways to fix this?

No, unfortunately I do not have a fix or other method in my mind to tell you. :blush:

BTW:

I guess the “native” (Using UI in Sketchup) Intersect Faces command will result the same ‘red lines’. Isn’t it?

It’s appeared to be that Intersect Faces command can use properly in this case. Is it a sign that a method working fine but I made a mistake somewhere?

This is all I use for method intersect_with. That’s why I’m so confused where can I fix my code and make them work properly :smiling_face_with_tear:.

How did you defined these?:
@first_group
@ents
@sec_group

Can you post your model you are testing?

What happen if you change the last parameter to:
@sec_group.entities


Here is @first_group and @sec_group, @ents is Sketchup.active_model.active_entities.

I’m not sure is this a model you want :sweat_smile:. You can correct if I misunderstand something.

Sure, I can draw a model like on a picture, but to be able to precise, would be the best to experiment on exactly the same model.

1 Like

test_intersect.skp (188.1 KB)
Here is a file for this model.

For this one, last parameter have to be entity but if I use @sec_group.entities.to_a the result edges will appear to be on global reference which I can’t use for my other application after this.

:thinking:

mod = Sketchup.active_model
@ents = mod.entities
sel = mod.selection
@first_group = sel[0]
@sec_group = sel[1]
trans1 = Geom::Transformation.new
trans2 = @first_group.transformation
g1_temp = @first_group.copy
edges = @ents.intersect_with(true, trans1, g1_temp.entities, trans2, false, @sec_group)

ints

… Hm. Perhaps if you change the order of the groups you will get better result.

I used SU2021
(later on I will check in other version… I have a meeting now…)

1 Like

In my code I actually want intersection line to be in group with upper group. Can you try to change trans2 to @sec_group.transformation and check if it’s appeared to have just 2 edges.

I’m not sure that because there’s already have edges in that position so intersect_with decide not to create a new one or not. But there’s a case where the edge already exist and still the intersect with are create new edges on that position.


(Thanks a lot for helping me!,)