Draft Workbench: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
(174 intermediate revisions by 21 users not shown)
Line 1: Line 1:
<languages/>
The draft Module is a work-in-progress and quite experimental module made to add basic 2d drawing functionality to FreeCAD. It is written entirely in python, and is also intended to showcase how far you can extend FreeCAD entirely in python, without even touching the source code. This module is currently developed outside of the main FreeCAD development structure.
<translate>
<!--T:32-->
{{Docnav
|[[Arch Workbench|Arch Workbench]]
|[[Drawing Workbench|Drawing Workbench]]
|IconL=Workbench_Arch.svg
|IconR=Workbench_Drawing.svg
}}


<!--T:38-->
Currently it is not really usable for production work, but already contains a couple of working basic functions. Feel free to test, and give us a feedback on the [[Talk:Draft_Module|discussion page]].
[[Image:Workbench_Draft.svg|thumb|128px|Draft workbench icon]]
{{TOCright}}


== Introduction == <!--T:1-->
I also maintain a workplan of the whole thing [http://yorik.orgfree.com/scripts/FreeCAD-draft.html here].
The Draft Workbench allows you to draw simple 2D objects, and offers several tools to modify them afterwards. It also provides tools to define a working plane, a grid, and a snapping system to precisely control the position of your geometry.


<!--T:29-->
==Installation==
The created 2D objects can be used for general drafting in a way similar to Inkscape or Autocad. These 2D shapes can also be used as the base components of 3D objects created with other workbenches, for example, the [[Part Workbench|Part]] and [[Arch Workbench|Arch Workbench]]es. Conversion of Draft objects to [[Sketcher Workbench|Sketches]] is also possible, which means that the shapes can also be used with the [[PartDesign Workbench|PartDesign Workbench]] for the creation of solid bodies.


<!--T:30-->
The draft Module is currently not part of the FreeCAD package, so you'll need to download it from here:
FreeCAD is primarily a 3D modelling application, and thus its 2D tools aren't as advanced as in other drawing programs. If your primary goal is the production of complex 2D drawings and [[DXF|DXF]] files, and you don't need 3D modelling, you may wish to consider a dedicated software program for technical drafting such as [https://en.wikipedia.org/wiki/LibreCAD LibreCAD], [https://en.wikipedia.org/wiki/QCad QCad], TurboCad, and others.
http://yorik.orgfree.com/scripts/Draft.zip
The zipfile here above contains just a "draft" directory. To install the module, simply place that draft directory into the "Mod" directory of FreeCAD, as explained in the [[Installing more workbenches]] page.


</translate>
Please note that the draft module requires two specific python modules to be installed and working on your system, PyQt4 and Pyvy. Instructions for installing or compiling these modules can be found on the [[extra python modules]] page. But if you are using an official FreeCAD package from the FreeCAD website, those two modules are usually already included in the package and you don't need to worry about it!
[[Image:Draft_Workbench_Example.png|400px|Draft Workbench Example]]
<translate>


== Drawing objects == <!--T:16-->
==General use==


<!--T:17-->
[[Image:Draftscreenshot.jpg|center|The draft interface with the buttons toolbar and the function toolbar]]
These are tools for creating objects.
Once installed, the draft workbench will be availible in your workbenches list. When you activate it, two toolbars will appear; a classical '''toolbar''' containing the standard draft commands listed below and a special '''command bar''' that has no tool icon on it, but that is used by the different functions to display their controls. On that toolbar, you can also change general things like current line color and width.


<!--T:18-->
One thing is important to know, the draft workbench doesn't put you automatically in orthographic projection (why would it?). So before drawing, make sure you are in orthographic projection and in the appropriate view, since at the moment not all the commands work in 3D.
* [[Image:Draft_Line.svg|32px]] [[Draft_Line|Line]]: draws a line segment between two points.
* [[Image:Draft_Wire.svg|32px]] [[Draft_Wire|Polyline]]: draws a line made of multiple line segments (polyline).
* [[Image:Draft_Fillet.svg|32px]] [[Draft_Fillet|Fillet]]: draws a fillet (rounded corner) or a chamfer (straight line) between two simple [[Draft_Line|Lines]]. {{Version|0.19}}
* [[Image:Draft_Arc.svg|32px]] [[Draft_Arc|Arc]]: draws an arc segment from center, radius, start angle and end angle.
* [[Image:Draft_Arc_3Points.svg|32px]] [[Draft_Arc_3Points|Arc 3Points]]: draws a circular arc segment from three points that are located in the circumference. {{Version|0.19}}
* [[Image:Draft_Circle.svg|32px]] [[Draft_Circle|Circle]]: draws a circle from center and radius.
* [[Image:Draft_Ellipse.svg|32px]] [[Draft_Ellipse|Ellipse]]: draws an ellipse from two corner points.
* [[Image:Draft_Rectangle.svg|32px]] [[Draft_Rectangle|Rectangle]]: draws a rectangle from two corner points.
* [[Image:Draft_Polygon.svg|32px]] [[Draft_Polygon|Polygon]]: draws a regular polygon from center, radius, and number of sides.
* [[Image:Draft_BSpline.svg|32px]] [[Draft_BSpline|BSpline]]: draws a B-Spline from a series of points.
* [[Image:Draft_CubicBezCurve.svg|32px]] [[Draft_CubicBezCurve|Cubic Bezier Curve]]: draws a Bezier curve of third degree by dragging two points. {{Version|0.19}}
* [[Image:Draft_BezCurve.svg|32px]] [[Draft_BezCurve|Bezier Curve]]: draws a Bezier curve from a series of points.
* [[Image:Draft_Point.svg|32px]] [[Draft_Point|Point]]: inserts a point object.
* [[Image:Draft_Facebinder.svg|32px]] [[Draft_Facebinder|Facebinder]]: creates a new object from selected faces on existing objects.
* [[Image:Draft_ShapeString.svg|32px]] [[Draft_ShapeString|ShapeString]]: inserts a compound shape representing a text string at a given point.


== Annotation objects == <!--T:46-->
==Import functions==


<!--T:47-->
These are functions for opening/importing other file formats. Opening will open a new document with the contents of the file, while importing will append the file content to the current document.
* [[Image:Draft_Text.svg|32px]] [[Draft_Text|Text]]: draws a multi-line text annotation.
* [[Image:Draft_Dimension.svg|32px]] [[Draft_Dimension|Dimension]]: draws a dimension annotation.
* [[Image:Draft_Label.svg|32px]] [[Draft_Label|Label]]: places a label with an arrow pointing to a selected element. {{Version|0.17}}


== Modifying objects == <!--T:19-->
===Autodesk DXF===


<!--T:20-->
File Menu > Open
These are tools for modifying existing objects. They work on selected objects, but if no object is selected, you will be invited to select one.
File Menu > Import


<!--T:31-->
This function opens a DXF file (any version from 12 to 2007) in a new drawing.
Many operation tools (move, rotate, array, etc.) also work on solid objects ([[Part Workbench|Part]], [[PartDesign Workbench|PartDesign]], [[Arch Workbench|Arch]], etc.).
The color and linetype of objects is currently not used.
DXF object types currently read by this script + implementation in FreeCAD:


<!--T:21-->
* lines: converted to FreeCAD Line
* [[Image:Draft_Move.svg|32px]] [[Draft_Move|Move]]: moves objects from one location to another.
* polylines and lwpolylines: converted to FreeCAD Wire w/ arcs straigthened
* [[Image:Draft_Rotate.svg|32px]] [[Draft_Rotate|Rotate]]: rotates objects from a start angle to an end angle.
* circle: converted to FreeCAD Circle
* [[Image:Draft_Scale.svg|32px]] [[Draft_Scale|Scale]]: scales selected objects around a base point.
* arc: converted to FreeCAD Arc
* [[Image:Draft_Mirror.svg|32px]] [[Draft_Mirror|Mirror]]: mirrors the selected objects.
* layer: layers containing objects are conveted to FreeCAD Group
* [[Image:Draft_Offset.svg|32px]] [[Draft_Offset|Offset]]: offsets segments of an object a certain distance.
* texts and mtexts: converted to FreeCAD Texts (Annotations)
* [[Image:Draft_Trimex.svg|32px]] [[Draft_Trimex|Trim/Extend (Trimex)]]: trims or extends an object.
* [[Image:Draft_Stretch.svg|32px]] [[Draft_Stretch|Stretch]]: stretches the selected objects. {{Version|0.17}}


<!--T:52-->
Other DXF entities, like blocks, etc... are currently not imported because there is no corresponding FreeCAD object. As new functionality gets implemented, it will be possibleto import more entity types.
* [[Image:Draft_Clone.svg|32px]] [[Draft_Clone|Clone]]: clones the selected objects.
* [[Image:Draft_Array.svg|32px]] Array tools.
** [[Image:Draft_OrthoArray.svg|32px]] [[Draft_OrthoArray|OrthoArray]]: creates an orthogonal array from the selected object. {{Version|0.19}}
** [[File:Draft_PolarArray.svg|32px]] [[Draft_PolarArray|Polar Array]]: creates an array in a polar pattern, that is, sweeping an angle. {{Version|0.19}}
** [[File:Draft_CircularArray.svg|32px]] [[Draft_CircularArray|Circular Array]]: creates an array in a circular pattern, that is, starting from a center and moving outwards radially. {{Version|0.19}}
** [[Image:Draft_PathArray.svg|32px]] [[Draft_PathArray|Path Array]]: creates an array of objects by placing the copies along a path.
** [[Image:Draft_PathLinkArray.svg|32px]] [[Draft_PathLinkArray|Path LinkArray]]: creates an array of [[Std_LinkMake|App::Link]] elements by placing the copies along a path. {{Version|0.19}}
** [[Image:Draft_PointArray.svg|32px]] [[Draft_PointArray|Point Array]]: creates an array of objects by placing the copies at certain points. {{version|0.18}}


<!--T:53-->
===SVG===
* [[Image:Draft_Edit.svg|32px]] [[Draft_Edit|Edit]]: edits a selected object.
* [[Image:Draft_SubelementHighlight.svg|32px]] [[Draft_SubelementHighlight|Subelement highlight]]: enters an edit mode that allows editing different objects. {{Version|0.19}}


<!--T:54-->
File Menu > Open
* [[Image:Draft_Join.svg|32px]] [[Draft_Join|Join]]: joins lines together into a single wire. {{version|0.18}}
File Menu > Import
* [[Image:Draft_Split.svg|32px]] [[Draft_Split|Split]]: splits a wire into two at a point. {{version|0.18}}
* [[Image:Draft_Upgrade.svg|32px]] [[Draft_Upgrade|Upgrade]]: upgrades objects into a higher-level object.
* [[Image:Draft_Downgrade.svg|32px]] [[Draft_Downgrade|Downgrade]]: downgrades objects into lower-level objects.


<!--T:55-->
A function to import SVG files as workable 2D objects, in opposition to the built-in drawing module which imports svg files as sheet drawings.
* [[Image:Draft_WireToBSpline.svg|32px]] [[Draft_WireToBSpline|Wire to BSpline]]: converts a wire to a B-Spline and vice-versa.
SVG objects that get imported at the moment:
* [[Image:Draft_Draft2Sketch.svg|32px]] [[Draft_Draft2Sketch|Draft to Sketch]]: converts a Draft object to a [[Sketcher Workbench|Sketcher Workbench]] Sketch and vice-versa.


<!--T:56-->
* PATH objects with M, C, L or A commands: converted to FreeCAD polygon
* [[Image:Draft_Shape2DView.svg|32px]] [[Draft_Shape2DView|Shape 2D View]]: creates a 2D object which is a flattened 2D view of a 3D object.
* RECT objects: converted to FreeCAD polygon


=== Obsolete === <!--T:48-->
==Drawing functions==


<!--T:49-->
These are tools for creating objects
This command is considered obsolete because the [[Drawing_Workbench|Drawing Workbench]] is obsolete. However, the command itself is still available.
* [[Image:Draft_Drawing.svg|32px]] [[Draft_Drawing|Drawing]]: writes selected objects to a [[Drawing_Workbench|Drawing Workbench]] page. {{obsolete|0.17}}


<!--T:50-->
===[[Image:Draft_Line.png]] 2-point Line===
These commands have been removed from the interface.
* [[Image:Draft_AddPoint.svg|32px]] [[Draft_AddPoint|Add point]]: adds a point to a wire or B-Spline. {{Obsolete|0.19}}
* [[Image:Draft_DelPoint.svg|32px]] [[Draft_DelPoint|Delete point]]: deletes a point from a wire or B-Spline. {{Obsolete|0.19}}
* [[Image:Draft_Array.svg|32px]] [[Draft_Array|Array]]: creates a polar or rectangular array from selected objects. {{Obsolete|0.19}}


== Utility tools == <!--T:22-->
Draft Toolbar > Line
Context menu > draft > Line
Draft Menu > Line
FreeCAD command: [[Draft_Line]]


<!--T:23-->
This tool asks the user for 2 points and draws a line betwen them. The newly created line will have the current color and width.
Additional tools available from the menu {{MenuCommand|Draft → Utilities}}, or via the right-click context menu, depending on the selected object.
The points can be picked with the mouse in the 3d view or by entering corrdinates with the keyboard. Following functionality is availible:
* Picking a point on an empty area of the 3d view will return a point situated at your mouse location on the current workplane.
* Picking a point on an object will return a point situated on the object, at your mouse location. An open "o" symbol appears to notify you.
* Pressing CTRL will snap your point to availible snap locations. A filled "o" or square symbol appears.
* Pressing SHIFT will constrain your new point in relation to the last one, horizontally or vertically, depending on the location of your mouse at the moment you press SHIFT. To change between horizontal and vertical, simply release SHIFT and press it again with your mouse in another location.
* Enter numbers to insert manually a coordinate.
* Pressing ENTER will switch you from X to Y, from Y to Z and pressing ENTER while you are editing Z will create a new point.
* Pressing SPACE will switch between relative and absolute coordinates. In relative coordinates, the location you enter is relative to the last point.
* Pressing CTRL+Z or pressing the "Undo" button will undo the last point.
* Pressing ESCAPE will cancel the operation.


<!--T:24-->
===[[Image:Draft_Polyline.png]] Multiple-point Line===
* [[Image:Draft_SelectPlane.svg|32px]] [[Draft_SelectPlane|Set working plane]]: sets a working plane from a standard view or a selected face.
* [[Image:Draft_FinishLine.svg|32px]] [[Draft_FinishLine|Finish line]]: ends the drawing of the current [[Draft Wire|Draft Wire]] or [[Draft BSpline|Draft BSpline]], without closing it.
* [[Image:Draft_CloseLine.svg|32px]] [[Draft_CloseLine|Close line]]: ends the drawing of the current [[Draft Wire|Draft Wire]] or [[Draft BSpline|Draft BSpline]], and closes it.
* [[Image:Draft_UndoLine.svg|32px]] [[Draft_UndoLine|Undo line]]: undoes the last segment of a [[Draft Wire|Draft Wire]].
* [[Image:Draft_ToggleConstructionMode.svg|32px]] [[Draft_ToggleConstructionMode|Toggle construction mode]]: toggles the Draft construction mode on or off.
* [[Image:Draft_ToggleContinueMode.svg|32px]] [[Draft_ToggleContinueMode|Toggle continue mode]]: toggles the Draft continue mode on or off.
* [[Image:Draft_ApplyStyle.svg|32px]] [[Draft_Apply|Apply style]]: applies the current style and color to selected objects.
* [[Image:Draft_ToggleDisplayMode.svg|32px]] [[Draft_ToggleDisplayMode|Toggle display mode]]: switches the display mode of selected objects between "Flat Lines" and "Wireframe".
* [[Image:Draft_AddToGroup.svg|32px]] [[Draft_AddToGroup|Add to group]]: quickly adds selected objects to an existing [[Std Group|Std Group]] or [[Draft VisGroup|Draft VisGroup]].
* [[Image:Draft_SelectGroup.svg|32px]] [[Draft_SelectGroup|Select group contents]]: selects the contents of a selected [[Std Group|Std Group]] or [[Draft VisGroup|Draft VisGroup]].
* [[Image:Draft_ToggleSnap.svg|32px]] [[Draft_ToggleSnap|Toggle snap]]: toggles [[Draft Snap|object snapping]] on or off.
* [[Image:Draft_ToggleGrid.svg|32px]] [[Draft_ToggleGrid|Toggle grid]]: toggles the visibility of the grid on or off.
* [[Image:Draft_ShowSnapBar.svg|32px]] [[Draft_ShowSnapBar|Show snap bar]]: shows or hides the [[Draft Snap|Draft Snap]] toolbar.
* [[Image:Draft_Heal.svg|32px]] [[Draft_Heal|Heal]]: heals problematic Draft objects found in very old files.
* [[Image:Draft_FlipDimension.svg|32px]] [[Draft_FlipDimension|Flip Dimension]]: flips the orientation of the text of a [[Draft Dimension|Draft Dimension]].
* [[Image:Draft_VisGroup.svg|32px]] [[Draft_VisGroup|VisGroup]]: creates a VisGroup in the current document. {{Obsolete|0.19}}
* [[Image:Draft_Layer.svg|32px]] [[Draft_Layer|Layer]]: creates a Layer in the current document, to which objects can be added to control object visibility and color. It replaces [[Draft_VisGroup|VisGroup]]. {{Version|0.19}}
* [[Image:Draft_Slope.svg|32px]] [[Draft Slope|Slope]]: changes the elevation slope of the currently selected [[Draft Line|Draft Line]] or [[Draft Wire|Draft Wire]]. {{Version|0.17}}
* [[Image:Draft_AutoGroup.svg|32px]] [[Draft AutoGroup|AutoGroup]]: automatically place new objects in a given [[Std Group|Std Group]] or [[Draft VisGroup|Draft VisGroup]]. {{Version|0.17}}
* [[Image:Draft_SetWorkingPlaneProxy.svg|32px]] [[Draft SetWorkingPlaneProxy|Set Working Plane Proxy]]: create a proxy object to store the current [[Draft_SelectPlane|Working Plane]] position. {{Version|0.17}}
* [[Image:Draft_AddConstruction.svg|32px]] [[Draft_AddConstruction|Add to Construction group]]: add selected objects to the Construction group. {{Version|0.17}}


== Preferences == <!--T:25-->
draft Toolbar > Polyline
Context menu > draft > Polyline
draft Menu > Polyline
FreeCAD Command: [[Draft_Polyline]]


<!--T:28-->
This tool behaves exactly the same way as the previous one, except that it doesn't stop after 2 points. Besids that, a number of extra features are availible:
* [[Image:Preferences-draft.svg|32px]] [[Draft_Preferences|Preferences]]: general preferences for the working plane and the drawing tools.
* Double-clicking the last point, instead of simply clicking, will finish the line, leaving it open.
* [[Image:Preferences-import-export.svg|32px]] [[Import_Export_Preference|Import-Export Preferences]]: preferences available for importing from and exporting to different file formats.
* Pressing F or context menu > draft > Finish or pressing the "Finish" button will also finish the line, leaving it open.
* CTRL-Clicking (snapping) on the first point will finish and close the line
* Pressing C or context menu > draft > Close or pressing the "Close" button will also finish and close the line.


== File formats == <!--T:3-->
===[[Image:Draft_Circle.png]] Circle===


<!--T:4-->
draft Toolbar > Circle
These are functions for opening, importing or exporting other file formats. Opening will open a new document with the contents of the file, while importing will append the contents of the file to the current document. Export will save the selected objects to a file. If nothing is selected, all objects will be exported. Be aware that the purpose of the Draft Module is to work with 2D objects, so those import routines focus only on 2D objects, and although DXF and OCA formats also support object definitions in 3D space (objects are not necessarily flat), they will not import volumetric objects such as meshes, 3D surfaces, etc., but rather lines, circles, texts or flat shapes. Currently supported file formats are:
Context menu > draft > Circle
The Draft module provides FreeCAD with importers and exporters for the following file formats:
draft Menu > Circle
FreeCAD command: [[Draft_Circle]]


<!--T:5-->
This tool draws a circle by asking for two points, the center and the radius. Both values can also be entered manually. The created circle will take the current line width and color. Availible features:
* [[Draft_DXF|Autodesk .DXF]]: imports and exports [http://en.wikipedia.org/wiki/AutoCAD_DXF Drawing Exchange Format] files created with 2D CAD applications. See also [[FreeCAD_and_DXF_Import|FreeCAD and DXF Import]].
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* [[Draft_DXF|Autodesk .DWG]]: imports and exports DWG files via the DXF importer, when the [[Extra python modules#ODA Converter (previously Teigha Converter)|ODA Converter]] utility is installed. See also [[FreeCAD_and_DWG_Import|FreeCAD and DWG Import]].
* Pressing ESCAPE cancels the function.
* [[Draft_SVG|SVG]]: imports and exports [http://en.wikipedia.org/wiki/Scalable_Vector_Graphics Scalable Vector Graphics] files created with vector drawing applications.
* [[Draft_OCA|Open Cad format .OCA]]: imports and exports OCA/GCAD files, a potentially new [http://groups.google.com/group/open_cad_format open CAD file format].
* [[Draft_DAT|Airfoil Data Format .DAT]]: imports DAT files describing [http://www.ae.illinois.edu/m-selig/ads/coord_database.html Airfoil profiles].


===Install importers=== <!--T:36-->
===[[Image:Draft_Arc.png]] Arc===


<!--T:37-->
draft Toolbar > Arc
* [[FreeCAD_and_DWG_Import|FreeCAD and DWG Import]]: Imports and exports DWG files
Context menu > draft > Arc
* [[FreeCAD_and_DXF_Import|FreeCAD and DXF Import]]: Imports and exports DXF files
draft Menu > Arc
FreeCAD command: [[Draft_Arc]]


== Additional features == <!--T:6-->
This tool draws an arc by picking four points: the center, the radius, the start angle and the end angle. All these values can also be entered manually. The created arc will take the current line width and color. Availible features:
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* Pressing SHIFT will constrain you vertically or horizontally in relation to the center.
* Pressing ALT when choosing the end angle will switch you to counter-clockwise direction.
* Pressing ESCAPE cancels the function.


<!--T:7-->
===[[Image:Draft_Rectangle.png]] Rectangle===
* [[Draft Coordinates|Coordinates]]: enter coordinates instead of clicking on the 3D view to define a new point.
* [[Draft Constrain|Constraining]]: limit the pointer to horizontal or vertical movements relative to a previous point.
* [[Draft Snap|Snapping]]: place new points on special places on existing objects or on the grid.
* [[Draft_Copying|Copy Mode]]: All modification tools can either modify the selected objects or create a modified copy of them. Pressing and holding {{KEY|Alt}} while the object is being modified, e.g. moved or rotated, creates a copy when the key is released.
* [[Draft ToggleConstructionMode|Construction Mode]]: Allows you to create geometries separate from the rest by simply switching them on and off.
* [[Draft SelectPlane|Working plane]]: allows you to select a surface on which to build your shapes.


== Unit tests == <!--T:39-->
draft Toolbar > Rectangle
Context menu > draft > Rectangle
draft Menu > Rectangle
FreeCAD command: [[Draft_Rectangle]]


<!--T:40-->
This tool draws a rectangle by picking two opposite points. These two points can also be entered manually. The created rectangle will take the current line width and color. Availible features:
{{Emphasis|See also:}} [[Test_Workbench|Test Workbench]].
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* Pressing ESCAPE cancels the function.


<!--T:41-->
===[[Image:DraftIconText.png]] Text===
To run the unit tests of the workbench execute the following from the operating system terminal.
</translate>
{{Code|code=
freecad -t TestDraft
}}
<translate>


== Scripting == <!--T:10-->
draft Toolbar > Text
Context menu > draft > Text
draft Menu > Text


<!--T:11-->
This tool asks the user for a location point, then, in a textbox, text can be entered. The created text height and color will be based on the current line width and color. Availible features:
The Draft tools can be used in [[macros|macros]] and from the [[Python|Python]] console by using the [[Draft_API|Draft API]].
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* Pressing ESCAPE cancels the function.


<!--T:42-->
==Modification functions==
The workbench includes a module to create samples of all objects in a new document. {{Version|0.19}}


<!--T:43-->
These are tools for modifying objects
Use this to test that all objects are produced correctly.
</translate>
{{Code|code=
import drafttests.draft_test_objects as dto
doc = dto.create_test_file()
}}
<translate>


<!--T:44-->
===[[Image:Drafticonmove.png]] Move===
Inspecting the code of this module is useful to understand how to use the programming interface.
</translate>
{{Code|code=
$INSTALLDIR/Mod/Draft/drafttests/draft_test_objects.py
}}
<translate>


<!--T:45-->
draft Toolbar > Move
Where {{incode|$INSTALLDIR}} is the toplevel directory where the software was installed; for example, in Linux it may be {{incode|/usr/share/freecad}}.
Context menu > draft > Move
draft Menu > Move


</translate>
This tool moves the selected objects from one point to another.
[[File:Draft_test_objects.png|500px]]
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
<translate>
* Pressing SHIFT will constrain you vertically or horizontally in relation to the center.
<!--T:51-->
* Pressing ESCAPE will cancel the move.
{{Caption|Test objects for the [[Draft_Workbench|Draft Workbench]].}}
* SPACE will switch you between relative and absolute coordinates.
* C switches the copy mode on/off. With Copy on, objects will be copied instead of moved.
* Pressing ALT will make a copy, even if the Copy check button is off.


== Tutorials == <!--T:14-->
* [[Draft_tutorial|Draft tutorial]]
* [[Draft_tutorial_Outdated|Draft tutorial Outdated]]
* [[Draft_ShapeString_tutorial|Draft ShapeString tutorial]]


<!--T:12-->
===[[Image:Drafticonrotate.png]] Rotate===
{{Docnav
|[[Arch Workbench|Arch Workbench]]
|[[Drawing Workbench|Drawing Workbench]]
|IconL=Workbench_Arch.svg
|IconR=Workbench_Drawing.svg
}}


</translate>
draft Toolbar > Rotate
{{Draft Tools navi{{#translation:}}}}
Context menu > draft > Rotate
{{Userdocnavi{{#translation:}}}}
draft Menu > Rotate
[[Category:Workbenches{{#translation:}}]]

This tool rotates the selected objects. The user is asked for the rotation center, the start angle and the rotation angle.
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* Pressing SHIFT will constrain you vertically or horizontally in relation to the center.
* Pressing ESCAPE will cancel the operation.
* SPACE will switch you between relative and absolute coordinates.
* C switches the copy mode on/off. With Copy on, new objects will be created instead of rotating existing objects.
* Pressing ALT will make a copy, even if the Copy check button is off.

===[[Image:Drafticonoffset.png]] Offset===

draft Toolbar > Offset
Context menu > draft > Offset
draft Menu > Offset

This tool offsets the selected object. Only works if only one object is selected. You are simply asked for one point, giving the distance to offsrt from the selected object.
* Pressing CTRL will snap you to availible snap locations. A filled symbol appears to notify you.
* Pressing SHIFT will constrain you to the current segment, instead of picking the closest one.
* Pressing ESCAPE will cancel the operation.
* C switches the copy mode on/off. With Copy on, new objects will be created instead of rotating existing objects.
* Pressing ALT will make a copy, even if the Copy check button is off.

Note that the offset tool currently doesn't work with wires containing arcs. You must first explode (downgrade) them before offsetting.

===[[Image:Drafticonupgrade.png]] Upgrade===

draft Toolbar > Upgrade
Context menu > draft > Upgrade
draft Menu > Upgrade

This tool upgrades selected objects in different ways, following this list (in order):
* if there are more than one faces, the faces are merged (union)
* if there is only one face, nothing is done
* if there are closed wires, they are transformed in a face
* otherwise, if possible, all edges are joind into a wire (closed if applicable)

===[[Image:Drafticondowngrade.png]] Downgrade===

draft Toolbar > Downgrade
Context menu > draft > Downgrade
draft Menu > Downgrade

This tool downgrades selected objects in different ways, following this list (in order):
* if there are more than one faces, the subsequent faces are subtracted from the first one
* if there is only one face, it gets converted into a wire
* otherwise all wires are exploded into single edges

==Other functions==

These is a category for tools I don't know where else to put :)

===[[Image:Drafticonapply.png]] Apply Style===

Context menu > draft > Apply Style

This function applies current line width and color to selected objects. If groups are selected, all objects inside them will take the style too.
This function is only availible when something is selected. It is also availible from the tree context menu.

==Export functions==

These are functions for exporting the current document to other file formats.

===Autodesk DXF===

File Menu > Export

The exported DXF is compatible with Autocad version 12 and up, so it should open in about any application that supports dxf format.
Currently the following FreeCAD features get exported:

* Lines get converted to dxf lines
* Polylines get converted to single lines (provisory)
* Circles get converted to circles
* Arcs (open circles) get converted to arcs
* colors are mapped from objects RGB colors to autocad color index (ACI). Black will always be "by layer"
* layers are mapped from group names When groups are nested, the deepest group gives the layer name.

==Common behaviours==

===Snapping===

CTRL while drawing

In all tools that support snapping, following snap locations are currently availible:
* Endpoint of lines/polylines
* Midpoint of lines/polylines
* Center of circles and arcs
* Quadrant points of circles and arcs
* Endpoints of arcs
* Vertically or horizontally aligned points on lines/polylines, if constraining (SHIFT)
* Intersection between straight segments

In tools that support both snapping and constraining, the combination of both behaviours (SHIFT+CTRL) can extend much the snapping possibilities.

===Constraining===

SHIFT while drawing

In all tools that support constraining, you can force the next point to be constrained horizontally or vertically in relation to the last point entered. The vertical or horizontal constraining depends on where your mouse lies when you press SHIFT. If you are more north or south from the last point, it will be vertical. If you are more east or west, it will be horizontal. To change, just release SHIFT and press again at another location.

===Copying===

ALT while drawing

All modification tools can either modify the selected objects or create a modified copy of them. Pressing ALT while using the tool will make a copy.

Revision as of 20:47, 30 March 2020

Draft workbench icon

Introduction

The Draft Workbench allows you to draw simple 2D objects, and offers several tools to modify them afterwards. It also provides tools to define a working plane, a grid, and a snapping system to precisely control the position of your geometry.

The created 2D objects can be used for general drafting in a way similar to Inkscape or Autocad. These 2D shapes can also be used as the base components of 3D objects created with other workbenches, for example, the Part and Arch Workbenches. Conversion of Draft objects to Sketches is also possible, which means that the shapes can also be used with the PartDesign Workbench for the creation of solid bodies.

FreeCAD is primarily a 3D modelling application, and thus its 2D tools aren't as advanced as in other drawing programs. If your primary goal is the production of complex 2D drawings and DXF files, and you don't need 3D modelling, you may wish to consider a dedicated software program for technical drafting such as LibreCAD, QCad, TurboCad, and others.

Draft Workbench Example

Drawing objects

These are tools for creating objects.

  • Line: draws a line segment between two points.
  • Polyline: draws a line made of multiple line segments (polyline).
  • Fillet: draws a fillet (rounded corner) or a chamfer (straight line) between two simple Lines. introduced in version 0.19
  • Arc: draws an arc segment from center, radius, start angle and end angle.
  • Arc 3Points: draws a circular arc segment from three points that are located in the circumference. introduced in version 0.19
  • Circle: draws a circle from center and radius.
  • Ellipse: draws an ellipse from two corner points.
  • Rectangle: draws a rectangle from two corner points.
  • Polygon: draws a regular polygon from center, radius, and number of sides.
  • BSpline: draws a B-Spline from a series of points.
  • Cubic Bezier Curve: draws a Bezier curve of third degree by dragging two points. introduced in version 0.19
  • Bezier Curve: draws a Bezier curve from a series of points.
  • Point: inserts a point object.
  • Facebinder: creates a new object from selected faces on existing objects.
  • ShapeString: inserts a compound shape representing a text string at a given point.

Annotation objects

Modifying objects

These are tools for modifying existing objects. They work on selected objects, but if no object is selected, you will be invited to select one.

Many operation tools (move, rotate, array, etc.) also work on solid objects (Part, PartDesign, Arch, etc.).

  • Shape 2D View: creates a 2D object which is a flattened 2D view of a 3D object.

Obsolete

This command is considered obsolete because the Drawing Workbench is obsolete. However, the command itself is still available.

These commands have been removed from the interface.

Utility tools

Additional tools available from the menu Draft → Utilities, or via the right-click context menu, depending on the selected object.

Preferences

  • Preferences: general preferences for the working plane and the drawing tools.
  • Import-Export Preferences: preferences available for importing from and exporting to different file formats.

File formats

These are functions for opening, importing or exporting other file formats. Opening will open a new document with the contents of the file, while importing will append the contents of the file to the current document. Export will save the selected objects to a file. If nothing is selected, all objects will be exported. Be aware that the purpose of the Draft Module is to work with 2D objects, so those import routines focus only on 2D objects, and although DXF and OCA formats also support object definitions in 3D space (objects are not necessarily flat), they will not import volumetric objects such as meshes, 3D surfaces, etc., but rather lines, circles, texts or flat shapes. Currently supported file formats are: The Draft module provides FreeCAD with importers and exporters for the following file formats:

Install importers

Additional features

  • Coordinates: enter coordinates instead of clicking on the 3D view to define a new point.
  • Constraining: limit the pointer to horizontal or vertical movements relative to a previous point.
  • Snapping: place new points on special places on existing objects or on the grid.
  • Copy Mode: All modification tools can either modify the selected objects or create a modified copy of them. Pressing and holding Alt while the object is being modified, e.g. moved or rotated, creates a copy when the key is released.
  • Construction Mode: Allows you to create geometries separate from the rest by simply switching them on and off.
  • Working plane: allows you to select a surface on which to build your shapes.

Unit tests

See also: Test Workbench.

To run the unit tests of the workbench execute the following from the operating system terminal.

freecad -t TestDraft

Scripting

The Draft tools can be used in macros and from the Python console by using the Draft API.

The workbench includes a module to create samples of all objects in a new document. introduced in version 0.19

Use this to test that all objects are produced correctly.

import drafttests.draft_test_objects as dto
doc = dto.create_test_file()

Inspecting the code of this module is useful to understand how to use the programming interface.

$INSTALLDIR/Mod/Draft/drafttests/draft_test_objects.py

Where $INSTALLDIR is the toplevel directory where the software was installed; for example, in Linux it may be /usr/share/freecad.

Test objects for the Draft Workbench.

Tutorials