Тема |
---|
Скетчер |
Уровень |
Начинающий |
Время для завершения |
Авторы |
Ulrich |
FreeCAD версия |
Примеры файлов |
Смотрите также |
None |
Введение
Скетчер - это инструмент для создания 2D-объектов с целью их использования при проектировании деталей. Скетчер отличается от традиционных инструментов рисования. Чтобы показать разницу, можно построить треугольник. Треугольник полностью определяется тремя величинами, которые могут быть любыми из следующего списка: длина стороны, угол, высота, площадь. Единственное исключение - три угла, которые не определяют размер.
Чтобы построить треугольник из 3 отрезков традиционным способом, нужно сделать следующее:
- провести базовую линию
- построить две окружности с радиусом, заданным длинами двух других сторон, или вычислить координаты третьей вершины
- провести недостающие две стороны от конечных точек базовой линии до точки пересечения двух окружностей или вычисленной вершины.
На странице wikipedia:Triangle (англ.) Треугольник (рус.) приведена коллекция формул для вычисления недостающей информации для построения треугольника по минимальным исходным данным. Они необходимы, если треугольник должен быть задан по заранее вычисленным координатам.
В Скетчере всё по-другому. Формулы и приведённые выше вспомогательные построения не нужны. Чтобы понять разницу, лучше всего самостоятельно построить треугольник.
Первый эскиз: треугольник
Для создания эскиза необходим открытый документ. Если открытого документа нет, новый будет создан, если щёлкнуть по . При этом должен быть выбран рабочий стол скетчера:
Новый эскиз будет создан, если щёлкнуть по . Появится диалог, в котором можно выбрать ориентацию нового эскиза в 3D-пространстве. В данном случае это не имеет значения, поэтому можно подтвердить плоскость XY. Будет создан новый пустой эскиз, который откроется в режиме редактирования. Появится сетка с системой координат и красной точкой в начале координат.
В Скетчере можно нарисовать произвольный треугольник с помощью инструмента полилинии и определить его свойства на следующем этапе. Каждый щелчок на поверхности рисунка задаёт вершину. Треугольник должен быть замкнут. Поэтому для последней линии нужно щёлкнуть по первой созданной вершине. Перед тем как щёлкнуть, рядом с указателем мыши должна появиться красная точка.
Это позволит убедиться, что последняя вершина совпадает с первой и профиль замкнут. Символы, которые появляются под курсором, обозначают автоограничения. Они устанавливаются автоматически, если щёлкнуть в этом месте. Красная точка под курсором указывает на совпадение ограничений между двумя вершинами, то есть вершины разных элементов чертежа ограничены одинаковым местоположением.
Созданный треугольник является подвижным. К вершине можно подвести мышь и перетащить её. Стороны треугольника следуют за вершиной. То же самое можно сделать с отрезком.
Длину каждой стороны теперь легко определить, выделив её мышью: выделенный элемент становится зелёным. Если щёлкнуть по инструменту длины, откроется диалог, в котором можно задать нужную длину. На рисунке ниже показан треугольник с длинами сторон 35 мм, 27 мм и 25 мм. Базовая линия была установлена горизонтально, для этого нужно выделить её и щёлкнуть по инструменту горизонтального ограничения
.
Эти определения длины называются ограничениями. Ограничения используются для определения фиксированной конструкции из изменяемых геометрических данных. Скетчер предоставляет все ограничения, необходимые для определения любого вида треугольника. Только площадь не может быть использована для определения треугольника. Поэтому созданный треугольник можно переопределить, изменив значение ограничения или удалив ограничения и добавив другие. Далее идёт список треугольников с другими заданными свойствами. Превратить только что созданный треугольник в один из них не составит труда.
- Даны один или два угла: Необходимо выбрать две стороны треугольника. Если щёлкнуть по
, откроется диалог для указания угла.
- Прямоугольный треугольник: Необходимо выбрать две стороны треугольника. Достаточно щёлкнуть по
, чтобы установить прямой угол между двумя сторонами.
- Равносторонний: Одна сторона должна быть задана определенной длины. Затем нужно выбрать все стороны. Если щёлкнуть по
, определяются два ограничения с равной длиной, чтобы придать всем сторонам одинаковую длину.
- Равносторонний треугольник (два одинаковых по длине ребра) с заданной высотой: Выберите сначала две стороны с одинаковой длиной. Щёлкните по
, чтобы установить равенство между двумя сторонами. Затем выберите базовую линию и верхнюю вершину и щёлкните по инструменту длины
.
Ограничения можно выбрать, щёлкнув по их символу или щёлкнув в списке ограничений. Их можно удалить, а в случае ограничений со значением - отредактировать двойным щёлчком. Данный треугольник может быть впоследствии преобразован в треугольник другого типа путём редактирования или изменения ограничений. Скетчер является частью параметрического подхода к моделированию в FreeCAD. То, что вы создали, может быть легко изменено впоследствии, если, например, потребуется другой вариант конструкции.
На показанных выше треугольниках есть белые линии. Это признак того, что у эскиза осталось несколько степеней свободы. Это можно проверить, перетащив некоторые линии или точки. Если линия или точка перемещается, значит, этот элемент не полностью определён. Эскиз, у которого нет степеней свободы, становится зелёным.
У изоскелетного треугольника отсутствует настройка длины базовой линии, и он может свободно перемещаться и вращаться в плоскости чертежа скетчера.
Если свойства треугольника определены, его всё равно нужно закрепить в плоскости рисования. В плоскости рисования скетчера есть система координат. Начало системы координат видно как красная точка в центре розовой оси x и светло-зелёной оси y. Самый простой способ исправить это - выбрать вершину и щёлкнуть по . Это добавит горизонтальное и вертикальное расстояние от вершины до начала системы координат. У треугольника по-прежнему может быть одна степень свободы для вращения. Поэтому одна из сторон нуждается в горизонтальном или вертикальном ограничении или в определенном угле к одной из осей системы координат. На следующем рисунке показан полностью ограниченный эскиз. Все линии и вершины теперь имеют зелёный цвет.
Подробнее об Ограничениях
Скетчер не знает формул треугольников из Википедии. Вместо этого он составляет систему уравнений для двумерных координат на основе заданных ограничений. Затем эта система уравнений решается численно.
Таким образом можно решать самые разные геометрические задачи. Но есть и недостаток. Если набор уравнений имеет несколько решений, мы можем получить совсем не то, что ожидали. Это особенно неприятно, если одна и та же конструкция должна быть использована с разными размерами. Типичным симптомом является то, что после изменения ограничения длины эскиз переходит в совершенно другое состояние. Простой пример - разделение расстояния на три равные части. На следующем рисунке показаны три линии в ряд с установленными ограничениями равенства и параллельности. Общее расстояние задано равным 10 мм.
Это работает хорошо, если вводить только большие расстояния. При уменьшении расстояния свыше определенного соотношения линии складываются. Таким образом, мы получаем уже не треть от заданного расстояния, а само расстояние или две трети от него. Некоторые линии нашего ряда изменили свою ориентацию. Это по-прежнему даёт правильное решение для набора ограничений, но не то, что было задумано. На следующем изображении того же эскиза показано следующее. Ограничение по длине было установлено на 1000 мм, а затем уменьшено до 5 мм.
Решением является определение угла 180° между линиями раздела вместо ограничения на параллельность. Ограничение 180° имеет только одно решение. Теперь эскиз устойчив к большим изменениям расстояния. Следует отметить, что для той же цели, где это уместно, служит и ограничение 0°.
Ограничение 180° - это решение многих проблем. В некоторых старых версиях FreeCAD есть проблемы с отображением 180°-ограничения в плоскости скетчера. В большинстве случаев 180°-дуга отображается в плоскости чертежа не так, как ожидалось. Это известная проблема для FreeCAD до версии 14.3613.
В случае, когда несколько размеров увеличиваются по прямой, целесообразно сначала нарисовать зигзагообразную линию, а затем задать ограничения 180°. Это поможет не забыть про какой-то один или задать его дважды.
В следующей таблице приведены некоторые комбинации ограничений для определения простого угла. Комбинация была протестирована путём увеличения горизонтального размера длины 10 мм до больших значений, пока угольник не изменит свою ориентацию. В таблице для каждого показанного сочетания ограничений указана измененная длина, при которой происходит изменение ориентации.
Комбинация Ограничений | Комментарии |
---|---|
|
Определение длины: Ограничение равенства для определения длины |
|
Определение длины: Ограничение равенства для определения вертикальной длины, дуга для определения горизонтальной длины. |
|
Definition of length: Equality constraint for definition of length |
|
Definition of length: Horizontal length defined with the general length constraint. Equality constraint for definition of vertical length. |
|
Definition of length: Equality constraint for definition of length |
Тест показал следующее: большие изменения размерных ограничений могут привести к переворачиванию некоторых линий эскиза из-за множественного решения основной системы уравнений. Единственными ограничениями, которые сохраняют ориентацию элементов, к которым они применяются, являются ограничение угла и ограничения горизонтальных и вертикальных размеров. Различия между другими ограничениями в вопросе сохранения ориентации незначительны.
Recommendation: Use angle constraints and horizontal and vertical dimension constraints at critical places in order to make a sketch robust against dimension changes.
Проблема сочетания ограничений
Sometimes two or more constraints define the same property. An example can be made of two connected lines, where the connection point is the center point of a symmetry constraint for the endpoints of the lines. Those lines now have equal length and are parallel. All this is the consequence of the symmetry constraint.
What happens, if those two lines already have an equality constraint and a parallel constraint and the symmetry constraint is added too? Now the parallel property is defined by two constraints and the equal length is also defined by two constraints. In principle the underlying system of equations should have a solution. But there may be numerical problems. This can be tested by trying to move the lines. In most cases the lines are frozen, even if the sketcher still reports several degrees of freedom.
The above case shows a problem that seems to be difficult to solve for the sketcher programmers. So the user has to take care, to avoid such situations. Sketches with redundant constraints do behave unexpected and problematic. Symptoms of those redundant constraints are the above frozen state or reported redundant constraints after modifying a different object in the sketch.
In general the sketcher gives a warning, when redundant constraints are detected. But this detection mechanism seems not to work in all cases. When the problem is recognized, it can be avoided by just deleting the redundant constraints. Sometimes it is necessary to choose a different combination of constraints.
The following cases are sources for redundant constraints:
- An equality constraint for two radii of the same arc
- An symmetry constraint for two radii of the same arc
- A symmetry constraint in combination with parallel, equality and or perpendicular constraints
A different problematic case are parallels with an intersection point in infinity. It is possible to set a 180°-constraint for two parallel lines without an intersection point. This is not recommended. An angle to an other line or axis should be used instead.
A different problem is the change of orientation of angles. This can happen if, angle changes above 180° are made. Doing this in smaller steps avoid the problem.
Конструкционные линии - пошаговый пример
In the first part it was shown that construction geometry is not necessary for constructing triangles. But nevertheless the sketcher provides construction geometry, which is useful for more complex problems. Any line can be converted to a construction line with the button. The construction lines are shown in the sketch as blue lines. They can be used for constraints in the same way as other lines, but are not shown and not used when the sketch is closed.
Giving the task to make a rectangle with the side length having the golden ratio. Wikipedia shows how to construct two lines with a length ratio of the golden ratio.
The sketcher is a perfect tool to construct a rectangle with the golden ratio for the side length. The size of the rectangle can be later changed without making a new construction. The construction steps for the golden ratio according to Wikipedia are:
- Having a line segment AB, construct a perpendicular BC at point B, with BC half the length of AB. Draw the hypotenuse AC.
- Draw an arc with center C and radius BC. This arc intersects the hypotenuse AC at point D.
- Draw an arc with center A and radius AD. This arc intersects the original line segment AB at point S. Point S divides the original segment AB into line segments AS and SB with lengths in the golden ratio.
Ниже будет пошаговое объяснение, как это можно сделать.
- Make a new sketch as explained at the triangle example.
- Draw a rectangle in the sketch. Use the button
. The following picture shows the rectangle. FreeCAD did add horizontal and vertical constraints to the rectangle. This rectangle can not be rotated.
The rectangle should stay in the center of the coordinate system. To achieve this, a symmetry constraint is added to a horizontal line. This is done by selecting first the two vertices of the horizontal line and then the vertical axis of the coordinate system. The symmetry constraint is added by clicking on the button . The same is done for a vertical line, but instead now the horizontal axis is selected as symmetry axis. The picture below shows the result. The rectangle stays now at the center and can only be resized but not moved.
This was the preparation for the rectangle. The top horizontal line should be the distance AS of the golden ration construction. An additional line is needed to represent the SB-distance. It is drawn a little bit skewed as shown below. This avoids the auto-constraining to horizontal. This line should instead be constrained later with a 180°-angle, in order to avoid the existence of multiple solutions to the constructed constrain-combination. If the line is drawn with an horizontal constrained, the sketcher will complain later at adding the 180°-angle constrained. The horizontal constrained has to be removed in such a case. The picture shows how to add an angle-constraint by selecting two lines and clicking at . After adding a line, it is often advisable to drag at the line with the mouse. This will easily show, if a line is not attached to the other drawn elements. If a line is not connected right to the other lines, problems may arise in later steps of the part construction.
The last line is not part of the rectangle. It is therefore necessary to convert it into a construction line. Selecting the line and clicking at the button does the conversion.
The line has now a blue color as visible below. The recipe from Wikipedia for the golden ratio requires a line half of the distance AB. In order to get a reference point for this, an additional vertex is set at the line with the tool. This is shown below.
The reference point should stay at the center of the distance AB. This will be achieved by selecting first the two endpoints of the distance AB and third selecting the center point. When all three points are selected in the right sequence, the symmetry constraint can be set at clicking at the button, as shown below.
The Picture below shows already the second side BC of the construction triangle. This line was drawn as described above and converted to a construction line. This line must have a vertical constraint as visible in the picture. This can be easily achieved by drawing the line nearly vertical. If the line is nearly vertical a vertical constraint symbol is shown and set by the Sketcher when finishing the line at this state.
The line BC must have half of the length of AB. There is only a reference point available for this purpose, so the equality constraint can not be used. The equality constraint would need a line with this length as reference, which is not available in the construction. Therefore the classical arc is used to define the length BC. The picture below shows the drawing of the arc. The arc-tool is used. First the center point is set at B. The point should be visible beneath the arc-tool at clicking at B. Often the arc-tool has not has to be not directly over the target point but a little beneath, in order to get the coincidence point visible. Second the radius of the arc is defined by setting the next point at the reference point. The last point of the arc is set in the neighborhood of the point C. It is important, that the first two points are fixed to C and the center point. This should be tested with dragging at the arc after finishing it.
In order to define the length of BC, the line must end at the arc. This will be done by setting a coincidence constraint between the last arc point and the C point as shown below. Both points have to be selected and the create a coincidence button has to be clicked.
The next picture shows the ready triangle. The hypotenuse AC is already drawn and converted to a construction line.
Now step 2 of the Wikipedia recipe has to be constructed. A second arc has to be drawn with the center point at C and the starting point at B. The last point should be end at the hypotenuse as shown in the picture below.
The drawn arc was converted to a construction line. Now step 3 of the Wikipedia recipe starts with drawing the last arc as shown in the picture below. The radius of this arc has to be defined with the above constructed point on the hypotenuse. The last point will usually not end at a corner of the rectangle. But this is not a problem, as it will be fixed later. The last point may set as shown below.
Now the final step has to be made, in order to make the horizontal line of the rectangle equal to the distance AS. This is shown below by setting a coincidence constraint between the end of the last arc and the corner of the rectangle.
Now the vertical line has to be made the length of the distance SC. Setting an equality constraint by selecting the button as shown below, will do this.
The next picture shows the rectangle with a side length ratio equal to the golden ratio. The rectangle should have only left one degree of freedom. So at dragging at it, it should only change its size but not move. If a certain size of one side is needed, a length constraint can be added to this side. Other wise the sketch is ready and can be closed. Only a rectangle should than be visible in the FreeCAD window.
Упражнение: упругий эскиз
The above example introduced construction lines. Now some important things to make resilient sketches are discussed. Here is an exercise to get some practice at working with the sketcher. The goal is to make a sketch for something like a special frame as shown below.
There should be only three dimensions needed to define the frame. In order to make changing dimensions easier, the constraints can be renamed to something memorable. Just select the constraint in the list view and press <F2>. The constraint can be named for example to "Thickness". The drawing below shows the dimensions. The peak at the right side should have two times the wall thickness.
The sketch should look as intended also after changing the key dimensions for example to 2000 mm and back to 30. You may need to use angle constraints at certain places to reach this goal. The picture below shows a sketch, which was not robust against such changes. It is unusable now. In order to get the original state back, the undo-button can be used.
The above sketch is unusable for the Part-Design Workbench. Only Profile without intersecting lines are allowed. Construction lines may intersect. Those are not used for making solids.
One of the main usage of the Sketcher is the construction of parts in the Part-Design-workbench. The already existing geometry can be used similar to construction lines. As this tutorial takes its focus more on the basic sketcher functionality, have a look here for usage of external geometry: Sketcher External
Эта страница получена от https://wiki.freecad.org/Sketcher_Tutorial