Hiding edges with fill_from_mesh
-
Both got asmooth_flags
argument. Is it not working for you? I usefill_from_mesh
for my Teapot plugin - smooth edges no problem. -
No, I had
weld
set to true. Probably why it won't smooth - since you don't weld the edges together. -
I tried using
entities.fill_from_mesh(mesh,false,8)
andentities.add_faces_from_mesh(mesh,8)
. it only works on faces with four or less edges.Are these the same arguments that you are using?
-
even when I set weld to
true
, I still get the triangulation.here is an example:
I start with this. then I usemesh = face.mesh
but when I try adding the mesh to the entities, it triangulates regardless of the flag setting:
-
@cjthompson said:
I tried using
entities.fill_from_mesh(mesh,false,8)
andentities.add_faces_from_mesh(mesh,8)
. it only works on faces with four or less edges.Are these the same arguments that you are using?
You only smooth the edges - that does not hide the edges. Only affects the shading of the connected faces. You must Soft the edges, use 4 or 12.
See this post for screenshot example of what smooth vs soft vs hidden does: http://forums.sketchucation.com/viewtopic.php?f=15&t=23239&p=196887#p196744
-
ok. I tried that, but I want to seperate faces that aren't coplanar.
Basically, I'm trying to go from a face to a mesh, then back to a face again, so there is no visible difference between the original and the face from the mesh. It sounds like that isn't really possible.
-
hmm... I've not tried to do that...
what if... you use the mesh you get from the face as a temporary mesh. Then iterate the polygons in that mesh and recreate a new one - but in the new one you add negative indexes for the edges you want to hide?
-
Are you trying to make a script that triangulates the geometry while making it look the same as the original?
-
this script isn't for any use in particular, I'm just trying to get the hang of polygon meshes.
the best way to describe what I'm doing is trying to turn all model entities into a mesh, delete the original entities, then put the mesh back, hopefully keeping the original stucture.
@thomthom said:
what if... you use the mesh you get from the face as a temporary mesh. Then iterate the polygons in that mesh and recreate a new one - but in the new one you add negative indexes for the edges you want to hide?
the problem isn't getting the negative numbers, it's making Sketchup recognize those numbers. it seems to completely ignore them. (if you
puts face.mesh.polygons
, you can see that there are already negative numbers there). -
mesh = Geom::PolygonMesh.new #<Geom::PolygonMesh:0xf631898> mesh.add_point [0,0,0] 1 mesh.add_point [100,0,0] 2 mesh.add_point [0,100,0] 3 mesh.add_point [100,100,0] 4 mesh.add_polygon(1,-2,3) 1 mesh.add_polygon(-2,3,4) 2 Sketchup.active_model.active_entities.fill_from_mesh(mesh) true
This sample produces two faces where the edge between them is soft.
Note that in my example I don't use anysmooth_flags
argument. I think that the optionalsmooth_flags
argument overrides the negative indexes if you use it.(also, my example is a bit messed up as the two faces have opposite normals.)
-
It looks like that's what the problem was. Now I just have to figure out how to combine meshes.
-
That would either be using Entities.add_faces_from_mesh for each mesh - if its ok to merge them in the Entities collection.
Otherwise you need to iterate one mesh and add all the polygons to the other.
Advertisement