3

Beginning programmer here (mostly engineer). I'm making trapezoids in layers. We begin with the small length layer, and end with the longest length layer.

I want my user to input in a desired maximum length, a desired minimum length, type of pattern (5 or 7 each) and number of layers to use.

Then the program spits out an output based on these inputs. Here is an example with 5 plies:

5 Layer Example:

15 layers = MRMRM/MRMRM/MRMRM/

For a desired minimum length of 3, and varying maximum lengths, my desired output string would be:

MAX LENGTH 3: 3[MRMRM/MRMRM/MRMRM/]

MAX LENGTH 4: 3[MRMRM/MRMR] 4[M/MRMRM/]

MAX LENGTH 5: 3[MRMR] 4[M/MRMR] 5[M/MRMRM/]

MAX LENGTH 6: 3[MRMR] 4[M/MRMR] 5[M/MR] 6[MRM/]

(Separating out the M/ layers first, now splitting the MRMR into 2-char strings)

MAX LENGTH 7: 3[MRMR] 4[M/MR] 5[MR] 6[M/MR] 7[MRM/]

MAX LENGTH 8: 3[MRMR] 4[M/MR] 5[MR] 6[M/MR] 7[MR] 8[M/]

MAX LENGTH 9: 3[MR] 4[MR] 5[M/MR] 6[MR] 7[M/MR] 8[MR] 9[M/]

(Now splitting M/ from the MR strings last):

MAX LENGTH 10: 3[MR] 4[MR] 5[M/MR] 6[MR] 7[M/] 8[MR] 9[MR] 10[M/]

MAX LENGTH 11: 3[MR] 4[MR] 5[M/] 6[MR] 7[MR] 8[M/] 9[MR] 10[MR] 11[M/]

From there, it's a simple matter of taking the middle point and changing the numbers evenly between back and in front of the midpoint, evenly adding to the numbers.

I can't think of a simple algorithm to do this splitting. Since it is slightly less material, if a split happens on an odd number (like the jump from 3-4, or 5-6), we have the split occur on the far side of the midpoint. I envision having to do two algorithms, one for the 5 layer case and one for the 7 layer case.

Thoughts?

Mark
  • 131
  • 4
  • If I had to read that twice to understand, then maybe you should re-evaluate how the user provides the input. If the user has to think about how to write the input, then you're not gaining any advantage. – Neil Jun 18 '15 at 15:46
  • The user just needs to input number of plies. So they plug in the number 15, and it spits out MRMRM/MRMRM/MRMRM, broken up based on the lengths as shown. – Mark Jun 18 '15 at 15:52
  • Oh, I see, you meant output. What do the Ms and Rs signify? – Neil Jun 18 '15 at 16:00
  • The layers designate different materials for the use in composites. The M is a chopped strand mat layer - uniformly dispersed reinforcing fibers, that basically adhere the R layers together. The R is a woven reinforcing layer, which does the work. Since we build these a lot to join pieces, this is pretty common jargon in the industry. – Mark Jun 18 '15 at 16:04
  • Could you provide an example of program usage as you would want it to work? For example, "How many trapezoids? 4 What is min length? 5 Output: x" Perhaps show a diagram? I'm still having difficulty understanding how your program should work. – Neil Jun 19 '15 at 07:26

0 Answers0