Wings 3D Development Forum

Full Version: unfold
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Hello!

for the purpose of hydroforming "complex" shapes, I figured wings would be an excellent choice.

So I made a simple shape, exported it to STL and tried to use this inkscape plugin : https://trmm.net/Unfolding_STL

However, exporting to STL before doing such operations is nonsense ; also, STL is all triangles so a dodecahedron will not have 12 5-gon faces but 36 triangular faces. If it is not much of an issue when it comes to tape and paper, it does become one when welding is involved. Also, that inkscape extension relies on a windows executable that is not maintained anymore and that has a tendency to lose triangles along the way ; again, this is not much of an issue when building paper shapes but it is when it comes to hydroforming where the shape has to be water-tight.

Wings has almost all the features needed to achieve unfolding objects : IMHO, the best way to do it would be to allow the user to select a number of edges that will either be cut or folded, then click a to-be-made "unfold" button (or maybe rather "export as.. unfolded SVG")

the result for [attachment=625]
should be sth such as [attachment=626]
Hey, thanks for the tip, I hadn't found that one. I am fluent in french so that was an easy one.

However, the first time I loaded my dodecahedron my browser hung ; so I killed it, reloaded the part and clicked "make PDF" but got an error message like "TypeError: Cannot read property 'plane' of undefined".

With the provided solids, I get no error message but no result either.

I was only able to make single-axis slices.

One issue I forgot to mention is that while folding paper or cardboard is pretty easy and it's quite acceptable to make a "light" cut to ease folding, other applications often require the use of cumbersome machinery such as https://i.ytimg.com/vi/Tmfe58_gnTw/maxresdefault.jpg.

Sheet metal folding can be a quite tedious process, for it is quite common that folds have to be made in a specific order so as to avoid interference with the tool. In many cases, the part _will_ need to be split in sub-surfaces so folding can be done properly. And because we don't want to waste too much material when cutting (sheet metal is quite more expensive than cardboard). There is almost no way you can leave that job to a computer, and since welding has to be done by hand also the amount of time spent deciding where to cut and where to fold is quite tolerable.
Right. I tried with another browser and got it to show something.

I can't help noticing that with the sample dodecahedron, the faces are subdivided in triangles and cuts are added at random places within some pentagonal faces. This may be fun for cardboard figures wrapped with starch and paper, but it is totally useless for an application where watertight welding is involved as it is a very time-consuming process.

The more I think about it, the more I am certain it would be a great addition to Wings, since the interface has everything it needs to select faces and edges.

I would be glad to help with the implementation, but I know nothing about Erlang or the Wing3D codebase so I would need to be guided.

Also, I insist the feature that is needed is only edge selection and unfolding on the selected edges. automatic unfolding and collision detection is a welcome addition, but it is not what is sought here.

as I see it, the simplest data structure for this purpose would be a tree of the form

Code:
unfold --- group0 --- face0 --- face1 --- face3 --- face7
        |                              |
        |                              |- face4 --- face6
        |                              |
        |                              |- face5
        |
        |- group1 --- face8 --- ...

the tree can be then be built as a sequence of clicks, selecting faces and/or edges to build the tree and coloring faces as it builds up.

this way it's also very easy to deliberately avoid cutting a specific face, or group them in a way that is functional: the teapot example makes total sense here.

to render / output, traverse the tree face by face, orienting them and appending them to the previous face in the tree.
I believe something like this should do it:

Code:
face_clicked()

is it connected to two or more faces present in the tree?
{
  // connect where?
  request from user: EDGE = select_edge() or FACE = select_face()
}

if is_set(EDGE) {
  FACE = from the connected faces, find which one connects to face_clicked() with that EDGE ; make sure it doesn't crash if no face match (invalid edge clicked, FACE not in tree)
}

if FACE not in tree: try again (or make new group)

is it connected to another face present in the tree?
{
- what edge connects the two faces? (unless EDGE is set)
- compute position and add to tree ; output can be generated on-the-fly
- update face color and edge colors ; color faces by first-level branch (group) and edges by unset/cut/fold
} else {
- make new group
}

I see it necessary to have the option of saving the tree and loading it to/from a text file, so it can be used with different versions of a model. upon loading, simply traverse the tree and if a face is missing just cut the rest of the branch.

to simplify the computation of the position of each face added to the tree, it may be advantageous to have a secondary list of fold (connecting) edges their X-Y position and orientation on the plane. when creating a tree and/or branch, a new sheet (page) with custom dimensions MAY be added for that branch and displayed alongside the 3D model ; the user should be able to move around and rotate each branch in the sheet in order to optimize placement simultaneously while building up the tree.
a tad simpler:

Code:
faceX_clicked() // event-based I suppose?

is it connected to two or more faces present in the tree?
{
   // connect where?
   request from user: FACE = select_face()
   if FACE not in unfold_tree: try again (or make new group)
} else is it connected to another face present in unfold_tree? {
    FACE = that face (in the tree) it is connected to
} else {
   make new group (set label and color, else random)
   return
}

what edge connects the two faces? add this edge and its position to fold_list, mark it as a fold in the output.

add faceX to unfold_tree and compute its position ; output can be generated on-the-fly for all edges of faceX that are not part of fold_list

update face color and edge colors in the 3D model view ; color faces by first-level branch (group) and edges by unset/cut/fold

note: ideally, the angle of each fold should be included in an "assembly instructions" file, while the output file only contains the cuts.

output outline must be a single continuous path.
I saw there is some problem with the Gilb-r Duval script. I just contacted him to take a look on that if possible.

The fact of you say you should have the control over the cut sounds to me like the UV segmentation operations.

Here, in a similar way to work with the Duval's approach, your dodecahedron was "cut" on the Geometry window by painting the faces. That was used as reference for - in the UV Segmenting window - mark the edges for cut and then get the islands in AutoUV window with the result you see at right on image (after rotate them a bit Smile):
[Image: egg3-uv.png]

Each island seem to me as those you call group.
yes, what I call groups are definitely islands in your case. edge selection was lost a few times trying to get a result with no succes but what you show definitely sounds like a good start.

got the AutoUV window open, my faces painted and my edges selected.. how do I "get the islands"? nothing shows in my AutoUV window Undecided
engrenage Wrote:got the AutoUV window open, my faces painted and my edges selected.. how do I "get the islands"? nothing shows in my AutoUV window
I recorded a video for you.



Notice that I used the Select menu just to show the used command, but you can use the shortcuts [L] and [Space] that is faster.
Also, the first time I used the Select menu in the video I got nothing selected because the menu option act over the focused geometry window. Moving the mouse over the main Geometry window gave it the focus. That is why I moved the AutoUV Segmenting window close to the main menu. Smile
Brilliant!

thanks a lot, I didn't realize everything was already there!

However, I haven't figured out a way to export the result as SVG/DXF/whatever.

Also, I have yet to figure out a way how to scale the object ; in such cases the base unit will be a volume in liters or m³.

can you help me with that?
Pages: 1 2 3 4