Author Topic: UnFold, Flatten, Unroll, etc. for GRID entities  (Read 8345 times)

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #15 on: May 03, 2014, 03:58:57 PM »
ablincoe,
Apologies, maybe I chose a bad example (the heat exchanger) to demonstrate. (but to be fair to myself, I didn;t see any examples before the one I posted)

If you start with a (simple) torus, and explode it, you get a grid.  This in turn "unfolds" quite easily, into a series of bowties - although...
So far I find the easiest way to "unscramble" it is to manually manipulate the bowties so that they don't overlap.

Second point - if you introduce an element of difficulty - eg slice a torus, then explode it - you no longer get a grid, but a set of planes.   And I don't think the unfold macro is gonna work there. 

Finally, just for interest, I stretch the torus to make a chainlink - and unfold that - and again move the bowties so that they don't overlap.  This demonstrates that the macro works fine for simple grids.   

I'll let someone else demonstrate with something more complex.  cheers.

Dr PR

  • Hero Member
  • *****
  • Posts: 5398
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #16 on: May 03, 2014, 04:17:03 PM »
I'm not sure what prl said with the n-2 etc. example.

BUT:

Within grids depicting curved surfaces the rectangular facets are actually two triangles with common hypotenuses - the hypotenuses just aren't displayed.

You can demonstrate this in two ways:

1. Draw a plane (polygon) that intersects the grid, and find the line of intersection between the polygon and the grid. Select this line in Point Select mode and the intermediate points will be visible where the plane intersected the hypotenuses.

2. Define the grid to be a solid and subtract (Solid Subtract) another solid from it. Part or all of the grid will be broken up into triangles.

****

I have always thought that the warping of grid facets was pretty clever. I once tried to draw a gun barrel that had spiral rifling grooves and a conical cut at the end of the barrel. This involves the intersection of a helical surface (rifling grooves) with a conical surface (the end of the barrel). There is no simple intersection between these two surfaces - it is a complex intersection of two curved surfaces that cannot be drawn as the intersection of two planar rectangular surfaces. But DesignCAD does it anyway, and it worked (more or less) from the first 3D version. Some far more expensive programs couldn't do this until many years after DesignCAD did it.

Of course, the trick is to do it with triangles, and pretend you didn't. Some CAD programs do everything with triangles.

Phil
DesignCAD user since 1987

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #17 on: May 03, 2014, 04:26:04 PM »
I'm not sure what prl said with the n-2 etc. example.

The number of mathematical plane triangles is n-3.  So if a DesignCAD plane has seven points (n=7) thereby meaning six sides, it potentially can consists of 4 triangles.
« Last Edit: May 03, 2014, 04:27:40 PM by prl »

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #18 on: May 03, 2014, 04:58:25 PM »
ablincoe,
Just for fun I tried a rounded box (solid) (drawn with "number of facets" = 6)
which explodes into a series of planes (top front or side planes)
 and grids.   

In fact there is a grid at each edge and also each corner, making for 12+8 = 20 grids total.   

The macro "develops/unfolds" each of these grids (only) into 6 strips / elemental bits (it ignores the planes).
However they are all overlain  (probably fair enough because each grid is drawn at the origin, on top of each other).

The enclosed jpeg shows what happens if you peel the (20x6 =120 off) elements off one by one.  You get the correct number of elements.
You have to do some manual work before you call it a "developed shape" however. (2 cents)

PS I like the way that your macro works for the "triangular" strips that make up the corners.
« Last Edit: May 03, 2014, 05:14:57 PM by samdavo »

ablincoe

  • Newbie
  • *
  • Posts: 37
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #19 on: May 03, 2014, 05:08:11 PM »
Sam,
The macro will only work with GRID objects.  Everything else that is selected will be ignored.
On the Link UnFold, you may like the output better if you change the "START_PT" to a 1.  It will still be BowTie shaped, but the overlap will disappear, and there will be gaps in the center (cut-outs) and you will not need to do any re-arrangement.

Dr PR,
I understood PRL's comment.  The main reason I put the long response there was to try and show how tricky it would be to try and deal with a set of Plane definitions which have no consistent connectivity point.  At leas GRIDs are always solidly connected to the "next item in line" (with the exception of the outer edge.

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #20 on: May 03, 2014, 05:12:57 PM »
Not trying to pull this topic off course, basically confirming what Allen knows that DesignCAD planes with more than 4 points may not be mathematical planes.

Example pics and file attached.  The red is a six sided single DesignCAD plane that isn't plane.

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #21 on: May 03, 2014, 05:51:19 PM »
PS herewith the developed rounded box (clearly done manually - the main contribution of the macro are the "curved triangular" bits at corners)  Just for interest.

ablincoe,
sorry, but I'm not fully understanding your method of changing those flag/parameters which change settings.   Is it one option (maybe easiest?) to leave the original macro unchanged, and make some copies with changes to these parameters?
« Last Edit: May 03, 2014, 06:03:36 PM by samdavo »

ablincoe

  • Newbie
  • *
  • Posts: 37
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #22 on: May 03, 2014, 06:15:51 PM »
Sam,
The macro copies a "base parameter set" out next to the drawing file with a  *.d3i  name.  As soon as you enter the macro, the first statement/question is where the macro log files for this UnFold, and if you want to change any of the parameters.  If you click on the "YES", it enters notepad to allow for the change to the  Drawing Specific parameter set.  I made the drawing specific parameter set so that it would be easier to re-do the unfold process multiple times during the life of the drawing.  I figured that once you got the parameters set for a particular drawing, they probably wouldn't change.  But there may be a need to use very different parameters for different drawings, and thus I did not want to have you always remembering how to change things for the drawing that you war working with now.

I agree that there are many different parameters, and that some changes may not even be visible when they are changed.  Part of the reasoning of the parameters is so that you don't need to do anything special to your drawing (except put a surface grid on what you want to UnFold) in order to get usable results.  You shouldn't have to make a special copy of things with different orientations in order to run the macro.  That would just make things more difficult for the user as they may forget to make a new copy and re-position it.

I envision 99% of the parameter changes to be to either:
     START_PT - Where within the GRID do you want to start the decoding from
     RET_LNPT - Which arranges what is considered to be a "Grid Line" vs a "Line Point"

samdavo

  • Hero Member
  • *****
  • Posts: 2587
  • the trick is knowin...^ > v < - which way's up?
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #23 on: May 03, 2014, 06:30:13 PM »
If you click on the "YES", it enters notepad to allow for the change to the  Drawing Specific parameter set. 
I believe you are also told this "this file needs to stay in its original format".  Exactly what does that mean?    Do you change the parameters there? do you need to save that new Notepad version?

Quote
'    THIS FILE NEEDS TO STAY IN IT's ORIGINAL FORMAT
'   It is used as a "Code Insert" to the program
'    Anything after a single quote "'" is a COMMENT
'    The "business part" of the line is a  -  Variable  equates  to a value
'   All of them are Numeric
'    This file is editable in Windows Notepad  -  or any other editor you choose
'
FLAT_LAYER   = 5      '  Which layer to put flattened objects on (strt
RET_LNPT   = 1      '  RETAIN DC3's  Mesh  Line/Point Relationship
            '  Fish Bone layout  -  or not
P_PLANE      = 0      '  Which Drawing Plane for "next point" calc's
            '    0=X/Y, 1=Y/Z, 2=X/Z
START_PT   = 5      '  Where to start flattening from within Grid
            '    Normally  1 - 9   Etc  etc

But is it an ALTERNATIVE option to make copies of the macro called eg start-point 1 and start point 2.?
 

ablincoe

  • Newbie
  • *
  • Posts: 37
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #24 on: May 03, 2014, 06:53:59 PM »
Sam,
The format of the *.d3i file is basically:
     Parameter_Name (some white space) "=" (some white space) Value (white space) [Comment]
     Just use Notepad to replace the "Value" area, and let Notepad save the data file upon exit (a normal function/process)
          It will look MUCH more consistent in NotePad than it does via the WEB pasting.
          The amount/type of "White Space" is very flexible, so don't be too worried about that part of it.

Could you make multiple copies of the macro for various parameter settings?
     Technically, yes. 
     You would need to re-write the "CHANGE_PARAMETERS:" Sub-Routine and just have it set all of the parameters instead of
          dealing with the  *.d3i  data files.

ablincoe

  • Newbie
  • *
  • Posts: 37
Re: UnFold, Flatten, Unroll, etc. for GRID entities
« Reply #25 on: May 04, 2014, 06:33:06 AM »
A somewhat easier modification ...

Old:     
GoSub   CHANGE_PARAMETERS         '    Deal with PARAMETER file

NEW:   
FLAT_LAYER   = 5      '  Which layer to put flattened objects on (strt
RET_LNPT   = 1      '  RETAIN DC3's  Mesh  Line/Point Relationship
            '  Fish Bone layout  -  or not
P_PLANE      = 0      '  Which Drawing Plane for "next point" calc's
            '    0=X/Y, 1=Y/Z, 2=X/Z
START_PT   = 5      '  Where to start flattening from within Grid
            '    Normally  1 - 9
    FRST_LN   = 0      '       Only used when START_PT=10
    FRST_PT   = 0      '       Only used when START_PT=10
FRST_SECT   = 1      '  Start plotting on a Verticl(1), Horizontl(2)
CALC_TRI   = 1      '  How to lay out the internal sub-triangles
            '    1=Norml, 2=Reversd, 3=Min Hypot, 4=Max Hyp
PRT_TRI      = 0      '  Print Diagonal reference lines every X points
PRT_REC      = 0      '  Print perpendicular ref lines every X points
PRT_REFERENCE   = 0      '    NOT Implemented at this time
W_TOLERANCE   = .0000001   '  WARNING Tolerance violation message
            '    .0000001 = .0063 inch devtn on 1-Mile scl
F_TOLERANCE   = .00001   '  FATAL (ABORT) Tolerance violation point
            '    .00001 = .63 inch devtn on 1-Mile scale
VERBOSE      = 1      '  VERBOSE Setting - 0-6
'  GoSub   CHANGE_PARAMETERS         '    Deal with PARAMETER file

Save the file with the name you wish to utilize.
« Last Edit: May 04, 2014, 06:42:37 AM by ablincoe »