Manual:Modeling for product design/ru

Проектирование продукта изначально было коммерческим термином, но в мире 3D это обычно означает моделирование чего-то, что будет напечатано с помощью 3D-принтера, или, в более общем случае, произведено с помощью машины, будь это объёмный принтера или станок с ЧПУ.

Когда Вы печатаете объёмный объект, обязательно нужно, чтобы Ваш объект был твёрдым телом. Конечно, ничего не мешает ему быть пустым внутри. Но Вам всегда следует чётко знать, с какой стороны внутренний материал, а где внешняя сторона, поскольку принтер или ЧПУ должны чётко знать, что заполнено материалом, а что нет. Поэтому верстак PartDesign является лучшим инструментом в FreeCAD для построения таких частей, потому что он всегда следит за тем, чтобы объекты были твердотельны и изготовляемы.

Для демонстрации работы верстака PartDesign, смоделируем эту хорошо известную деталь Лего:



В элементах Лего хорошо то, что их размеры, как минимум для стандартных, легко узнать в Интернет. Их достаточно легко моделировать и печатать в объёме, и при некотором терпении (объёмная печать требует много настройки) Вы сможете сделать элементы, которые полностью совместимы и идеально присоединяются к оригинальным блокам Лего. В показанном ниже примере мы делаем элемент в 1,5 раз больше оригинала.

Мы будем использовать только инструменты модулей Sketcher и PartDesign. Поскольку все инструменты верстака Sketcher включены в верстак PartDesign, мы можем оставаться в PartDesign и не нуждаться в переключении между верстаками.

Объекты PartDesign полностью базируются на Эскизах. Эскизы это двумерные объекты, составленные из линейных сегментов (линий, дуг или эллипсов) и геометрических ограничений. Эти ограничения могут быть применены либо к линейным сегментам или их конечным точкам или центральным точкам, и заставляют геометрию следовать некоторым правилам. Например, Вы можете поместить вертикальные ограничения к сегменту линии, чтобы заставить его быть вертикальным, или установить для конечных точек ограничения позиции, чтобы запретить перемещение. Когда эскиз содержит такой набор ограничений, что никакие точки эскиза не могут быть сдвинуты, говорят о полностью ограниченном эскизе. Когда есть излишние ограничения, которые могут быть убраны без позволения изменений геометрии, он называется переограниченным. Этого следует избегать, и FreeCAD в этом случае сделает предупреждение.

Sketches have an edit mode, where their geometry and constraints can be changed. When you are done with editing, and leave edit mode, sketches behaves like any other FreeCAD object, and can be used as building blocks for all the Part Design tools, but also in other workbenches, such as Part or Arch. The Draft workbench also has a tool that converts Draft objects to Sketches, and vice-versa.


 * Let's start by modeling a cubic shape that will be the base of our Lego brick. Later on we will carve the insides, and add the 8 dots on top of it. So let's start this by making a rectangular sketch that we will then extrude:
 * Switch to the PartDesign Workbench
 * Click on the [[Image:Sketcher_NewSketch.png|16px]] New Sketch button. A dialog will appear asking where you want to lie the sketch, choose the XY plane, which is the "ground" plane. The sketch will be created and will immediately be switched to edit mode, and the view will be rotated to look at your sketch orthogonally.
 * Now we can draw a rectangle, by selecting the [[Image:Sketcher_CreateRectangle.png|16px]] Rectangle tool and clicking 2 corner points. You can place the two points anywhere, since their correct location will be set in the next step.
 * You will notice that a couple of constraints have automatically been added to our rectangle: the vertical segments have received a vertical constraint, the horizontal ones a horizontal constraint, and each corner a point-on-point constraint that glues the segments together. You can experiment moving the rectangle around by dragging its lines with the mouse, all the geometry will keep obeying the constraints.




 * Now, let's add three more constraints:
 * Select one of the vertical segments and add a [[Image:Constraint_VerticalDistance.png|16px]] Vertical Distance Constraint. Give it a size of 23.7mm.
 * Select one of the horizontal segments and add a [[Image:Constraint_HorizontalDistance.png|16px]] Horizontal Distance Constraint. Make it 47.7mm.
 * Finally, select one of the corner points, then the origin point (which is the dot at the crossing of the red and green axes), then add a [[Image:Constraint_PointOnPoint.png|16px]] Point on Point Constraint. The rectangle will then jump to the origin point, and your sketch will turn green, meaning it is now fully constrained. You can try moving its lines or points, nothing will move anymore.



Note that the last point-on-point constraint was not absolutely necessary. You are never forced to work with fully constrained sketches. However, if we are going to print this block in 3D, it will be necessary to maintain our piece close to the origin point (which will be the center of the space where the printer head can move). By adding that constraint we are making sure that our piece will always stay "anchored" to that origin point.


 * Our base sketch is now ready, we can leave edit mode by pressing the Close button on top of its task panel, or simply by pressing the Escape key. If needed later on, we can reenter edit mode anytime by double-clicking the sketch in the tree view.
 * Let's extrude it by using the [[Image:PartDesign_Pad.png|16px]] Pad tool, and giving it a distance of 14.4mm. The other options can be left at their default values:



The Pad behaves very much like the Extrude tool that we used in the previous chapter. There are a couple of differences, though, the main one being that a pad cannot be moved. It is attached forever to its sketch. If you want to change the position of the pad, you must move the base sketch. In the current context, where we want to be sure nothing will move out of position, this is an additional security.


 * We will now carve the inside of the block, using the [[Image:PartDesign_Pocket.png|16px]] Pocket tool, which is the PartDesign version of Part Cut. To make a pocket, we will create a sketch on the bottom face of our block, which will be used to remove a part of the block.
 * With the bottom face selected, press the [[Image:Sketcher_NewSketch.png|16px]] New sketch button.
 * Draw a rectangle on the face.




 * We will now constrain the rectangle in relation to the bottom face. To do this, we need to "import" some edges of the face with the [[Image:Sketcher_External.png|16px]] External geometry tool. Use this tool on the two vertical lines of the bottom face:



You will notice that only edges from the base face can be added by this tool. When you create a sketch with a face selected, a relation is created between that face and the sketch, which is important for further operations. You can always remap a sketch to another face later with the Map sketch tool.


 * The external geometry is not "real", it will be hidden when we leave edit mode. But we can use it to place constraints. Place the 4 following constraints:
 * Select the top left point of the rectangle and the top point of the imported line and add a [[Image:Constraint_HorizontalDistance.png|16px]] Horizontal Distance Constraint of 1.8mm
 * Select again the top left point of the rectangle and the top point of the imported line and add a [[Image:Constraint_VerticalDistance.png|16px]] Vertical Distance Constraint of 1.8mm
 * Select the bottom right point of the rectangle and the bottom point of the right imported line and add a [[Image:Constraint_HorizontalDistance.png|16px]] Horizontal Distance Constraint of 1.8mm
 * Select again the bottom right point of the rectangle and the bottom point of the right imported line and add a [[Image:Constraint_VerticalDistance.png|16px]] Vertical Distance Constraint of 1.8mm




 * Leave edit mode and we can now perform the pocket operation: With the sketch selected, press the [[Image:PartDesign_Pocket.png|16px]] Pocket buttton. Give it a length of 12.6mm, which will leave the upper face of our pad with a thickness of 1.8mm (remember, the total height of our pad was 14.4mm).




 * We will now attack the 8 dots on the top face. To do this, since they are a repetition of a same feature, we will use the handy [[Image:PartDesign_LinearPattern.png|16px]] Linear pattern tool of the Part Design Workbench, which allows to model once and repeat the shape.
 * Start by selecting the top face of our block
 * Create a [[Image:Sketcher_NewSketch.png|16px]] New sketch.
 * Create two [[Image:Sketcher_Circle.png|16px]] circles.
 * For each circle, select it and add a [[Image:Constraint_Radius.png|16px]] Radius Constraint of 3.6mm to each of them
 * Import the left edge of the base face with the [[Image:Sketcher_External.png|16px]] External geometry tool.
 * Place two vertical constraints and two horizontal constraints of 6mm between the center point of each circle and the corner points of the imported edge, so each circle has its center at 6mm from the border of the face:




 * Notice how, once again, when you lock the position and dimension of everything in your sketch, it becomes fully constrained. This always keeps you on the safe side. You could change the first sketch now, everything we did afterwards would keep tight.
 * Leave edit mode, select this new sketch, and create a [[Image:PartDesign_Pad.png|16px]] Pad of 2.7mm:




 * Notice that, as earlier with the pocket, since we used the top face of our base block as a base for this latest sketch, any PartDesign operation we do with this sketch will correctly be built on top of the base shape: The two dots are not independent objects, they have been extruded directly from our brick. This is the great advantage of working with the Part Design Workbench, as long as you take care of always building one step on top of the previous one, you are actually building one final solid object.
 * We can now duplicate our two dots four times, so we get eight. Select the latest Pad we just created.
 * Press the [[Image:PartDesign_LinearPattern.png|16px]] Linear pattern button.
 * Give it a length of 36mm (which is the total "span" we want our copies to fit in), in the "horizontal sketch axis" direction, and make it 4 occurences:




 * Once again, see that this is not just a duplication of an object, it is a *feature* of our shape that has been duplicated, the final object is still only one solid object.
 * Now let's work on the three "tubes" that fill the void we created on the bottom face. We have several possibilities: create a sketch with three circles, pad it then pocket it three times, or create a base sketch with one circle inside the other and pad it to form the complete tube already, or even other combinations. Like always in FreeCAD, there are many ways to achieve a same result. Sometimes one way will not work the way we want, and we must try other ways. Here, we will take the safest approach, and do things one step at a time.
 * Select the face that is at the bottom of the hollow space we carved earlier inside the block.
 * Create a new sketch, add a circle with a radius of 4.8825mm, import the left border of the face, and constrain it vertically and horizontally at 10.2mm from the upper corner of the face:




 * Leave edit mode, and pad this sketch with a distance of 12.6mm
 * Create a linear pattern from this last pad, give it a length of 24mm and 3 occurences. We now have three filled tubes filling the hollow space:




 * Now let's make the final holes. Select the circular face of the first of our three "pins"
 * Create a new sketch, import the circular border of our face, create a circle with a radius constraint of 3.6mm, and add a [[Image:Constraint_PointOnPoint.png|16px]] Point on Point Constraint between the center of the imported circle and our new circle. We now have a perfectly centered circle,and once again fully constrained:




 * Leave edit mode, and create a pocket from this sketch, with a length of 12.6mm
 * Create a linear pattern from this pocket, with a length of 24mm and 3 occurences. That's the last step, our piece of lego is now complete, we can give it a nice color of Victory!



You will notice that our modeling history (what appears in the tree view) has become quite long. This is precious because every single step of what we did can be changed later on. Adapting this model for another kind of brick, for example one with 2x2 dots, instead of 2x4, would be a piece of cake, we would just need to change a couple of dimensions and the number of occurences in linear patterns. We could as easily create bigger pieces that don't exist in the original Lego game.

But we could also need to get rid of the history, for example if we are going to model a castle with this brick, and we don't want to have this whole history repeated 500 times in our file.

There are two simple ways to get rid of the history, one is using the Create simple copy tool from the Part Workbench, which will create a copy of our piece that doesn't depend anymore on the history (you can delete the whole history afterwards), the other way is exporting the piece as a STEP file and reimporting it.

Assembling

But the best of both worlds also exists, which is the Assembly2 Workbench, an addon that can be installed from the FreeCAD-addons repository. This Workbench is named "2" because there is also an official built-in Assembly Workbench in development, which is not ready yet. The Assembly2 Workbench, however, already works very well to construct assemblies, and also features a couple of object-to-object constraints which you can use to constrain the position of one object in relation to another. In the example below, however, it will be quicker and easier to position the pieces using Draft Move and  Draft Rotate than using the Assembly2 constraints.


 * Save the file we did until now
 * Install the Assembly2 Workbench and restart FreeCAD
 * Create a new empty document
 * Switch to the Assembly2 workbench
 * Press the Import a part from another FreeCAD document button
 * Select the file we saved above
 * The final piece will be imported in the current document. The Assembly2 workbench will determine automatically what is the final piece in our file that needs to be used, and the new object stays linked to the file. If we go back and modify the contents of the first file, we can press the Update parts imported into the assembly button to update the pieces here.
 * By using the Import a part from another FreeCAD document button several times, and moving and rotating the pieces (with the Draft tools or by manipulating their Placement property), we can quickly create a small assembly:



Downloads


 * The model produced during this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/lego.FCStd

Read more


 * Эскизирование
 * Верстак PartDesign
 * Верстак Assembly2