DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

DesignCAD Unfolding - Surface Mesh Based

Started by ablincoe, October 10, 2011, 08:56:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ablincoe

I was wondering if anyone had tried to take the newer DesignCAD Mesh structures
and used them to control an automated Unfold.  I am not sure exactly when DC
brought these into the mix of definitions.  They are definitely in V19 (and
probably beyond).

The chosen (and internal) control lines are divided and appear to provide the
definition to triangle structures
    Triangle 1 = (Line 1, Point 1  to  Line 2, Point 1  to Line 2, point 2
        returning to  Line 1, Point 1),
    Triangle 2 = "(Line 2, point2  to  Line 1, Point 2  to  Line 1, Point 1
        returning to  Line 2, point 2).
The adjoining triangle side in this case would be  Line 1, point 1  to  Line 2
point 1.  The third triangle adjoining side would be  Line 1 Point 2  to
line 2, Point 2.

Functions exist to calculate the length of the 3 sides of each triangle as
well as the three angles of the triangle.

Placing each triangle's common side along the previous one on a single plane
(a new X,Y layer?) would provide the basics.  I can see difficulties when
there are more than 2 control lines.

I am a beginning R/C modeler and this functionality would be great for patterns.

I have been reading the forums for quite some time, and they are GREAT.
This may be a way to ease the long process that Dr PR has put out there.

Keep up the great work.

Allen

Dr PR

Allen,

I have thought about trying to automate the unfolding process. However, I need to unfold surfaces very infrequently. I suspect the time required to develop and debug a macro would be greater than the time needed to unfold the next piece manually. However, the time required to unfold a grid is one of the reasons I do this infrequently. If we had a macro (or built-in function) I would probably unfold many more grids.

My initial idea was to copy the grid and explode it. Then take each facet/triangle, measure the line lengths and angles, and draw it in a plane on another layer. After the original facet has been copied, delete the original, and move on to the next facet.

One of the problems is defining where the macro should start. This is important for closed grids (grids that loop back upon themselves, like a conical section).

Phil
DesignCAD user since 1987

MarkX

I think you guys are talking about "unrolling" a 3D shape so that it lies flat? Right? That would be cool.

Trying to imagine it in my mind, it seems like when the triangles are placed flat, there will be gaps where they used to touch. Maybe I'm not picturing it right.

As for moving each triangle down to a plane -- does DC have a "place on plane" command? This command exists in at least one other system I know of.

One of the obstacles is that the DC macro language is really, really primitive. Its like time traveling  back to the 1970s.

Mark

Bob P

Quote from: MarkX on October 11, 2011, 09:45:14 PM
I think you guys are talking about "unrolling" a 3D shape so that it lies flat? Right? That would be cool.

Trying to imagine it in my mind, it seems like when the triangles are placed flat, there will be gaps where they used to touch. Maybe I'm not picturing it right.

Ideally, each facet would be placed so that one edge would be coincident with an adjacent triangle.  That's the rub in the whole process, since a macro (or the program) would have to choose between two shared sides.

QuoteAs for moving each triangle down to a plane -- does DC have a "place on plane" command? This command exists in at least one other system I know of.

No, but relatively easy to do with a macro.

QuoteOne of the obstacles is that the DC macro language is really, really primitive. Its like time traveling  back to the 1970s.

Mark

Not for those of us that grew up with Fortran.  8)

I'm curious how/where you're getting DC to generate triangles from a patch.  I've not seen anything but the non-planar rectangles of a grid.

Dr PR

#4
Conical sections (cylinders, cones and truncated cones) are relatively easy to unfold. All of the pieces fit together in a plane.

Curved surfaces will not unfold perfectly - think of a Mercator map. You can't squash a curved surface into a plane without distorting the elements unless you have an infinitely large number of planes that are each infinitely small - and an infinite amount of time to complete the process. Eternity is just too long to wait for a solution!

Curved surfaces like bulldozer blades which are not conical sections, but have a linear axis, can be unfolded. I have also unfolded "skirts" around elliptical and egg-shaped cross section smoke pipes, etc. See the image below - I used the unfolded pattern to photoetch a brass part for the top surface of the skirt. Again, the cross section of the skirts are straight lines.

Phil

Note: It took the better part of a day to do this manually. It really would be nice to have a function to do this while I get a cup of coffee!
DesignCAD user since 1987

MarkX

Hi Dr Pr

That looked pretty cool.

Could you briefly explain your approach to unfolding these parts?

Thanks!
Mark

Bob P

I don't know the the Good Doctor does it, but I do it this way:

To place the first piece in the XY plane, you must find the length of a base line of the #1 segment.
Select the segment.
Set handles on the base line and on a third point on another corner.
>Move, setting a base point, a second point at the measured distance, and a third point in a consistent direction (all in the XY plane).
Now you can move each segment in turn, using handles on the (previously) common side and the side of previous segment. i.e. Select, set 3 handles, set points on previous edge and another in the XY plane.
Repeat as necessary...

Comprende?  ::)

Lar

If I had time here's how I would approach that macro:

1] The user selects the grid surface (probably a duplicate should be used)...
2] The macro solid explodes (just in case it's a solid) then (regular) explodes the grid surface, which would create a number of planes whose entity numbers are all in sequence. The planes would remain selected [turn off point-select-mode?]...
3] Use 'getselect' and a loop to determine the number of planes and their entity numbers...
4] Deselect everything then select the 1st in the series... use 'pointval' to determine its point locations then set handles at points 1, 2 and 3. Move it to (let's say) 0,0,0... 0,1,0... 1,1,0 so the plane is flat in the xy plane (ignoring which way the points are running since all the planes would run the same way). Deslect the plane.
5] Using the same 3 first points of the plane draw a 3 point line, select it [sys(9)] and set handles on the 3 points. Move this line so point one falls on point 4 of the plane (a 4-sided plane has 5 points), point two falls on point 3 of the plane and the 3rd handle is placed in the xy plane (so the line is flat in xy), ie, the first segment of the line aligns with the side of the plane opposite to points 1 and 2 and the 3rd point of the line sticks out at its relative angle.
6] Create a loop that would move the next plane in the sequence so that it falls on the 3-point line, then move the line to the other side of the plane. This way the 3rd handle would be more or less angled properly, minimizing the likelihood of the 3rd handle being placed somewhere weird and causing problems. It may be better to delete the line each time and recreate it after moving the next plane.

If this works the downside would be that Doc won't have time to make his coffee since it will execute in less than a second for a non-too-ambitious grid-surface.

Probable Issue: since grid segments are not necessarily flat the macro may have to triangulate each segment.

Lar

Dr PR

#8
Mark,

The explanation isn't brief!

1. First I explode the grid (Edit/Selection Edit/Convert/Explode). This separates it into individual rectangular polygons. Each polygon will be moved and rotated into the working plane adjacent to its neighboring polygons.

2. I draw a rectangular plane along the X axis and either the Y or Z axis, whichever you prefer. This defines the Working Plane. This will help you keep oriented to "which way is up" during the process. For purposes of discussion the axis perpendicular to the Working Plane will be called the Vertical Axis.

3. Draw a line along the horizontal edge of the working plane- this will be the Base Line. The left end of the Base Line is
  Point O. We will work from Point O to the right (positive X direction).

4. I select one polygon and move it with the bottom left corner (1st point) at Point O.

5. I then rotate the polygon so one edge lies along the base line.

 a. Draw a circle (C) from one corner of the polygon (1st point) to another (2nd point) that you want to rotate into the Working Plane.
    The 3rd point should be moved perpendicular to the Working Plane (parallel to the Vertical Axis) to cause the circle to intersect the
    plane.
 b. Find the intersection of the circle with the Working Plane (Point/Line-Plane).
 c. Draw a line (line A) from the 1st point to the 2nd point (a radius of the circle).
 d. Draw a line (line B) from the 1st point to the place the circle intersects the Working Plane.
 e. Draw a line (line C) perpendicular to line B in the working plane (Draw/Lines/Perpendicular to a line)
 f. Find the angle between lines A and B.
 g. Rotate the polygon around line C through the angle between lines A and B. This puts the 2nd point in the Working Plane.

6. Rotate the polygon so both the 1st and 2nd points lie on the Base Line.

 a. Determine the angle between line B and the Base line.
 b. Rotate the polygon about the 1st point around around the Vertical Axis.

7. Now I rotate the polygon so it lies in the Working Plane.

 a. Draw another circle (C) with the radius from the 1st point to a 3rd point along the edge of the polygon. The third point of the circle
    should be moved perpendicular to the Working Plane (parallel to the Vertical Axis) to cause the circle to intersect the plane.
 b. Draw a line (line D) from the 1st point to the 2nd point (a radius of the circle).
 c. Draw a line (line E) from the 1st point to the place the circle intersects the Working Plane.
 d. Find the angle between lines D and E.
 g. Rotate the polygon around the Base Line at the 1st point through the angle between lines D and E. This puts the 3nd point in the
    Working Plane.
 h. That completes the rotation of the polygon into the Working Plane. Delete all the temporary working lines.

8. Move the polygon (and any other polygons already moved into the Working Plane) so the 2nd point is at Point O.

9. Now rotate the polygon (and all other polygons in the Working Plane) so the side from the 2nd point to the 4th point on the polygon
  is perpendicular to the Base Line.

 a. Draw a line (line F) from the 2nd point to the 4th point.
 b. Determine the angle between line F and the Base Line.
 c. Rotate the polygon at the 2nd point around the Vertical Axis to make the side between the 2nd and 4th points perpendicular to the
    Base Line.
 d. Delete all temporary lines.

10. Select the lower left corner (new 1st point) of the next polygon and move it to Point O.

11. Repeat steps 5 through 10 until all polygons are in the Working Plane. This puts all polygons into the working plane with each sharing common sides with its two neighboring polygons (except the two end polygons)

12. On a new layer draw the outline of the collection of polygons.* This is the unfolded shape of the original grid.

13. Delete all of the original polygon fragments of the original grid.

14. Done! Now wasn't that simple? Of course not!

****

This requires about 23 different steps per polygon. It is so much work that no one will ever do it unless they absolutely must! Large grids with many facets can take many hours to unfold. That unfolded grid I posted above had more than 700 facets! Since it was symmetrical along one axis I had to unfold "only" about 350 facets - more than 8000 boringly sequential steps! I started when I got up in the morning and worked until after midnight, 16 to 18 hours stopping only twice to get a bite to eat.

****

* Note: Sometimes the polygonal facets of exploded grids really aren't planar - they are actually composed of two triangles with common hidden hypotenuses, and these triangles may be angled slightly out of the same plane. The result is that the 4th points of the polygons will be slightly out of the Working Plane. However, the 1st, 2nd and 3rd points of all polygons will lie within the Working Plane.

This really isn't hard to correct for. When drawing the outline of the unfolded grid (step 12) draw a plane (P) instead of a line. Start at the first polygon you moved into the Working Plane and work along successive 1st and 2nd points until you come to the last 2nd point (on the last polygon moved. Then continue around to the 4th point of the last polygon and then to the 3rd points of all polygons. Finish the plane at the 3rd point of the first polygon. This will,place all but one of the points in the new plane in the Working Plane. DesignCAD will automatically correct for the one point (the 4th point of the last polygon) that was out of plane. The resulting plane will be truly flat.

****

If you have a highly curved grid with a small number of facets you may have to diivide each non-planar "rectangular" facet into two right triangles and unfold the triangles into the Working Plane. It is twice as much work but it will produce a more accurate unfolded grid.

Phil
DesignCAD user since 1987

ablincoe

Thanks for all the comments guys.  The primary philosophies I have started with are:
    1)  DC Mesh display automatically suppresses the hypotenuse(s) of the connected triangles
          (thus rectangles are displayed)
    2)  Any 2 consecutive control lines contain all of the connected corners of the triangles
    3)  Any 3-point polygon with straight sides can be placed on a single plane (XY) by definition
    4)  The direction/length of the control lines do not matter (too much) as the "side lengths" of each
           next triangle are always determinable as well as the triangle's angles.
          (the variance between my chosen point sequence and the logical opposite should be miniscule
           depending on the number of control points used when defining the mesh)
    5)  Placing a known size and angle triangle up against the previous one on a new layer is not
          close to rocket science, but not quite a trivial matter (as I am finding out).
I am sure that my creation of Macro (less than # 10 for me) will take much longer than the seasoned
people here, but a lot of this is for my own personal challenge.  When finished, it will hopefully be much
easier (and quicker) to use than Dr PR's process from times past.

I will definitely keep going on this for a while, but it is not my number 1 task at the moment.  I was hoping
that someone had maybe had my idea first  :).

Dr PR

Allen,

Your statements seem to be correct to me.

Keep us posted as to your progress, and if you run into difficulties ask. There are some pretty high powered macro writers ont he forum, and of course DT, and that might save you quite a mit of head scratching.

And when you get your unfolding macro working you get a gold star!

Phil

PS: ANYTHING will be faster than the method I described!
DesignCAD user since 1987

MarkX

It seemed to me that a first step would be to make a macro that would place a polygon on destination plane.

After more time than I want to discuss, several blind alleys, and a lot of misleading results from a memory/update bug in DC, I have something that does that. Might be a starter for someone use in a larger unfolding project.

Mark
Attachment

ablincoe

Mark,
My primary shapes are those of a 63' Motor Yacht and a 25' Airplane which I will be working on Radio Controlled models of.  Neither one has an easy polygon to place onto a flat surface, so I chose to use a designated triangle (polygon) of the Surface Mesh Entity to place onto the single plane first.  I am then adding the subsequently system defined triangles (polygons) onto the same plane with an appropriate algorithm using sequential control line definitions within the Mesh Entity.

It is possible for these "strips" of flattened (unrolled or unfolded) triangles to both converge and diverge in such a manner that the resultant "pattern template" can not be formed from a single piece of flat material. 

I am initially starting with plots from the first defined corner of the mesh.  I have plans to then migrate the algorithms such that the user has a choice of 9 predefined starting points within the Surface Mesh Entity to start the process at to provide possibly better pattern making templates (fewer convergences).

I have downloaded your macro and will take a look at it to see how it fits my train(s) of thought.

Thanks for the thoughts,
Allen