How to create a face with a hole touching its edge?
-
Does anyone has know how to create a face with a hole in it, while vertices of the hole may touch the edge of the face. See the attached figure f2 touches f1 at point P. I tried to create f1 and f2, then call f2.erase!. But this does not work.
update:
I tried the plugin 2d-simplex-bool
http://extensions.sketchup.com/en/content/2d-simplex-bool
It seems not working neither.
one working code from TIG's idea:
e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[7,2,0],[4,4,0] ed = f1.edges[0] f1.erase! ed.find_faces; f2.erase!
-
@icehuli said:
But this does not work.
How does it not work? Errors? Unexpected result?
Got a snippet of what you got so far?
-
@tt_su said:
@icehuli said:
But this does not work.
How does it not work? Errors? Unexpected result?
Got a snippet of what you got so far?
I executed the following code:
When f2 does NOT touch f1, I get the face with a hole as I expected, see the attached new figure
e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[%(#0000FF)[**6**],2,0],[4,4,0] f2.erase!
When f2 does touch f1, I can not get the face with a hole. A hole is not subtracted from f1.
e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[%(#0000FF)[**7**],2,0],[4,4,0] f2.erase!
-
Always add the inner face, and then add the outer face.
Then the inner face should erase as you hope. -
@tig said:
Always add the inner face, and then add the outer face.
Then the inner face should erase as you hope.Tried that, didn't work for me.
I also tried to intersect; group & explode; nuffin' worked. The dark force is string with this geometry.
-
strong dark force !!!
Another case does not work!
I can not get the correct offset of the left polygon. The hole is not empty in Sketchup.
-
@tt_su said:
@tig said:
Always add the inner face, and then add the outer face.
Then the inner face should erase as you hope.Tried that, didn't work for me.
I also tried to intersect; group & explode; nuffin' worked. The dark force is string with this geometry.
Works when you draw on the GUI in the order TIG suggests, but I also can't get it to work via Ruby. Where are the Jedi when we need them?
-
Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
Then the inner face should then be retained for erase!, and the outer one remains as a loop.The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...
-
@tig said:
Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
Then the inner face should then be retained for erase!, and the outer one remains as a loop.The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...
Hi TIG,
I am not sure I understand you well. Could you post the code, that how exactly should I do it? Thanks in advance!
-
That's a bug. Won't intersect either.
I wonder if it's related to this problem.. Some funny thing going on here,
although this is done by hand.Face is recognized somehow although deleted..
-
Not too much code either.
-
@tig said:
Try making the inner face then using find_faces on the added outer edges, rather than making that face directly.
Then the inner face should then be retained for erase!, and the outer one remains as a loop.The reason your API 'offset' leaves a hole and SketchUp doesn't is [I suspect] along these lines too...
GREAT!!!! You are the Jedi!!!
so the code is:
e = Sketchup.active_model.entities f1 = e.add_face [1,1,0],[8,1,0],[4,5,0] f2 = e.add_face [2,2,0],[7,2,0],[4,4,0] ed = f1.edges[0] f1.erase! ed.find_faces; f2.erase!
-
Some observations.....
The sketchup offset tool is not consistent. It does not always provide the same result....sometime gives the left, sometime gives the right.
They are slightly different.
Both results have two faces, a bigger face and a small one(the hole).
The bigger face is selected in both results, while the small one is not selected.
On the left, the small one is separated from the bigger face, i.e. the bigger face contains a hole.
On the right, the small one is overlapped with the bigger face, i.e. the bigger face does not contain a hole.
.......
Advertisement