Organising your code. Using variables and comments.
We already know how to place points, size measurements and variables. We even looked into different ways of making your code simpler and more readable.
For now, our code is 7 lines long, and counting. Your pattern draft might be several dozens of lines long, and it is good to know how to make the process of reading, understanding and editing it less complicated.
Here are a couple of ideas:
1) Do use variables.
This might make your code longer, but it is easier to read. While you are creating your pattern you have a clear picture of what you are doing and may cut corners. However when you return to it weeks or months later, you might forget why you placed P110 by (sz43-sz40)+1*0.5-[p120:p130].l to the right from P1.
2) Keep your calculations and settings in one place, preferably at the beginning of the pattern draft.
You can then edit them in one highly visible place, and the rest of the geometry will be executed accordingly.
3) Use comments.
Comments are like sticky notes on your drafting. You can leave yourself, or your colleague a note explaining why you did it a certain way, or simply mark up the sections of your draft. To mark one line, or a part of a line, use
//. To comment on several lines, use
/*at the beginning and
*/at the end.
4) Use tabulation and spaces
It's ok to press the return button for another paragraph. It doesn't affect the way your draft is processed by the system, and it makes it easier to read.
Let's take a look at the skirt pattern draft and make some changes to it.
First, we shall put all calculations in one place, create variables for commonly used values, and mark up sections.
Sewist doesn't limit you in terms of pattern drafting methods, and you can use whatever system you prefer, or even experiment with your own one. For the sake of this manual we are going to make it rather simple, and rely on anthropometry only when we calculate the most vital variables. It is our design decision, that there will be one dart in the front, and one in the back, and we shall distribute these proportionally.
ea19 = 1.5// ease allowance around hips
ea18 = 0.5// ease allowance around waist
back_dart_pos = 0.55// that's how far the back dart is placed on back skirt from back center
front_dart_pos = 0.5// that's how far the front dart is placed on front skirt front center
hip_width = sz19/2 + ea19// width of skirt pattern at the hip level
waist_width = sz18/2 + ea18// width of skirt pattern at the waist level
skirt_length = sz26 - sz9// knee length
dif_side = sz25 - sz26// how much higher the top corner of side seam is from height of center front
hip_length = ( sz7 - sz12 ) * 0.76// length from waist to hips
back_dart_length = hip_length * 0.7// length of back dart
front_dart_length = hip_length * 0.45// length of front dart
dif_waist_hip = hip_width - waist_width// total value of darts
back_dart = dif_waist_hip * 0.35// width of the back dart
front_dart = dif_waist_hip * 0.15// width of the front dart
side_dart = dif_waist_hip * 0.5// width of the side dart
We can now continue with drafting. Later, if we decide to change ease allowances, or re-distribute darts, we can easily do it in the beginning of the pattern draft.