Game
March 27, 2023, 10:47am
1
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.
dezmo
March 27, 2023, 11:34am
2
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 )
2 Likes
Game
March 27, 2023, 11:40am
3
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?
dezmo
March 27, 2023, 12:08pm
4
No, unfortunately I do not have a fix or other method in my mind to tell you.
BTW:
I guess the “native” (Using UI in Sketchup) Intersect Faces command will result the same ‘red lines’. Isn’t it?
Game
March 27, 2023, 12:13pm
5
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?
Game
March 27, 2023, 12:17pm
6
Game:
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)
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 .
dezmo
March 27, 2023, 12:22pm
7
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
Game
March 27, 2023, 12:28pm
8
Here is
@first_group and
@sec_group ,
@ents is Sketchup.active_model.active_entities.
I’m not sure is this a model you want . You can correct if I misunderstand something.
dezmo
March 27, 2023, 12:32pm
9
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
Game
March 27, 2023, 12:36pm
10
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.
dezmo
March 27, 2023, 12:48pm
11
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)
… 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
Game
March 27, 2023, 12:58pm
12
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!,)