Традиционное моделирование методом КБГ

From FreeCAD Documentation
Revision as of 08:40, 10 January 2017 by Baritone (talk | contribs) (Created page with "* Теперь сделаем отверстия для винтов, используя тот же метод Cut. Поскольку нам нужно 8 отверстий,...")

CGS означает Constructive Solid Geometry (Конструктивная сплошная геометрия), и описывает самый простой способ работы со сплошной трёхмерной геометрией: создание сложных объектов добавкой и удалением кусков в/из сплошных тел с помощью булевых операций, таких как объединение, вычитание или пересечение.

Как мы уже видели в этом руководстве, FreeCAD может поддерживать множество типов геометрии, но предпочтительным и наиболее подходящим типом объёмных объектов, которые мы будем проектировать с помощью FreeCAD, это объекты реального мира, которые, разумеется, твердотельные, граничной геометрией, которая в основном поддерживается модулем Part. В отличие от полигональных сеток, которые состоят из точек и треугольников, поверхности объектов BREP определяются математическими кривыми, обеспечивающими абсолютную точность вне зависимости от масштаба.

Различие между ними может сравниться с различием между растровыми и векторными изображениями. Как в растровых изображениях, полигональные сетки разбивают кривые поверхности на последовательность точек. При взгляде на них в приближении или печати в большом масштабе они будут видны не как кривые, а как гранёная поверхность. Как в векторных изображениях, так и в данных граничных представлений, позиция любой точки кривой не сохраняется в в геометрии, а вычисляется на лету, с большой точностью.

Граничная геометрия в FreeCAD поддерживается сторонним приложением с открытыми источниками, OpenCasCade. Основным интерфейсом между FreeCAD и ядром OpenCasCade служит модуль Part. Большинство других верстаков строят свою функциональность поверх модуля Part.

Хотя другие верстаки часто предлагают более совершенные инструменты для построения и манипуляции геометрией, поскольку все они фактически манипулируют объектами Part, полезно знать как эти объекты работают изнутри, и уметь использовать инструменты Part, поскольку они проще и часто могут помочь обойти проблемы, которые более интеллектуальные инструменты не могут решить правильно.

Для иллюстрации работы верстака Part мы будем моделировать этот стол, используя лишь операции CSG (за исключением винтов, для которых мы используем одно из расширений, и размерностей, которые мы рассмотрим в следующей главе):

Создадим новый документ (Ctrl+N или через меню Файл -> Создать), переключимся на верстак Part, и начнём с первой ножки:

  • Нажмите кнопку Куб
  • Выделите куб и установите следующие параметры на вкладке Данные:
    • Length: 80mm (или 8cm, или 0.8m, FreeCAD работает с любыми единицами)
    • Width: 80mm
    • Height: 75cm
  • Продублируйте параллелепипед нажатием Ctrl+C, затем Ctrl+V (или в меню Правка -> Дубликат)
  • Выделите новый созданный объект
  • Смените его позицию редактированием параметра Placement:
    • Position x: 8mm
    • Position y: 8mm

Вы получите два высоких параллелепипеда, один в 8 миллиметрах от другого:

  • Теперь мы можем вычесть один из другого: выделите первый, который должен остаться, затем, с помощью нажатой кнопки CTRL, выделите другой, который будет вычтен (порядок важен), и нажмите кнопку Обрезать:

Заметим, что вновь созданный объект, называемый "Cut", по-прежнему содержит два куба, которые мы использовали в качестве операндов. На самом деле, два куба остались в документе, они просто были скрыты и сгруппированы в древе проекта как объект Cut. Их еще можно выбрать, раскрывая стрелку у объекта Cut, и при желании можно сделать их видимыми снова, щелкнув их правой кнопкой, или изменить их свойства.

  • Теперь давайте создадим три других ножки, создав 6 дублей нашего базового куба. Поскольку он уже скопирован, можно просто вставить его (Ctrl+V) 6 раз. Изменим их позиции следующим образом:
    • Куб002: x: 0, y: 80cm
    • Куб003: x: 8mm, y: 79.2cm
    • Куб004: x: 120cm, y: 0
    • Куб005: x: 119.2cm, y: 8mm
    • Куб006: x: 120cm, y: 80cm
    • Куб007: x: 119.2cm, y: 79.2cm
  • Теперь сделаем три остальных выреза, выбрав сначала "базовый" параллелепипед, затем вырезаемый. Теперь у нас три объекта Cut:

Вы могли подумать, что вместо шестикратного дублирования базового куба нам следовало дублировать полную ножку три раза. Это правда, как всегда в FreeCAD, есть много путей получить тот же результат. Это важно запомнить, поскольку по мере продвижения к более сложным объектам некоторые операции не дадут нам правильный результат и нам часто понадобится искать другие пути.

  • Теперь сделаем отверстия для винтов, используя тот же метод Cut. Поскольку нам нужно 8 отверстий, два на каждую ножку, нам нужно сделать 8 вычитаемых объектов. Вместо этого поищем другой путь и сделаем 4 трубки, которые могут использоваться двумя ножками. Создадим четыре трубки инструментом Цилиндр. Можно опять сделать только один и дублировать взамен. Возьмём все цилиндры радиусом 6mm. Теперь нам надо повернуть их, что может быть сделано параметром Placement:
    • Цилиндр: height: 130cm, angle: 90°, axis: x:0,y:1, position: x:-10mm, y:40mm, z:72cm
    • Цилиндр001: height: 130cm, angle: 90°, axis: x:0,y:1, position: x:-10mm, y:84cm, z:72cm
    • Цилиндр002: height: 90cm, angle: 90°, axis: x:-1,y:0, position: x:40mm, y:-10mm, z:70cm
    • Цилиндр003: height: 90cm, angle: 90°, axis: x:-1,y:0, position: x:124cm, y:-10mm, z:70cm

You will notice that the cylinders are a bit longer than needed. This is because, as in all solid-based 3D applications, boolean operations in FreeCAD are sometimes oversensitive to face-on-face situations and might fail. By doing this, we put ourselves on the safe side.

  • Now let's do the subtractions. Select the first foot, then, with CTRL pressed, select one of the tubes that crosses it, press the Cut button. The hole will be done, and the tube hidden. Find it in the tree view by expanding the pierced foot.
  • Select another foot pierced by this hidden tube, then repeat the operation, this time Ctrl+ selecting the tube in the tree view, as it is hidden in the 3D view (you can also make it visible again and select it in the 3D view). Repeat this for the other feet until each of them has its two holes:

As you can see, each foot has become a quite long series of operations. All this stays parametric, and you can go change any parameter of any of the older operations anytime. In FreeCAD, we often refer to this pile as "modeling history", since it in fact carries all the history of the operations you did.

Another particularity of FreeCAD is that the concept of 3D object and the concept of 3D operation tend to blend into one same thing. The Cut is at the same time an operation, and the 3D object resulting from this operation. In FreeCAD this is called a "feature", rather than object or operation.

  • Now let's do the tabletop, it will be a simple block of wood, let's do it with another Box with length: 126cm, width: 86cm, height: 8cm, position: x: 10mm, y: 10mm, z, 67cm. In the View tab, you can give it a nice brownish, wood-like color by changing its Shape Color property:

Notice that, although the legs are 8mm thick, we placed it 10mm away, leaving 2mm between them. This is not necessary, of course, it won't happen with the real table, but it is a common thing to do in that kind of "assembled" models, it helps people who look at the model to understand that these are independent parts, that will need to be attached together manually later.

Now that our five pieces are complete, it is a good time to give them more proper names than "Cut015". By right-clicking the objects in the tree view (or pressing F2), you can rename them to something more meaningful to yourself or to another person who would open your file later. It is often said that simlpy giving proper names to your objects is much more important than the way you model them.

  • We will now place some screws. There is nowadays an extremely useful addon developed by a member of the FreeCAD community, that you can find on the FreeCAD addons repository, called Fasteners, that makes the insertion of screws very easy. Installing additional workbenches is easy and described on the addons pages.
  • Once you have installed the Fasteners Workbench and restarted FreeCAD, it will appear in the workbenches list, and we can switch to it. Adding a screw to one of our holes is done by first selecting the circular edge of our hole:

  • Then we can press one of the screw buttons of the Fasteners Workbench, for example the EN 1665 Hexagon bolt with flanges, heavy series. The screw will be placed and aligned with our hole, and the diameter will automatically be selected to match the size of our hole. Sometimes the screw will be placed inverted, which we can correct by flipping its invert proprty. We can also set its offset to 2mm, to follow the same rule we used between the tabletop and the feet:

  • Repeat this for all the holes, and our table is complete!

The internal structure of Part objects

As we saw above, it is possible in FreeCAD to select not only whole objects, but parts of them, such as the circular border of our screw hole. This is a good time to have a quick look at how Part objects are constructed internally. Every workbench that produces Part geometry will be based on these:

  • Vertices: These are points (usually endpoints) on which all the rest is built. For example, a line has two vertices.
  • Edges: the edges are linear geometry like lines, arcs, ellipses or NURBS curves. They usually have two vertices, but some special cases have only one (a closed circle for example).
  • Wires: A wire is a sequence of edges connected by their endpoints. It can contain edges of any type, and it can be closed or not.
  • Faces: Faces can be planar or curved, and can be formed by one closed wire, which forms the border of the face, or more than one, in case the face has holes.
  • Shells: Shells are simply a group of faces connected by their edges. It can be open or closed.
  • Solids: When a shell is tighly closed, that is, it has no "leak", it becomes a solid. Solids carry the notion of inside and outside. Many workbench rely on this to make sure the objects they produce can be built in the real world.
  • Compounds: Compounds are simply aggegates of other shapes, no matter their type, into a single shape.

In the 3D view, you can select individual vertices, edges or faces. Selecting one of these also selects the whole object.

A note about shared design

You might look at the table above, and think its design is not good. The tightening of the feet with the tabletop is probably too weak. You might want to add reforcing pieces, or simply you have other ideas to make it better. This is where sharing becomes interesting. You can download the file made during this exercise from the link below, and modify it to make it better. Then, if you share that improved file, others might be able to make it even better, or use your well-designed table in their projects. Your design might then give other ideas to other people, and maybe you will have helped a tiny bit to make a better world...

Загрузки

Читать далее