[Plugin] Face Flattener 0.19
-
RE: Face flattener - I'll give it a shot... thanks for sharing!
Ray, and others, when wanting to export a flat model from SU to CAD format - don't forget the Automated 2D Output ruby! Then you can just re-import the .dwg file back into SU, and it will be flat.
-
-
hehe,hello.
-
@cerevellum said:
Hi Ray and Bob,
This is something I've noticed while working on my flattening script, and I still haven't figured out why it happens. The simplest way of reproducing this is to draw a box, add a rectangle to the top surface and connect it with a line to the outer edge loop. When erasing one of the edges of the rectangle that was added, both faces disappear.
What you can try to possibly avoid this problem is to calculate all coplanar segments, not delete them, but instead put them in a list (or in the selection). Then, just delete the entities in the list (or in the selection):
model.entities.erase_entities list_edges #or model.entities.erase_entities model.selection
It seems to work fine on your example, and on some more complex configurations, but I did not try in the general case.
Note: manually in Sketchup, what I would use is to select all coplanar segments, put them in a group and then just delete the group. It leaves all faces intact. Unfortunately, there is no method in Ruby to make a group or a component out of existing elements!
-
-
@unknownuser said:
Thanks Zack.
This could prove really useful for the bad AutoCad imports I sometimes get.Yip, so true for me too . Very useful. Thanks for this script!
-
@cerevellum said:
The order of operations:
- Select some geometry
- Right click, select Flattening Script
- Left click on a face (this decides the plane the geometry will project to)
This doesn't work for me at all. please test on attached scene.
- select all the geometry on the lower plane
- Right click, select Flattening Script
- Left click on a face above
-
This seem like a useful script, shame it is still on 0.19.
-
@Fletch
Hey, I took a look at the test model. The script doesn't work on curves yet. Basically, if you were to explode any curves it should work fine!@chango70
Yeah, I stopped working on this script a while back (1 year?). Hopefully, I will be able to finish it up soon enough. Probably will ensure this script works inside Groups and works with curves as well.Thanks! BTW, the original version of this had an arbitrary axis, something that could be useful as well. Perhaps the next steps are to rework the code to include this feature, or maybe to include a dialog box with several options to choose from?
-
@Gaieus
about the "Remove unused edges"
It works fine only if you have first used "Remove inner faces" -
IF you have inner faces. If edges on an outer face are there because they define inner faces, they certainly aren't "unused". In any case, you should (almost) never model with inner faces.
-
@unknownuser said:
In any case, you should (almost) never model with inner faces.
Imagine that you build a "cuboรฏd snake" or any similar concepts with the Push Pull Tool + CTRL
(that is very speedy practical building and other method don't really yet exist for that)
My "remove inner faces" will be very useful at the end for after remove coplanar edges not wanted!
(here 5 visible (except "eyes & noze") before killing
-
@cerevellum said:
Hi Ray and Bob,
This is something I've noticed while working on my flattening script, and I still haven't figured out why it happens. The simplest way of reproducing this is to draw a box, add a rectangle to the top surface and connect it with a line to the outer edge loop. When erasing one of the edges of the rectangle that was added, both faces disappear.
[attachment=1:2xv3js9g]<!-- ia1 -->edgeFaceEraseExFinalA.jpg<!-- ia1 -->[/attachment:2xv3js9g]
However, if you were to erase the edge that connects both edge loops first, then you can erase the edges of the inside rectangle just fine. It apparently has to do with the order in which you erase coplanar edges. Delete edges in the following order: edges connected to 0 faces go first, then edges connected to 1 face, and finally edges connected to 2 faces.
[attachment=0:2xv3js9g]<!-- ia0 -->edgeFaceEraseExFinalB.jpg<!-- ia0 -->[/attachment:2xv3js9g]
See ya,
ZachThis explains some of the oddities when I tried to write a script to remove co-planar lines. I found that existing some times didn't work - especially on messy triangulated stepped terrain imported from Max. I tried to write my own version - got pretty close, but all versions had some issues. But from this post - I got some new ideas I'd like to try.
-
@cerevellum said:
However, if you were to erase the edge that connects both edge loops first, then you can erase the edges of the inside rectangle just fine. It apparently has to do with the order in which you erase coplanar edges. Delete edges in the following order: edges connected to 0 faces go first, then edges connected to 1 face, and finally edges connected to 2 faces.
[attachment=0:p7r2k6cj]<!-- ia0 -->edgeFaceEraseExFinalB.jpg<!-- ia0 -->[/attachment:p7r2k6cj]
That line that connects the two squares has two items in it
.faces
array - both referring to the same face.I've also come across times when you have a face inside another face. They have one vertex that they share. All the edges in the inner face is also part of the outer face. Some weird cross loop. If you delete one of the edges of the inner face, you'll affect the outerface and it's disappear. It's one of them things that makes removing co-planar edges really hard.
One of my versions has been to recreate the geometry - but even that didn't work perfectly.
-
Here's a sample of such a loop. I just moved the vertex of the connecting line onto the outer edge. There are other cases when this happen as well.
If you try to delete any of the edges of the internal face you'll also delete the outer face.
-
For some reason, I don't get this script....
Does it work similar to "drop.rb"?cheers,
-
@thomthom said:
Here's a sample of such a loop. I just moved the vertex of the connecting line onto the outer edge. There are other cases when this happen as well.
If you try to delete any of the edges of the internal face you'll also delete the outer face.Whooopdedoo! This is fixed in 7.1!!!
-
Zach, you're my hero! Thanks.
-
The script doesn't work and has no effect. Any reason why??
-
@glidias said:
The script doesn't work and has no effect. Any reason why??
No. You must provide some more info. Exactly what doesn't work? No menus? No action when you activate the menus? Not the desired results? What did you do when you tried to use it? (detailed) If you open the Ruby Console, did you get any error messages when you tried to activate it?
Advertisement