https://wiki.freecad.org/api.php?action=feedcontributions&user=Heda&feedformat=atomFreeCAD Documentation - User contributions [en]2024-03-28T16:39:48ZUser contributionsMediaWiki 1.40.1https://wiki.freecad.org/index.php?title=Macros_recipes&diff=1305234Macros recipes2023-09-24T19:45:39Z<p>Heda: Undo revision 1305231 by Heda (talk)</p>
<hr />
<div><languages/><br />
{{TOCright}}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
<!--T:388--><br />
* {{MacroLink|Icon=TNP_solution.png|Macro_TNP_Solution|Macro TNP Solution}}: A basic example of how the Topological Naming Problem can be solved. The macro is intended for programmers only.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:389--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Draft_Circle_Tangent|Macro Draft Circle Tangent}}: Makes tangents to Draft circles.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle from 3 selected points, the points can be objects.<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=Std_AxisCross_example.svg|Macro Express Placement|Macro Express Placement}}: Quick edit Values and/or Expressions of the X, Y, Z coordinates in the additional UI panel.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face.<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:385--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a B-spline surface through a grid of points.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_Circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:391--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Place_Image|Macro Place Image}}: Creates an [[Image_CreateImagePlane|ImagePlane]] and aligns it to an existing [[Draft_Rectangle|Draft Rectangle]].<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/x_magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:386--><br />
* {{MacroLink|Icon=multiCuts.png|Macro_MultiCuts|Macro MultiCuts}}: This macro improves boolean cut hierarchy by automatic labeling and using copies for cut.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:393--><br />
* {{MacroLink|Icon=EasyReflectorIcon.svg|Macro_EasyReflector|Macro EasyReflector}}: Easily managed textures with a parametric feature python object that persists between FreeCAD and Document sessions.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
<!--T:390--><br />
* {{MacroLink|Icon=Macro_3D_Printer_Workflow.png|Macro_3D_Printer_Workflow|Macro 3D Printer Workflow}}: Macro that creates an stl file with perfect rounding, i.e. without visible facets, from selected objects. It also allows to launch programs of your choice. For example to automate the FreeCAD -> Slicer -> printing workflow.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
<br />
<!--T:387--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Z_Height_Map|Macro Z Height Map}}: Makes a grayscale heightmap in Z.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:392--><br />
* {{MacroLink|Icon=Macro_Sketch_Constraint_From_Spreadsheet.svg|Macro_Sketch_Constraint_From_Spreadsheet|Macro Sketch Constraint From Spreadsheet}}: Quickly add a length constraint to a line or between 2 points using a spreadsheet cell alias or address.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macros_recipes&diff=1305231Macros recipes2023-09-24T19:33:57Z<p>Heda: added express placement</p>
<hr />
<div><languages/><br />
{{TOCright}}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
<!--T:388--><br />
* {{MacroLink|Icon=TNP_solution.png|Macro_TNP_Solution|Macro TNP Solution}}: A basic example of how the Topological Naming Problem can be solved. The macro is intended for programmers only.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:389--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Draft_Circle_Tangent|Macro Draft Circle Tangent}}: Makes tangents to Draft circles.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle from 3 selected points, the points can be objects.<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
* {{MacroLink|Macro_Express_Placement|Macro Express Placement}}: This macro allows quick editing of the X, Y, Z placement coordinates for the currently selected object..<br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face.<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:385--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a B-spline surface through a grid of points.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_Circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:391--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Place_Image|Macro Place Image}}: Creates an [[Image_CreateImagePlane|ImagePlane]] and aligns it to an existing [[Draft_Rectangle|Draft Rectangle]].<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/x_magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:386--><br />
* {{MacroLink|Icon=multiCuts.png|Macro_MultiCuts|Macro MultiCuts}}: This macro improves boolean cut hierarchy by automatic labeling and using copies for cut.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:393--><br />
* {{MacroLink|Icon=EasyReflectorIcon.svg|Macro_EasyReflector|Macro EasyReflector}}: Easily managed textures with a parametric feature python object that persists between FreeCAD and Document sessions.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
<!--T:390--><br />
* {{MacroLink|Icon=Macro_3D_Printer_Workflow.png|Macro_3D_Printer_Workflow|Macro 3D Printer Workflow}}: Macro that creates an stl file with perfect rounding, i.e. without visible facets, from selected objects. It also allows to launch programs of your choice. For example to automate the FreeCAD -> Slicer -> printing workflow.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
<br />
<!--T:387--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Z_Height_Map|Macro Z Height Map}}: Makes a grayscale heightmap in Z.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:392--><br />
* {{MacroLink|Icon=Macro_Sketch_Constraint_From_Spreadsheet.svg|Macro_Sketch_Constraint_From_Spreadsheet|Macro Sketch Constraint From Spreadsheet}}: Quickly add a length constraint to a line or between 2 points using a spreadsheet cell alias or address.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macros_recipes&diff=1224862Macros recipes2023-01-30T21:59:55Z<p>Heda: </p>
<hr />
<div><languages/><br />
<br />
{|class="fcinfobox wikitable ct" height=100% style="width: 230px; float: right; margin-left: 1em" |<br />
| class="ctTitle" style="font-weight: bold; font-size: 125%;" | [[Image:Text-x-python.png|32px]] Macros<br />
|-<br />
| class="ctToc"|<br/>__TOC__<br />
|}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
<!--T:388--><br />
* {{MacroLink|Icon=TNP_solution.png|Macro_TNP_Solution|Macro TNP Solution}}: A basic example of how the Topological Naming Problem can be solved. The macro is intended for programmers only.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:389--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Draft_Circle_Tangent|Macro Draft Circle Tangent}}: Makes tangents to Draft circles.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle from 3 selected points, the points can be objects.<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Drawing-orthoviews.svg|32px]] Drawing Workbench=== <!--T:105--><br />
<br />
<!--T:165--><br />
The [[Drawing Workbench|Drawing Workbench]] is obsolete since FreeCAD 0.17. Consider using the [[TechDraw Workbench|TechDraw Workbench]] instead.<br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:223--><br />
* {{MacroLink|Icon=Macro_Automatic_drawing.png|Macro_Automatic_drawing|Macro Automatic drawing}}: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.<br />
<br />
<!--T:224--><br />
* {{MacroLink|Icon=Macro_CartoucheFC.png|Macro_CartoucheFC|Macro CartoucheFC}}: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:225--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_2.png|Macro_CartoucheFC_2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.<br />
<br />
<!--T:226--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro_CartoucheFC_Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|Misc templates Full]] of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:385--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a B-spline surface through a grid of points.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_Circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:386--><br />
* {{MacroLink|Icon=multiCuts.png|Macro_MultiCuts|Macro MultiCuts}}: This macro improves boolean cut hierarchy by automatic labeling and using copies for cut.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
<!--T:390--><br />
* {{MacroLink|Icon=Macro_3D_Printer_Workflow.png|Macro_3D_Printer_Workflow|Macro 3D Printer Workflow}}: Macro that creates an stl file with perfect rounding, i.e. without visible facets, from selected objects. It also allows to launch programs of your choice. For example to automate the FreeCAD -> Slicer -> printing workflow.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
<br />
<!--T:387--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Z_Height_Map|Macro Z Height Map}}: Makes a grayscale heightmap in Z.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:354--><br />
* {{MacroLink|Icon=Macro_Corner_shapes_wizard.png|Macro_Corner_shapes_wizard/update|Macro Corner shapes wizard/update}}: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.<br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Place_Image|Macro Place Image}}: Aligns ImagePlane to existing draft rectangle.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Place_Image&diff=1224859Macro Place Image2023-01-30T21:54:40Z<p>Heda: Created page with "<languages/> <translate> <!--T:1--> {{Macro |Name=Macro Place Image |Description=Aligns ImagePlane to existing draft rectangle. |Author=heda |Version=0.1 |Date=2023-01-30 }} ==Description== Aligns an ImagePlane image to an existing Draft Rectangle. ==Usage== Select a Draft Rectangle, run the macro. See __doc__ for limitation. ==Install== Through the Addon manager. ==Link== Forum: No dedicated thread, but sprung out of [https://forum.freecadweb.o..."</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Place Image<br />
|Description=Aligns ImagePlane to existing draft rectangle.<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2023-01-30<br />
}}<br />
<br />
==Description==<br />
<br />
Aligns an ImagePlane image to an existing Draft Rectangle.<br />
<br />
==Usage==<br />
<br />
Select a Draft Rectangle, run the macro.<br />
See __doc__ for limitation.<br />
<br />
==Install==<br />
<br />
Through the [[Std_AddonMgr|Addon manager]].<br />
<br />
==Link==<br />
<br />
Forum: No dedicated thread, but sprung out of [https://forum.freecadweb.org/viewtopic.php?f=22&t=75606& forum post].<br />
<br />
==Version==<br />
<br />
v0.1 2023-01-30 : first release<br />
<br />
==Script==<br />
<br />
</translate><br />
'''Macro_Place_Image.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2023 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Place_Image'<br />
__Comment__ = 'Aligns ImagePlane to existing draft rectangle'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.1'<br />
__Date__ = '2023-01-30'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Place_Image'<br />
__Icon__ = ''<br />
__Help__ = 'Select rectangle, run macro and image is placed.'<br />
__Status__ = 'Stable'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = 'forum'<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
Works as intended on XY-plane.<br />
When out of XY-plane, not so much.<br />
Feel free to improve the placement logic.<br />
"""<br />
<br />
<br />
from pathlib import Path as pyPath<br />
from PySide.QtGui import QMessageBox, QFileDialog<br />
<br />
import Draft<br />
import FreeCAD as App<br />
import FreeCADGui as Gui<br />
<br />
doc = App.ActiveDocument<br />
sel = Gui.Selection.getSelection()<br />
rect = None<br />
<br />
def message(msg):<br />
QMessageBox.information(None, __Name__, msg)<br />
<br />
if sel:<br />
sel, *_ = sel<br />
if hasattr(sel, 'Proxy') and isinstance(sel.Proxy, Draft.Rectangle):<br />
rect = sel<br />
else:<br />
message('Sorry, selected object needs to be a draft rectangle.')<br />
else:<br />
message('No selection, select a draft rectangle.')<br />
<br />
if rect:<br />
rname = rect.Name<br />
picformats = '*.png *.bmp *.jpg *.jpeg'<br />
pic, _ = QFileDialog.getOpenFileName(None, 'Select Image',<br />
'', f'Images ({picformats})')<br />
if pic:<br />
picname = pyPath(pic).stem.replace(' ', '_')<br />
imp = doc.addObject('Image::ImagePlane', picname)<br />
imp.ImageFile = pic<br />
<br />
imp.setExpression('XSize', f'{rname}.Length')<br />
imp.setExpression('YSize', f'{rname}.Height')<br />
imp.setExpression('.Placement.Base.x',<br />
f'{rname}.Placement.Base.x + XSize / 2')<br />
imp.setExpression('.Placement.Base.y',<br />
f'{rname}.Placement.Base.y + YSize / 2')<br />
imp.setExpression('.Placement.Base.z',<br />
f'{rname}.Placement.Base.z - 0.1 mm')<br />
imp.setExpression('.Placement.Rotation.Angle',<br />
f'{rname}.Placement.Rotation.Angle')<br />
imp.setExpression('.Placement.Rotation.Axis',<br />
f'{rname}.Placement.Rotation.Axis')<br />
<br />
rect.ViewObject.Visibility = False<br />
rect.setExpression('.Label2', f'<<{picname}>>')<br />
doc.recompute()<br />
print('placed image successfully')<br />
<br />
}}<br />
<br />
[[Category:File_Formats{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Draft_Circle_Tangent&diff=1211768Macro Draft Circle Tangent2022-12-04T12:42:58Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Draft Circle Tangent<br />
|Description=Makes tangents to Draft circles.<br />
|Author=heda<br />
|Version=0.2<br />
|Date=2022-11-27<br />
|FCVersion=-<br />
}}<br />
<br />
==Description== <!--T:2--><br />
<br />
</translate><br />
[[File:Macro_Draft_circle_tangent_example.png]]<br />
<translate><br />
<!--T:3--><br />
{{Caption|Macro Draft Circle Tangent}}<br />
<br />
==Usage== <!--T:4--><br />
<br />
<!--T:5--><br />
Select and launch.<br />
<br />
==Install== <!--T:6--><br />
<br />
<!--T:7--><br />
Through the [[Std_AddonMgr|Addon manager]].<br />
<br />
==Version== <!--T:8--><br />
<br />
<!--T:11--><br />
v0.2 2022-11-27 : Fixed draft point selection in Tree view.<br />
<br />
<!--T:9--><br />
v0.1 2022-11-21 : First release.<br />
<br />
==Code== <!--T:10--><br />
<br />
</translate><br />
'''Macro_Draft_Circle_Tangent.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Draft_Circle_Tangent'<br />
__Comment__ = 'Makes tangents to draft circles.'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.2'<br />
__Date__ = '2022-11-27'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Draft_Circle_Tangent'<br />
__Icon__ = ''<br />
__Help__ = 'Select and launch.'<br />
__Status__ = 'functional'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
makes tangents for draft circles and arcs<br />
a) circle and vertex/point<br />
b) two circles<br />
<br />
select before launching macro<br />
<br />
for circle and point the tangents are constructed,<br />
as one would do with pen and paper<br />
for circle and circle the angles are calculated,<br />
one can also construct the tangents in a similar way to<br />
circle/point way, i.e. intersections by additional construction circles<br />
<br />
note: tesselation often makes the true tangent not look like a true tangent<br />
this is to not overload rendering for larger projects<br />
one can change the viewsetting deviation for the circle to minimum (0.01)<br />
if one wants to better view the true tangent, if so, better turn that back<br />
to default once viewed - it is easy to forget that this has been done,<br />
and can in larger projects put fc to more or less a complete halt.<br />
"""<br />
<br />
from math import sin, cos, pi, atan2, acos, asin<br />
<br />
import Draft<br />
<br />
doc = App.ActiveDocument<br />
cgroup = doc.addObject('App::DocumentObjectGroup','Construction')<br />
Vector, Placement = App.Vector, App.Placement<br />
RotZero = Placement().Rotation<br />
<br />
def get_curve(obj):<br />
return obj.Shape.Edge1.Curve<br />
<br />
def point2vector(pt):<br />
return pt.toShape().Point<br />
<br />
def get_intersection_points(obj1, obj2):<br />
doc.recompute()<br />
i1, i2 = get_curve(obj1).intersect(get_curve(obj2))<br />
return (point2vector(p) for p in (i1, i2))<br />
<br />
def add_construction(obj):<br />
_ = cgroup.addObject(obj)<br />
<br />
def mk_line(v1, v2, construction=True):<br />
line = Draft.make_line(v1, v2)<br />
if construction:<br />
line.ViewObject.DrawStyle = 'Dashdot'<br />
add_construction(line)<br />
return line<br />
<br />
def mk_circle(centre, radius):<br />
circle = Draft.make_circle(radius, Placement(centre, RotZero), False)<br />
circle.ViewObject.DrawStyle = 'Dashed'<br />
add_construction(circle)<br />
return circle<br />
<br />
<br />
## selection logic<br />
SINGLE = False<br />
msg = ('select exactly 2 items, 2 (draft) circles '<br />
'or 1 (draft) circle and one vertex or (draft) point')<br />
selection = Gui.Selection.getSelection()<br />
if len(selection) == 2:<br />
s1, s2 = selection<br />
r1, r2 = (hasattr(r, 'Radius') for r in selection)<br />
if r1 and r2:<br />
c1s, c2s = s1, s2<br />
elif not r1 and not r2:<br />
raise RunTimeWarning(msg)<br />
else:<br />
SINGLE = True<br />
circle = s1 if r1 else s2<br />
sx1, sx2 = Gui.Selection.getSelectionEx()<br />
sx = sx2 if r1 else sx1<br />
if sx.PickedPoints:<br />
point, = sx.PickedPoints<br />
else: # it is a draft point selected in tree view<br />
point = sx.Object.Shape.Point<br />
<br />
else:<br />
raise RunTimeWarning(msg)<br />
<br />
if SINGLE:<br />
<br />
o = circle.Placement.Base<br />
op = point - o<br />
<br />
ccircle = mk_circle(o + op/2, op.Length/2)<br />
<br />
v1, v2 = get_intersection_points(circle, ccircle)<br />
<br />
tangent1 = mk_line(point, v1, False)<br />
tangent2 = mk_line(point, v2, False)<br />
<br />
<br />
else:<br />
<br />
# c1 is the larger one<br />
if c1s.Radius >= c2s.Radius:<br />
c1, c2 = c1s, c2s<br />
else:<br />
c1, c2 = c2s, c1s<br />
<br />
c1c, c2c = c1.Placement.Base, c2.Placement.Base<br />
<br />
centerline = mk_line(c1c, c2c)<br />
cc = c2c - c1c<br />
<br />
# construction circle outer tangent<br />
c3 = mk_circle(c1c, c1.Radius - c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + acos(c3.Radius / cc.Length)<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c1c, v1 * c1.Radius + c1c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c + v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - acos(c3.Radius / cc.Length)<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c1c, v2 * c1.Radius + c1c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c + v2 * c2.Radius, False)<br />
<br />
# construction circle inner tangent<br />
c4 = mk_circle(c2c, c1.Radius + c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + asin(c4.Radius / cc.Length) - pi/2<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c2c, -v1 * c2.Radius + c2c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c - v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - asin(c4.Radius / cc.Length) + pi/2<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c2c, - v2 * c2.Radius + c2c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c - v2 * c2.Radius, False)<br />
<br />
cgroup.ViewObject.Visibility = False<br />
doc.recompute()<br />
<br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Draft_Circle_Tangent&diff=1210838Macro Draft Circle Tangent2022-11-27T17:55:58Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Draft Circle Tangent<br />
|Description=Makes tangents to Draft circles.<br />
|Author=heda<br />
|Version=0.2<br />
|Date=2022-11-27<br />
|FCVersion=-<br />
}}<br />
<br />
==Description== <!--T:2--><br />
<br />
</translate><br />
[[File:Macro_Draft_circle_tangent_example.png]]<br />
<translate><br />
<!--T:3--><br />
{{Caption|Macro Draft Circle Tangent}}<br />
<br />
==Usage== <!--T:4--><br />
<br />
<!--T:5--><br />
Select and launch.<br />
<br />
==Install== <!--T:6--><br />
<br />
<!--T:7--><br />
Through the [[Std_AddonMgr|Addon manager]].<br />
<br />
==Version== <!--T:8--><br />
<br />
<!--T:9--><br />
v0.2 2022-11-27 : fixed draft point selection in treeview<br />
<br />
v0.1 2022-11-21 : first release<br />
<br />
==Code== <!--T:10--><br />
<br />
</translate><br />
'''Macro_Draft_Circle_Tangent.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Draft_Circle_Tangent'<br />
__Comment__ = 'Makes tangents to draft circles.'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.2'<br />
__Date__ = '2022-11-27'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Draft_Circle_Tangent'<br />
__Icon__ = ''<br />
__Help__ = 'Select and launch.'<br />
__Status__ = 'functional'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
makes tangents for draft circles and arcs<br />
a) circle and vertex/point<br />
b) two circles<br />
<br />
select before launching macro<br />
<br />
for circle and point the tangents are constructed,<br />
as one would do with pen and paper<br />
for circle and circle the angles are calculated,<br />
one can also construct the tangents in a similar way to<br />
circle/point way, i.e. intersections by additional construction circles<br />
<br />
note: tesselation often makes the true tangent not look like a true tangent<br />
this is to not overload rendering for larger projects<br />
one can change the viewsetting deviation for the circle to minimum (0.01)<br />
if one wants to better view the true tangent, if so, better turn that back<br />
to default once viewed - it is easy to foget that this has been done,<br />
and can in larger projects put fc to more or less a complete halt.<br />
"""<br />
<br />
from math import sin, cos, pi, atan2, acos, asin<br />
<br />
import Draft<br />
<br />
doc = App.ActiveDocument<br />
cgroup = doc.addObject('App::DocumentObjectGroup','Construction')<br />
Vector, Placement = App.Vector, App.Placement<br />
RotZero = Placement().Rotation<br />
<br />
def get_curve(obj):<br />
return obj.Shape.Edge1.Curve<br />
<br />
def point2vector(pt):<br />
return pt.toShape().Point<br />
<br />
def get_intersection_points(obj1, obj2):<br />
doc.recompute()<br />
i1, i2 = get_curve(obj1).intersect(get_curve(obj2))<br />
return (point2vector(p) for p in (i1, i2))<br />
<br />
def add_construction(obj):<br />
_ = cgroup.addObject(obj)<br />
<br />
def mk_line(v1, v2, construction=True):<br />
line = Draft.make_line(v1, v2)<br />
if construction:<br />
line.ViewObject.DrawStyle = 'Dashdot'<br />
add_construction(line)<br />
return line<br />
<br />
def mk_circle(centre, radius):<br />
circle = Draft.make_circle(radius, Placement(centre, RotZero), False)<br />
circle.ViewObject.DrawStyle = 'Dashed'<br />
add_construction(circle)<br />
return circle<br />
<br />
<br />
## selection logic<br />
SINGLE = False<br />
msg = ('select exactly 2 items, 2 (draft) circles '<br />
'or 1 (draft) circle and one vertex or (draft) point')<br />
selection = Gui.Selection.getSelection()<br />
if len(selection) == 2:<br />
s1, s2 = selection<br />
r1, r2 = (hasattr(r, 'Radius') for r in selection)<br />
if r1 and r2:<br />
c1s, c2s = s1, s2<br />
elif not r1 and not r2:<br />
raise RunTimeWarning(msg)<br />
else:<br />
SINGLE = True<br />
circle = s1 if r1 else s2<br />
sx1, sx2 = Gui.Selection.getSelectionEx()<br />
sx = sx2 if r1 else sx1<br />
if sx.PickedPoints:<br />
point, = sx.PickedPoints<br />
else: # it is a draft point selected in treeview<br />
point = sx.Object.Shape.Point<br />
<br />
else:<br />
raise RunTimeWarning(msg)<br />
<br />
if SINGLE:<br />
<br />
o = circle.Placement.Base<br />
op = point - o<br />
<br />
ccircle = mk_circle(o + op/2, op.Length/2)<br />
<br />
v1, v2 = get_intersection_points(circle, ccircle)<br />
<br />
tangent1 = mk_line(point, v1, False)<br />
tangent2 = mk_line(point, v2, False)<br />
<br />
<br />
else:<br />
<br />
# c1 is the larger one<br />
if c1s.Radius >= c2s.Radius:<br />
c1, c2 = c1s, c2s<br />
else:<br />
c1, c2 = c2s, c1s<br />
<br />
c1c, c2c = c1.Placement.Base, c2.Placement.Base<br />
<br />
centerline = mk_line(c1c, c2c)<br />
cc = c2c - c1c<br />
<br />
# construction circle outer tangent<br />
c3 = mk_circle(c1c, c1.Radius - c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + acos(c3.Radius / cc.Length)<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c1c, v1 * c1.Radius + c1c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c + v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - acos(c3.Radius / cc.Length)<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c1c, v2 * c1.Radius + c1c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c + v2 * c2.Radius, False)<br />
<br />
# construction circle inner tangent<br />
c4 = mk_circle(c2c, c1.Radius + c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + asin(c4.Radius / cc.Length) - pi/2<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c2c, -v1 * c2.Radius + c2c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c - v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - asin(c4.Radius / cc.Length) + pi/2<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c2c, - v2 * c2.Radius + c2c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c - v2 * c2.Radius, False)<br />
<br />
cgroup.ViewObject.Visibility = False<br />
doc.recompute()<br />
<br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Draft_Circle_Tangent&diff=1209062Macro Draft Circle Tangent2022-11-21T21:59:46Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{Macro<br />
|Name=Draft_circle_tangent<br />
|Description=Makes tangents to draft circles..<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-11-21<br />
|FCVersion=-<br />
}}<br />
<br />
==Description==<br />
<br />
</translate><br />
[[File:Macro_Draft_circle_tangent_example.png]]<br />
<translate><br />
{{Caption|Macro Draft circle tangent}}<br />
<br />
==Usage==<br />
<br />
Select and launch.<br />
<br />
==Install==<br />
<br />
Through Addon manager.<br />
<br />
==Version==<br />
<br />
v0.1 2022-11-21 : first release<br />
<br />
==Code==<br />
<br />
</translate><br />
'''Macro_Draft_circle_tangent.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Draft_circle_tangent'<br />
__Comment__ = 'Makes tangents to draft circles.'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-11-21'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Draft_circle_tangent'<br />
__Icon__ = ''<br />
__Help__ = 'Select and launch.'<br />
__Status__ = 'functional'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
makes tangents for draft circles and arcs<br />
a) circle and vertex/point<br />
b) two circles<br />
<br />
select before launching macro<br />
<br />
for circle and point the tangents are constructed,<br />
as one would do with pen and paper<br />
for circle and circle the angles are calculated,<br />
one can also construct the tangents in a similar way to<br />
circle/point way, i.e. intersections by additional construction circles<br />
<br />
note: tesselation often makes the true tangent not look like a true tangent<br />
this is to not overload rendering for larger projects<br />
one can change the viewsetting deviation for the circle to minimum (0.01)<br />
if one wants to better view the true tangent, if so, better turn that back<br />
to default once viewed - it is easy to foget that this has been done,<br />
and can in larger projects put fc to more or less a complete halt.<br />
"""<br />
<br />
from math import sin, cos, pi, atan2, acos, asin<br />
<br />
import Draft<br />
<br />
doc = App.ActiveDocument<br />
cgroup = doc.addObject('App::DocumentObjectGroup','Construction')<br />
Vector, Placement = App.Vector, App.Placement<br />
RotZero = Placement().Rotation<br />
<br />
def get_curve(obj):<br />
return obj.Shape.Edge1.Curve<br />
<br />
def point2vector(pt):<br />
return pt.toShape().Point<br />
<br />
def get_intersection_points(obj1, obj2):<br />
doc.recompute()<br />
i1, i2 = get_curve(obj1).intersect(get_curve(obj2))<br />
return (point2vector(p) for p in (i1, i2))<br />
<br />
def add_construction(obj):<br />
_ = cgroup.addObject(obj)<br />
<br />
def mk_line(v1, v2, construction=True):<br />
line = Draft.make_line(v1, v2)<br />
if construction:<br />
line.ViewObject.DrawStyle = 'Dashdot'<br />
add_construction(line)<br />
return line<br />
<br />
def mk_circle(centre, radius):<br />
circle = Draft.make_circle(radius, Placement(centre, RotZero), False)<br />
circle.ViewObject.DrawStyle = 'Dashed'<br />
add_construction(circle)<br />
return circle<br />
<br />
<br />
## selection logic<br />
SINGLE = False<br />
msg = ('select exactly 2 items, 2 (draft) circles '<br />
'or 1 (draft) circle and one vertex or (draft) point')<br />
selection = Gui.Selection.getSelection()<br />
if len(selection) == 2:<br />
s1, s2 = selection<br />
r1, r2 = (hasattr(r, 'Radius') for r in selection)<br />
if r1 and r2:<br />
c1s, c2s = s1, s2<br />
elif not r1 and not r2:<br />
raise RunTimeWarning(msg)<br />
else:<br />
SINGLE = True<br />
circle = s1 if r1 else s2<br />
sx1, sx2 = Gui.Selection.getSelectionEx()<br />
sx = sx2 if r1 else sx1<br />
point, = sx.PickedPoints<br />
<br />
else:<br />
raise RunTimeWarning(msg)<br />
<br />
if SINGLE:<br />
<br />
o = circle.Placement.Base<br />
op = point - o<br />
<br />
ccircle = mk_circle(o + op/2, op.Length/2)<br />
<br />
v1, v2 = get_intersection_points(circle, ccircle)<br />
<br />
tangent1 = mk_line(point, v1, False)<br />
tangent2 = mk_line(point, v2, False)<br />
<br />
<br />
else:<br />
<br />
# c1 is the larger one<br />
if c1s.Radius >= c2s.Radius:<br />
c1, c2 = c1s, c2s<br />
else:<br />
c1, c2 = c2s, c1s<br />
<br />
c1c, c2c = c1.Placement.Base, c2.Placement.Base<br />
<br />
centerline = mk_line(c1c, c2c)<br />
cc = c2c - c1c<br />
<br />
# construction circle outer tangent<br />
c3 = mk_circle(c1c, c1.Radius - c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + acos(c3.Radius / cc.Length)<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c1c, v1 * c1.Radius + c1c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c + v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - acos(c3.Radius / cc.Length)<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c1c, v2 * c1.Radius + c1c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c + v2 * c2.Radius, False)<br />
<br />
# construction circle inner tangent<br />
c4 = mk_circle(c2c, c1.Radius + c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + asin(c4.Radius / cc.Length) - pi/2<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c2c, -v1 * c2.Radius + c2c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c - v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - asin(c4.Radius / cc.Length) + pi/2<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c2c, - v2 * c2.Radius + c2c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c - v2 * c2.Radius, False)<br />
<br />
cgroup.ViewObject.Visibility = False<br />
doc.recompute()<br />
<br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macros_recipes&diff=1209061Macros recipes2022-11-21T21:58:44Z<p>Heda: </p>
<hr />
<div><languages/><br />
<br />
{|class="fcinfobox wikitable ct" height=100% style="width: 230px; float: right; margin-left: 1em" |<br />
| class="ctTitle" style="font-weight: bold; font-size: 125%;" | [[Image:Text-x-python.png|32px]] Macros<br />
|-<br />
| class="ctToc"|<br/>__TOC__<br />
|}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
<!--T:388--><br />
* {{MacroLink|Icon=TNP_solution.png|Macro_TNP_Solution|Macro TNP Solution}}: A basic example of how the Topological Naming Problem can be solved. The macro is intended for programmers only.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle on 3 selected points, the points can be objects (this example brings together the two examples below, all parameters simply settle on a graphic window).<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Draft_circle_tangent|Macro Draft circle tangent}}: Makes tangents to draft circles.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Drawing-orthoviews.svg|32px]] Drawing Workbench=== <!--T:105--><br />
<br />
<!--T:165--><br />
The [[Drawing Workbench|Drawing Workbench]] is obsolete since FreeCAD 0.17. Consider using the [[TechDraw Workbench|TechDraw Workbench]] instead.<br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:223--><br />
* {{MacroLink|Icon=Macro_Automatic_drawing.png|Macro_Automatic_drawing|Macro Automatic drawing}}: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.<br />
<br />
<!--T:224--><br />
* {{MacroLink|Icon=Macro_CartoucheFC.png|Macro_CartoucheFC|Macro CartoucheFC}}: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:225--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_2.png|Macro_CartoucheFC_2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.<br />
<br />
<!--T:226--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro_CartoucheFC_Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|Misc templates Full]] of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:385--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a B-spline surface through a grid of points.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_Circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:386--><br />
* {{MacroLink|Icon=multiCuts.png|Macro_MultiCuts|Macro MultiCuts}}: This macro improves boolean cut hierarchy by automatic labeling and using copies for cut.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
<br />
<!--T:387--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Z_Height_Map|Macro Z Height Map}}: Makes a grayscale heightmap in Z.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:354--><br />
* {{MacroLink|Icon=Macro_Corner_shapes_wizard.png|Macro_Corner_shapes_wizard/update|Macro Corner shapes wizard/update}}: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.<br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Draft_Circle_Tangent&diff=1209060Macro Draft Circle Tangent2022-11-21T21:46:58Z<p>Heda: Created page with "<languages/> <translate> {{Macro |Name=Draft_circle_tangent |Description=Makes tangents to draft circles.. |Author=heda |Version=0.1 |Date=2022-11-21 |FCVersion=- }} ==Descr..."</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{Macro<br />
|Name=Draft_circle_tangent<br />
|Description=Makes tangents to draft circles..<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-11-21<br />
|FCVersion=-<br />
}}<br />
<br />
==Description==<br />
<br />
</translate><br />
[[File:Macro_Draft_circle_tangent_example.png]]<br />
<translate><br />
{{Caption|Macro Draft circle tangent}}<br />
<br />
==Usage==<br />
<br />
Select and launch.<br />
<br />
==Install==<br />
<br />
Through Addon manager.<br />
<br />
==Version==<br />
<br />
v0.1 2022-11-21 : first release<br />
<br />
==Code==<br />
<br />
</translate><br />
'''Macro_Draft_circle_tangent.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Draft_circle_tangent'<br />
__Comment__ = 'Makes tangents to draft circles.'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-11-21'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Circle_tangent'<br />
__Icon__ = ''<br />
__Help__ = 'Select and launch.'<br />
__Status__ = 'functional'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
makes tangents for draft circles and arcs<br />
a) circle and vertex/point<br />
b) two circles<br />
<br />
select before launching macro<br />
<br />
for circle and point the tangents are constructed,<br />
as one would do with pen and paper<br />
for circle and circle the angles are calculated,<br />
one can also construct the tangents in a similar way to<br />
circle/point way, i.e. intersections by additional construction circles<br />
<br />
note: tesselation often makes the true tangent not look like a true tangent<br />
this is to not overload rendering for larger projects<br />
one can change the viewsetting deviation for the circle to minimum (0.01)<br />
if one wants to better view the true tangent, if so, better turn that back<br />
to default once viewed - it is easy to foget that this has been done,<br />
and can in larger projects put fc to more or less a complete halt.<br />
"""<br />
<br />
from math import sin, cos, pi, atan2, acos, asin<br />
<br />
import Draft<br />
<br />
doc = App.ActiveDocument<br />
cgroup = doc.addObject('App::DocumentObjectGroup','Construction')<br />
Vector, Placement = App.Vector, App.Placement<br />
RotZero = Placement().Rotation<br />
<br />
def get_curve(obj):<br />
return obj.Shape.Edge1.Curve<br />
<br />
def point2vector(pt):<br />
return pt.toShape().Point<br />
<br />
def get_intersection_points(obj1, obj2):<br />
doc.recompute()<br />
i1, i2 = get_curve(obj1).intersect(get_curve(obj2))<br />
return (point2vector(p) for p in (i1, i2))<br />
<br />
def add_construction(obj):<br />
_ = cgroup.addObject(obj)<br />
<br />
def mk_line(v1, v2, construction=True):<br />
line = Draft.make_line(v1, v2)<br />
if construction:<br />
line.ViewObject.DrawStyle = 'Dashdot'<br />
add_construction(line)<br />
return line<br />
<br />
def mk_circle(centre, radius):<br />
circle = Draft.make_circle(radius, Placement(centre, RotZero), False)<br />
circle.ViewObject.DrawStyle = 'Dashed'<br />
add_construction(circle)<br />
return circle<br />
<br />
<br />
## selection logic<br />
SINGLE = False<br />
msg = ('select exactly 2 items, 2 (draft) circles '<br />
'or 1 (draft) circle and one vertex or (draft) point')<br />
selection = Gui.Selection.getSelection()<br />
if len(selection) == 2:<br />
s1, s2 = selection<br />
r1, r2 = (hasattr(r, 'Radius') for r in selection)<br />
if r1 and r2:<br />
c1s, c2s = s1, s2<br />
elif not r1 and not r2:<br />
raise RunTimeWarning(msg)<br />
else:<br />
SINGLE = True<br />
circle = s1 if r1 else s2<br />
sx1, sx2 = Gui.Selection.getSelectionEx()<br />
sx = sx2 if r1 else sx1<br />
point, = sx.PickedPoints<br />
<br />
else:<br />
raise RunTimeWarning(msg)<br />
<br />
if SINGLE:<br />
<br />
o = circle.Placement.Base<br />
op = point - o<br />
<br />
ccircle = mk_circle(o + op/2, op.Length/2)<br />
<br />
v1, v2 = get_intersection_points(circle, ccircle)<br />
<br />
tangent1 = mk_line(point, v1, False)<br />
tangent2 = mk_line(point, v2, False)<br />
<br />
<br />
else:<br />
<br />
# c1 is the larger one<br />
if c1s.Radius >= c2s.Radius:<br />
c1, c2 = c1s, c2s<br />
else:<br />
c1, c2 = c2s, c1s<br />
<br />
c1c, c2c = c1.Placement.Base, c2.Placement.Base<br />
<br />
centerline = mk_line(c1c, c2c)<br />
cc = c2c - c1c<br />
<br />
# construction circle outer tangent<br />
c3 = mk_circle(c1c, c1.Radius - c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + acos(c3.Radius / cc.Length)<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c1c, v1 * c1.Radius + c1c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c + v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - acos(c3.Radius / cc.Length)<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c1c, v2 * c1.Radius + c1c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c + v2 * c2.Radius, False)<br />
<br />
# construction circle inner tangent<br />
c4 = mk_circle(c2c, c1.Radius + c2.Radius)<br />
<br />
phi1 = atan2(cc.y, cc.x) + asin(c4.Radius / cc.Length) - pi/2<br />
v1 = Vector(cos(phi1), sin(phi1), 0).normalize()<br />
line = mk_line(c2c, -v1 * c2.Radius + c2c)<br />
ot1 = mk_line(c1c + v1 * c1.Radius, c2c - v1 * c2.Radius, False)<br />
<br />
phi2 = atan2(cc.y, cc.x) - asin(c4.Radius / cc.Length) + pi/2<br />
v2 = Vector(cos(phi2), sin(phi2), 0).normalize()<br />
line2 = mk_line(c2c, - v2 * c2.Radius + c2c)<br />
ot2 = mk_line(c1c + v2 * c1.Radius, c2c - v2 * c2.Radius, False)<br />
<br />
cgroup.ViewObject.Visibility = False<br />
doc.recompute()<br />
<br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_Draft_circle_tangent_example.png&diff=1209059File:Macro Draft circle tangent example.png2022-11-21T21:43:12Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Sandbox:Wishlist&diff=1209058Sandbox:Wishlist2022-11-21T21:42:04Z<p>Heda: </p>
<hr />
<div><br />
== Introduction ==<br />
<br />
This page is a wishlist of items that can improve the FreeCAD experience.<br />
<br />
<br />
Anyone is free to add / remove / modify items here, i.e. help in recording new ideas and keeping it decently up to date.<br />
The purpose of the wishlist is not to replace forum posts, bug reports or feature requests,<br />
but rather serve as an incomplete overview of identified improvement areas.<br />
<br />
The page is a complement to the [[Workarounds|Workarounds]] page, and less well maintained [[:Category:Roadmap|Roadmap Category]] on this Wiki.<br />
<br />
The page has 4 benefits:<br />
* people can scan the page to see if an idea of theirs is already noted down<br />
* minimal effort to capture an idea that is then possible to find back<br />
* works for people that are not present at gh<br />
* avoids ideas to fade to a less discoverable spot in the forum<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Application wide ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Selection methods<br />
|| Modify<br />
|| There are multiple paradigms for how to select objects/entities for use with a command.<br />
|| More streamlined through the application. In order for that to happen, someone needs to make a detailed overview of how it works today for all corners of FreeCAD. That overview, to date, does not exist. So do not expect anything to happen on this topic unless it is kicked off with creating an overview.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=59384 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Control of spin widget ticks<br />
|| New<br />
|| Different spin widgets have different tick-steps, some in preference, some hardcoded?<br />
|| Add functionality to alter tick-size on the fly. Think font size up/down but for decimal point location. Should be part of std toolbar and affect relevant widgets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=543849#p543849 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Standardized performance tests<br />
|| New<br />
|| Not present<br />
|| Create some scripts to test & record performance of different aspects over time.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70550 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=73306&sid=ba36fcfc368afe5c111cbeddbc78626c forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Editor preference<br />
|| Modify<br />
|| Current is tabs<br />
|| Change default to 4 spaces.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70620 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Selection<br />
|| Modify<br />
|| Improve selection behaviour<br />
|| a) do not deselect when ctrl is down<br />
b) instead of require “to be spot on” (within picking radius), i.e. preselection is active, one could select anything that is in closest proximity to the mouse click. Librecad does it this way, and it is very convenient.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=638582#p638582 forum thread]<br />
|| a) 0.21<br />
|-<br />
|0.20<br />
|| Box Selection<br />
|| Modify<br />
|| No preview highlight when using box selection.<br />
|| Add preview highlight for box selection.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| No icons on the buttons.<br />
|| Add icons for the buttons<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| There is a button to edit macro path, but no button to open “location” with native file explorer.<br />
|| Add button to open macro location in native file explorer.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| Button “Download” opens AddOnMgr<br />
|| Why not just have “AddOnManager” as button text?<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Std / Base / AddonMgr ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Py imports<br />
|| Modify<br />
|| New users used to python often struggle with imports in current fc.<br />
|| Make imports behave more like vanilla python. Could also be beneficial to start a breaking journey to make addons pip/conda installable, while at the same time impose full namespacing for py code.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=29584&start=40 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=67498&p=583438#p583438 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=43280 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folder missing from sys.path<br />
|| Modify<br />
|| Appears to be inconsistent behavior of adding the macro folder to sys.path.<br />
|| No matter location (including non-std user settings) importing from macro folder should work out of the box. (is this currently handled by packaging?)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=72293 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Cmd args<br />
|| Modify<br />
|| Running headless with arguments is a bit of an headache (think running a sphinx build)<br />
|| Make shell-runs behave more like vanilla python & a decent scheme for env-vars.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=67780 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Restart command<br />
|| New<br />
|| No file menu option to restart.<br />
|| A file menu option to restart.<br />
|| [https://wiki.freecadweb.org/Code_snippets#Close_and_restart_FreeCAD forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Measurement tool<br />
|| Modify / new<br />
|| Several different tools, part wb measure is the most comprehensive built in option.<br />
Addon options include FCInfo, Asm4 Measure, QuickMeasure, etc.<br />
|| A new application wide info tool located in inspection wb. Inspection wb should as well be able to compute area / volume of selected items (with its own icons)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=68243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=72643 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Category views<br />
|| Modify<br />
|| Addon manager shows a flat (long) view of macros / wb’s.<br />
|| Simplest is probably just an additional preset filter with category. Both macros and wb’s have a categorization already available, that should be possible to use in the addonmgr.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Internal rounding<br />
|| New<br />
|| One symptom is for example that placement all of a sudden is -0.00<br />
|| That there was a possibility to apply round to geometries in an easy way. Should work application wide, i.e. any new geometry is created with rounded values (no more 1.23456e-7 instead of 0) with user setting. Think this implies a sort of inspection round when geometry comes back from occ. Should also be possible to take for example a polyline and round those coordinates to a given decimal number, analogue for a shell/solid/mesh and its vertexes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| 3d-view coordsys<br />
|| Modify<br />
|| Cuts the right most letter (when in default) lower right location.<br />
|| Move zero of that coordsys slightly to left.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=463243#p463243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=63527 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Set edge colors<br />
|| New<br />
|| There is a dialogue for setting face colors.<br />
|| Expand that dialogue, or a new one, for edge & vertex colors.<br />
|| [https://wiki.freecadweb.org/Macro_Colorize forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Identifying versions when opening files.<br />
|| New<br />
|| Users are not informed when opening files created with earlier versions. Once the file is opened the earlier file is lost forever.<br />
|| Ask user if they want to save a back-up of the file before it is altered.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=496590#p496590 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Pip install through gui<br />
|| New<br />
|| Pip install is currently only by shell.<br />
|| Create a gui for correct installation of additional libs. Could be pip, conda, apt, etc based on existing install. If not actually running the command, at least it could produce a string to copy into shell, with info from which directory to run it from. Should be possible to do even for appimages.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=57023 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Arrow for direction<br />
|| New<br />
|| There is no visual indication of where a placement/attachment edit goes.<br />
|| Show an arrow indicating positive direction when user enters edit mode of such property, i.e when clicking for example z, an arrow will appear showing the positive direction an altered value will move the entity. Does not do much when everything is aligned to global xyz, but helps when coord sys are nested and individually rotated.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Creation / edit coordinates<br />
|| New<br />
|| When creating / editing draft objects the coordinate inputs are always tracking 3d-view mouse movements. This is unpractical if one just wants to enter coordinates, and happen to move the mouse in the 3d view.<br />
|| a) a reset button, so that all goes to zero<br />
b) checkbox for switching off tracking of 3d-view coordinates in input widgets.<br />
(implementation proposal in link)<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=503914#p503914 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Font for shapestring<br />
|| Modify<br />
|| Font must be given for something to render, user is not informed if font is missing. Meaning on a fresh install shapestring will most likely render nothing without notifying user.<br />
|| a) attempt to find font on os default locations, qt has current used font-family<br />
b) raise meaningful user info if nothing is rendered<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=509970#p509970 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Improved coordinate api<br />
|| Modify<br />
|| For example Vector is an iterable, whereas Vertex is not.<br />
|| a) all should be iterables out of the box<br />
b) vertex should have same py.__repr__ as vector<br />
c) vector could have a round method<br />
d) there could be a application wide setting for number of decimals to show in __repr__<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=63751 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folders<br />
|| Modify<br />
|| Today one and only one folder must be used for macros.<br />
|| a) allow for recursive folders in “user/Macro”<br />
b) allow to configure multiple folders<br />
c) new document object type that holds a path to a macro that runs if doc.obj is double-clicked.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform widget origin<br />
|| Modify<br />
|| Always show in placement coord.<br />
|| Make configurable to also show in for example shape cog.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=67159 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/issues/6588 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Dxf import<br />
|| New<br />
|| Dxf import is a constant and reoccurring source of forum posts showcasing different issues.<br />
|| Use ezdxf as base for dxf import, seems like parts of ezdxf can optionally be compiled for speed. In any case a pure python importer based on ezdxf appears to have ability to outpace current c-importer, so a pure python implementation to begin with focusing on coverage should be good enough.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=68444 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Group<br />
|| New<br />
|| The count of children in a group is only available through scripting.<br />
|| Show children count of a selected group in “status bar”. Could be valid for any other container object as well. Or the count could be part of the tool-tip when hoovering in the tree-view.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Selection view<br />
|| Modify<br />
|| No gui indication of total amount of selected objects.<br />
|| Add label at bottom of “selection view” with total amount of selected entities.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro execution<br />
|| New<br />
|| No meaningful way to stop execution of a macro other than killing the whole application.<br />
|| Introduce a way to break a running macro, corresponding to “ctrl-c” in a vanilla python session. Could be a short-cut of a gui-button.0<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro namespace<br />
|| New<br />
|| Macro variables not available in python console after execution. Actually they can be made to be, they just are not with default settings.<br />
|| a) change default to "run in global".<br />
b) introduce a "macro" namespace that could be imported, would avoid possible conflicts with fc main namespace.<br />
|| [https://wiki.freecadweb.org/Preferences_Editor#Macro macro settings]<br />
||<br />
|-<br />
| 0.20<br />
|| Shape.BoundBox<br />
|| Modify<br />
|| In python, Shape.BoundBox appears to be a static snap-shot, i.e. it is not a reference to current data. A recompute does not reflect updated values, the Shape.BoundBox has to be reassigned to pick up current values.<br />
|| Modify the python version of Shape.BoundBox to reflect current values after a recompute.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro toolbar "execute"<br />
|| Modify<br />
|| Only runs macro when macro is the active tab in document/3d-view.<br />
|| If no macro open/shown in 3d-view, run the first macro in the “recent macro” list.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Arch ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Cut-plane<br />
|| Bug<br />
|| Transparency and color of cut-plane is transferred to final solid.<br />
|| Object appearance should be unaffected by cut.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=628242#p628242 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Draft ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Move<br />
|| Modify<br />
|| If wanting to make for example 10 lines as transformed copies, when using draft/move and enabling “continue & copy” the dialogue still automatically closes when 2nd point is defined.<br />
|| Keep dialogue open for a new move. Additionally when in copy/continue mode, the 1st point can be skipped, it should be the 2nd point of the last move (with relative setting that is zero, but it would save one button press if there was no need to re-enter that)<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Chain select<br />
|| New<br />
|| Path wb has chain select, but it bugs out on for example a set of draft/lines.<br />
|| A chain select command in base wb’s (std/draft/part?) with option to a) chain connected b) chain tangent. Should also not break out of command when hitting a branch of edges, it should simply stay in selection mode and allow for selection of branch and thus continue the chain.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Dimension<br />
|| Modify<br />
|| When adding a dimension, the actual dimension is often way too small.<br />
|| First fontsize should be a portion of document bounding box. Rather than the application default, there should be a document default value, and once that is set, it stays – so no change in property as such, just how the first value is set in a document.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| Input widget for scale factor is not user friendly.<br />
a) try and enter a scale factor of 1.23 with a fresh install<br />
b) does not take expressions.<br />
|| Better handling of decimal entries and allow expressions in input widget.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Edit dialogue for wire/spline<br />
||<br />
|| Hard to discover how to add/remove points to wires & splines.<br />
If one edits wires in current versions, there is more clicks now than earlier, which matters a lot if you are cleaning files that have a large amount of points (read thousands...)<br />
|| a) bring back the buttons from v0.18 into the edit dialogue<br />
b) make a label widget explaining the procedure to add/remove points.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=57630&start=30 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| An arc cannot be scaled in draft without making a clone.<br />
|| Make it possible to scale arcs naively, should not be technically impossible, even with non-uniform scaling parameters (although it will change the type of entity irreversibly).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform<br />
|| New<br />
|| Part/transform widget does not work on draft objects.<br />
|| Adapt transform widget to work also for draft objects.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split taskpanel<br />
|| Modify<br />
|| Esc does not exit task-panel.<br />
|| Make esc exit task panel in draft, it does on some draft taskpanels but not all. There are more than split, for example shapestring.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split / downgrade etc<br />
|| Modify<br />
|| When using a dividing function in draft, split, downgrade, etc. If the object is in a group the new objects end up in root.<br />
|| Dividing operations should respect the original object location (group/layer) and be created in that location.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Points removal from wires<br />
|| New<br />
|| Currently 3 clicks (and 2 hands) are required to remove a point from a wire. Alt needs to be pressed, the point needs to clicked, rmb needs to be clicked and “delete point” needs to be clicked in the context menu.<br />
|| Allow for box selection in the wire edit mode and have a button for deletion of points, or possibly context menu entry.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Svg export<br />
|| Modify<br />
|| A draft line, etc with a dash-dot decoration, exported to svg, imports as a solid line into inkscape.<br />
|| Respect line decorations in exports to svg.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| ShapeString<br />
|| Modify<br />
|| ShapeString does not allow for alternative aligning.<br />
|| Make aligning properties such as “right-align”, “center”, etc. the full capability would be NSEW or any combination of those with the additional centre option.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Draft linestyle<br />
|| Modify<br />
|| To reproduce: change linestyles to “dashed”, the gap is dynamic based on object size and zoom (assuming this, but that is how it appears to work on screen). Now if one object is about half in size, it will appear as solid line on screen although dashed is set, this is valid when zoomed out, if one zooms in it appears dashed on the screen.<br />
|| Modify gap algo to care for all objects in such way that dashed is dashed on the screen (btw, dashdot behaves different…)<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Sketcher ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Optional “missing coincidences check”<br />
|| New<br />
|| Not being able to extrude/pad due to missing coincidences in sketches is a constant and reoccurring source of forum posts.<br />
|| Auto check for missing coincidences when closing a sketch. Should be a preference to switch behaviour on/off. Should be on as default since the target audience is new users. That there are usecases for open vertexes should not affect this, deliberate open vertexes have little to do with missing coincidences. Could be made fancy and only raise the info dialogue if found and be silent if nothing is found.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Angle constraint<br />
|| New<br />
|| Support common angles, steps of 15.<br />
|| See forum thread<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70424 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Part ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Loft<br />
|| Modify<br />
|| Selection widget only allows to add profiles one by one.<br />
|| a) multi-select with ctrl-key down<br />
b) new buttons to “add all” / “remove all”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Undesired reset of colors<br />
|| Bug<br />
|| Color of shape resets to default without asking for it.<br />
|| To be fixed, description in forum post.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=68411 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Rework check geometry dialogue<br />
|| Modify<br />
|| See forum thread.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=34&t=70809 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Segfault sweep<br />
|| Bug<br />
|| Example file in forum post.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=70770 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Fuse behaviour on larger sets<br />
|| Modify<br />
|| Example in forum post.<br />
|| For operations where a list is passed, it appears that chunking the operation makes a noticable speed-up.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=73306 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Part Design ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Out of body message.<br />
|| Modify / new<br />
|| Cryptic error for new comers when trying to do operations on entities outside of the body.<br />
|| a) open a dialogue for selecting objects to move into the body.<br />
b) error message with suggestions for actions, rather than just stating what is wrong.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=55575 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Hole<br />
|| Modify<br />
|| Direction of hole is always same, occasionally leading to a hole initially not being made, this confuses users<br />
|| Add heuristics to apply a direction of the hole that is actually producing a cavity. Heuristics is only for best guess during creation. The “reverse” property should stay as a static property.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Mesh ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Merge close points<br />
|| New<br />
|| No built in way to merge close points on a mesh.<br />
|| Repair option to merge close points, with dialogue to set distance (in mm) for what qualifies as a close point. Returns a new mesh with valid topology.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Show / hide facets<br />
|| New<br />
|| Can show/hide complete meshes.<br />
|| Allow for selection of faces, and a graphical way to hide them along with a reset button. The hiding should be persistent, so that one can use other operations while hidden.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split facet<br />
|| New<br />
|| No obvious way to split facets.<br />
|| Select a facet, it is then split in 2 with the longest edge split at midpoint.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Move facet point<br />
|| New<br />
|| No gui for redefining a single facet point.<br />
|| Select a point in a mesh, snap to another existing point on another facet, not necessarily on same mesh, but always a mesh-object.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Mesh boolean icons<br />
|| Modify<br />
|| Think they are not disabled although fc cannot find a valid OpenSCad installation.<br />
|| Commands should be disabled if there is no valid OpenSCad installation on the machine. Maybe update the preference page with a button to check if there is a valid installation as well.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Add triangle<br />
|| Modify<br />
|| Pop-up menu today is “Add triangle / Flip normal / Clear”<br />
|| Suggest pop-up menu wording should be “Add triangle +N / Add triangle -N / Clear” or “Add +Normal / Add -Normal / Clear”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Extract facet<br />
|| New<br />
|| Multiple steps to be able to extract a couple of facets to faces.<br />
|| Command that allows selection of individual facets and upon “ok/apply” it creates part.faces from the selected facets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=510737#p510737 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Quad meshes<br />
|| New<br />
|| Handles exclusively trimeshes as of today<br />
|| Add support for pure quad meshes and mixed tri/quad meshes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| Modify<br />
|| Gui only allows for uniform scale.<br />
|| Allow non-uniform scaling via gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Py-api<br />
|| Modify<br />
|| Mesh.show does not return document object.<br />
|| Return the new document object when showing.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Points ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| New<br />
|| No native scaling command for point clouds.<br />
|| Add scaling command to points wb, and a method for scaling in the points obj.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== FEM ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Torque load<br />
|| New<br />
|| No built in way to correctly apply a torque load.<br />
|| Make a torque constraint object & gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=420008#p420008 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Use multicore<br />
|| Modify<br />
|| Appears that preference setting for multi-core is not effective.<br />
|| Fix in link...<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=519494#p519494 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Image ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Python api<br />
|| New<br />
|| Non existing<br />
|| Add py-api with image object. Creation of object either with path to image on disk or data as bytes.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=70504 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Wiki ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| Versioning / archiving<br />
|| New<br />
|| a) No agreed means to lock a version of the wiki. The crawler used to create the qt helpfiles is not a complete snap, it is a partial crawl.<br />
b) could use an “archived v.xyz” scheme as well<br />
|| A robuster way to secure legacy info on wiki.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Fixed ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Workbench'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| Draft<br />
|| Spline 2 arc / dxf<br />
|| Bug<br />
|| See forum thread. An easy fix for someone working with git...<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=600132#p600132 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Draft/draftgeoutils/arcs.py#L135-L147 gh source]<br />
|| 0.21 [https://github.com/FreeCAD/FreeCAD/pull/7821 gh pull]<br />
<br />
|-<br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
[[Category:Roadmap]] [[Category:Sandbox]]</div>Hedahttps://wiki.freecad.org/index.php?title=Sandbox:Wishlist&diff=1205452Sandbox:Wishlist2022-11-12T12:43:45Z<p>Heda: </p>
<hr />
<div><br />
== Introduction ==<br />
<br />
This page is a wishlist of items that can improve the FreeCAD experience.<br />
<br />
<br />
Anyone is free to add / remove / modify items here, i.e. help in recording new ideas and keeping it decently up to date.<br />
The purpose of the wishlist is not to replace forum posts, bug reports or feature requests,<br />
but rather serve as an incomplete overview of identified improvement areas.<br />
<br />
The page is a complement to the [[Workarounds|Workarounds]] page, and less well maintained [[:Category:Roadmap|Roadmap Category]] on this Wiki.<br />
<br />
The page has 4 benefits:<br />
* people can scan the page to see if an idea of theirs is already noted down<br />
* minimal effort to capture an idea that is then possible to find back<br />
* works for people that are not present at gh<br />
* avoids ideas to fade to a less discoverable spot in the forum<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Application wide ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Selection methods<br />
|| Modify<br />
|| There are multiple paradigms for how to select objects/entities for use with a command.<br />
|| More streamlined through the application. In order for that to happen, someone needs to make a detailed overview of how it works today for all corners of FreeCAD. That overview, to date, does not exist. So do not expect anything to happen on this topic unless it is kicked off with creating an overview.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=59384 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Control of spin widget ticks<br />
|| New<br />
|| Different spin widgets have different tick-steps, some in preference, some hardcoded?<br />
|| Add functionality to alter tick-size on the fly. Think font size up/down but for decimal point location. Should be part of std toolbar and affect relevant widgets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=543849#p543849 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Standardized performance tests<br />
|| New<br />
|| Not present<br />
|| Create some scripts to test & record performance of different aspects over time.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70550 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=73306&sid=ba36fcfc368afe5c111cbeddbc78626c forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Editor preference<br />
|| Modify<br />
|| Current is tabs<br />
|| Change default to 4 spaces.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70620 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Selection<br />
|| Modify<br />
|| Improve selection behaviour<br />
|| a) do not deselect when ctrl is down<br />
b) instead of require “to be spot on” (within picking radius), i.e. preselection is active, one could select anything that is in closest proximity to the mouse click. Librecad does it this way, and it is very convenient.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=638582#p638582 forum thread]<br />
|| a) 0.21<br />
|-<br />
|0.20<br />
|| Box Selection<br />
|| Modify<br />
|| No preview highlight when using box selection.<br />
|| Add preview highlight for box selection.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| No icons on the buttons.<br />
|| Add icons for the buttons<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| There is a button to edit macro path, but no button to open “location” with native file explorer.<br />
|| Add button to open macro location in native file explorer.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| Button “Download” opens AddOnMgr<br />
|| Why not just have “AddOnManager” as button text?<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Std / Base / AddonMgr ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Py imports<br />
|| Modify<br />
|| New users used to python often struggle with imports in current fc.<br />
|| Make imports behave more like vanilla python. Could also be beneficial to start a breaking journey to make addons pip/conda installable, while at the same time impose full namespacing for py code.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=29584&start=40 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=67498&p=583438#p583438 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=43280 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folder missing from sys.path<br />
|| Modify<br />
|| Appears to be inconsistent behavior of adding the macro folder to sys.path.<br />
|| No matter location (including non-std user settings) importing from macro folder should work out of the box. (is this currently handled by packaging?)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=72293 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Cmd args<br />
|| Modify<br />
|| Running headless with arguments is a bit of an headache (think running a sphinx build)<br />
|| Make shell-runs behave more like vanilla python & a decent scheme for env-vars.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=67780 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Restart command<br />
|| New<br />
|| No file menu option to restart.<br />
|| A file menu option to restart.<br />
|| [https://wiki.freecadweb.org/Code_snippets#Close_and_restart_FreeCAD forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Measurement tool<br />
|| Modify / new<br />
|| Several different tools, part wb measure is the most comprehensive built in option.<br />
Addon options include FCInfo, Asm4 Measure, QuickMeasure, etc.<br />
|| A new application wide info tool located in inspection wb. Inspection wb should as well be able to compute area / volume of selected items (with its own icons)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=68243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=72643 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Category views<br />
|| Modify<br />
|| Addon manager shows a flat (long) view of macros / wb’s.<br />
|| Simplest is probably just an additional preset filter with category. Both macros and wb’s have a categorization already available, that should be possible to use in the addonmgr.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Internal rounding<br />
|| New<br />
|| One symptom is for example that placement all of a sudden is -0.00<br />
|| That there was a possibility to apply round to geometries in an easy way. Should work application wide, i.e. any new geometry is created with rounded values (no more 1.23456e-7 instead of 0) with user setting. Think this implies a sort of inspection round when geometry comes back from occ. Should also be possible to take for example a polyline and round those coordinates to a given decimal number, analogue for a shell/solid/mesh and its vertexes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| 3d-view coordsys<br />
|| Modify<br />
|| Cuts the right most letter (when in default) lower right location.<br />
|| Move zero of that coordsys slightly to left.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=463243#p463243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=63527 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Set edge colors<br />
|| New<br />
|| There is a dialogue for setting face colors.<br />
|| Expand that dialogue, or a new one, for edge & vertex colors.<br />
|| [https://wiki.freecadweb.org/Macro_Colorize forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Identifying versions when opening files.<br />
|| New<br />
|| Users are not informed when opening files created with earlier versions. Once the file is opened the earlier file is lost forever.<br />
|| Ask user if they want to save a back-up of the file before it is altered.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=496590#p496590 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Pip install through gui<br />
|| New<br />
|| Pip install is currently only by shell.<br />
|| Create a gui for correct installation of additional libs. Could be pip, conda, apt, etc based on existing install. If not actually running the command, at least it could produce a string to copy into shell, with info from which directory to run it from. Should be possible to do even for appimages.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=57023 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Arrow for direction<br />
|| New<br />
|| There is no visual indication of where a placement/attachment edit goes.<br />
|| Show an arrow indicating positive direction when user enters edit mode of such property, i.e when clicking for example z, an arrow will appear showing the positive direction an altered value will move the entity. Does not do much when everything is aligned to global xyz, but helps when coord sys are nested and individually rotated.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Creation / edit coordinates<br />
|| New<br />
|| When creating / editing draft objects the coordinate inputs are always tracking 3d-view mouse movements. This is unpractical if one just wants to enter coordinates, and happen to move the mouse in the 3d view.<br />
|| a) a reset button, so that all goes to zero<br />
b) checkbox for switching off tracking of 3d-view coordinates in input widgets.<br />
(implementation proposal in link)<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=503914#p503914 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Font for shapestring<br />
|| Modify<br />
|| Font must be given for something to render, user is not informed if font is missing. Meaning on a fresh install shapestring will most likely render nothing without notifying user.<br />
|| a) attempt to find font on os default locations, qt has current used font-family<br />
b) raise meaningful user info if nothing is rendered<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=509970#p509970 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Improved coordinate api<br />
|| Modify<br />
|| For example Vector is an iterable, whereas Vertex is not.<br />
|| a) all should be iterables out of the box<br />
b) vertex should have same py.__repr__ as vector<br />
c) vector could have a round method<br />
d) there could be a application wide setting for number of decimals to show in __repr__<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=63751 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folders<br />
|| Modify<br />
|| Today one and only one folder must be used for macros.<br />
|| a) allow for recursive folders in “user/Macro”<br />
b) allow to configure multiple folders<br />
c) new document object type that holds a path to a macro that runs if doc.obj is double-clicked.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform widget origin<br />
|| Modify<br />
|| Always show in placement coord.<br />
|| Make configurable to also show in for example shape cog.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=67159 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/issues/6588 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Dxf import<br />
|| New<br />
|| Dxf import is a constant and reoccurring source of forum posts showcasing different issues.<br />
|| Use ezdxf as base for dxf import, seems like parts of ezdxf can optionally be compiled for speed. In any case a pure python importer based on ezdxf appears to have ability to outpace current c-importer, so a pure python implementation to begin with focusing on coverage should be good enough.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=68444 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Group<br />
|| New<br />
|| The count of children in a group is only available through scripting.<br />
|| Show children count of a selected group in “status bar”. Could be valid for any other container object as well. Or the count could be part of the tool-tip when hoovering in the tree-view.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Selection view<br />
|| Modify<br />
|| No gui indication of total amount of selected objects.<br />
|| Add label at bottom of “selection view” with total amount of selected entities.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro execution<br />
|| New<br />
|| No meaningful way to stop execution of a macro other than killing the whole application.<br />
|| Introduce a way to break a running macro, corresponding to “ctrl-c” in a vanilla python session. Could be a short-cut of a gui-button.0<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro namespace<br />
|| New<br />
|| Macro variables not available in python console after execution.<br />
|| As final part of execution of a macro, variables should be transferred to python console namespace (do not know if there are any particular technical obstacles in implementing such feature, but it would be really nice to have).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Shape.BoundBox<br />
|| Modify<br />
|| In python, Shape.BoundBox appears to be a static snap-shot, i.e. it is not a reference to current data. A recompute does not reflect updated values, the Shape.BoundBox has to be reassigned to pick up current values.<br />
|| Modify the python version of Shape.BoundBox to reflect current values after a recompute.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Arch ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Cut-plane<br />
|| Bug<br />
|| Transparency and color of cut-plane is transferred to final solid.<br />
|| Object appearance should be unaffected by cut.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=628242#p628242 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Draft ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Move<br />
|| Modify<br />
|| If wanting to make for example 10 lines as transformed copies, when using draft/move and enabling “continue & copy” the dialogue still automatically closes when 2nd point is defined.<br />
|| Keep dialogue open for a new move. Additionally when in copy/continue mode, the 1st point can be skipped, it should be the 2nd point of the last move (with relative setting that is zero, but it would save one button press if there was no need to re-enter that)<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Chain select<br />
|| New<br />
|| Path wb has chain select, but it bugs out on for example a set of draft/lines.<br />
|| A chain select command in base wb’s (std/draft/part?) with option to a) chain connected b) chain tangent. Should also not break out of command when hitting a branch of edges, it should simply stay in selection mode and allow for selection of branch and thus continue the chain.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Dimension<br />
|| Modify<br />
|| When adding a dimension, the actual dimension is often way too small.<br />
|| First fontsize should be a portion of document bounding box. Rather than the application default, there should be a document default value, and once that is set, it stays – so no change in property as such, just how the first value is set in a document.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| Input widget for scale factor is not user friendly.<br />
a) try and enter a scale factor of 1.23 with a fresh install<br />
b) does not take expressions.<br />
|| Better handling of decimal entries and allow expressions in input widget.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Edit dialogue for wire/spline<br />
||<br />
|| Hard to discover how to add/remove points to wires & splines.<br />
If one edits wires in current versions, there is more clicks now than earlier, which matters a lot if you are cleaning files that have a large amount of points (read thousands...)<br />
|| a) bring back the buttons from v0.18 into the edit dialogue<br />
b) make a label widget explaining the procedure to add/remove points.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=57630&start=30 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| An arc cannot be scaled in draft without making a clone.<br />
|| Make it possible to scale arcs naively, should not be technically impossible, even with non-uniform scaling parameters (although it will change the type of entity irreversibly).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform<br />
|| New<br />
|| Part/transform widget does not work on draft objects.<br />
|| Adapt transform widget to work also for draft objects.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Spline 2 arc / dxf<br />
|| Bug<br />
|| See forum thread. An easy fix for someone working with git...<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=600132#p600132 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Draft/draftgeoutils/arcs.py#L135-L147 gh source]<br />
||<br />
|-<br />
| 0.20<br />
|| Split taskpanel<br />
|| Modify<br />
|| Esc does not exit task-panel.<br />
|| Make esc exit task panel in draft, it does on some draft taskpanels but not all. There are more than split, for example shapestring.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split / downgrade etc<br />
|| Modify<br />
|| When using a dividing function in draft, split, downgrade, etc. If the object is in a group the new objects end up in root.<br />
|| Dividing operations should respect the original object location (group/layer) and be created in that location.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Points removal from wires<br />
|| New<br />
|| Currently 3 clicks (and 2 hands) are required to remove a point from a wire. Alt needs to be pressed, the point needs to clicked, rmb needs to be clicked and “delete point” needs to be clicked in the context menu.<br />
|| Allow for box selection in the wire edit mode and have a button for deletion of points, or possibly context menu entry.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Svg export<br />
|| Modify<br />
|| A draft line, etc with a dash-dot decoration, exported to svg, imports as a solid line into inkscape.<br />
|| Respect line decorations in exports to svg.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| ShapeString<br />
|| Modify<br />
|| ShapeString does not allow for alternative aligning.<br />
|| Make aligning properties such as “right-align”, “center”, etc. the full capability would be NSEW or any combination of those with the additional centre option.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Sketcher ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Optional “missing coincidences check”<br />
|| New<br />
|| Not being able to extrude/pad due to missing coincidences in sketches is a constant and reoccurring source of forum posts.<br />
|| Auto check for missing coincidences when closing a sketch. Should be a preference to switch behaviour on/off. Should be on as default since the target audience is new users. That there are usecases for open vertexes should not affect this, deliberate open vertexes have little to do with missing coincidences. Could be made fancy and only raise the info dialogue if found and be silent if nothing is found.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Angle constraint<br />
|| New<br />
|| Support common angles, steps of 15.<br />
|| See forum thread<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70424 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Part ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Loft<br />
|| Modify<br />
|| Selection widget only allows to add profiles one by one.<br />
|| a) multi-select with ctrl-key down<br />
b) new buttons to “add all” / “remove all”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Undesired reset of colors<br />
|| Bug<br />
|| Color of shape resets to default without asking for it.<br />
|| To be fixed, description in forum post.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=68411 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Rework check geometry dialogue<br />
|| Modify<br />
|| See forum thread.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=34&t=70809 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Segfault sweep<br />
|| Bug<br />
|| Example file in forum post.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=70770 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Fuse behaviour on larger sets<br />
|| Modify<br />
|| Example in forum post.<br />
|| For operations where a list is passed, it appears that chunking the operation makes a noticable speed-up.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=73306 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Part Design ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Out of body message.<br />
|| Modify / new<br />
|| Cryptic error for new comers when trying to do operations on entities outside of the body.<br />
|| a) open a dialogue for selecting objects to move into the body.<br />
b) error message with suggestions for actions, rather than just stating what is wrong.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=55575 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Hole<br />
|| Modify<br />
|| Direction of hole is always same, occasionally leading to a hole initially not being made, this confuses users<br />
|| Add heuristics to apply a direction of the hole that is actually producing a cavity. Heuristics is only for best guess during creation. The “reverse” property should stay as a static property.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Mesh ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Merge close points<br />
|| New<br />
|| No built in way to merge close points on a mesh.<br />
|| Repair option to merge close points, with dialogue to set distance (in mm) for what qualifies as a close point. Returns a new mesh with valid topology.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Show / hide facets<br />
|| New<br />
|| Can show/hide complete meshes.<br />
|| Allow for selection of faces, and a graphical way to hide them along with a reset button. The hiding should be persistent, so that one can use other operations while hidden.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split facet<br />
|| New<br />
|| No obvious way to split facets.<br />
|| Select a facet, it is then split in 2 with the longest edge split at midpoint.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Move facet point<br />
|| New<br />
|| No gui for redefining a single facet point.<br />
|| Select a point in a mesh, snap to another existing point on another facet, not necessarily on same mesh, but always a mesh-object.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Mesh boolean icons<br />
|| Modify<br />
|| Think they are not disabled although fc cannot find a valid OpenSCad installation.<br />
|| Commands should be disabled if there is no valid OpenSCad installation on the machine. Maybe update the preference page with a button to check if there is a valid installation as well.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Add triangle<br />
|| Modify<br />
|| Pop-up menu today is “Add triangle / Flip normal / Clear”<br />
|| Suggest pop-up menu wording should be “Add triangle +N / Add triangle -N / Clear” or “Add +Normal / Add -Normal / Clear”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Extract facet<br />
|| New<br />
|| Multiple steps to be able to extract a couple of facets to faces.<br />
|| Command that allows selection of individual facets and upon “ok/apply” it creates part.faces from the selected facets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=510737#p510737 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Quad meshes<br />
|| New<br />
|| Handles exclusively trimeshes as of today<br />
|| Add support for pure quad meshes and mixed tri/quad meshes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| Modify<br />
|| Gui only allows for uniform scale.<br />
|| Allow non-uniform scaling via gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Py-api<br />
|| Modify<br />
|| Mesh.show does not return document object.<br />
|| Return the new document object when showing.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Points ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| New<br />
|| No native scaling command for point clouds.<br />
|| Add scaling command to points wb, and a method for scaling in the points obj.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== FEM ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Torque load<br />
|| New<br />
|| No built in way to correctly apply a torque load.<br />
|| Make a torque constraint object & gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=420008#p420008 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Use multicore<br />
|| Modify<br />
|| Appears that preference setting for multi-core is not effective.<br />
|| Fix in link...<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=519494#p519494 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Image ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Python api<br />
|| New<br />
|| Non existing<br />
|| Add py-api with image object. Creation of object either with path to image on disk or data as bytes.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=70504 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Wiki ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| Versioning / archiving<br />
|| New<br />
|| a) No agreed means to lock a version of the wiki. The crawler used to create the qt helpfiles is not a complete snap, it is a partial crawl.<br />
b) could use an “archived v.xyz” scheme as well<br />
|| A robuster way to secure legacy info on wiki.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<br />
== Fixed ==<br />
<br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Workbench'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
[[Category:Roadmap]] [[Category:Sandbox]]</div>Hedahttps://wiki.freecad.org/index.php?title=Sandbox:Wishlist&diff=1205451Sandbox:Wishlist2022-11-12T12:38:26Z<p>Heda: /* Introduction */</p>
<hr />
<div><br />
== Introduction ==<br />
<br />
This page is a wishlist of items that can improve the FreeCAD experience.<br />
<br />
<br />
Anyone is free to add / remove / modify items here, i.e. help in recording new ideas and keeping it decently up to date.<br />
The purpose of the wishlist is not to replace forum posts, bug reports or feature requests,<br />
but rather serve as an incomplete overview of identified improvement areas.<br />
<br />
The page is a complement to the [[Workarounds|Workarounds]] page, and less well maintained [[:Category:Roadmap|Roadmap Category]] on this Wiki.<br />
<br />
The page has 4 benefits:<br />
* people can scan the page to see if an idea of theirs is already noted down<br />
* minimal effort to capture an idea that is then possible to find back<br />
* works for people that are not present at gh<br />
* avoids ideas to fade to a less discoverable spot in the forum<br />
<br />
== Application wide ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Selection methods<br />
|| Modify<br />
|| There are multiple paradigms for how to select objects/entities for use with a command.<br />
|| More streamlined through the application. In order for that to happen, someone needs to make a detailed overview of how it works today for all corners of FreeCAD. That overview, to date, does not exist. So do not expect anything to happen on this topic unless it is kicked off with creating an overview.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=59384 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Control of spin widget ticks<br />
|| New<br />
|| Different spin widgets have different tick-steps, some in preference, some hardcoded?<br />
|| Add functionality to alter tick-size on the fly. Think font size up/down but for decimal point location. Should be part of std toolbar and affect relevant widgets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=543849#p543849 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Standardized performance tests<br />
|| New<br />
|| Not present<br />
|| Create some scripts to test & record performance of different aspects over time.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70550 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=73306&sid=ba36fcfc368afe5c111cbeddbc78626c forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Editor preference<br />
|| Modify<br />
|| Current is tabs<br />
|| Change default to 4 spaces.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70620 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Selection<br />
|| Modify<br />
|| Improve selection behaviour<br />
|| a) do not deselect when ctrl is down<br />
b) instead of require “to be spot on” (within picking radius), i.e. preselection is active, one could select anything that is in closest proximity to the mouse click. Librecad does it this way, and it is very convenient.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=638582#p638582 forum thread]<br />
|| a) 0.21<br />
|-<br />
|0.20<br />
|| Box Selection<br />
|| Modify<br />
|| No preview highlight when using box selection.<br />
|| Add preview highlight for box selection.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| No icons on the buttons.<br />
|| Add icons for the buttons<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| There is a button to edit macro path, but no button to open “location” with native file explorer.<br />
|| Add button to open macro location in native file explorer.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| Button “Download” opens AddOnMgr<br />
|| Why not just have “AddOnManager” as button text?<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Std / Base / AddonMgr ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Py imports<br />
|| Modify<br />
|| New users used to python often struggle with imports in current fc.<br />
|| Make imports behave more like vanilla python. Could also be beneficial to start a breaking journey to make addons pip/conda installable, while at the same time impose full namespacing for py code.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=29584&start=40 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=67498&p=583438#p583438 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=43280 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folder missing from sys.path<br />
|| Modify<br />
|| Appears to be inconsistent behavior of adding the macro folder to sys.path.<br />
|| No matter location (including non-std user settings) importing from macro folder should work out of the box. (is this currently handled by packaging?)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=72293 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Cmd args<br />
|| Modify<br />
|| Running headless with arguments is a bit of an headache (think running a sphinx build)<br />
|| Make shell-runs behave more like vanilla python & a decent scheme for env-vars.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=67780 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Restart command<br />
|| New<br />
|| No file menu option to restart.<br />
|| A file menu option to restart.<br />
|| [https://wiki.freecadweb.org/Code_snippets#Close_and_restart_FreeCAD forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Measurement tool<br />
|| Modify / new<br />
|| Several different tools, part wb measure is the most comprehensive built in option.<br />
Addon options include FCInfo, Asm4 Measure, QuickMeasure, etc.<br />
|| A new application wide info tool located in inspection wb. Inspection wb should as well be able to compute area / volume of selected items (with its own icons)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=68243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=72643 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Category views<br />
|| Modify<br />
|| Addon manager shows a flat (long) view of macros / wb’s.<br />
|| Simplest is probably just an additional preset filter with category. Both macros and wb’s have a categorization already available, that should be possible to use in the addonmgr.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Internal rounding<br />
|| New<br />
|| One symptom is for example that placement all of a sudden is -0.00<br />
|| That there was a possibility to apply round to geometries in an easy way. Should work application wide, i.e. any new geometry is created with rounded values (no more 1.23456e-7 instead of 0) with user setting. Think this implies a sort of inspection round when geometry comes back from occ. Should also be possible to take for example a polyline and round those coordinates to a given decimal number, analogue for a shell/solid/mesh and its vertexes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| 3d-view coordsys<br />
|| Modify<br />
|| Cuts the right most letter (when in default) lower right location.<br />
|| Move zero of that coordsys slightly to left.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=463243#p463243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=63527 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Set edge colors<br />
|| New<br />
|| There is a dialogue for setting face colors.<br />
|| Expand that dialogue, or a new one, for edge & vertex colors.<br />
|| [https://wiki.freecadweb.org/Macro_Colorize forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Identifying versions when opening files.<br />
|| New<br />
|| Users are not informed when opening files created with earlier versions. Once the file is opened the earlier file is lost forever.<br />
|| Ask user if they want to save a back-up of the file before it is altered.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=496590#p496590 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Pip install through gui<br />
|| New<br />
|| Pip install is currently only by shell.<br />
|| Create a gui for correct installation of additional libs. Could be pip, conda, apt, etc based on existing install. If not actually running the command, at least it could produce a string to copy into shell, with info from which directory to run it from. Should be possible to do even for appimages.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=57023 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Arrow for direction<br />
|| New<br />
|| There is no visual indication of where a placement/attachment edit goes.<br />
|| Show an arrow indicating positive direction when user enters edit mode of such property, i.e when clicking for example z, an arrow will appear showing the positive direction an altered value will move the entity. Does not do much when everything is aligned to global xyz, but helps when coord sys are nested and individually rotated.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Creation / edit coordinates<br />
|| New<br />
|| When creating / editing draft objects the coordinate inputs are always tracking 3d-view mouse movements. This is unpractical if one just wants to enter coordinates, and happen to move the mouse in the 3d view.<br />
|| a) a reset button, so that all goes to zero<br />
b) checkbox for switching off tracking of 3d-view coordinates in input widgets.<br />
(implementation proposal in link)<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=503914#p503914 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Font for shapestring<br />
|| Modify<br />
|| Font must be given for something to render, user is not informed if font is missing. Meaning on a fresh install shapestring will most likely render nothing without notifying user.<br />
|| a) attempt to find font on os default locations, qt has current used font-family<br />
b) raise meaningful user info if nothing is rendered<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=509970#p509970 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Improved coordinate api<br />
|| Modify<br />
|| For example Vector is an iterable, whereas Vertex is not.<br />
|| a) all should be iterables out of the box<br />
b) vertex should have same py.__repr__ as vector<br />
c) vector could have a round method<br />
d) there could be a application wide setting for number of decimals to show in __repr__<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=63751 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folders<br />
|| Modify<br />
|| Today one and only one folder must be used for macros.<br />
|| a) allow for recursive folders in “user/Macro”<br />
b) allow to configure multiple folders<br />
c) new document object type that holds a path to a macro that runs if doc.obj is double-clicked.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform widget origin<br />
|| Modify<br />
|| Always show in placement coord.<br />
|| Make configurable to also show in for example shape cog.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=67159 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/issues/6588 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Dxf import<br />
|| New<br />
|| Dxf import is a constant and reoccurring source of forum posts showcasing different issues.<br />
|| Use ezdxf as base for dxf import, seems like parts of ezdxf can optionally be compiled for speed. In any case a pure python importer based on ezdxf appears to have ability to outpace current c-importer, so a pure python implementation to begin with focusing on coverage should be good enough.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=68444 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Group<br />
|| New<br />
|| The count of children in a group is only available through scripting.<br />
|| Show children count of a selected group in “status bar”. Could be valid for any other container object as well. Or the count could be part of the tool-tip when hoovering in the tree-view.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Selection view<br />
|| Modify<br />
|| No gui indication of total amount of selected objects.<br />
|| Add label at bottom of “selection view” with total amount of selected entities.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro execution<br />
|| New<br />
|| No meaningful way to stop execution of a macro other than killing the whole application.<br />
|| Introduce a way to break a running macro, corresponding to “ctrl-c” in a vanilla python session. Could be a short-cut of a gui-button.0<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro namespace<br />
|| New<br />
|| Macro variables not available in python console after execution.<br />
|| As final part of execution of a macro, variables should be transferred to python console namespace (do not know if there are any particular technical obstacles in implementing such feature, but it would be really nice to have).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Shape.BoundBox<br />
|| Modify<br />
|| In python, Shape.BoundBox appears to be a static snap-shot, i.e. it is not a reference to current data. A recompute does not reflect updated values, the Shape.BoundBox has to be reassigned to pick up current values.<br />
|| Modify the python version of Shape.BoundBox to reflect current values after a recompute.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Arch ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Cut-plane<br />
|| Bug<br />
|| Transparency and color of cut-plane is transferred to final solid.<br />
|| Object appearance should be unaffected by cut.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=628242#p628242 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Draft ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Move<br />
|| Modify<br />
|| If wanting to make for example 10 lines as transformed copies, when using draft/move and enabling “continue & copy” the dialogue still automatically closes when 2nd point is defined.<br />
|| Keep dialogue open for a new move. Additionally when in copy/continue mode, the 1st point can be skipped, it should be the 2nd point of the last move (with relative setting that is zero, but it would save one button press if there was no need to re-enter that)<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Chain select<br />
|| New<br />
|| Path wb has chain select, but it bugs out on for example a set of draft/lines.<br />
|| A chain select command in base wb’s (std/draft/part?) with option to a) chain connected b) chain tangent. Should also not break out of command when hitting a branch of edges, it should simply stay in selection mode and allow for selection of branch and thus continue the chain.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Dimension<br />
|| Modify<br />
|| When adding a dimension, the actual dimension is often way too small.<br />
|| First fontsize should be a portion of document bounding box. Rather than the application default, there should be a document default value, and once that is set, it stays – so no change in property as such, just how the first value is set in a document.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| Input widget for scale factor is not user friendly.<br />
a) try and enter a scale factor of 1.23 with a fresh install<br />
b) does not take expressions.<br />
|| Better handling of decimal entries and allow expressions in input widget.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Edit dialogue for wire/spline<br />
||<br />
|| Hard to discover how to add/remove points to wires & splines.<br />
If one edits wires in current versions, there is more clicks now than earlier, which matters a lot if you are cleaning files that have a large amount of points (read thousands...)<br />
|| a) bring back the buttons from v0.18 into the edit dialogue<br />
b) make a label widget explaining the procedure to add/remove points.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=57630&start=30 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| An arc cannot be scaled in draft without making a clone.<br />
|| Make it possible to scale arcs naively, should not be technically impossible, even with non-uniform scaling parameters (although it will change the type of entity irreversibly).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform<br />
|| New<br />
|| Part/transform widget does not work on draft objects.<br />
|| Adapt transform widget to work also for draft objects.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Spline 2 arc / dxf<br />
|| Bug<br />
|| See forum thread. An easy fix for someone working with git...<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=600132#p600132 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Draft/draftgeoutils/arcs.py#L135-L147 gh source]<br />
||<br />
|-<br />
| 0.20<br />
|| Split taskpanel<br />
|| Modify<br />
|| Esc does not exit task-panel.<br />
|| Make esc exit task panel in draft, it does on some draft taskpanels but not all. There are more than split, for example shapestring.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split / downgrade etc<br />
|| Modify<br />
|| When using a dividing function in draft, split, downgrade, etc. If the object is in a group the new objects end up in root.<br />
|| Dividing operations should respect the original object location (group/layer) and be created in that location.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Points removal from wires<br />
|| New<br />
|| Currently 3 clicks (and 2 hands) are required to remove a point from a wire. Alt needs to be pressed, the point needs to clicked, rmb needs to be clicked and “delete point” needs to be clicked in the context menu.<br />
|| Allow for box selection in the wire edit mode and have a button for deletion of points, or possibly context menu entry.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Svg export<br />
|| Modify<br />
|| A draft line, etc with a dash-dot decoration, exported to svg, imports as a solid line into inkscape.<br />
|| Respect line decorations in exports to svg.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| ShapeString<br />
|| Modify<br />
|| ShapeString does not allow for alternative aligning.<br />
|| Make aligning properties such as “right-align”, “center”, etc. the full capability would be NSEW or any combination of those with the additional centre option.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Sketcher ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Optional “missing coincidences check”<br />
|| New<br />
|| Not being able to extrude/pad due to missing coincidences in sketches is a constant and reoccurring source of forum posts.<br />
|| Auto check for missing coincidences when closing a sketch. Should be a preference to switch behaviour on/off. Should be on as default since the target audience is new users. That there are usecases for open vertexes should not affect this, deliberate open vertexes have little to do with missing coincidences. Could be made fancy and only raise the info dialogue if found and be silent if nothing is found.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Angle constraint<br />
|| New<br />
|| Support common angles, steps of 15.<br />
|| See forum thread<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70424 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Part ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Loft<br />
|| Modify<br />
|| Selection widget only allows to add profiles one by one.<br />
|| a) multi-select with ctrl-key down<br />
b) new buttons to “add all” / “remove all”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Undesired reset of colors<br />
|| Bug<br />
|| Color of shape resets to default without asking for it.<br />
|| To be fixed, description in forum post.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=68411 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Rework check geometry dialogue<br />
|| Modify<br />
|| See forum thread.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=34&t=70809 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Segfault sweep<br />
|| Bug<br />
|| Example file in forum post.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=70770 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Fuse behaviour on larger sets<br />
|| Modify<br />
|| Example in forum post.<br />
|| For operations where a list is passed, it appears that chunking the operation makes a noticable speed-up.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=73306 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Part Design ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Out of body message.<br />
|| Modify / new<br />
|| Cryptic error for new comers when trying to do operations on entities outside of the body.<br />
|| a) open a dialogue for selecting objects to move into the body.<br />
b) error message with suggestions for actions, rather than just stating what is wrong.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=55575 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Hole<br />
|| Modify<br />
|| Direction of hole is always same, occasionally leading to a hole initially not being made, this confuses users<br />
|| Add heuristics to apply a direction of the hole that is actually producing a cavity. Heuristics is only for best guess during creation. The “reverse” property should stay as a static property.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Mesh ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Merge close points<br />
|| New<br />
|| No built in way to merge close points on a mesh.<br />
|| Repair option to merge close points, with dialogue to set distance (in mm) for what qualifies as a close point. Returns a new mesh with valid topology.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Show / hide facets<br />
|| New<br />
|| Can show/hide complete meshes.<br />
|| Allow for selection of faces, and a graphical way to hide them along with a reset button. The hiding should be persistent, so that one can use other operations while hidden.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split facet<br />
|| New<br />
|| No obvious way to split facets.<br />
|| Select a facet, it is then split in 2 with the longest edge split at midpoint.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Move facet point<br />
|| New<br />
|| No gui for redefining a single facet point.<br />
|| Select a point in a mesh, snap to another existing point on another facet, not necessarily on same mesh, but always a mesh-object.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Mesh boolean icons<br />
|| Modify<br />
|| Think they are not disabled although fc cannot find a valid OpenSCad installation.<br />
|| Commands should be disabled if there is no valid OpenSCad installation on the machine. Maybe update the preference page with a button to check if there is a valid installation as well.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Add triangle<br />
|| Modify<br />
|| Pop-up menu today is “Add triangle / Flip normal / Clear”<br />
|| Suggest pop-up menu wording should be “Add triangle +N / Add triangle -N / Clear” or “Add +Normal / Add -Normal / Clear”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Extract facet<br />
|| New<br />
|| Multiple steps to be able to extract a couple of facets to faces.<br />
|| Command that allows selection of individual facets and upon “ok/apply” it creates part.faces from the selected facets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=510737#p510737 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Quad meshes<br />
|| New<br />
|| Handles exclusively trimeshes as of today<br />
|| Add support for pure quad meshes and mixed tri/quad meshes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| Modify<br />
|| Gui only allows for uniform scale.<br />
|| Allow non-uniform scaling via gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Py-api<br />
|| Modify<br />
|| Mesh.show does not return document object.<br />
|| Return the new document object when showing.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Points ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| New<br />
|| No native scaling command for point clouds.<br />
|| Add scaling command to points wb, and a method for scaling in the points obj.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== FEM ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Torque load<br />
|| New<br />
|| No built in way to correctly apply a torque load.<br />
|| Make a torque constraint object & gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=420008#p420008 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Use multicore<br />
|| Modify<br />
|| Appears that preference setting for multi-core is not effective.<br />
|| Fix in link...<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=519494#p519494 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Image ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Python api<br />
|| New<br />
|| Non existing<br />
|| Add py-api with image object. Creation of object either with path to image on disk or data as bytes.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=70504 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Wiki ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| Versioning / archiving<br />
|| New<br />
|| a) No agreed means to lock a version of the wiki. The crawler used to create the qt helpfiles is not a complete snap, it is a partial crawl.<br />
b) could use an “archived v.xyz” scheme as well<br />
|| A robuster way to secure legacy info on wiki.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Fixed ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Workbench'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
[[Category:Roadmap]] [[Category:Sandbox]]</div>Hedahttps://wiki.freecad.org/index.php?title=Sandbox:Wishlist&diff=1205450Sandbox:Wishlist2022-11-12T12:17:13Z<p>Heda: Created page with " == Introduction == This page is a wishlist of items that can improve the FreeCAD experience. Anyone is free to add / remove / modify items here, i.e. help in recording new..."</p>
<hr />
<div><br />
== Introduction ==<br />
<br />
This page is a wishlist of items that can improve the FreeCAD experience.<br />
<br />
<br />
Anyone is free to add / remove / modify items here, i.e. help in recording new ideas and keeping it decently up to date.<br />
The purpose of the wishlist is not to replace forum posts, bug reports or feature requests,<br />
but rather serve as an incomplete overview of identified improvement areas.<br />
<br />
The page is a complement to the [[Workarounds|Workarounds]] page, and less well maintained [[:Category:Roadmap|Roadmap Category]] on this Wiki.<br />
<br />
The page has 4 benefits:<br />
- people can scan the page to see if an idea of theirs is already noted down<br />
- minimal effort to capture an idea that is then possible to find back<br />
- works for people that are not present at gh<br />
- avoids ideas to fade to a less discoverable spot in the forum<br />
<br />
== Application wide ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Selection methods<br />
|| Modify<br />
|| There are multiple paradigms for how to select objects/entities for use with a command.<br />
|| More streamlined through the application. In order for that to happen, someone needs to make a detailed overview of how it works today for all corners of FreeCAD. That overview, to date, does not exist. So do not expect anything to happen on this topic unless it is kicked off with creating an overview.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=59384 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Control of spin widget ticks<br />
|| New<br />
|| Different spin widgets have different tick-steps, some in preference, some hardcoded?<br />
|| Add functionality to alter tick-size on the fly. Think font size up/down but for decimal point location. Should be part of std toolbar and affect relevant widgets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=543849#p543849 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Standardized performance tests<br />
|| New<br />
|| Not present<br />
|| Create some scripts to test & record performance of different aspects over time.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70550 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=73306&sid=ba36fcfc368afe5c111cbeddbc78626c forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Editor preference<br />
|| Modify<br />
|| Current is tabs<br />
|| Change default to 4 spaces.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70620 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Selection<br />
|| Modify<br />
|| Improve selection behaviour<br />
|| a) do not deselect when ctrl is down<br />
b) instead of require “to be spot on” (within picking radius), i.e. preselection is active, one could select anything that is in closest proximity to the mouse click. Librecad does it this way, and it is very convenient.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=638582#p638582 forum thread]<br />
|| a) 0.21<br />
|-<br />
|0.20<br />
|| Box Selection<br />
|| Modify<br />
|| No preview highlight when using box selection.<br />
|| Add preview highlight for box selection.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| No icons on the buttons.<br />
|| Add icons for the buttons<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| There is a button to edit macro path, but no button to open “location” with native file explorer.<br />
|| Add button to open macro location in native file explorer.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro dialogue<br />
|| Modify<br />
|| Button “Download” opens AddOnMgr<br />
|| Why not just have “AddOnManager” as button text?<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Std / Base / AddonMgr ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Py imports<br />
|| Modify<br />
|| New users used to python often struggle with imports in current fc.<br />
|| Make imports behave more like vanilla python. Could also be beneficial to start a breaking journey to make addons pip/conda installable, while at the same time impose full namespacing for py code.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=29584&start=40 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=67498&p=583438#p583438 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=43280 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folder missing from sys.path<br />
|| Modify<br />
|| Appears to be inconsistent behavior of adding the macro folder to sys.path.<br />
|| No matter location (including non-std user settings) importing from macro folder should work out of the box. (is this currently handled by packaging?)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=72293 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Cmd args<br />
|| Modify<br />
|| Running headless with arguments is a bit of an headache (think running a sphinx build)<br />
|| Make shell-runs behave more like vanilla python & a decent scheme for env-vars.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=67780 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Restart command<br />
|| New<br />
|| No file menu option to restart.<br />
|| A file menu option to restart.<br />
|| [https://wiki.freecadweb.org/Code_snippets#Close_and_restart_FreeCAD forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Measurement tool<br />
|| Modify / new<br />
|| Several different tools, part wb measure is the most comprehensive built in option.<br />
Addon options include FCInfo, Asm4 Measure, QuickMeasure, etc.<br />
|| A new application wide info tool located in inspection wb. Inspection wb should as well be able to compute area / volume of selected items (with its own icons)<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=68243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=22&t=72643 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Category views<br />
|| Modify<br />
|| Addon manager shows a flat (long) view of macros / wb’s.<br />
|| Simplest is probably just an additional preset filter with category. Both macros and wb’s have a categorization already available, that should be possible to use in the addonmgr.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Internal rounding<br />
|| New<br />
|| One symptom is for example that placement all of a sudden is -0.00<br />
|| That there was a possibility to apply round to geometries in an easy way. Should work application wide, i.e. any new geometry is created with rounded values (no more 1.23456e-7 instead of 0) with user setting. Think this implies a sort of inspection round when geometry comes back from occ. Should also be possible to take for example a polyline and round those coordinates to a given decimal number, analogue for a shell/solid/mesh and its vertexes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| 3d-view coordsys<br />
|| Modify<br />
|| Cuts the right most letter (when in default) lower right location.<br />
|| Move zero of that coordsys slightly to left.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=463243#p463243 forum thread]<br />
[https://forum.freecadweb.org/viewtopic.php?f=10&t=63527 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Set edge colors<br />
|| New<br />
|| There is a dialogue for setting face colors.<br />
|| Expand that dialogue, or a new one, for edge & vertex colors.<br />
|| [https://wiki.freecadweb.org/Macro_Colorize forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Identifying versions when opening files.<br />
|| New<br />
|| Users are not informed when opening files created with earlier versions. Once the file is opened the earlier file is lost forever.<br />
|| Ask user if they want to save a back-up of the file before it is altered.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=496590#p496590 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Pip install through gui<br />
|| New<br />
|| Pip install is currently only by shell.<br />
|| Create a gui for correct installation of additional libs. Could be pip, conda, apt, etc based on existing install. If not actually running the command, at least it could produce a string to copy into shell, with info from which directory to run it from. Should be possible to do even for appimages.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=57023 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Arrow for direction<br />
|| New<br />
|| There is no visual indication of where a placement/attachment edit goes.<br />
|| Show an arrow indicating positive direction when user enters edit mode of such property, i.e when clicking for example z, an arrow will appear showing the positive direction an altered value will move the entity. Does not do much when everything is aligned to global xyz, but helps when coord sys are nested and individually rotated.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Creation / edit coordinates<br />
|| New<br />
|| When creating / editing draft objects the coordinate inputs are always tracking 3d-view mouse movements. This is unpractical if one just wants to enter coordinates, and happen to move the mouse in the 3d view.<br />
|| a) a reset button, so that all goes to zero<br />
b) checkbox for switching off tracking of 3d-view coordinates in input widgets.<br />
(implementation proposal in link)<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=503914#p503914 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Font for shapestring<br />
|| Modify<br />
|| Font must be given for something to render, user is not informed if font is missing. Meaning on a fresh install shapestring will most likely render nothing without notifying user.<br />
|| a) attempt to find font on os default locations, qt has current used font-family<br />
b) raise meaningful user info if nothing is rendered<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=509970#p509970 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Improved coordinate api<br />
|| Modify<br />
|| For example Vector is an iterable, whereas Vertex is not.<br />
|| a) all should be iterables out of the box<br />
b) vertex should have same py.__repr__ as vector<br />
c) vector could have a round method<br />
d) there could be a application wide setting for number of decimals to show in __repr__<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=63751 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Macro folders<br />
|| Modify<br />
|| Today one and only one folder must be used for macros.<br />
|| a) allow for recursive folders in “user/Macro”<br />
b) allow to configure multiple folders<br />
c) new document object type that holds a path to a macro that runs if doc.obj is double-clicked.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform widget origin<br />
|| Modify<br />
|| Always show in placement coord.<br />
|| Make configurable to also show in for example shape cog.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=67159 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/issues/6588 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Dxf import<br />
|| New<br />
|| Dxf import is a constant and reoccurring source of forum posts showcasing different issues.<br />
|| Use ezdxf as base for dxf import, seems like parts of ezdxf can optionally be compiled for speed. In any case a pure python importer based on ezdxf appears to have ability to outpace current c-importer, so a pure python implementation to begin with focusing on coverage should be good enough.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=68444 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Group<br />
|| New<br />
|| The count of children in a group is only available through scripting.<br />
|| Show children count of a selected group in “status bar”. Could be valid for any other container object as well. Or the count could be part of the tool-tip when hoovering in the tree-view.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Selection view<br />
|| Modify<br />
|| No gui indication of total amount of selected objects.<br />
|| Add label at bottom of “selection view” with total amount of selected entities.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro execution<br />
|| New<br />
|| No meaningful way to stop execution of a macro other than killing the whole application.<br />
|| Introduce a way to break a running macro, corresponding to “ctrl-c” in a vanilla python session. Could be a short-cut of a gui-button.0<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Macro namespace<br />
|| New<br />
|| Macro variables not available in python console after execution.<br />
|| As final part of execution of a macro, variables should be transferred to python console namespace (do not know if there are any particular technical obstacles in implementing such feature, but it would be really nice to have).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Shape.BoundBox<br />
|| Modify<br />
|| In python, Shape.BoundBox appears to be a static snap-shot, i.e. it is not a reference to current data. A recompute does not reflect updated values, the Shape.BoundBox has to be reassigned to pick up current values.<br />
|| Modify the python version of Shape.BoundBox to reflect current values after a recompute.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Arch ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Cut-plane<br />
|| Bug<br />
|| Transparency and color of cut-plane is transferred to final solid.<br />
|| Object appearance should be unaffected by cut.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=628242#p628242 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Draft ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Move<br />
|| Modify<br />
|| If wanting to make for example 10 lines as transformed copies, when using draft/move and enabling “continue & copy” the dialogue still automatically closes when 2nd point is defined.<br />
|| Keep dialogue open for a new move. Additionally when in copy/continue mode, the 1st point can be skipped, it should be the 2nd point of the last move (with relative setting that is zero, but it would save one button press if there was no need to re-enter that)<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Chain select<br />
|| New<br />
|| Path wb has chain select, but it bugs out on for example a set of draft/lines.<br />
|| A chain select command in base wb’s (std/draft/part?) with option to a) chain connected b) chain tangent. Should also not break out of command when hitting a branch of edges, it should simply stay in selection mode and allow for selection of branch and thus continue the chain.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Dimension<br />
|| Modify<br />
|| When adding a dimension, the actual dimension is often way too small.<br />
|| First fontsize should be a portion of document bounding box. Rather than the application default, there should be a document default value, and once that is set, it stays – so no change in property as such, just how the first value is set in a document.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| Input widget for scale factor is not user friendly.<br />
a) try and enter a scale factor of 1.23 with a fresh install<br />
b) does not take expressions.<br />
|| Better handling of decimal entries and allow expressions in input widget.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Edit dialogue for wire/spline<br />
||<br />
|| Hard to discover how to add/remove points to wires & splines.<br />
If one edits wires in current versions, there is more clicks now than earlier, which matters a lot if you are cleaning files that have a large amount of points (read thousands...)<br />
|| a) bring back the buttons from v0.18 into the edit dialogue<br />
b) make a label widget explaining the procedure to add/remove points.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=57630&start=30 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Scale<br />
|| Modify<br />
|| An arc cannot be scaled in draft without making a clone.<br />
|| Make it possible to scale arcs naively, should not be technically impossible, even with non-uniform scaling parameters (although it will change the type of entity irreversibly).<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Transform<br />
|| New<br />
|| Part/transform widget does not work on draft objects.<br />
|| Adapt transform widget to work also for draft objects.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Spline 2 arc / dxf<br />
|| Bug<br />
|| See forum thread. An easy fix for someone working with git...<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=600132#p600132 forum thread]<br />
[https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Draft/draftgeoutils/arcs.py#L135-L147 gh source]<br />
||<br />
|-<br />
| 0.20<br />
|| Split taskpanel<br />
|| Modify<br />
|| Esc does not exit task-panel.<br />
|| Make esc exit task panel in draft, it does on some draft taskpanels but not all. There are more than split, for example shapestring.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split / downgrade etc<br />
|| Modify<br />
|| When using a dividing function in draft, split, downgrade, etc. If the object is in a group the new objects end up in root.<br />
|| Dividing operations should respect the original object location (group/layer) and be created in that location.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Points removal from wires<br />
|| New<br />
|| Currently 3 clicks (and 2 hands) are required to remove a point from a wire. Alt needs to be pressed, the point needs to clicked, rmb needs to be clicked and “delete point” needs to be clicked in the context menu.<br />
|| Allow for box selection in the wire edit mode and have a button for deletion of points, or possibly context menu entry.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Svg export<br />
|| Modify<br />
|| A draft line, etc with a dash-dot decoration, exported to svg, imports as a solid line into inkscape.<br />
|| Respect line decorations in exports to svg.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| ShapeString<br />
|| Modify<br />
|| ShapeString does not allow for alternative aligning.<br />
|| Make aligning properties such as “right-align”, “center”, etc. the full capability would be NSEW or any combination of those with the additional centre option.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Sketcher ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Optional “missing coincidences check”<br />
|| New<br />
|| Not being able to extrude/pad due to missing coincidences in sketches is a constant and reoccurring source of forum posts.<br />
|| Auto check for missing coincidences when closing a sketch. Should be a preference to switch behaviour on/off. Should be on as default since the target audience is new users. That there are usecases for open vertexes should not affect this, deliberate open vertexes have little to do with missing coincidences. Could be made fancy and only raise the info dialogue if found and be silent if nothing is found.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Angle constraint<br />
|| New<br />
|| Support common angles, steps of 15.<br />
|| See forum thread<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=8&t=70424 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Part ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Loft<br />
|| Modify<br />
|| Selection widget only allows to add profiles one by one.<br />
|| a) multi-select with ctrl-key down<br />
b) new buttons to “add all” / “remove all”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Undesired reset of colors<br />
|| Bug<br />
|| Color of shape resets to default without asking for it.<br />
|| To be fixed, description in forum post.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=68411 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Rework check geometry dialogue<br />
|| Modify<br />
|| See forum thread.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=34&t=70809 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Segfault sweep<br />
|| Bug<br />
|| Example file in forum post.<br />
||<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=70770 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Fuse behaviour on larger sets<br />
|| Modify<br />
|| Example in forum post.<br />
|| For operations where a list is passed, it appears that chunking the operation makes a noticable speed-up.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=73306 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Part Design ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Out of body message.<br />
|| Modify / new<br />
|| Cryptic error for new comers when trying to do operations on entities outside of the body.<br />
|| a) open a dialogue for selecting objects to move into the body.<br />
b) error message with suggestions for actions, rather than just stating what is wrong.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=55575 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Hole<br />
|| Modify<br />
|| Direction of hole is always same, occasionally leading to a hole initially not being made, this confuses users<br />
|| Add heuristics to apply a direction of the hole that is actually producing a cavity. Heuristics is only for best guess during creation. The “reverse” property should stay as a static property.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Mesh ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Merge close points<br />
|| New<br />
|| No built in way to merge close points on a mesh.<br />
|| Repair option to merge close points, with dialogue to set distance (in mm) for what qualifies as a close point. Returns a new mesh with valid topology.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Show / hide facets<br />
|| New<br />
|| Can show/hide complete meshes.<br />
|| Allow for selection of faces, and a graphical way to hide them along with a reset button. The hiding should be persistent, so that one can use other operations while hidden.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Split facet<br />
|| New<br />
|| No obvious way to split facets.<br />
|| Select a facet, it is then split in 2 with the longest edge split at midpoint.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Move facet point<br />
|| New<br />
|| No gui for redefining a single facet point.<br />
|| Select a point in a mesh, snap to another existing point on another facet, not necessarily on same mesh, but always a mesh-object.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Mesh boolean icons<br />
|| Modify<br />
|| Think they are not disabled although fc cannot find a valid OpenSCad installation.<br />
|| Commands should be disabled if there is no valid OpenSCad installation on the machine. Maybe update the preference page with a button to check if there is a valid installation as well.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Add triangle<br />
|| Modify<br />
|| Pop-up menu today is “Add triangle / Flip normal / Clear”<br />
|| Suggest pop-up menu wording should be “Add triangle +N / Add triangle -N / Clear” or “Add +Normal / Add -Normal / Clear”<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Extract facet<br />
|| New<br />
|| Multiple steps to be able to extract a couple of facets to faces.<br />
|| Command that allows selection of individual facets and upon “ok/apply” it creates part.faces from the selected facets.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=510737#p510737 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Quad meshes<br />
|| New<br />
|| Handles exclusively trimeshes as of today<br />
|| Add support for pure quad meshes and mixed tri/quad meshes.<br />
||<br />
||<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| Modify<br />
|| Gui only allows for uniform scale.<br />
|| Allow non-uniform scaling via gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Py-api<br />
|| Modify<br />
|| Mesh.show does not return document object.<br />
|| Return the new document object when showing.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=10&t=70713&p=614405#p614405 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Points ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Scaling<br />
|| New<br />
|| No native scaling command for point clouds.<br />
|| Add scaling command to points wb, and a method for scaling in the points obj.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=3&t=66091 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== FEM ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Torque load<br />
|| New<br />
|| No built in way to correctly apply a torque load.<br />
|| Make a torque constraint object & gui.<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=420008#p420008 forum thread]<br />
||<br />
|-<br />
| 0.20<br />
|| Use multicore<br />
|| Modify<br />
|| Appears that preference setting for multi-core is not effective.<br />
|| Fix in link...<br />
|| [https://forum.freecadweb.org/viewtopic.php?p=519494#p519494 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Image ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| 0.20<br />
|| Python api<br />
|| New<br />
|| Non existing<br />
|| Add py-api with image object. Creation of object either with path to image on disk or data as bytes.<br />
|| [https://forum.freecadweb.org/viewtopic.php?f=22&t=70504 forum thread]<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Wiki ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Ver.'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| Versioning / archiving<br />
|| New<br />
|| a) No agreed means to lock a version of the wiki. The crawler used to create the qt helpfiles is not a complete snap, it is a partial crawl.<br />
b) could use an “archived v.xyz” scheme as well<br />
|| A robuster way to secure legacy info on wiki.<br />
||<br />
||<br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
== Fixed ==<br />
<br />
<div class="mw-collapsible mw-collapsed toccolours"><br />
<div class="mw-collapsible-content"><br />
{| class="wikitable" style="text-align: left;"<br />
|+ <!-- caption --><br />
|-<br />
| '''Workbench'''<br />
|| '''Item'''<br />
|| '''Type'''<br />
|| '''Current'''<br />
|| '''Wish'''<br />
|| '''Additional'''<br />
|| '''Fixed in'''<br />
|-<br />
| -<br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|| <br />
|}<br />
</div></div><br />
{{Top}}<br />
<br />
<br />
[[Category:Roadmap]] [[Category:Sandbox]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Z_Height_Map&diff=1177334Macro Z Height Map2022-08-28T15:08:47Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<br />
{{Macro<br />
|Name=Z_height_map<br />
|Description=Makes a grayscale heightmap in z.<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-08-28<br />
|FCVersion=-<br />
}}<br />
<br />
==Description==<br />
<br />
[[File:Macro zheightmap fig.png]]<br />
<br />
Makes the grayscale height map for all visible root objects with a volume<br />
from the active document.<br />
<br />
No gui, options can be set in macro-file.<br />
<br />
Image file saved with document name.<br />
<br />
<br />
==Usage==<br />
<br />
Run macro with a document open.<br />
<br />
==Install==<br />
<br />
Through Addon manager.<br />
<br />
==Link==<br />
<br />
Forum: No dedicated thread, but sprung out of [https://forum.freecadweb.org/viewtopic.php?f=3&t=71247 forum post].<br />
<br />
==Version==<br />
<br />
v0.1 2022-08-28 : first release<br />
<br />
==Code==<br />
<br />
</translate><br />
'''Macro_Z_height_map.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Z_height_map'<br />
__Comment__ = 'Makes a grayscale heightmap in z'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-08-28'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Z_height_map'<br />
__Icon__ = ''<br />
__Help__ = 'Run macro and heightmap is created.'<br />
__Status__ = 'Stable'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = 'forum'<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
Makes the grayscale height map for all visible root objects with a volume<br />
from the active document.<br />
<br />
No gui, options can be set in macro-file.<br />
<br />
png file saved with document name.<br />
"""<br />
<br />
import numpy as np<br />
import matplotlib.pyplot as plt<br />
from PIL import Image<br />
<br />
pxpmm = 1 # pixels per mm<br />
# adjust pxpmm up/down if there are bands in the heightmap<br />
pad = 2<br />
grayscale_compress = 0.1 # range 0 - 1<br />
invert = False # grayscale, high is white with False<br />
<br />
IMSHOW = True<br />
IMSAVE = True<br />
IMRESIZE = False # only saved pil-image, quicker than increase of pxpmm<br />
imwidth = 500 # resizing does give artefacts, can change interpolation...<br />
<br />
doc = App.ActiveDocument<br />
<br />
shapes = list()<br />
for obj in doc.Objects:<br />
if hasattr(obj, 'Shape'):<br />
if hasattr(obj.Shape, 'Volume'):<br />
if obj.Shape.Volume > 0:<br />
if obj.ViewObject.Visibility:<br />
shapes.append(obj.Shape)<br />
<br />
xmin, ymin, zmin = (min((getattr(shp.BoundBox, f'{which}Min')<br />
for shp in shapes)) for which in 'XYZ')<br />
xmax, ymax, zmax = (max((getattr(shp.BoundBox, f'{which}Max')<br />
for shp in shapes)) for which in 'XYZ')<br />
<br />
xspan, yspan, zspan = xmax - xmin, ymax - ymin, zmax - zmin<br />
w, h = (int(span * pxpmm) for span in (xspan, yspan))<br />
pic = np.zeros((w + 1, h + 1, len(shapes)))<br />
<br />
print('w x h --> {} x {}'.format(w, h))<br />
print('working on pixels, might take a while...')<br />
<br />
for i, shape in enumerate(shapes):<br />
pv = shape.getPoints(1/pxpmm)<br />
zpoints = (p for p, v in zip(*pv) if v.z > 0)<br />
for zpoint in zpoints:<br />
x = round((zpoint.x - xmin) / xspan * w)<br />
y = round((zpoint.y - ymin) / yspan * h)<br />
pic[x, y, i] = zpoint.z<br />
<br />
print('pic loop done')<br />
<br />
pic = (pic.max(axis=2) - zmin) / zspan<br />
im = np.zeros((w + 1 + 2 * pad, h + 1 + 2 * pad))<br />
pic = (1 - grayscale_compress) * pic + grayscale_compress<br />
im[pad:pad + w + 1, pad:pad + h + 1] = pic<br />
im = (im.T * 255).astype(np.uint8)<br />
h, w = im.shape<br />
<br />
if invert:<br />
im = 255 - im<br />
print('grayscale inverted')<br />
<br />
if IMSHOW:<br />
plt.imshow(im, cmap='gray', interpolation='none')<br />
plt.grid(color='r')<br />
plt.show()<br />
<br />
if IMSAVE:<br />
with Image.fromarray(im, mode='L') as pim:<br />
if IMRESIZE:<br />
pim = pim.resize((imwidth, int(h * imwidth / w)),<br />
Image.Resampling.LANCZOS)<br />
print('resized to:', pim.size)<br />
pim.save('{}.png'.format(doc.Name), mode='L')<br />
<br />
print('height map done')<br />
}}<br />
<br />
[[Category:File_Formats{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Toothbrush_Head_Stand&diff=1177333Toothbrush Head Stand2022-08-28T14:47:43Z<p>Heda: fix redlinked icon</p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{TutorialInfo|Topic=Modeling|Level=Beginner|Author=[[User:EmmanuelG|EmmanuelG]]|Time=1 hour|FCVersion=0.16 or greater|Files=[https://www.thingiverse.com/thing:2403310 Thingiverse 2403310]}}<br />
<br />
== A daily-life problem == <!--T:2--><br />
<br />
<!--T:3--><br />
Electric toothbrushes rarely come with a head stand, while in a family you will often see multiple heads used with one body. Many people facing a common problem lead us to a variety of solutions, as you can see on Thingiverse (200-800 projects are related to that). Here is the first answer and how to design it.<br />
<br />
<!--T:4--><br />
This tutorial will take you through the steps needed to model the part shown in the image below using basic tools from the [[PartDesign Workbench|Part Design Workbench]] (many of the tools and capabilities are not covered).<br />
<br />
</translate><br />
[[Image:TBHS-model.png|center]]<br />
<translate><br />
<br />
== First idea : a plate == <!--T:5--><br />
*From the start-page, select [[Image:Workbench_PartDesign.svg]] ''Part Design'', or create a new document and select the ''Part Design'' workbench.<br />
[[Image:TBHS-0.png|center]]<br />
<br />
=== Create a sketch === <!--T:6--><br />
*Click on [[Image:Sketcher_NewSketch.svg|32px]] [[Sketcher_NewSketch|'''New sketch''']]. Either from the contextual task menu at the left, or the toolbar above or from the Part Design menu at the top.<br />
[[File:TBHS-1.JPG|800px|center]]<br />
<br />
<br />
<!--T:7--><br />
A dialog prompts you to choose the sketch orientation and provide an offset.<br />
<br />
<!--T:8--><br />
*We will pick the XY Plane as shown in the image above (that orientation correspond to the common build plate of most 3D printers), then click OK.<br />
<br />
<!--T:9--><br />
[[File:TBHS-2.JPG|800px|center]]<br />
<br />
<br />
<!--T:10--><br />
You now are facing the XY plane from above, and have access to the drawing tools.<br />
<br />
<!--T:11--><br />
* Click on [[File:Sketcher_CreateRectangle.svg|32px]] [[Sketcher_CreateRectangle|'''Rectangle''']].<br />
* Click to place a first point.<br />
* Click to place the opposite corner.<br />
* Press {{KEY|ESC}} or click the right mouse button to stop using the tool.<br />
<br />
<!--T:12--><br />
[[File:TBHS-3.JPG|800px|center]]<br />
<br />
<br />
<!--T:13--><br />
You now have a floating rectangle of unspecified dimensions.<br />
<br />
<!--T:14--><br />
* Click on a line of the rectangle, you now have access to the constraint tools at the right of the toolbar (depending of the size of your screen you may need to drag them to the left in order to see them all)<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 80mm, click OK.<br />
* Repeat with the other side of the rectangle, also 80mm.<br />
<br />
<!--T:15--><br />
[[File:TBHS-4.JPG|800px|center]]<br />
<br />
<br />
<!--T:16--><br />
You now have a floating square.<br />
<br />
<!--T:17--><br />
* Click on the lower left point of the square.<br />
* Click on the origin of the XY plane (at the intersection of the two thick lines).<br />
* Click on [[File:Constraint_PointOnPoint.svg|32px]] [[Sketcher ConstrainCoincident |'''Coincident''']].<br />
<br />
<!--T:18--><br />
[[File:TBHS-5.JPG|800px|center]]<br />
<br />
<br />
<!--T:19--><br />
You now have a totally constrained sketch, as you are told by the solver on the left and the change of color.<br />
It is a good practice to always have a totally constrained sketch.<br />
<br />
<!--T:20--><br />
An under-constrained sketch can leave room for unwanted change, if you modify something later on.<br />
On the opposite, an over-constrained sketch is also not good. In that case the solver warn you of redundant constraints and you should remove some of them.<br />
<br />
<!--T:21--><br />
* To leave the sketch, click either on the "Close" button on the left, or the [[File:Sketcher_LeaveSketch.png|32px]] icon in the toolbar, or press {{KEY|ESC}}.<br />
<br />
<!--T:22--><br />
[[File:TBHS-6.JPG|800px|center]]<br />
<br />
<br />
<!--T:23--><br />
You now only see the square, and the contextual task menu on the left show you more options than before.<br />
<br />
=== Create a pad === <!--T:24--><br />
* Click on [[Image:View-axometric.svg|32px]] '''Axonometric''' among the standard views, to better see what will happen.<br />
* Click on [[File:PartDesign_Pad.svg|32px]] '''Pad'''.<br />
* Enter 4mm and click OK.<br />
<br />
<!--T:25--><br />
[[File:TBHS-7.JPG|800px|center]]<br />
<br />
<br />
<!--T:26--><br />
Your sketch is now in volume !<br />
<br />
=== Create a sketch on it === <!--T:27--><br />
* Select the upper face<br />
<br />
<!--T:28--><br />
[[File:TBHS-8.JPG|800px|center]]<br />
<br />
<br />
<!--T:29--><br />
The color of the face change and you have more options in the contextual task menu.<br />
<br />
<!--T:30--><br />
* Click on [[Image:Sketcher_NewSketch.svg|32px]] '''New sketch'''. As a face was selected it will not ask you to choose a plane.<br />
<br />
<!--T:31--><br />
[[File:TBHS-9.JPG|800px|center]]<br />
<br />
<br />
<!--T:32--><br />
* Click on [[File:Sketcher_Circle.svg|32px]] [[Sketcher_CreateCircle|'''Circle''']], click to place the center, move the pointer and click to define the radius.<br />
* Draw 4 circles on the pad (of any size)<br />
* Press {{KEY|ESC}} or click the right mouse button to stop using the tool.<br />
<br />
<!--T:33--><br />
[[File:TBHS-10.JPG|800px|center]]<br />
<br />
<br />
<!--T:34--><br />
* Select the circles<br />
* Click on [[File:Constraint_EqualLength.png|32px]] [[Sketcher ConstrainEqual|'''Equal Length''']]<br />
<br />
<!--T:35--><br />
[[File:TBHS-11.JPG|800px|center]]<br />
<br />
<br />
<!--T:36--><br />
Now the circles share the same radius.<br />
<br />
<!--T:37--><br />
* Click on [[File:Sketcher_External.svg|32px]] [[Sketcher_External|'''External geometry''']].<br />
* Click on the four sides of the square, it add lines, color magenta.<br />
<br />
<!--T:38--><br />
[[File:TBHS-12.JPG|800px|center]]<br />
<br />
<br />
<!--T:39--><br />
Theses lines will serve as reference to position the circles.<br />
<br />
<!--T:40--><br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']].<br />
* Click on a center of a circle.<br />
* Click on a magenta line.<br />
* Set distance (20mm from each side).<br />
<br />
<!--T:41--><br />
[[File:TBHS-13.JPG|800px|center]]<br />
<br />
<br />
<!--T:42--><br />
* Click on a circle<br />
* Click on [[File:Sketcher_ConstrainRadius.svg|32px]] [[Sketcher ConstrainRadius|'''Radius''']] and set it at 1,5mm.<br />
<br />
<!--T:43--><br />
[[File:TBHS-14.JPG|800px|center]]<br />
<br />
<br />
<!--T:44--><br />
* To leave the sketch, click either on the "Close" button on the left, or the [[File:Sketcher_LeaveSketch.png|32px]] icon in the toolbar, or press {{KEY|ESC}}.<br />
<br />
<!--T:45--><br />
[[File:TBHS-15.JPG|800px|center]]<br />
<br />
=== Create a pad=== <!--T:46--><br />
* Click on [[Image:View-axometric.svg|32px]] '''Axonometric''' among the standard views, to better see what will happen.<br />
* Click on [[File:PartDesign_Pad.svg|32px]] '''Pad'''.<br />
* Enter 25mm and click OK.<br />
<br />
<!--T:47--><br />
[[File:TBHS-16.JPG|800px|center]]<br />
<br />
<br />
<!--T:48--><br />
You have the basic shape, it just need final touches.<br />
<br />
=== Rounding the corners === <!--T:49--><br />
* Holding {{KEY|CTRL}} click on the vertical edge at each corner to select the four of them.<br />
<br />
<!--T:50--><br />
Don't hesitate to help you by switching the display mode (just at the left of the Axonometric View) between [[File:DrawStyleWireFrame.svg|32px]] '''Wireframe''' and [[File:DrawStyleFlatLines.svg|32px]] '''Wireframe and shadow'''.<br />
<br />
<!--T:51--><br />
[[File:TBHS-17.JPG|800px|center]]<br />
<br />
<br />
<!--T:52--><br />
* Click on [[File:PartDesign_Fillet.svg|32px]] [[PartDesign_Fillet|'''Fillet''']].<br />
* Set the radius at 20mm.<br />
<br />
<!--T:53--><br />
[[File:TBHS-18.JPG|800px|center]]<br />
<br />
<br />
<!--T:54--><br />
Much better.<br />
<br />
=== Making it more robust === <!--T:55--><br />
We need to add material at the base of the cylinders to make them less prone to snap. Because of the printing orientation these small surfaces will be fragile at the junction with the base.<br />
<br />
<!--T:56--><br />
* Select the circles at the base of the cylinders<br />
<br />
<!--T:57--><br />
[[File:TBHS-19.JPG|800px|center]]<br />
<br />
<br />
<!--T:58--><br />
* Click on [[File:PartDesign_Chamfer.svg|32px]] [[PartDesign_Chamfer|'''Chamfer''']].<br />
* Set it to 2mm.<br />
<br />
<!--T:59--><br />
[[File:TBHS-20.JPG|800px|center]]<br />
<br />
=== Chamfer the edges === <!--T:60--><br />
* Select the face under the base, add a [[File:PartDesign_Chamfer.svg|32px]] '''Chamfer''' of 0,5mm.<br />
<br />
<!--T:61--><br />
The first layer of plastic is often being squashed a little too much, this will compensate that and save you time in cleaning the model. If the first layer is ok that will make it only nicer<br />
<br />
<!--T:62--><br />
[[File:TBHS-21.JPG|800px|center]]<br />
<br />
<br />
<!--T:63--><br />
* Select the edges at the border of the upper face (holding {{KEY|CTRL}} ).<br />
<br />
<!--T:64--><br />
[[File:TBHS-23.JPG|800px|center]]<br />
<br />
<br />
<!--T:65--><br />
* Add a [[File:PartDesign_Chamfer.svg|32px]] '''Chamfer''' of 1mm. This one is only aesthetic.<br />
<br />
<!--T:66--><br />
[[File:TBHS-22.JPG|800px|center]]<br />
<br />
<br />
<!--T:67--><br />
Tadaa !<br />
<br />
== Export as a .STL == <!--T:68--><br />
* In the Combo View on the left, select the tree view instead of the contextual task menu, click on the last feature (the chamfer).<br />
<br />
<!--T:69--><br />
[[File:TBHS-24.JPG|800px|center]]<br />
<br />
<br />
<!--T:70--><br />
* Now you can select "Export..." from the File menu at the top left, and select the file format .STL.<br />
* Just print it :-)<br />
<br />
== Inspiration == <!--T:71--><br />
The above model make a good starting point to use FreeCAD, but as a toothbrush head stand it have its flaws : due to the print orientation and small surface the sticks are prone to break.<br />
<br />
<!--T:72--><br />
Inspired by the variety of solutions other people came up with, we will make this second version which will be much better.<br />
<br />
<!--T:73--><br />
[[File:TBHS-v2.jpg|800px|center]]<br />
<br />
<br />
<!--T:74--><br />
Don't worry it is often needed to go through several revision for an idea (e.g. : once the prototype on the picture was used, we added more space between the heads so that they should not touch).<br />
<br />
<!--T:75--><br />
In this second part you will also learn to use more tools, like the powerful ''Linear repetition''.<br />
<br />
== Second idea : a band == <!--T:76--><br />
<br />
<!--T:77--><br />
*Create a new document and select the [[Image:Workbench_PartDesign.svg]] ''Part Design'' workbench.<br />
<br />
=== Create a sketch === <!--T:78--><br />
<br />
<!--T:79--><br />
*Create a [[Image:Sketcher_NewSketch.svg|32px]] '''New sketch''', on the XY plane.<br />
[[File:TBHS-1.JPG|800px|center]]<br />
<br />
<br />
<!--T:80--><br />
*Draw a [[Image:Sketcher_CreateSlot.svg|32px]] [[Sketcher_CreateSlot|'''Slot''']]<br />
**Click to place the first center<br />
**Move to define the length and radius<br />
**Click to set the second center.<br />
[[File:TBHS2-1.JPG|800px|center]]<br />
<br />
<br />
<!--T:81--><br />
You now have a floating slot of unspecified dimensions.<br />
<br />
<!--T:82--><br />
* Click on one of the horizontal lines of the slot<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 75mm, click OK.<br />
** that's for a 3 head stand, count 25mm for each, if you want more<br />
[[File:TBHS2-2.JPG|800px|center]]<br />
<br />
<br />
<!--T:83--><br />
* Click on one point of the horizontal line<br />
* Click on one point of the other horizontal line<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 29mm, click OK.<br />
[[File:TBHS2-3.JPG|800px|center]]<br />
<br />
<br />
<!--T:84--><br />
*Draw a [[Image:Sketcher_CreateSlot.svg|32px]] [[Sketcher_CreateSlot|'''Slot''']] around the first slot.<br />
[[File:TBHS2-4.JPG|800px|center]]<br />
<br />
<br />
<!--T:85--><br />
*Make the centers of the second slot coincident with the centers of the first slot with [[File:Constraint_PointOnPoint.svg|32px]] [[Sketcher ConstrainCoincident |'''Coincident''']].<br />
[[File:TBHS2-5.JPG|800px|center]]<br />
<br />
<br />
<!--T:86--><br />
* Click on one point of the horizontal line of the first slot<br />
* Click on one point of the nearest horizontal line of the second slot<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 3mm, click OK.<br />
[[File:TBHS2-6.JPG|800px|center]]<br />
<br />
<br />
<!--T:87--><br />
*To make the sketch fully constrained<br />
**Click on the lower left point of the second slot<br />
**Click on the origin of the XY plan<br />
**Click on [[File:Constraint_PointOnPoint.svg|32px]] [[Sketcher ConstrainCoincident |'''Coincident''']]<br />
[[File:TBHS2-7.JPG|800px|center]]<br />
<br />
<br />
<!--T:88--><br />
* To leave the sketch, click either on the "Close" button on the left, or the [[File:Sketcher_LeaveSketch.png|32px]] icon in the toolbar, or press {{KEY|ESC}}.<br />
[[File:TBHS2-8.JPG|800px|center]]<br />
<br />
=== Create a pad === <!--T:89--><br />
* Click on [[Image:View-axometric.svg|32px]] '''Axonometric''' among the standard views, to better see what will happen.<br />
* Click on [[File:PartDesign_Pad.svg|32px]] '''Pad'''.<br />
* Enter 30mm and click OK.<br />
[[File:TBHS2-9.JPG|800px|center]]<br />
<br />
<br />
=== Create a sketch on it === <!--T:90--><br />
*Select the upper face<br />
[[File:TBHS2-10.JPG|800px|center]]<br />
<br />
<br />
<!--T:91--><br />
*Create a [[Image:Sketcher_NewSketch.svg|32px]] '''New sketch'''. As a face was selected it will not ask you to choose a plane.<br />
[[File:TBHS2-11.JPG|800px|center]]<br />
<br />
<br />
<!--T:92--><br />
*Draw an [[Image:Sketcher_CreateHexagon.svg|32px]] [[Sketcher_CreateHexagon|'''Hexagon''']]<br />
**Click to place the center<br />
**Move to define the radius<br />
**Click to set<br />
[[File:TBHS2-12.JPG|800px|center]]<br />
<br />
<br />
<!--T:93--><br />
*Click on an edge of the hexagon<br />
*Click on [[Image:Constraint_Horizontal.svg|32px]] [[Sketcher ConstrainHorizontal |'''Horizontal''']]<br />
[[File:TBHS2-13.JPG|800px|center]]<br />
<br />
<br />
<!--T:94--><br />
* Click on the center of the hexagon<br />
* Click on the horizontal line of the XY plane<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 15mm, click OK.<br />
[[File:TBHS2-14.JPG|800px|center]]<br />
<br />
<br />
<!--T:95--><br />
* Click on the center of the hexagon<br />
* Click on the vertical of the XY plane<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 10mm, click OK.<br />
[[File:TBHS2-15.JPG|800px|center]]<br />
<br />
<br />
<!--T:96--><br />
* Click on the blue circle of the hexagon<br />
* Click on [[File:Sketcher_ConstrainRadius.svg|32px]] [[Sketcher ConstrainRadius|'''Radius''']]<br />
* A dialog prompts you to set a dimension. Enter 8mm, click OK.<br />
[[File:TBHS2-16.JPG|800px|center]]<br />
<br />
<br />
<!--T:97--><br />
* To leave the sketch, click either on the "Close" button on the left, or the [[File:Sketcher_LeaveSketch.png|32px]] icon in the toolbar, or press {{KEY|ESC}}.<br />
[[File:TBHS2-17.JPG|800px|center]]<br />
<br />
=== Create a hole === <!--T:98--><br />
* Click on [[Image:View-axometric.svg|32px]] '''Axonometric''' among the standard views, to better see what will happen.<br />
* Click on [[File:PartDesign_Pocket.svg|32px]] [[PartDesign_Pocket|'''Pocket''']].<br />
* Select ''to the first'' in the dropdown menu and click OK.<br />
[[File:TBHS2-18.JPG|800px|center]]<br />
<br />
<br />
=== Linear repetition === <!--T:99--><br />
* In the Combo View on the left, select the tree view instead of the contextual task menu, click on the pocket feature.<br />
* Click on [[File:PartDesign_LinearPattern.svg|32px]] [[PartDesign_LinearPattern|'''LinearPattern''']].<br />
* Set the length at 55mm and occurencies at 3, then click OK.<br />
[[File:TBHS2-19.JPG|800px|center]]<br />
<br />
=== Create a sketch on it === <!--T:100--><br />
*Select the inner face<br />
[[File:TBHS2-20.JPG|800px|center]]<br />
<br />
<br />
<!--T:101--><br />
*Create a [[Image:Sketcher_NewSketch.svg|32px]] '''New sketch'''. As a face was selected it will not ask you to choose a plane.<br />
[[File:TBHS2-21.JPG|800px|center]]<br />
<br />
<br />
<!--T:102--><br />
* Click on [[File:Sketcher_Circle.svg|32px]] [[Sketcher_CreateCircle|'''Circle''']], click to place the center, move the pointer and click to define the radius.<br />
[[File:TBHS2-22.JPG|800px|center]]<br />
<br />
<br />
<!--T:103--><br />
* Click on the center of the circle<br />
* Click on the horizontal line of the XY plane<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 15mm, click OK.<br />
[[File:TBHS2-23.JPG|800px|center]]<br />
<br />
<br />
<!--T:104--><br />
* Click on the center of the circle<br />
* Click on the vertical of the XY plane<br />
* Click on [[File:Constraint_Length.png|32px]] [[Sketcher ConstrainDistance|'''Distance''']]<br />
* A dialog prompts you to set a dimension. Enter 10mm, click OK.<br />
[[File:TBHS2-24.JPG|800px|center]]<br />
<br />
<br />
<!--T:105--><br />
* Click on the circle<br />
* Click on [[File:Sketcher_ConstrainRadius.svg|32px]] [[Sketcher ConstrainRadius|'''Radius''']]<br />
* A dialog prompts you to set a dimension. Enter 3.5mm, click OK.<br />
[[File:TBHS2-25.JPG|800px|center]]<br />
<br />
<br />
<!--T:106--><br />
* To leave the sketch, click either on the "Close" button on the left, or the [[File:Sketcher_LeaveSketch.png|32px]] icon in the toolbar, or press {{KEY|ESC}}.<br />
[[File:TBHS2-26.JPG|800px|center]]<br />
<br />
<br />
=== Create a pad === <!--T:107--><br />
* Click on [[Image:View-axometric.svg|32px]] '''Axonometric''' among the standard views, to better see what will happen.<br />
* Click on [[File:PartDesign_Pad.svg|32px]] '''Pad'''.<br />
* Enter 4mm and click OK.<br />
[[File:TBHS2-27.JPG|800px|center]]<br />
<br />
=== Linear repetition === <!--T:108--><br />
* In the Combo View on the left, select the tree view instead of the contextual task menu, click on the pad feature.<br />
* Click on [[File:PartDesign_LinearPattern.svg|32px]] [[PartDesign_LinearPattern|'''LinearPattern''']].<br />
* Set the length at 55mm and occurencies at 3, then click OK.<br />
[[File:TBHS2-28.JPG|800px|center]]<br />
<br />
<br />
=== Draft === <!--T:109--><br />
*Select the side of each round pads<br />
[[File:TBHS2-29.JPG|800px|center]]<br />
<br />
<br />
<!--T:110--><br />
* Click on [[File:PartDesign_Draft.svg|32px]] [[PartDesign_Draft|'''Draft''']].<br />
* Set the draft angle at 40°.<br />
* Click on "Neutral plane" and select the face on which the sketch is drawn.<br />
* Tick "Invert the draft direction".<br />
[[File:TBHS2-30.JPG|800px|center]]<br />
<br />
<br />
<!--T:111--><br />
We could have used a chamfer to do something similar, but the draft is more appropriate in this case.<br />
<br />
<!--T:112--><br />
Chamfer = left / Draft = right<br />
<br />
<!--T:113--><br />
[[File:TBHS2-30-chamfer.JPG|200px]][[File:TBHS2-30-draft.JPG|200px]]<br />
<br />
<br />
=== Finitions === <!--T:114--><br />
*Holding {{KEY|CTRL}} select the bottom and top faces.<br />
[[File:TBHS2-31-bottom.JPG|200px]][[File:TBHS2-31-top.JPG|200px]]<br />
<br />
<!--T:115--><br />
** Add a [[File:PartDesign_Chamfer.svg|32px]] '''Chamfer''' of 0,5mm.<br />
[[File:TBHS2-31.JPG|800px|center]]<br />
<br />
<br />
<!--T:116--><br />
Perfect !<br />
<br />
== Export as a .STL == <!--T:117--><br />
* In the Combo View on the left, select the tree view instead of the contextual task menu, click on the last feature (the chamfer).<br />
<br />
<!--T:118--><br />
[[File:TBHS2-32.JPG|800px|center]]<br />
<br />
<!--T:119--><br />
* Now you can select "Export..." from the File menu at the top left, and select the file format .STL.<br />
* Print it instead of the first version or to replace it if it eventually broke ;-)<br />
</translate><br />
<br />
{{Tutorials navi{{#translation:}}}}<br />
{{PartDesign Tools navi{{#translation:}}}}<br />
{{Sketcher Tools navi{{#translation:}}}}<br />
{{Userdocnavi{{#translation:}}}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macros_recipes&diff=1177269Macros recipes2022-08-28T09:34:51Z<p>Heda: </p>
<hr />
<div><languages/><br />
<br />
{|class="fcinfobox wikitable ct" height=100% style="width: 230px; float: right; margin-left: 1em" |<br />
| class="ctTitle" style="font-weight: bold; font-size: 125%;" | [[Image:Text-x-python.png|32px]] Macros<br />
|-<br />
| class="ctToc"|<br/>__TOC__<br />
|}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle on 3 selected points, the points can be objects (this example brings together the two examples below, all parameters simply settle on a graphic window).<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Drawing-orthoviews.svg|32px]] Drawing Workbench=== <!--T:105--><br />
<br />
<!--T:165--><br />
The [[Drawing Workbench|Drawing Workbench]] is obsolete since FreeCAD 0.17. Consider using the [[TechDraw Workbench|TechDraw Workbench]] instead.<br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:223--><br />
* {{MacroLink|Icon=Macro_Automatic_drawing.png|Macro_Automatic_drawing|Macro Automatic drawing}}: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.<br />
<br />
<!--T:224--><br />
* {{MacroLink|Icon=Macro_CartoucheFC.png|Macro_CartoucheFC|Macro CartoucheFC}}: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:225--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_2.png|Macro_CartoucheFC_2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.<br />
<br />
<!--T:226--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro_CartoucheFC_Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|Misc templates Full]] of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:385--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a B-spline surface through a grid of points.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
<!--T:313--><br />
* {{MacroLink|Icon=multiCuts.png|Macro_multiCuts|multiCuts}}: This macro improves bool cut hierarchy by automatic labeling and using copies for cut.<br />
<br />
<!--T:314--><br />
* {{MacroLink|Icon=TNP_solution.png|TNP_solution|TNP_solution}}: Solution for Topological Naming Problem.<br />
<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Z_height_map|Macro Z height map}}: Makes a grayscale heightmap in z.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:354--><br />
* {{MacroLink|Icon=Macro_Corner_shapes_wizard.png|Macro_Corner_shapes_wizard/update|Macro Corner shapes wizard/update}}: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.<br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Z_Height_Map&diff=1177268Macro Z Height Map2022-08-28T09:29:36Z<p>Heda: Created page with "<languages/> <translate> {{Macro |Name=Z_height_map |Description=Makes a grayscale heightmap in z. |Author=heda |Version=0.1 |Date=2022-08-28 |FCVersion=- }} ==Description=..."</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<br />
{{Macro<br />
|Name=Z_height_map<br />
|Description=Makes a grayscale heightmap in z.<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-08-28<br />
|FCVersion=-<br />
}}<br />
<br />
==Description==<br />
<br />
[[File:Macro zheightmap fig.png]]<br />
<br />
Makes the grayscale height map for all visible root objects with a volume<br />
from the active document.<br />
<br />
No gui, options can be set in macro-file.<br />
<br />
Image file saved with document name.<br />
<br />
<br />
==Usage==<br />
<br />
Run macro with a document open.<br />
<br />
==Install==<br />
<br />
Through Addon manager.<br />
<br />
==Link==<br />
<br />
Forum: No dedicated thread, but sprung out of [https://forum.freecadweb.org/viewtopic.php?f=3&t=71247 forum post].<br />
<br />
==Version==<br />
<br />
v0.1 2022-08-28 : first release<br />
<br />
==Code==<br />
<br />
</translate><br />
'''Macro_3DXML_import.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
#!/usr/bin/env python3<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * Copyright (c) 2022 heda <heda @ freecad forum> *<br />
# * *<br />
# * This file is part of the FreeCAD CAx development system. *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
<br />
__Name__ = 'Z_height_map'<br />
__Comment__ = 'Makes a grayscale heightmap in z'<br />
__Author__ = 'heda @ fc-forum'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-08-28'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecadweb.org/Macro_Z_height_map'<br />
__Icon__ = ''<br />
__Help__ = 'Run macro and heightmap is created.'<br />
__Status__ = 'Stable'<br />
__Requires__ = 'tested on FreeCAD v0.20'<br />
__Communication__ = 'forum'<br />
__Files__ = ''<br />
<br />
<br />
__doc__ = """<br />
Makes the grayscale height map for all visible root objects with a volume<br />
from the active document.<br />
<br />
No gui, options can be set in macro-file.<br />
<br />
png file saved with document name.<br />
"""<br />
<br />
import numpy as np<br />
import matplotlib.pyplot as plt<br />
from PIL import Image<br />
<br />
pxpmm = 1 # pixels per mm<br />
# adjust pxpmm up/down if there are bands in the heightmap<br />
pad = 2<br />
grayscale_compress = 0.1 # range 0 - 1<br />
invert = False # grayscale, high is white with False<br />
<br />
IMSHOW = True<br />
IMSAVE = True<br />
IMRESIZE = False # only saved pil-image, quicker than increase of pxpmm<br />
imwidth = 500 # resizing does give artefacts, can change interpolation...<br />
<br />
doc = App.ActiveDocument<br />
<br />
shapes = list()<br />
for obj in doc.Objects:<br />
if hasattr(obj, 'Shape'):<br />
if hasattr(obj.Shape, 'Volume'):<br />
if obj.Shape.Volume > 0:<br />
if obj.ViewObject.Visibility:<br />
shapes.append(obj.Shape)<br />
<br />
xmin, ymin, zmin = (min((getattr(shp.BoundBox, f'{which}Min')<br />
for shp in shapes)) for which in 'XYZ')<br />
xmax, ymax, zmax = (max((getattr(shp.BoundBox, f'{which}Max')<br />
for shp in shapes)) for which in 'XYZ')<br />
<br />
xspan, yspan, zspan = xmax - xmin, ymax - ymin, zmax - zmin<br />
w, h = (int(span * pxpmm) for span in (xspan, yspan))<br />
pic = np.zeros((w + 1, h + 1, len(shapes)))<br />
<br />
print('w x h --> {} x {}'.format(w, h))<br />
print('working on pixels, might take a while...')<br />
<br />
for i, shape in enumerate(shapes):<br />
pv = shape.getPoints(1/pxpmm)<br />
zpoints = (p for p, v in zip(*pv) if v.z > 0)<br />
for zpoint in zpoints:<br />
x = round((zpoint.x - xmin) / xspan * w)<br />
y = round((zpoint.y - ymin) / yspan * h)<br />
pic[x, y, i] = zpoint.z<br />
<br />
print('pic loop done')<br />
<br />
pic = (pic.max(axis=2) - zmin) / zspan<br />
im = np.zeros((w + 1 + 2 * pad, h + 1 + 2 * pad))<br />
pic = (1 - grayscale_compress) * pic + grayscale_compress<br />
im[pad:pad + w + 1, pad:pad + h + 1] = pic<br />
im = (im.T * 255).astype(np.uint8)<br />
h, w = im.shape<br />
<br />
if invert:<br />
im = 255 - im<br />
print('grayscale inverted')<br />
<br />
if IMSHOW:<br />
plt.imshow(im, cmap='gray', interpolation='none')<br />
plt.grid(color='r')<br />
plt.show()<br />
<br />
if IMSAVE:<br />
with Image.fromarray(im, mode='L') as pim:<br />
if IMRESIZE:<br />
pim = pim.resize((imwidth, int(h * imwidth / w)),<br />
Image.Resampling.LANCZOS)<br />
print('resized to:', pim.size)<br />
pim.save('{}.png'.format(doc.Name), mode='L')<br />
<br />
print('height map done')<br />
}}<br />
<br />
[[Category:File_Formats{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_zheightmap_fig.png&diff=1177263File:Macro zheightmap fig.png2022-08-28T09:25:16Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Part_WB&diff=1167304Creating a simple part with Part WB2022-08-01T14:07:09Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<!--T:1--><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=2 hours<br />
|FCVersion=0.19 or above<br />
|Files=<br />
}}<br />
<br />
==Introduction== <!--T:2--><br />
<br />
<!--T:3--><br />
This tutorial aims to be used as a first introduction to 3D modeling using the [[Part_Workbench|Part Workbench]] [[Image:Switch_PartWorkbench.JPG]] of FreeCAD. After having finished this tutorial you should be able to make simple 3D models by using primitives like cubes, cylinders, etc with a technique called [https://en.wikipedia.org/wiki/Constructive_solid_geometry Constructive Solid Geometry], short '''CSG''' modeling. Another way to create 3D models is by using a 2D shape by for example extruding or revolving the 2D shape in 3D space. For an introduction of that technique please follow the sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''. The two tutorials intentionally have exactly the same model generated, this presents the beginner with a hands on experience of the two different techniques and how they are implemented in FreeCAD. The definition of the two techniques can be viewed as strictly divided from a semantic point of view, however there is nothing directly hindering a mix of the techniques when creating models. There are some caveats to watch out for when mixing modeling techniques, those are mainly related to aspects of how FreeCAD is programmed. There is a [[Creating_a_simple_part_with_Draft_and_Part_WB|third tutorial]] intended as a first introduction to a mixed modeling example. That tutorial uses the '''Draft Workbench''' to create a 2D profile utilized to extrude a solid in the '''Part Workbench''' to make the same model as in this tutorial.<br />
<br />
<!--T:4--><br />
Before you start please have a look at how to '''[[Mouse_navigation|navigate]]''' in 3D space. When hoovering over the mouse model selector in the lower right corner of the FreeCAD window, a cheat-sheet of the current mouse model appears as in the picture below.<br />
<br />
</translate><br />
[[Image:T101pwb00-01_navi.png|center]]<br />
<translate><br />
<br />
<!--T:5--><br />
Many newcomers to CAD programs get stuck while learning the software, if that happens to you, please go ahead and search the wiki or forum for further information – chances are that others also have been stuck on the same specific thing in the past so there is already an answer to your specific question. Or make a post on the forum with your questions or findings. The forum has several threads where users are helped to complete all sorts of different tasks, those threads are often similar to tutorials, and often have specific illustrations included.<br />
<br />
===The tutorial covers=== <!--T:6--><br />
<br />
<!--T:7--><br />
* The model to make<br />
* Using the Part Workbench to create and manipulate the primitive building blocks<br />
* Changing the color and transparency<br />
* A different way to locate the hole<br />
* Making the hole a countersunk hole<br />
* Making a hollow piece<br />
* A different way to position the chamfer<br />
* Editing dimensions<br />
* Organizing the tree a bit differently<br />
* Wrapping up<br />
<br />
==The model to make== <!--T:8--><br />
<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center|372px]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<translate><br />
<br />
==Using the Part Workbench to create and manipulate the primitive building blocks== <!--T:9--><br />
<br />
<!--T:10--><br />
Create a new document and save it directly under a new name, it is good practice to make sure that you save the document at regular intervals, or just before larger operations. Then switch to the '''[[Part_Workbench|Part Workbench]]''' using either the [[Getting_started#Exploring_the_interface|workbench selector]] (labeled 10 in the linked image) or by going to the {{MenuCommand|View → Workbench}} menu. FreeCAD will start with toolbars at the top, the combo view to the left and the 3D view at the right.<br />
<br />
===Create the main solid block=== <!--T:11--><br />
<br />
<!--T:12--><br />
Press [[Image:Part_Box.svg|24px|link=Part_Box]] [[Part_Box|Box]] to make a default solid cube. The cube appears in the [[3D_view|3D view]] and also as a new object in the [[Tree_view|Tree view]] in the sidebar.<br />
<br />
<!--T:13--><br />
Press [[Image:Std_ViewIsometric.svg|24px|link=Std_ViewIsometric]] [[Std_ViewIsometric|Isometric]] to see the cube in 3D.<br />
<br />
</translate><br />
[[Image:T101pwb01-03_cube1.png|center]]<br />
<translate><br />
<br />
<!--T:14--><br />
Select the cube in the [[Tree_view|Tree view]], it becomes green in the 3D view. Below the tree view you will now see that the cube by default is created with the dimensions '''Length x Width x Height''' as ''10 x 10 x 10 mm''. Change those dimensions to '''100 x 30 x 50''' as per the initial drawing of the model.<br />
<br />
</translate><br />
[[Image:T101pwb01-04_cubedims.png|center]]<br />
<translate><br />
<br />
<!--T:15--><br />
When changing a property, like ''Length'' through the spinbox, one can either enter the values, or use the scroll-wheel to tick values up or down. The arrows for ticking values up or down can of course also be used. In the right most picture above, the ''Height'' property is in edit mode, rolling the scroll wheel when the mouse is over that cell will change the value by one up or down.<br />
<br />
<!--T:16--><br />
Click [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] '''[[Std_ViewFitAll|Fit all]]''' to see the whole cube.<br />
<br />
</translate><br />
[[Image:T101pwb01-05_cube2.png|center]]<br />
<translate><br />
<br />
===Create the fillet=== <!--T:17--><br />
<br />
<!--T:18--><br />
To make the filleted corner, in the toolbar press [[Image:Part_Fillet.svg|24px|link=Part_Fillet]] '''[[Part_Fillet|Fillet]]''' which opens the ''task panel'' for fillets in the [[Combo_view|combo view]] to the side. Change the ''radius'' spinbox to 20 mm, then in the 3D view, select the width edge to the upper right and click {{Button|OK}}.<br />
<br />
</translate><br />
[[Image:T101pwb01-06_filletrad.png|center]] <br />
<translate><br />
<br />
<!--T:19--><br />
The ''task panel'' closes and you are back to the Tree view which now has a fillet object instead of the earlier cube.<br />
<br />
===Visibility of children=== <!--T:20--><br />
<br />
<!--T:21--><br />
Click the plus sign/caret to expand the children of the fillet, which in this case is the ''cube'' we created earlier, but it is grayed out. Select the cube and press the space bar – this toggles visibility so the cube is now visible again and the icon is no longer grayed out. To deselect the cube click in a blank area in the Tree view or the 3D view.<br />
<br />
</translate><br />
[[Image:T101pwb01-07_fillet.png|center]]<br />
<translate><br />
<br />
===Create the chamfer=== <!--T:22--><br />
<br />
<!--T:23--><br />
Next is to create the 30 degree ''chamfer'', start by toggling the visibility of the child cube of the fillet. There is a chamfer tool in [[Part_Workbench|Part Workbench]], but instead of using it we will make the chamfer with another block and a boolean cut.<br />
<br />
<!--T:24--><br />
Create a new [[Image:Part_Box.svg|24px|link=Part_Box]] '''[[Part_Box|Box]]''' with dimensions 60 x 30 x 30. Change the '''placement angle''' to -30 degrees.<br />
<br />
</translate><br />
[[Image:T101pwb01-08_chamfer1.png|center]]<br />
<translate><br />
<br />
<!--T:25--><br />
The placement angle is using the '''placement vector''' (Axis) as axis of rotation. The default is the z-axis, which is not matching our target direction, changing the placement vector to the '''y-axis''' produces the desired orientation of the cutting tool for the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-09_chamfer2.png|center]]<br />
<translate><br />
<br />
<!--T:26--><br />
The same placement can be attained with other values as well, the simplest alternative example of a placement that is the same is an angle of +30 degrees and a y-axis of -1.<br />
<br />
====Python console==== <!--T:27--><br />
<br />
<!--T:28--><br />
Furthermore the position needs to be adjusted, looking at the drawing of the finished part, there is no direct dimension to use for the intended translation upwards. Since the upward dimension is the one needed, we have to calculate it. Let’s make use of the built in '''[[Python_console|Python console]]''' for those calculations, it is basic trigonometry. If the FreeCAD Python console is not visible for you, just right-click in an empty space in the toolbar area and check the ''Python console'' and it should appear in the workspace, when there you should as well add the '''[[Report_view|report view]]''' if not already visible. The ''report view'' most of the times provides useful information or even hints of what to do next for different commands.<br />
<br />
</translate><br />
[[Image:T101pwb01-10_pyconsole.png|center]]<br />
<translate><br />
<br />
<!--T:29--><br />
After importing the '''[https://docs.python.org/3/library/math.html#module-math math]''' module from the standard libraries in python we can use the formula ''(50 - math.tan(math.radians(30)) * 50)'' to find the distance in z-direction that the block should be moved. Copy the result of the formula from the Python console and paste it into the z position for '''Cube001'''. The ''tool'' to use for the chamfer ''cut'' is now properly oriented and positioned.<br />
<br />
</translate><br />
[[Image:T101pwb01-11_chamfer3.png|center]]<br />
<translate><br />
<br />
====Expressions==== <!--T:30--><br />
<br />
<!--T:31--><br />
One does not have to use the Python console to do the calculation, In most cases when dealing with numeric parametric values, FreeCAD has a short-cut to a built-in calculator. It is called '''[[Expressions|Expressions]]''' in FreeCAD, you can enter the ''expression mode'' by first clicking in the spinbox for the z-position, a small blueish circular icon will appear at the right side.<br />
<br />
</translate><br />
[[Image:T101pwb01-12_expression1.png|center]] <br />
<translate><br />
<br />
<!--T:32--><br />
Clicking that icon opens new window ''Formula editor'' where formulas and expressions can be entered as shown below. Using expressions is a powerful tool, since one can access parameters from the model, effectively making all parameters in the model available as variables to be used when creating an expression. In short, in our formula, instead of entering the number 50 when in the formula editor, we could enter a ''named parameter'' holding the value 50 from the cube, with the benefit that if we change the cube ''height'', the position of the chamfer will automatically follow. The value of 50 in the current model is referred to as ''Cube.Length'', i.e. the ''Length'' property of the ''Cube'' feature. Further information on this can be found on the wiki.<br />
<br />
</translate><br />
[[Image:T101pwb01-13_expression2.png|center]] <br />
<translate><br />
<br />
<!--T:33--><br />
To make the cut, with the {{KEY|Ctrl}} key pressed down first select the '''Fillet''' in the Tree view and then the latest created cube (named '''Cube001''') and finally in the toolbar press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button. Your Tree view should now again be a single object in the root called '''Cut'''.<br />
<br />
</translate><br />
[[Image:T101pwb01-14_model1.png|center]]<br />
<translate><br />
<br />
====The toolbars====<br />
A sidenote on the toolbars, since they are the typical avenue to invoke a command. Although there is a basic setting for the layout of the toolbars, the actual layout on your computer could turn out to be less than ideal.<br />
In such cases it is easy to adjust. Consider the upper section of below image. There are 2 rows of toolbars and only a limited number of the [[Part_Workbench|Part Workbench]] toolbar buttons are visible. The simplest way to see more toolbar buttons is to maximize the FreeCAD window, unless it already is maximized of course.<br />
<br />
More common is to adjust the layout of the toolbars to suit your needs and your specific computer. The repositioning is done with the handles to the left in a toolbar group. It is just to click-drag the handle to a new location. In the lower section of below image the toolbar positions has been adjusted, thus revealing the full content of the toolbar groups. Changes to toolbar positions are persistant through sessions.<br />
<br />
</translate><br />
[[Image:T101pwb01-141_toolbars.png|center]]<br />
<translate><br />
<br />
====The measurement tool==== <!--T:34--><br />
<br />
<!--T:35--><br />
The '''[[Part_Measure_Menu|measurement tool]]''' in the '''Part Workbench''' can be used to check that our calculation and placement of the chamfer is correct. Press the [[Image:Part_Measure_Linear.svg|24px|link=Part_Measure_Linear]] '''[[Part_Measure_Linear|Measure Linear]]''' button and a ''task panel'' opens up, then select the 2 endpoints of one side of the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-15_model1measure1.png|center]]<br />
<translate><br />
<br />
<!--T:36--><br />
It checks out with an x dimension of 50 mm, clear the measurement and close the dialogue.<br />
<br />
===Create the hole=== <!--T:37--><br />
<br />
<!--T:38--><br />
To make the hole, press the [[Image:Part_Cylinder.svg|24px|link=Part_Cylinder]] '''[[Part_Cylinder|Cylinder]]''' button, set the ''radius'' to 5 mm and ''height'' to 50 mm.<br />
<br />
</translate><br />
[[Image:T101pwb01-16_cyl1.png|center]]<br />
<translate><br />
<br />
<!--T:39--><br />
Next we need to position the hole according to the dimensions in the drawing. Change the view to [[Image:Std_ViewTop.svg|24px|link=Std_ViewTop]] '''[[Std_ViewTop|Top]]''' view, then right-click the '''Cylinder''' in the Tree view and select '''Transform''' from the pop-up menu.<br />
<br />
</translate><br />
[[Image:T101pwb01-17_cyl1translate.png|center]]<br />
<translate><br />
<br />
<!--T:40--><br />
Change the ''Translation increment'' to 5 and use the red and green arrow to position the cylinder in the right position, moving it 15 mm in y and 65 in x by dragging the arrow ends with the mouse. Click {{Button|OK}} to close the ''Transform'' dialogue. To make the hole press the {{KEY|Ctrl}} key and select the '''Cut''' and '''Cylinder''' in the Tree view, then press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button in the toolbar. Your Tree view should once again have a single object in the root called '''Cut001'''.<br />
<br />
<!--T:41--><br />
Congratulations, the model is now ready.<br />
<br />
</translate><br />
[[Image:T101pwb01-18_model1complete.png|center]]<br />
<translate><br />
<br />
<!--T:42--><br />
With the basic model ready, let us explore different ways to alter this model, some examples are related to the appearance, additional features, or simply a different way to do the same.<br />
<br />
==Changing the color and transparency== <!--T:43--><br />
<br />
<!--T:44--><br />
There are several different ways one can change the appearance of objects, for this case, let's use the view tab in the property part of the combo view. First select the object in the Tree view and then edit any property like line color, shape color or transparency via the '''view tab''' (found at the bottom of the ''combo view'').<br />
<br />
</translate><br />
[[Image:T101pwb02-01_appearance1.png|center]]<br />
<translate><br />
<br />
<!--T:45--><br />
Unfortunately when the object is selected it is a bit hard to see how it will look when tuning the new appearance. To see the final result one has to deselect the object. Here is the new look of the model, where one now can see the through hole also in the iso-view. Another way to edit the appearance is via the {{MenuCommand|View → [[Image:Std_SetAppearance.svg|24px|link=Std_SetAppearance]] Appearance...}} menu.<br />
<br />
</translate><br />
[[Image:T101pwb02-02_appearance2.png|center]]<br />
<translate><br />
<br />
==A different way to locate the hole== <!--T:46--><br />
<br />
<!--T:47--><br />
Do a ''save-as'' under a new name. Then delete the cut that added the hole and move the cylinder back to zero position. Your model should look like the below picture, which is the starting point for using a different technique to locate the hole at the center of the upper face. Note that the color is back to the default gray, the change in appearance we did was on the cut object which now is deleted.<br />
<br />
</translate><br />
[[Image:T101pwb03-01_cyl.png|center]] <br />
<translate><br />
<br />
<!--T:48--><br />
This time the [[Image:Workbench_Draft.svg|24px|link=Draft_Workbench]] '''[[Draft_Workbench|Draft Workbench]]''' will be used to locate the hole. The hole is as before to be located at the center of the upper face, which is the same as the midpoint of the diagonal of the upper face.<br />
<br />
<!--T:97--><br />
Start by switching the workbench to '''Draft''', it might be that a ''grid'' appears in the 3D view, the grid visibility can be toggled with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]] in the toolbar. When making use of the '''[[Draft_Snap|snap]]''' functionality in the '''Draft Workbench''' it helps to only have the ''snap types'' of interest enabled. This time it is sufficient to leave ''endpoint, midpoint and circle center enabled'', so the settings for snapping should look something like below.<br />
<br />
</translate><br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<translate><br />
<br />
<!--T:49--><br />
Finding the point to place the center of the cylinder could be done by making a diagonal as helpline and use the center of the cylinder and midpoint of the diagonal to identify the points to move between, however it turns out that we do not even need to make any helplines, we can snap on already existing solid geometry.<br />
<br />
<!--T:50--><br />
Select the '''Cylinder''' in the Tree view (it turns green in the 3D view) and press the [[Image:Draft_Move.svg|24px|link=Draft_Move]] '''[[Draft_Move|Move]]''' button in the toolbar. A ''task panel'' opens for moving objects, make sure that ''Copy'' is unchecked.<br />
<br />
</translate><br />
[[Image:T101pwb03-03_move.png|center]]<br />
<translate><br />
<br />
<!--T:51--><br />
Then move the mouse to the upper face of the cylinder so that you see a ''white dot'' in the center of the circle as per the left picture below, this together with the center symbol next to the mouse pointer means that a left button mouse click will snap to the white point.<br />
<br />
</translate><br />
[[Image:T101pwb03-04_snapselect.png|center]]<br />
<translate><br />
<br />
<!--T:52--><br />
When you have the white dot on the upper face, click the left mouse button, and repeat for the upper square face of the main solid, like the right picture above, and confirm the choice with a left mouse button click. The snap function makes use of ''mass-center'' for any type of face, and in this case the mass center is the same as the geometrical center that is sought after. You will by now have noticed that the move of the cylinder is animated, so you always see what is about to happen.<br />
<br />
<!--T:53--><br />
Repeating the step of the '''boolean cut''' from earlier once again will make the through hole that completes the model. Using the '''linear measurement tool''' in the Part Workbench, a check that the hole is correctly placed is done. The measurement can only be done between ''points'', so the measurement is done from main body zero to the seam point of the cylinder, meaning that the correct distance is 70 mm instead of the 65 that is on the drawing to account for the extra radius that is included in the distance.<br />
<br />
</translate><br />
[[Image:T101pwb03-05_modelmeasure.png|center]]<br />
<translate><br />
<br />
==Making the hole a countersunk hole== <!--T:54--><br />
<br />
<!--T:55--><br />
Switch back to the [[Part_Workbench|Part Workbench]] and create a ''cone'' by pressing the [[Image:Part_Cone.svg|24px|link=Part_Cone]] '''[[Part_Cone|Cone]]''' button in the toolbar. Change ''radius1'' to 0 mm and ''radius2'' to 7 mm – this will give a 2 mm ''countersink'' on the radius. Making the ''height'' of the cone 7 mm results in a 90 degree top angle of the cone, or 45 degree countersink angle. Worth to note is that again one could as well use the [[Image:Part_Chamfer.svg|24px|link=Part_Chamfer]] [[Part_Chamfer|Chamfer]] operation.<br />
<br />
<!--T:56--><br />
When working with FreeCAD you will continuously be faced with several different ways to achieve seemingly the same result. There is hardly any absolute truth in what is the right way to achieve a particular end result – however when looking in a specific context one specific workflow can be more flexible, allow for later features to actually be used etc. How you build 3D models will evolve over time as you along the way learn more and more about the features and capabilities of FreeCAD.<br />
<br />
</translate><br />
[[Image:T101pwb04-01_cone.png|center]]<br />
<translate><br />
<br />
<!--T:57--><br />
Translate the cone so that it is ''concentric'' with the hole and ''coplanar'' with the main solid upper surface. Use any method described earlier in this tutorial to accomplish that.<br />
<br />
<!--T:98--><br />
In the picture below the move is made with ''Transform'' and an ''increment'' setting of 1 mm, since the cone has a characteristic dimension of 7 mm, meaning that the earlier increment setting of 5 mm will not allow for correct positioning. The [[Image:Std_DrawStyleWireFrame.svg|24px|link=Std_DrawStyle#Wireframe]] '''[[Std_DrawStyle#Wireframe|Wireframe]]''' rendering is used to easier see that the cone is in the right position.<br />
<br />
</translate><br />
[[Image:T101pwb04-02_conetranslate.png|center]]<br />
<translate><br />
<br />
<!--T:58--><br />
To complete the model, let's make use of the [[Image:Part_Boolean.svg|24px|link=Part_Boolean]] '''[[Part_Boolean|Boolean]]''' command instead of first selecting objects and apply a specific boolean operation. Press the toolbar button and a ''task panel'' opens as per the below picture to the left.<br />
<br />
</translate><br />
[[Image:T101pwb04-03_boolean.png|center]]<br />
<translate><br />
<br />
<!--T:59--><br />
Three items needs to be specified, the ''operation type'', the ''first shape'' and the ''second shape''. The cone is supposed to be cut, this is called ''Difference'' in this command, instead of ''Cut''. The first shape is our '''Cut001''', it is listed under ''compounds'', since it is build from several solids. The second shape is the '''Cone'''. Once the correct settings are made for the command, click the {{Button|Apply}} button to execute the operation. This has all been done in the picture to the right, and there one can also see that a ''compound'' '''Cut002''' is now listed, this is our final model shape. After having changed the appearance the final model looks like this.<br />
<br />
</translate><br />
[[Image:T101pwb04-04_modelcomplete.png|center]]<br />
<translate><br />
<br />
==Making a hollow piece== <!--T:60--><br />
<br />
<!--T:61--><br />
Do a ''save-as'' under a new name. FreeCAD has all of the typical operations of a 3D modeller, one of them is [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''', which is used to ''hollow out'' parts.<br />
<br />
<!--T:62--><br />
Rotate the view so that the bottom face of the model is visible.<br />
<br />
</translate><br />
[[Image:T101pwb05-01_frombottom.png|center]]<br />
<translate><br />
<br />
<!--T:63--><br />
Select the ''bottom face'' of the model, then in the [[Part_Workbench|Part Workbench]] select [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''' and the screen should look like below.<br />
<br />
</translate><br />
[[Image:T101pwb05-02_thickness_cmd.png|center]]<br />
<translate><br />
<br />
<!--T:64--><br />
Click {{Button|OK}}, as you can see there is now a ''radius'' on the hollowed out part.<br />
<br />
</translate><br />
[[Image:T101pwb05-03_thickness_dimension.png|center]]<br />
<translate><br />
<br />
<!--T:65--><br />
Moreover, when taking a measurement of the width of the part, it is now 32 mm, so the ''thickness'' has been applied ''outwards''. Let’s edit that, double-click the model in the Tree view and modify the ''join-type'' settings to ''intersection'' and the ''thickness'' setting to -1.<br />
<br />
</translate><br />
[[Image:T101pwb05-04_thickness_modify.png |center]]<br />
<translate><br />
<br />
<!--T:66--><br />
Now the outer width of the part is 30 mm, same as before and the corners are all sharp corners.<br />
<br />
</translate><br />
[[Image:T101pwb05-05_thickness_modified.png|center]]<br />
<translate><br />
<br />
==A different way to position the chamfer== <!--T:67--><br />
<br />
<!--T:68--><br />
Do a ''save-as'' under a new name. Then delete features so that the model looks like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-01_startingpoint.png|center]]<br />
<translate><br />
<br />
<!--T:69--><br />
Make a '''Cube''' with dimensions '''30x30x60''', ending up like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-02_with_cube.png|center]]<br />
<translate><br />
<br />
<!--T:70--><br />
Change the '''placement''' by first rotating -120 degrees around the Y-axis.<br />
<br />
</translate><br />
[[Image:T101pwb06-03_rotated_cube.png|center]]<br />
<translate><br />
<br />
<!--T:71--><br />
Finally, change the position to '''X=50''' and '''Z=50''' and make the ''cut'' to produce the same result as earlier.<br />
<br />
</translate><br />
[[Image:T101pwb06-04_cube_cut.png|center]]<br />
<translate><br />
<br />
<!--T:72--><br />
This once again highlights that there are always several ways to produce the same outcome, which is a recurring theme when it comes to 3D modeling. When it comes to basic geometries or solids, one can use different workbenches in FreeCAD as well as different commands and still have the same outer shape of a solid. You simply need to find your own way to a set of preferred tools and workflow that you are comfortable in using. Modeling in parametric 3D is a process of constant learning, and takes practice to master.<br />
<br />
==Editing dimensions, face colors and TNP== <!--T:73--><br />
<br />
<!--T:74--><br />
FreeCAD is a parametric 3D modeler, this allows you to change any ''placement'' or ''dimension'' and the model will update accordingly. In general this works, but it is possible to break a model when edited – for example when a fillet is based on an edge that no longer exists due to editing. When a model breaks during editing, it is referred to as '''TNP, [[Topological_naming_problem|Topological Naming Problem]]'''.<br />
<br />
<!--T:75--><br />
Go ahead and experiment with changing dimensions and placements to see if you can break the model, do not forget to recalculate the model after changes if required. This can be done with the [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] button in the toolbar, if the icon is grayed out it is not needed to refresh the object.<br />
<br />
===Reposition the cylinder=== <!--T:76--><br />
<br />
<!--T:77--><br />
Here is an example of the cylinder moved from the center to one side of the main body by using ''Transform'' on the cylinder. As can be seen in the picture, the cone is still in the original position, not affected by the move of the cylinder.<br />
<br />
</translate><br />
[[Image:T101pwb07-01_cylindermoved.png|center]]<br />
<translate><br />
<br />
<!--T:78--><br />
When you move the cylinder and break through the outer surface, in version 0.19 you are loosing part of the color settings on your model. FreeCAD reverts to the user default settings for shape colors and transparency in the 3D view, however the '''Cut002''' shape still shows the colors and transparency that it had before as seen in below picture.<br />
<br />
===Fixing the colors=== <!--T:79--><br />
<br />
</translate><br />
[[Image:T101pwb07-02_wrongcolor.png|center]]<br />
<translate><br />
<br />
<!--T:80--><br />
Here is one way to get it back. First change ''transparency'' one tick up or down and then back, that brings back the transparency. You can do the same trick on ''shape color''. Another way to get the color back is to ''right-click'' '''Cut002''' in the Tree view and select '''Set Colors''' in the context menu. In the ''task panel'' that displays, click {{Button|Set to Default}}, that brings back the color to the one set in the view-properties.<br />
<br />
</translate><br />
[[Image:T101pwb07-03_set_colors.png|center]]<br />
<translate><br />
<br />
<!--T:81--><br />
The '''Set Colors''' command allows you to select individual faces of a shape and set a unique color on the selected faces.<br />
<br />
===Multiple solids=== <!--T:82--><br />
<br />
<!--T:83--><br />
Another example where the cube that is making the chamfer has been translated and rotated.<br />
<br />
</translate><br />
[[Image:T101pwb07-04_3solids.png|center]]<br />
<translate><br />
<br />
<!--T:84--><br />
As can be seen when repositioning the chamfer in this way, the end result is ''3 disjoint solids''. [[Part_Workbench|Part Workbench]] allows this, [[PartDesign_Workbench|PartDesign Workbench]] does not, either you will get an ''multiple solids error'' or it will simply not render all solids.<br />
<br />
===TNP=== <!--T:85--><br />
<br />
<!--T:86--><br />
Going back to the original completed model, let’s explore how the faces are named.<br />
<br />
<!--T:99--><br />
Here the '''[[Selection_view|selection view]]''' has been made active, just to show clearly what is selected and not, also coloring is adjusted so that the selection is easier to see.<br />
<br />
</translate><br />
[[Image:T101pwb07-05_face2and9.png|center]]<br />
<translate><br />
<br />
<!--T:87--><br />
Selecting one side face and the cylinder inner face gives that they are internally called face ''2'' and ''9'', where face ''2'' is the side face. Face numbering can be different for you.<br />
<br />
<!--T:100--><br />
Moving the cylinder so that the cavity ends up on the side face, and doing the selection of faces now gives a different number for the cylindrical face.<br />
<br />
</translate><br />
[[Image:T101pwb07-06_newfacenumbers.png|center]]<br />
<translate><br />
<br />
<!--T:88--><br />
Face 2 is the right side of the original face 2, the left side of former face 2 is now face 8. The cylindrical part was face 9, but is now face 7. FreeCAD reassigns the numbering and the order is not necessarily preserved. The total face count in the first model is 10, in the version with the cylindrical face piercing the side face, the total face count is 11. So obviously face numbering has to change when the so called ''topology'' changes. This probably feels like a minute detail, but turns out to be quite important in parametric 3D CAD. Imagine that you have used the cylindrical face as reference for another feature, it used to be called face 9, but is now called face 8. The reference to the intended cylindrical surface is lost. Since FreeCAD, at least in currently released versions does not keep track of the ''intended face'', it only keeps track of the ''numbered face'', a model breaks when a reference is made to a face that later is renumbered. This is called '''TNP, [[Topological_naming_problem|Topological Naming Problem]]'''.<br />
<br />
<!--T:89--><br />
You are encouraged to learn how to avoid broken models due to TNP, further reading can be done [[Topological_naming_problem|elsewhere on the wiki]], which largely focuses on a ''sketch driven'' workflow, the underlying mechanism is the same though. The renumbering described here for faces goes for all geometrical entities, faces, edges and vertexes.<br />
<br />
==Organizing the tree a bit differently== <!--T:90--><br />
<br />
<!--T:91--><br />
Do a ''save-as'' under a new name. Then delete all the cuts ending up with a model looking like below.<br />
<br />
</translate><br />
[[Image:T101pwb08-01_primitives.png|center]]<br />
<translate><br />
<br />
<!--T:92--><br />
When using the '''Part Workbench''' and modelling feature rich solids, the tree structure of a solid can become hard to decipher. So far we have created one primitive / feature and applied a boolean operation. In the Part Workbench one can bundle primitives into one boolean operation. In our case we have the cylinder, cone and cube that are all a cut boolean operation.<br />
<br />
<!--T:101--><br />
Instead of making a cut for each primitive, we can first apply a boolean union, [[Image:Part_Fuse.svg|24px|link=Part_Fuse]] '''[[Part_Fuse|Fuse]]''' the primitives intended for the boolean cut, and then make the ''cut'' between the '''Fillet''' and the '''Fusion'''.<br />
<br />
<!--T:93--><br />
Using this approach, the Tree view ends up looking like below, which is just a different way of building the same model. Compare this with the original Tree view, none is better than the other, however when making more complex models, one approach over the other can have benefits in ease of modifying/reorganizing the model if needed.<br />
<br />
</translate><br />
[[Image:T101pwb08-02_fused.png|center]]<br />
<translate><br />
<br />
==Wrapping up== <!--T:94--><br />
<br />
<!--T:95--><br />
Having gone through the tutorial you are now briefly acquainted with the user interface of FreeCAD and you have learned the basics in using the '''Part Workbench'''. You should now be able to build simple models after your own liking. The '''Part Workbench''' is one of the workbenches that can be used to create solids, the '''PartDesign Workbench''' is another. The different workbenches have different capabilities and workflows. Learning FreeCAD in full, especially considering all add-ons and macros takes years, so keep on exploring new and different ways of making models – take different tutorials on the wiki, the learning never stops when working with FreeCAD. It is suggested that you learn ''sketches'' and the '''PartDesign Workbench''' next if your focus is on creating solids. If your focus is modelling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
<br />
<!--T:96--><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving the documentation.<br />
<br />
<br />
</translate><br />
[[Category:Part{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=File:T101pwb01-141_toolbars.png&diff=1167303File:T101pwb01-141 toolbars.png2022-08-01T14:03:24Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Macro_BSurf_from_grid&diff=1167182Macro BSurf from grid2022-07-31T20:42:41Z<p>Heda: /* Description */</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{Macro<br />
|Name=BSurf_from_grid<br />
|Icon=<br />
|Description=Makes a BSpline surface through a grid of points.<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-07-31<br />
|FCVersion=<br />
|Download=<br />
}}<br />
<br />
==Description==<br />
<br />
Makes a BSpline surface through a grid of points. Options for only creating Wire or BSpline curves.<br />
<br />
</translate><br />
[[File:Macro_BSurf_from_grid_example.png]]<br />
<translate><br />
{{Caption|Macro BSurf from grid}}<br />
<br />
== Installation ==<br />
<br />
Available in the [[Std AddonMgr|Addon manager]].<br />
<br />
== Options ==<br />
<br />
See docstring.<br />
<br />
== Usage ==<br />
<br />
See docstring.<br />
<br />
==Script==<br />
<br />
</translate><br />
<br />
'''Macro_BSurf_from_grid.FCMacro'''<br />
<br />
<!--DO NOT CHANGE THE <pre> </pre> TAG, code contains pipe or space character which breaks the wiki macro--><br />
<pre><br />
<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * *<br />
# * Copyright (c) 2022 - heda <heda@fc-forum> *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
__Name__ = 'BSurf_from_grid'<br />
__Comment__ = 'Makes a BSpline surface through a grid of points.'<br />
__Author__ = 'heda'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-07-31'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Grid_2_BSurf'<br />
__Icon__ = ''<br />
__Help__ = 'Select structured point-cloud, set options, run macro'<br />
__Status__ = 'functional'<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
"""<br />
inspired by:<br />
https://forum.freecadweb.org/viewtopic.php?f=22&t=69941&start=10<br />
cred to snow54<br />
<br />
it is assumed that the cloud is:<br />
- structured<br />
- aligned with xy grid,<br />
i.e. a constant y divides 2 horizontal rows of points,<br />
analogue for x and vertical columns of points<br />
<br />
<br />
usage:<br />
select a pointcloud and run macro <br />
<br />
options:<br />
wires: convert boundary wires to spline (draft wb),<br />
in surf wb, use boundry edges and verts on wires as vertex-constraints<br />
<br />
splines: in surf wb, use outer contour as boundry edges,<br />
inner edges can be used as edge constraints<br />
<br />
bsurf: surface directly created with poles/knots from interpolated spline<br />
<br />
mkwframe: in case of bsurf, symbolic wireframe of splines (draft wb)<br />
"""<br />
<br />
import numpy as np<br />
from scipy import interpolate<br />
<br />
import FreeCAD as App<br />
import FreeCADGui as Gui<br />
import Draft, Part<br />
<br />
Vector = App.Vector<br />
<br />
doc = App.ActiveDocument<br />
<br />
try:<br />
cloud, = Gui.Selection.getSelection()<br />
except ValueError as e:<br />
raise RuntimeWarning('a point cloud needs to be selected.')<br />
<br />
points = cloud.Points.Points<br />
bb = cloud.Points.BoundBox<br />
<br />
options = o = dict(MakeWires=False,<br />
MakeBSplines=False,<br />
MakeBSurf=True,<br />
MakeWFrame=True)<br />
<br />
## a bit of options logic...<br />
if o['MakeWires']: o['MakeBSplines'] = False<br />
if o['MakeBSplines']: o['MakeBSurf'] = o['MakeWires'] = False<br />
if o['MakeBSurf'] and o['MakeWFrame']:<br />
o['MakeBSplines'] = True; o['MakeWires'] = False<br />
if not o['MakeBSurf']: o['MakeWFrame'] = False<br />
<br />
<br />
def RGB(*args):<br />
return tuple((float(i/255) for i in args))<br />
<br />
<br />
hstep = min((p.y for p in points))<br />
vstep = min((p.x for p in points))<br />
<br />
wiregroup = doc.addObject('App::DocumentObjectGroup', 'Wires')<br />
hwires = doc.addObject('App::DocumentObjectGroup', 'HWires')<br />
vwires = doc.addObject('App::DocumentObjectGroup', 'VWires')<br />
wiregroup.addObjects([hwires, vwires])<br />
<br />
for wg, step, getter in ((hwires, hstep, 'y'),<br />
(vwires, vstep, 'x')):<br />
wires = list()<br />
empty = False<br />
cc = bb.YMin if getter == 'y' else bb.XMin<br />
cc -= step/2<br />
while not empty:<br />
polypoints = list()<br />
for pt in points:<br />
value = getattr(pt, getter)<br />
if cc < value < cc + step:<br />
polypoints.append(pt)<br />
if polypoints:<br />
if o['MakeWires'] or (o['MakeBSurf'] and not o['MakeWFrame']):<br />
maker = Draft.make_wire<br />
elif o['MakeBSplines']:<br />
maker = Draft.make_bspline<br />
wires.append(maker(polypoints, closed=False))<br />
cc += step<br />
else:<br />
empty = True<br />
<br />
wg.addObjects(wires)<br />
<br />
Gui.Selection.clearSelection()<br />
<br />
if o['MakeBSurf']:<br />
degree_u = degree_v = 3<br />
periodic = False<br />
<br />
lowerx, lowery = hwires.Group[0], vwires.Group[0]<br />
x = np.array([pt.x for pt in lowerx.Points])<br />
y = np.array([pt.y for pt in lowery.Points])<br />
Z = np.array([[pt.z for pt in hw.Points] for hw in hwires.Group])<br />
<br />
## Create spline surface<br />
g = interpolate.RectBivariateSpline(x, y, Z.T)<br />
coefgs = g.get_coeffs()<br />
coefgs = np.reshape(coefgs, Z.T.shape).T<br />
knots = g.get_knots()<br />
# Convert knot vector format<br />
knot_u, mult_u = np.unique(knots[1], return_counts=True)<br />
knot_v, mult_v = np.unique(knots[0], return_counts=True)<br />
# Normalize knot vectors<br />
knot_u = (knot_u - knot_u.min()) / (knot_u.max() - knot_u.min())<br />
knot_v = (knot_v - knot_v.min()) / (knot_v.max() - knot_v.min())<br />
<br />
# Calculate spline coefficients for x and y<br />
gx = interpolate.make_interp_spline(x, x)<br />
coefgx = gx.tck[1]<br />
gy = interpolate.make_interp_spline(y, y)<br />
coefgy = gy.tck[1]<br />
<br />
getVector = lambda iz, jz: Vector(coefgx[jz],<br />
coefgy[iz],<br />
coefgs[iz, jz])<br />
<br />
# Create control point vectors<br />
ctrl = [[getVector(iZ, jZ) for jZ, lc in enumerate(lr)]<br />
for iZ, lr in enumerate(coefgs)]<br />
<br />
# Create spline surface in FreeCAD<br />
bs = Part.BSplineSurface()<br />
bs.buildFromPolesMultsKnots(ctrl, mult_u, mult_v, knot_u, knot_v,<br />
periodic, periodic, degree_u, degree_v)<br />
<br />
surf = Part.show(bs.toShape(), 'BSplineSurf')<br />
surf.Label2 = 'spline surface through points'<br />
surf.ViewObject.ShapeColor = RGB(0, 170, 255)<br />
<br />
if not o['MakeWFrame']:<br />
for obj in hwires.Group + vwires.Group + [hwires, vwires, wiregroup]:<br />
doc.removeObject(obj.Name)<br />
<br />
<br />
doc.recompute()<br />
<br />
av = Gui.ActiveDocument.ActiveView<br />
av.viewIsometric()<br />
av.fitAll()<br />
<br />
</pre></div>Hedahttps://wiki.freecad.org/index.php?title=Macros_recipes&diff=1167181Macros recipes2022-07-31T20:41:12Z<p>Heda: </p>
<hr />
<div><languages/><br />
<br />
{|class="fcinfobox wikitable ct" height=100% style="width: 230px; float: right; margin-left: 1em" |<br />
| class="ctTitle" style="font-weight: bold; font-size: 125%;" | [[Image:Text-x-python.png|32px]] Macros<br />
|-<br />
| class="ctToc"|<br/>__TOC__<br />
|}<br />
<translate><br />
<br />
<!--T:95--><br />
This page lists [[Macros|macros]] that can add functionality to a FreeCAD installation.<br />
<br />
<!--T:158--><br />
If you have written a macro and want to include it in one of the categories on this page, then go to [[Macro_documentation|Macro documentation]] to learn more about properly documenting a macro.<br />
<br />
== Categories == <!--T:96--><br />
<br />
</translate><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_CheckGeometry.svg|32px]] 3D View operations=== <!--T:97--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:170--><br />
* {{MacroLink|Icon=Macro_Align_Face_Object_to_View.png|Macro_Align_Face_Object_to_View|Macro Align Face Object to View}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:171--><br />
* {{MacroLink|Icon=Macro_Align_View_to_Face.png|Macro_Align_View_to_Face|Macro Align View to Face}}: This macro aligns the current view to a selected face.<br />
<br />
<!--T:172--><br />
* {{MacroLink|Icon=Macro_Copy3DViewToClipboard.png|Macro_Copy3DViewToClipboard|Macro Copy3DViewToClipboard}}: Copy contents of 3DView resized 640, 480 px to clipboard.<br />
<br />
<!--T:173--><br />
* {{MacroLink|Icon=FCCamera_00.png|Macro_FCCamera|Macro FCCamera}}: This macro can rotate the screen in a defined angle and the defined axis and creates a plan to face the screen to create a form in the specified plan positions the selected face facing the screen, to detect the position of the camera.<br />
<br />
<!--T:174--><br />
* {{MacroLink|Icon=Macro_Mouse_Cross.png|Macro_Mouse_Cross|Macro Mouse Cross}}: This small macro turns the arrow of the mouse in a precision cross.<br />
<br />
<!--T:175--><br />
* {{MacroLink|Icon=Macro_Rotate_View_view_90_Degrees.png|Macro_Rotate_View|Macro Rotate View}}: This macro rotates the current view by 90° to the left. Only works if you are in [[Image:View-top.svg|Std_ViewTop|16px|link=Std_ViewTop]] [[Std_ViewTop|XY (top)]] view.<br />
<br />
<!--T:176--><br />
* {{MacroLink|Icon=Text_console_python.png|Macro_Rotate_View_Free|Macro Rotate View Free}}: This macro is used in the Python console and rotates the current view in the angle and plane given.<br />
<br />
<!--T:177--><br />
* {{MacroLink|Icon=Macro_Rotate_View_with_Y_pointing_upwards_.png|Macro_Rotate_ViewAxonometric|Macro Rotate ViewAxonometric}}: This macro rotates the current view in View Axonometric.<br />
<br />
<!--T:178--><br />
* {{MacroLink|Icon=Macro_Screen_Wiki.png|Macro_Screen_Wiki|Macro Screen Wiki}}: This macro allows to save the 3D view in the desired format. The 3D view or the full 3D window of FreeCAD takes the desired dimensions.<br />
<br />
<!--T:179--><br />
* {{MacroLink|Icon=Snip.png|Macro_Snip|Macro Snip}}: Easily post screenshots to the FreeCAD forum.<br />
<br />
<!--T:180--><br />
* {{MacroLink|Icon=Macro_View_Rotation.png|Macro_View_Rotation|Macro View Rotation}}: Provides a GUI to permit rotation of view by precise amounts in all three directions.<br />
<br />
<!--T:181--><br />
* {{MacroLink|Icon=Zoom1_1.svg|Macro_Zoom1_1|Macro Zoom 1:1}}: 1:1 Zoom so objects appear their actual size on the screen.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_FlipDimension.svg|32px]] Animation=== <!--T:99--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:182--><br />
* {{MacroLink|Icon=Macro_Animated_Constrain.png|Macro_Animated_Constrain|Macro Animated Constrain}}: Animate angle constrain in sketcher.<br />
<br />
<!--T:183--><br />
* {{MacroLink|Icon=Animator.svg|Macro_Animator|Macro Animator}}: Animate your model by animating its properties with this feature Python object.<br />
<br />
<!--T:184--><br />
* {{MacroLink|Icon=Macro_Assemblage_Imprimante_3D.png|Macro_Assemblage_Imprimante_3D|Macro Assemblage Imprimante 3D}}: Simulation of movements of a 3D printer.<br />
<br />
<!--T:185--><br />
* {{MacroLink|Icon=Macro_Assembly.png|Macro_Assembly|Macro Assembly}}: Assembly animate.<br />
<br />
<!--T:186--><br />
* {{MacroLink|Icon=Macro_Constraint_Draft.png|Macro_Constraint_Draft|Macro Constraint Draft}}: Simple example animation Draft wires by use the Expressions for associate many wires and simulate or verify the movement. Here the circle rotation create the movement for all objects connected (This macro run with FreeCAD version 0.16).<br />
<br />
<!--T:187--><br />
* {{MacroLink|Icon=Macro_crank_simul.png|Macro_crank_simul|Macro crank simul}}: Rotation rod and piston.<br />
<br />
<!--T:188--><br />
* {{MacroLink|Icon=Macro_hinge.png|Macro_hinge|Macro hinge}}: Open and close hinge.<br />
<br />
<!--T:189--><br />
* {{MacroLink|Icon=Macro_Spring.png|Macro_Spring|Macro Spring}}: Simulation of one spring.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Applications-python.svg|32px]] Code and scripting=== <!--T:101--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:190--><br />
* {{MacroLink|Icon=Macro_Build_Utility.png|Macro_Build_Utility|Macro Build Utility}}: This macro provides a utility to assemble a project from sub-project files using the Merge Project facility.<br />
<br />
<!--T:191--><br />
* {{MacroLink|Icon=Macro_clone_explicit.png|Macro_clone_explicit|Macro clone explicit}}: Creates a copy of each selected object and sets its properties to an expression linking to the original object, making it an explicit and editable clone.<br />
<br />
<!--T:192--><br />
* {{MacroLink|Icon=Editor_Assistant_Icon.svg|Macro_Editor_Assistant|Macro Editor Assistant}}: Extends the capabilities of FreeCAD's integrated Python editor.<br />
<br />
<!--T:193--><br />
* {{MacroLink|Icon=Macro_Global_Variable_Watcher.png|Macro_Global_Variable_Watcher|Macro Global Variable Watcher}}: This macro facilitates the user selecting global variables and monitoring their values.<br />
<br />
<!--T:194--><br />
* {{MacroLink|Icon=Macro_MessageBox.png|Macro_MessageBox|Macro MessageBox}}: Shows how to give information to the user through the GUI.<br />
<br />
<!--T:195--><br />
* {{MacroLink|Icon=Macro_Print_SceneGraph.png|Macro_Print_SceneGraph|Macro Print SceneGraph}}: Prints the SceneGraph.<br />
<br />
<!--T:196--><br />
* {{MacroLink|Icon=Macro_Python_Assistant_Window.png|Macro_Python_Assistant_Window|Macro Python Assistant Window}}: This macro provides a cut/copy/paste workspace for Python code, it is segmented so different sections can be selected and it is persistent between FreeCAD sessions.<br />
<br />
</translate><br />
<!--THIS MACRO "Macro ZTest Over 128" SHOULD NOT BE TRANSLATED--><br />
* {{MacroLink|Icon=Macro_ZTest_Over_128.png|Macro_ZTest_Over_128|Macro ZTest Over 128}}: This macro is only used by programmers Test characters ASCII over 127.<br />
<translate><br />
<br />
<!--T:197--><br />
* {{MacroLink|Icon=MEPlan.png|Qt_Example|Qt Example}}: Example of using Qt commands, their connections, extraction and data assignment.<br />
<br />
<!--T:198--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/scanObjects scanObjects]: Inspection tool for FreeCAD macro development and project debug.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_MeshToShape.svg|32px]] Conversion=== <!--T:103--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:199--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_3DXML_import|Macro 3DXML import}}: Imports a 3DXML-ascii file into FreeCAD, limited functionality.<br />
<br />
<!--T:200--><br />
* {{MacroLink|Icon=Macro_Compound_Plus.png|Macro_Compound_Plus|Macro Compound Plus}}: Draft command set in a small macro for the 2D sketch example: work with the DXF files.<br />
<br />
<!--T:201--><br />
* {{MacroLink|Icon=Macro_Creating_faces_from_a_DXF_file.png|Macro_Creating_faces_from_a_DXF_file|Macro Creating faces from a DXF file}}: This macro create face from a DXF file, the "Layer" are recognized separate and trained in groups.<br />
<br />
<!--T:202--><br />
* {{MacroLink|Icon=Macro_DeepCopy.png|Macro_DeepCopy|Macro DeepCopy}}: Make a compound out of a part with a copy of all its shapes.<br />
<br />
<!--T:203--><br />
* {{MacroLink|Icon=Macro_DXF_to_Face_and_Sketch.png|Macro_DXF_to_Face_and_Sketch|Macro DXF to Face and Sketch}}: This macro converts selected elements of imported DXF file to face and sketch.<br />
<br />
<!--T:204--><br />
* {{MacroLink|Icon=Macro_Dxf_To_Shape.png|Macro_Dxf_To_Shape|Macro Dxf To Shape}}: Macro utility for create unique wire with many wires, the type wire created is selected to MakeWire, Bspline, BsplineCurve, BsplineCurve + Arc, Polygon, Bezier curve.<br />
<br />
<!--T:205--><br />
* {{MacroLink|Icon=Macro_Extract_Wires_from_Mesh.png|Macro_Extract_Wires_from_Mesh|Macro Extract Wires from Mesh}}: Extracts boundary wires from selected meshes.<br />
<br />
<!--T:206--><br />
* {{MacroLink|Icon=Macro_FaceToSketch.png|Macro_FaceToSketch|Macro FaceToSketch}}: Converts the selected Face to a single Sketch without constraints.<br />
<br />
<!--T:207--><br />
* {{MacroLink|Icon=FCBmpImportLogo.svg|Macro_FCBmpImport|Macro FCBmpImport}}: Import Black and White BMP images into FreeCAD as sketch, wire, or solid or Grayscale BMP for lithophanes.<br />
<br />
<!--T:208--><br />
* {{MacroLink|Icon=Macro_FCWire_To_Volume.png|Macro_FCWire_To_Volume|Macro FCWire To Volume}}: This macro create boolean operation with the objects selected just select the wires give the thickness and click "Create".<br />
<br />
<!--T:209--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Iges_PyImporter|Macro Iges PyImporter}}: Imports an iges file with entity 128, for example an iges-file from FreeShip, into FreeCAD.<br />
<br />
<!--T:210--><br />
* {{MacroLink|Icon=Macro_MeshToPart.png|Macro_MeshToPart|Macro MeshToPart}}: Converts selected meshes to parts.<br />
<br />
<!--T:211--><br />
* {{MacroLink|Icon=MultiCopy-reduced.png|Macro_MultiCopy|Macro MultiCopy}}: MultiCopy allows the duplication (copy and paste) of multiple FreeCAD objects that can be labelled sequentially and in a custom manner.<br />
<br />
<!--T:212--><br />
* {{MacroLink|Icon=PartToVRML.png|Macro_PartToVRML|Macro PartToVRML}}: Converts selected parts to VRML meshes for small size and faster loading (VRML models Kicad and Blender compatible).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_Draft.svg|32px]] Draft Workbench and 2D=== <!--T:107--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:213--><br />
* {{MacroLink|Icon=Macro_Align_Camera_to_Working_Plane.png|Macro_Align_Camera_to_Working_Plane|Macro Align Camera to Working Plane}}: This macro aligns the camera to the current [[Draft_SelectPlane|Draft Working Plane]].<br />
<br />
<!--T:214--><br />
* {{MacroLink|Icon=Macro_Align_Working_Plane_to_Camera.png|Macro_Align_Working_Plane_to_Camera|Macro Align Working Plane to Camera}}: This macro moves the current [[Draft_SelectPlane|Draft Working Plane]] to the center of the current view.<br />
<br />
<!--T:215--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points|Macro Draft Circle 3 Points}}: Creates a circle from 3 selected points 2D orthogonal.<br />
<br />
<!--T:216--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Draft_Circle_3_Points_3D|Macro Draft Circle 3 Points 3D}}: Creates a circle from 3 selected points in the space 3D.<br />
<br />
<!--T:217--><br />
* {{MacroLink|Icon=Macro_EdgesToArc.png|Macro_EdgesToArc|Macro EdgesToArc}}: Converts the selected Edges to a circular Arc if possible. Useful for restoring discretized arcs.<br />
<br />
<!--T:218--><br />
* {{MacroLink|Icon=Macro_Ellipse-Center%2B2Points.png|Macro_Ellipse-Center+2Points|Macro Ellipse-Center+2Points}}: Makes an ellipse by selecting three points (in this order): center, major radius and minor radius.<br />
<br />
<!--T:219--><br />
* {{MacroLink|Icon=Macro_FCConvertLines.png|Macro_FCConvertLines|Macro FC Convert Lines}}: This macro convert the object line, wire in line Dash, DashDot, DashDotDot, ZigZag and Hand with the dimensions given.<br />
<br />
<!--T:220--><br />
* {{MacroLink|Icon=Macro_Make_Arc_3_Points.png|Macro_Make_Arc_3_Points|Macro Make Arc 3 Points}}: Creates a arc from 3 selected points.<br />
<br />
<!--T:221--><br />
* {{MacroLink|Icon=Macro_Draft_Circle_3_Points.png|Macro_Make_Circle_3_Points|Macro Make Circle 3 Points}}: Creates a circle on 3 selected points, the points can be objects (this example brings together the two examples below, all parameters simply settle on a graphic window).<br />
<br />
<!--T:222--><br />
* {{MacroLink|Icon=Macro_Rectellipse.png|Macro_Rectellipse|Macro Rectellipse}}: Creates a parametric rectellipse.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Drawing-orthoviews.svg|32px]] Drawing Workbench=== <!--T:105--><br />
<br />
<!--T:165--><br />
The [[Drawing Workbench|Drawing Workbench]] is obsolete since FreeCAD 0.17. Consider using the [[TechDraw Workbench|TechDraw Workbench]] instead.<br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:223--><br />
* {{MacroLink|Icon=Macro_Automatic_drawing.png|Macro_Automatic_drawing|Macro Automatic drawing}}: Allows the user to get the view of his object in a drawing with 4 different position (front,top,iso,right). Needs some modification to be perfectly effective.<br />
<br />
<!--T:224--><br />
* {{MacroLink|Icon=Macro_CartoucheFC.png|Macro_CartoucheFC|Macro CartoucheFC}}: This GUI macro to fill simply all fields of the cartridge of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:225--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_2.png|Macro_CartoucheFC_2|Macro CartoucheFC 2}}: This GUI macro to fill simply all fields of the cartridge '''model 2''' of the plan implementation worksheet FreeCAD.<br />
<br />
<!--T:226--><br />
* {{MacroLink|Icon=Macro_CartoucheFC_Full.png|Macro_CartoucheFC_Full|Macro CartoucheFC Full}}: This GUI macro to fill simply all fields of the cartridge [[Misc_templates_Full|Misc templates Full]] of the plan implementation worksheet FreeCAD, the format of the date and the symbol of the projection mode adapt to the EU region or US selected.<br />
<br />
<!--T:227--><br />
* {{MacroLink|Icon=Macro_Normal_Vector.png|Macro_Normal_Vector|Macro Normal Vector}}: Get the normal vector of a preselected face for creating a drawing view normal to that face.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_FEM.svg|32px]] Fem Workbench=== <!--T:109--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:228--><br />
* {{MacroLink|Icon=Text-x-python.png|Macro_export_transient_FEM_results|Macro export transient FEM results}}: This macro exports multiple FEM result objects from a transient analysis to the VTK format and generates a PVU file which can be used to load the results directly into ParaView for post-processing.<br />
<br />
<!--T:229--><br />
* {{MacroLink|Icon=Macro_GMSH.png|Macro_GMSH|Macro GMSH}}: Create FEM Meshes by GMSH Mesh Generator.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_Windows.svg|32px]] Gui=== <!--T:230--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:231--><br />
* {{MacroLink|Icon=GuiResetToolbars.svg|Macro_GuiResetToolbars|Macro GuiResetToolbars}}: This macro resets the position of the toolbars.<br />
<br />
<!--T:232--><br />
* {{MacroLink|Icon=Macro_MacroMenu.png|Macro_MacroMenu|Macro MacroMenu}}: Add the macros found in the macros folder to the Macros menu of FreeCAD.<br />
<br />
<!--T:233--><br />
* {{MacroLink|Macro_SplitPropEditor|Macro SplitPropEditor}}: Temporarily split the property editor from the combo view to a separated dock widget.<br />
<br />
<!--T:234--><br />
* {{MacroLink|Icon=Macro_Toggle_Views_Visibility.png|Macro_Toggle_Panels_Visibility|Macro Toggle Panels Visibility}}: This macro toggles the visibility of various supporting panels in FreeCAD, allowing the main window to be viewed with all available screen space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Measure_Linear.svg|32px]] Info and measurements=== <!--T:111--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:235--><br />
* {{MacroLink|Icon=BoundBoxTracing.png|Macro_BoundingBox_Tracing|Macro BoundingBox Tracing}}: This macro red trace (editable) around the BoundingBox with 6 rectangles.<br />
<br />
<!--T:236--><br />
* {{MacroLink|Icon=CenterFace.png|Macro_CenterFace|Macro CenterFace}}: This macro red trace (editable) the center face (mass) with 1 point and print the coordinates.<br />
<br />
<!--T:237--><br />
* {{MacroLink|Icon=Macro_CenterOfMass.png|Macro_CenterOfMass|Macro CenterOfMass}}: Gives the total mass and the center of mass of multiple objects selected with the density chosen.<br />
<br />
<!--T:238--><br />
* {{MacroLink|Icon=Macro_cross_section.png|Macro_cross_section|Macro cross section}}: Displays an interactively slidable cross-section.<br />
<br />
<!--T:239--><br />
* {{MacroLink|Icon=Macro_Delta_xyz.png|Macro_Delta_xyz|Macro Delta xyz}}: Gives the Delta values and the distance between 2 points.<br />
<br />
<!--T:240--><br />
* {{MacroLink|Icon=Macro_Dump_Objects.png|Macro_Dump_Objects|Macro Dump Objects}}: This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.<br />
<br />
<!--T:241--><br />
* {{MacroLink|Icon=Macro_FC_element_selector.png|Macro_FC_element_selector|Macro FC element selector}}: This macro display all elements below cursor same "Macro Mouse over cb" with GUI (elements covered by other elements will also be displayed).<br />
<br />
<!--T:242--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo|Macro FCInfo}}: Gives a series of information about the selected shape and can display a conversion of length, inclination (degrees, radian, grade) shape, surface, volume and the weight of the form in the density selected in various international and Anglo-Saxon units.<br />
<br />
<!--T:243--><br />
* {{MacroLink|Icon=FCInfo.png|Macro_FCInfo_Alternate_Linux|Macro FCInfo Alternate Linux}}: Same as above, but for Linux (obsolete).<br />
<br />
<!--T:244--><br />
* {{MacroLink|Icon=FCInfoToolBar.png|Macro_FCInfo_ToolBar|Macro FCInfo ToolBar}}: Gives a series of information about the selected shape as FCInfo in a mini ToolBar.<br />
<br />
<!--T:245--><br />
* {{MacroLink|Icon=Macro_FCInfoGlass.png|Macro_FCInfoGlass|Macro FCInfoGlass}}: Gives a series of information about the selected shape and displayed in screen 3D.<br />
<br />
<!--T:246--><br />
* {{MacroLink|Icon=FCInfoToMouse.png|Macro_FCInfoToMouse|Macro FCInfoToMouse}}: Provides informations coordinates, length and angles in real time on the mouse in a bubble annotation displayed in the 3D screen.<br />
<br />
<!--T:247--><br />
* {{MacroLink|Icon=Macro_FCTreeView.png|Macro_FCTreeView|Macro FCTreeView}}: Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label... without case sensitive or with case sensitive and select all objects displayed in the macro window.<br />
<br />
<!--T:248--><br />
* {{MacroLink|Icon=Macro_HighlightCommon.png|Macro_HighlightCommon|Macro HighlightCommon}}: Highlight common parts.<br />
<br />
<!--T:249--><br />
* {{MacroLink|Icon=HighlightDifference.png|Macro_HighlightDifference|Macro HighlightDifference}}: Compute the difference between two shapes.<br />
<br />
<!--T:250--><br />
* {{MacroLink|Icon=Macro_MeasureCircle.png|Macro_MeasureCircle|Macro MeasureCircle}}: Compute the radius of a circle by 3 points or a circular edge.<br />
<br />
<!--T:251--><br />
* {{MacroLink|Icon=Macro_Mouse_over_cb.png|Macro_Mouse_over_cb|Macro Mouse over cb}}: This macro display all elements below cursor (elements covered by other elements will also be displayed).<br />
<br />
<!--T:252--><br />
* {{MacroLink|Icon=Macro_ObjectInfo.png|Macro_ObjectInfo|Macro ObjectInfo}}: User-friendly "Info" module created by a FreeCAD user.<br />
<br />
<!--T:381--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceModel.py Macro showSpaceModel]: Allows to calculate occupied space in 3D by the full model.<br />
<br />
<!--T:382--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/showSpaceSelected.py Macro showSpaceSelected]: Allows to calculate occupied space in 3D by all selected elements.<br />
<br />
<!--T:253--><br />
* {{MacroLink|Icon=Macro_SimpleProperties.png|Macro_SimpleProperties|Macro SimpleProperties}}: Display in a concise way basic physical properties of an object (volume, bound box dimensions, ...).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Draft_VisGroup.svg|32px]] Libraries=== <!--T:113--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:254--><br />
* {{MacroLink|Icon=Macro_BOLTS.png|Macro_BOLTS|Macro BOLTS}}: The aim of BOLTS is to build a free and open-source standard parts library for CAD applications.<br />
<br />
<!--T:255--><br />
* {{MacroLink|Icon=FreeCAD_Doc.png|Macro_PartsLibrary|Macro PartsLibrary}}: Starts the Parts library browser.<br />
<br />
<!--T:256--><br />
* {{MacroLink|Icon=Macro_screw_maker1_2.png|Macro_screw_maker1_2|Macro screw maker1_2}}: This macro creates a screw with or without thread, according to ISO standards ([http://forum.freecadweb.org/viewtopic.php?f=22&t=6088#p48519 screw_maker1_6.py.zip with Pyside support]). [http://forum.freecadweb.org/viewtopic.php?f=22&t=6558&start=30#p95929 (Screw Maker 2.0 - new version!)] <br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bound-expression.svg|32px]] Mathematical functions=== <!--T:115--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:257--><br />
* {{MacroLink|Icon=Macro_3D_Parametric_Curve.png|Macro_3D_Parametric_Curve|Macro 3D Parametric Curve}}: Draw a function described by parametric equations x(t), y(t) and z(t).<br />
<br />
<!--T:258--><br />
* {{MacroLink|Icon=Macro_Draw_2D_Function.png|Macro_Draw_2D_Function|Macro Draw 2D Function}}: Draws a function described by an equation z=F(x).<br />
<br />
<!--T:259--><br />
* {{MacroLink|Icon=Macro_Draw_Parametric_2D_Function.png|Macro_Draw_Parametric_2D_Function|Macro Draw Parametric 2D Function}}: Based on the above macro, but for parametric and optionally polar.<br />
<br />
<!--T:260--><br />
* {{MacroLink|Icon=Parametric_Curve_FP.svg|Macro_Parametric_Curve_FP|Macro Parametric Curve FP}}: Feature Python update of Macro 3D Parametric Curve.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Part_Primitives.svg|32px]] Object creation=== <!--T:119--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:261--><br />
* {{MacroLink|Icon=AeroFoil.png|Macro_AeroFoil|Macro AeroFoil}}: AeroFoil creates airfoil curves and faces using pre-defined models, algebraic functions, and DAT or CSV Files.<br />
<br />
<!--T:262--><br />
* {{MacroLink|Icon=Macro_Airfoil_Import_&_Scale.png|Macro_Airfoil_Import_&_Scale|Macro Airfoil Import & Scale}}: Imports and scales a .dat airfoil to desired chord length.<br />
<br />
<!--T:263--><br />
* {{MacroLink|Icon=Part_Prism_Apothem.svg|Macro_Apothem_Based_Prism_GUI|Macro Apothem Based Prism GUI}}: A GUI dialog that creates an Apothem, (inradius) Based Prism from user input.<br />
<br />
<!--T:264--><br />
* {{MacroLink|Icon=Macro_Circle.png|Macro_circle|Macro Circle}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same above without GUI).<br />
<br />
<!--T:265--><br />
* {{MacroLink|Icon=Macro_CirclePlus.png|Macro_CirclePlus|Macro CirclePlus}}: Create a circle or arc giving radius, diameter, circumference, area, startangle, endangle, arc, anglecenter, cord, arrow, center (point) on choice (same below but with GUI) plus create sector and face.<br />
<br />
<!--T:266--><br />
* {{MacroLink|Icon=Macro_Cut_Circle.png|Macro_Cut_Circle|Macro Cut Circle}}: Cut a circle or arc and create x arcs, giving the number of cut.<br />
<br />
<!--T:267--><br />
* {{MacroLink|Icon=Macro_Cut_Line.png|Macro_Cut_Line|Macro Cut Line}}: Cut a line and create x points, giving the number of points, create line or not, create points or not, create bicolor or not on choice.<br />
<br />
<!--T:268--><br />
* {{MacroLink|Icon=Cam-groover-icon-32x32.png|Macro_FCCamGroover|Macro FCCamGroover}}: Creates grooved cylinder for cam.<br />
<br />
<!--T:269--><br />
* {{MacroLink|Icon=FCCircularTextButtom.png|Macro_FCCircularText|Macro FCCircularText}}: This macro create a text around a cylinder.<br />
<br />
<!--T:270--><br />
* {{MacroLink|Icon=FCHoneycombMakerIcon.png|Macro_FCHoneycombMaker|Macro FCHoneycombMaker}}: Creates parametric honeycomb grid.<br />
<br />
<!--T:271--><br />
* {{MacroLink|Icon=FCSpring_Helix_Variable.png|Macro_FCSpring_Helix_Variable|Macro FCSpring Helix Variable}}: This macro creates one spring truncate, the troncature is adjustable on the all coil to choice.<br />
<br />
<!--T:272--><br />
* {{MacroLink|Icon=FCSpring_On_Surface.png|Macro_FCSpring_On_Surface|Macro FCSpring On Surface}}: This macro creates one spring (helix) on the surface of the object (solide).<br />
<br />
<!--T:273--><br />
* {{MacroLink|Icon=FCCreaLoft.png|Macro_Loft|Macro Loft}}: Create a loft with a list of wire (specially created for [[Macro_Texture|Macro Texture]]).<br />
<br />
<!--T:274--><br />
* {{MacroLink|Icon=Macro_Geodesic_Dome.svg|Macro_Geodesic_Dome|Macro Geodesic Dome}}: This macro creates a geodesic dome shell.<br />
<br />
<!--T:275--><br />
* {{MacroLink|Icon=Macro_Guitar_fretboard.png|Macro_Guitar_fretboard|Macro Guitar fretboard}}: Guitar Fretboard Maker.<br />
<br />
<!--T:276--><br />
* {{MacroLink|Icon=Macro_Guitar_Nut.png|Macro_Guitar_Nut|Macro Guitar Nut}}: Guitar Nut Maker.<br />
<br />
<!--T:277--><br />
* {{MacroLink|Icon=Hilbert_curve_icon.png|Macro_HilbertCurve|Macro HilbertCurve}}: Creates an Hilbert curve wire in 2 or 3 dimensions with many iterations.<br />
<br />
<!--T:278--><br />
* {{MacroLink|Icon=Macro_Honeycomb.svg|Macro_Honeycomb|Macro Honeycomb}}: Creates a feature Python Honeycomb object compatible in and out of PartDesign.<br />
<br />
<!--T:279--><br />
* {{MacroLink|Icon=ImportAirfoil.svg|Macro_ImportAirfoil|Macro ImportAirfoil}}: Airfoil coordinates import, then scale the airfoil, rotate, translate in the plane, translate along the span, select the plane and the main axis, and turn the geometry into a sketch.<br />
<br />
<!--T:280--><br />
* {{MacroLink|Icon=Intersection_Icon.svg|Macro_Intersection|Macro Intersection}}: Finds the intersection between 2 or 3 selected edges/faces, works with Datum Planes and Datum Lines also. Creates a parametric feature Python object containing the shape of the intersection.<br />
<br />
<!--T:281--><br />
* {{MacroLink|Icon=Macro_Line_Length.png|Macro_Line_Length|Macro Line Length}}: Create a line giving coordinate XYZ length and angle to plane X Y.<br />
<br />
<!--T:282--><br />
* {{MacroLink|Icon=Macro_makeCube.png|Macro_Make_Cube|Macro Make Cube}}: Creates a [http://en.wikipedia.org/wiki/Cuboid rectangular cuboid] from 4 points.<br />
<br />
<!--T:283--><br />
* {{MacroLink|Icon=Dodecahedron.svg|Macro_Polyhedrons|Macro Polyhedrons}}: This macro creates parametric polyhedrons (dodecahedron, icosahedron, tetrahedron, ...). Customizable via radius or side.<br />
<br />
<!--T:284--><br />
* {{MacroLink|Icon=Pyramidicon.svg|Macro_Pyramid|Macro Pyramid}}: This macro creates a parametric pyramid. All parameters are customizable just like with Part Cone.<br />
<br />
<!--T:285--><br />
* {{MacroLink|Icon=Macro_ReproWire.png|Macro_Repro_Wire|Macro Repro Wire}}: This macro reproduces all element selected subobject wire or face.<br />
<br />
<!--T:286--><br />
* {{MacroLink|Icon=Macro_Site_From_Contours.png|Macro_Site_From_Contours|Macro Site From Contours}}: Creates an Arch Site from a series of contour lines.<br />
<br />
<!--T:287--><br />
* {{MacroLink|Icon=Macro_Solid_Sweep.png|Macro_Solid_Sweep|Macro Solid Sweep}}: Creates a solid by sweeping a 2D profile along a trajectory previously selected in the 3D view. The 2D elements can be created through the regular tools in FreeCAD's GUI.<br />
<br />
<!--T:288--><br />
* {{MacroLink|Icon=Macro_Triangle_AH.png|Macro_Triangle_AH|Macro Triangle AH}}: This macro creates a triangle by giving the head angle and the height of the triangle (the head of the triangle is positioned to the xyz coordinates 0.0).<br />
<br />
<!--T:289--><br />
* {{MacroLink|Icon=Macro_WireXYZ.png|Macro_WireXYZ|Macro WireXYZ}}: This macro creates a Wire with the coordinates extracted from a file. The coordinates X Y Z are separated by a space.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_TransformManip.svg|32px]] Object transformation=== <!--T:121--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:290--><br />
* {{MacroLink|Icon=Macro_Align_Object_to_View.png|Macro_Align_Object_to_View|Macro Align Object to View}}: This macro align the selected object to the current View and set the coordinates Placement of the camera.<br />
<br />
<!--T:291--><br />
* {{MacroLink|Icon=Macro_ArrayCopy.png|Macro_ArrayCopy|Macro ArrayCopy}}: Copies the selected object several times, on an array grid.<br />
<br />
<!--T:292--><br />
* {{MacroLink|Icon=Bevel.svg|Macro_Bevel|Macro Bevel}}: Bevels selected vertices, creates parametric feature Python object, compatible with all solids (except with round edges) including features in Part Design bodies.<br />
<br />
<!--T:293--><br />
* {{MacroLink|Icon=Macro_Center_Align_Objects_with_Faces_or_Edges.png|Macro_Center_Align_Objects_with_Faces_or_Edges|Macro Center Align Objects with Faces or Edges}}: This macro covers the following constraints: Concentric constraint among non cylindrical parts; and Constraint on center Faces and/or Edges. It works also with the new Body and App::Part containers, as well as with STEP hierarchy.<br />
<br />
<!--T:294--><br />
* {{MacroLink|Icon=Macro_CloneConvert.png|Macro_CloneConvert|Macro CloneConvert}}: Creates a clone of the object and the converted in the chosen position and size (inch, mm, m, µm...). The base object is recognized in mm (FreeCAd base).<br />
<br />
<!--T:295--><br />
* {{MacroLink|Icon=Macro_Connect_And_Sweep.png|Macro_Connect_And_Sweep|Macro Connect And Sweep}}: This macro easily creates a connection between two objects, an object and a point or between two points or the selected line, wire, edge (the center of the objects are the starting and ending points of the sweep) can be selected form a configurable ellipse polygon circle.<br />
<br />
<!--T:296--><br />
* {{MacroLink|Icon=Macro_FlattenWire.png|Macro_FlattenWire|Macro FlattenWire}}: Flattens draft wires that are not planar to their median Z coordinate.<br />
<br />
<!--T:297--><br />
* {{MacroLink|Icon=Macro_FlattenWire3Points.png|Macro_FlattenWire3Points|Macro FlattenWire3Points}}: Flattens draft wires that are not planar to a plane defined by 3 points.<br />
<br />
<!--T:298--><br />
* {{MacroLink|Icon=Macro_HealArcs.png|Macro_HealArcs|Macro HealArcs}}: Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf.<br />
<br />
<!--T:299--><br />
* {{MacroLink|Icon=Image_Scaling.svg|Macro_Image_Scaling|Macro Image Scaling}}: Macro for easy scaling drawings, graphics, diagram, blueprint and similar 2D images in Image workbench.<br />
<br />
<!--T:300--><br />
* {{MacroLink|Icon=Macro_JointWire.png|Macro_JointWire|Macro JointWire}}: Allows to find and joint all non connected edge to the closest non connected one using a line.<br />
<br />
<!--T:383--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/magicAngle.py Macro magicAngle]: Small GUI for the Draft.rotate function. Allows to rotate panels and even other more complicated objects, like construction profiles.<br />
<br />
<!--T:301--><br />
* {{MacroLink|Icon=Macro_MatrixTransform.png|Macro_MatrixTransform|Macro MatrixTransform}}: Apply linear space transformations to distort shapes. E.g., non-uniform scaling, shearing, mirroring, axes swapping.<br />
<br />
<!--T:302--><br />
* {{MacroLink|Icon=Centericon.png|Macro_MoveToOrigin|Macro Move to Origin}}: This macro translates the Placement of an object so that a selected location becomes its new origin.<br />
<br />
<!--T:303--><br />
* {{MacroLink|Icon=Macro_Overlap.png|Macro_Overlap|Macro Overlap}}: Boolean operation. Similar to [[Part_Common|Part Common]], but with custom overlap count threshold (parametric).<br />
<br />
<!--T:304--><br />
* {{MacroLink|Icon=parametric_defeaturing.svg|Macro_Parametric_Defeaturing|Macro Parametric Defeaturing}}: Macro that provides parametric defeaturing inside and outside the [[PartDesign_Workbench|PartDesign Workbench]].<br />
<br />
<!--T:305--><br />
* {{MacroLink|Icon=Macro_Perpendicular_To_Wire.png|Macro_Perpendicular_To_Wire|Macro Perpendicular To Wire}}: This macro positions an object perpendicularl to a selected wire.<br />
<br />
<!--T:306--><br />
* {{MacroLink|Icon=Macro_PlacementAbsolufy.png|Macro_PlacementAbsolufy|Macro PlacementAbsolufy}}: Reset Part containers to global origin while maintaining objects absolute position.<br />
<br />
<!--T:307--><br />
* {{MacroLink|Icon=Macro_Remove_parametric_history.png|Macro_Remove_parametric_history|Macro Remove parametric history}}: Removes all parametric associativity from an object, leaving it as a "dumb" shape.<br />
<br />
<!--T:308--><br />
* {{MacroLink|Icon=Macro_Rotate_To_Point.png|Macro_Rotate_To_Point|Macro Rotate To Point}}: Macro to rotate an object around the center of its boundbox, its center of mass, or the last clicked point.<br />
<br />
<!--T:309--><br />
* {{MacroLink|Icon=Part_Section.png|Macro_Section|Macro Section}}: Alternative implementation of Part Section tool, more suitable for making sweep paths (parametric).<br />
<br />
<!--T:310--><br />
* {{MacroLink|Icon=Macro_StraightenObject.png|Macro_StraightenObject|Macro StraightenObject}}: Re-align object(s) with FreeCAD coordinate system according reference face/edge.<br />
<br />
<!--T:311--><br />
* {{MacroLink|Icon=Macro_SuperWire.png|Macro_SuperWire|Macro SuperWire}}: Forces the creation of a Wire from lines and arcs that don't necessarily touch each other. Use this if normal wire operation fails.<br />
<br />
<!--T:312--><br />
* {{MacroLink|Icon=Wirefilter.svg|Macro_WireFilter|Macro WireFilter}}: Filter wires from a sketch to only use certain ones, also 2D offsets, scales, rearranges wire order.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Part_FaceColors.svg|32px]] Object visibility, view properties and textures === <!--T:313--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:314--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/colorManager.py colorManager]: Allows to set face colors for all objects from a spreadsheet. Also you can browse colors for a manually selected face or object and see the effect in the 3D model in real-time.<br />
<br />
<!--T:315--><br />
* {{MacroLink|Icon=Workbench_Image.svg|Macro_Colorize|Macro Colorize}}: Easily set colors of faces, edges, and vertices, including individual transparency levels.<br />
<br />
<!--T:316--><br />
* {{MacroLink|Icon=Macro_HiddenAlls.png|Macro_HiddenAlls|Macro Hidden Alls objects}}: This macro check hidden all object in the document (Visibility=False).<br />
<br />
<!--T:317--><br />
* {{MacroLink|Icon=FCTexture.png|Macro_Texture|Macro Texture}}: Create a project from a bmp image to create a texture easily.<br />
<br />
<!--T:318--><br />
* {{MacroLink|Icon=Macro_Texture_Objects.png|Macro_Texture_Objects|Macro Texture Objects}}: This macro allows you to temporarily put a texture image on the selected objects.<br />
<br />
<!--T:319--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle.png|Macro_Toggle_Drawstyle|Macro Toggle Drawstyle}}: This macro toggles the Drawstyle of the selected object.<br />
<br />
<!--T:320--><br />
* {{MacroLink|Icon=Macro_Toggle_Drawstyle_Optimized.png|Macro_Toggle_Drawstyle_Optimized|Macro Toggle Drawstyle Optimized}}: This macro toggles the Drawstyle of the selected object (same as Macro Toggle Drawstyle above but optimized for all languages).<br />
<br />
<!--T:321--><br />
* {{MacroLink|Icon=Macro_SelectVisible.png|Macro_Toggle_Visibility|Macro Toggle Visibility}}: Set of three macro, macro '''1:''' hidden the objects not selected, macro '''2:''' displayed alls objects, macro '''3:''' hidden alls objects.<br />
<br />
<!--T:322--><br />
* {{MacroLink|Icon=Macro_SelectVisible2.png|Macro_Toggle_Visibility2_1-2|Macro Toggle Visibility2 1-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:323--><br />
* {{MacroLink|Icon=Macro_VisibleAlls2.png|Macro_Toggle_Visibility2_2-2|Macro Toggle Visibility2 2-2}}: Set of two macro, macro '''1:Macro_Toggle_Visibility2_1-2''' hidden the objects not selected, macro '''2:Macro_Toggle_Visibility2_2-2''' displayed alls objects, macro with the original visibility.<br />
<br />
<!--T:324--><br />
* {{MacroLink|Icon=Macro_VisibleAlls.png|Macro_VisibleAlls|Macro Visible Alls objects}}: This macro check visible all object in the document (Visibility=True).<br />
<br />
<!--T:325--><br />
* {{MacroLink|Icon=Macro_Visibility_Manager.png|Macro_Visibility_Manager|Macro Visibility Manager}}: Manage visibility of document objects by type or individually.<br />
<br />
<!--T:326--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/setTextures setTextures]: Allows to permanently store the URL of textures in a FreeCAD project and load stored textures.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Workbench_PartDesign.svg|32px]] PartDesign Workbench=== <!--T:166--><br />
<br />
</translate><br />
<br />
<div class = "mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:167--><br />
* {{MacroLink|Icon=Workbench_PartDesign.svg|Macro_PDWrapper|Macro PDWrapper}}: Encapsulates non-PartDesign solids for use in PartDesign Bodies, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:View.svg|32px]] Printer 3D=== <!--T:123--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:327--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer.png|Macro_3d_Printer_Slicer|Macro 3d Printer Slicer}}: Exports current design to slicer software or CAM software.<br />
<br />
<!--T:328--><br />
* {{MacroLink|Icon=Macro_3d_Printer_Slicer_Individual_Parts.svg|Macro_3d_Printer_Slicer_Individual_Parts|Macro 3d Printer Slicer Individual Parts}}: This code, when run, will export the visible bodies at the top level (bodies deeper in the tree will be ignored) of the currently open design to individual STL files, and open them it in the slicing software that you use. This macro will look for Cura as the default but you can change it to any other slicer by changing the SLICERAPP variable in the source code.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Preferences-raytracing.svg|32px]] Raytracing=== <!--T:125--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:126--><br />
* {{MacroLink|Icon=Macro_FreeCAD_to_Kerkythea.png|Macro_FreeCAD_to_Kerkythea|Macro FreeCAD to Kerkythea}}: Export from FreeCAD to Kerkythea.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Spreadsheet.svg|32px]] Spreadsheet Workbench=== <!--T:127--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:329--><br />
* {{MacroLink|Icon=aliasmanager_icon.png|Macro_Alias_Manager|Macro Alias Manager}}: Helps managing aliases inside FreeCAD Spreadsheet workbench. It is able to create, delete, move aliases and create a 'part family' group of files.<br />
<br />
<!--T:330--><br />
* {{MacroLink|Icon=easy-alias-icon.png|Macro_EasyAlias|Macro EasyAlias}}: Quickly create aliases in FreeCAD Spreadsheet workbench. It uses the labels from one column to create aliases for adjacent cells in the next column to the right, e.g. labels from Column A become aliases for the cells in Column B.<br />
<br />
<!--T:331--><br />
* {{MacroLink|Icon=Macro_FCSpreadsheet_Extract.png|Macro_FCSpreadSheet_Extract|Macro FCSpreadSheet Extract}}: This macro save the data in a csv file with the formula or in a xml file.<br />
<br />
<!--T:332--><br />
* {{MacroLink|Icon=Macro_SpreadsheetTools.png|Macro_SpreadsheetTools|Macro Spreadsheet Tools}}: This macro helps managing cells inside FreeCAD Spreadsheet workbench.<br />
<br />
<!--T:333--><br />
* {{MacroLink|Icon=Applications-python.svg|Macro_Spreadsheet2html|Macro Spreadsheet2html}}: Exports a spreadsheet as styled html. Intended as support in transfering data to office suits.<br />
<br />
<!--T:334--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/sheet2export sheet2export]: Allows to export FreeCAD spreadsheet to file formats (.md, .html, .csv, .json).<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Arch_Survey.svg|32px]] Utility=== <!--T:129--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:335--><br />
* {{MacroLink|Icon=Macro_Arch_Axis_System_Repartition.png|Macro_Arch_Axis_System_Repartition|Macro Arch Axis System Repartition}}: This macro help you to create an Arch Axis System along a line with a set of parameters.<br />
<br />
<!--T:336--><br />
* {{MacroLink|Icon=Macro_Duplicate_Selection.png|Macro_Duplicate_Selection|Macro Duplicate Selection}}: This macro testing if one selection are duplicate, select the object IN THE 3D VIEW the "ForbiddenCursor" stay if the or one selection is duplicate, the macro stay resident.<br />
<br />
<!--T:337--><br />
* {{MacroLink|Icon=Macro_Easy_Cutouts_for_Enclosures.png|Macro_Easy_cutouts_for_Enclosure_Design|Macro Easy cutouts for Enclosure Design}}: This macro makes Cutouts for Enclosures in a very handy way.<br />
<br />
<!--T:338--><br />
* {{MacroLink|Icon=Macro_ExpandTreeItem.png|Macro_ExpandTreeItem|Macro ExpandTreeItem}}: This macro expand selected items in the tree view. If not selection all item are expand/collapse.<br />
<br />
<!--T:339--><br />
* {{MacroLink|Icon=Macro_findConfigFiles.png|Macro_findConfigFiles|Macro findConfigFiles}}: Finds user config files system.cfg and user.cfg, copies folder location to system clipboard, instructs user on renaming these files in order to reset FreeCAD settings, and opens folder with default file browser.<br />
<br />
<!--T:340--><br />
* {{MacroLink|Icon=Force_Recompute.png|Macro_ForceRecompute|Macro ForceRecompute}}: Forces manual recompute of model.<br />
<br />
<!--T:341--><br />
* {{MacroLink|Icon=Macro_If_Selected_Stay_If_Not_Then_Delete.png|Macro_If_Selected_Stay_If_Not_Then_Delete|Macro If Selected Stay If Not Then Delete}}: All object not selected are deleted!<br />
<br />
<!--T:342--><br />
* {{MacroLink|Macro_ImperialScales|Macro ImperialScales}}: Shows a list of US Imperial Arch scales list with the corresponding factor to apply to TechDraw pages or views.<br />
<br />
<!--T:343--><br />
* {{MacroLink|Icon=Macro_merge_duplicate_materials.png|Macro_merge_duplicate_materials|Macro merge duplicate materials}}: Merges materials that have the same base name (with different numeral endings like 001, 002,...) into one.<br />
<br />
<!--T:384--><br />
* {{MacroLink|Icon=Pcbway.png|Macro_PCBWay|Macro PCBWay}}: Sends a selected object to [https://pcbway.com PCBWay] for manufacturing through CNC milling, laser cutting or 3D printing.<br />
<br />
<!--T:344--><br />
* {{MacroLink|Icon=Pinger_Icon.svg|Macro_Pinger|Macro Pinger}}: Ping users on the forum with ease.<br />
<br />
<!--T:345--><br />
* {{MacroLink|Icon=Macro_Recompute_Profiler.png|Macro_Recompute_Profiler|Macro Recompute Profiler}}: Measures time it takes to recompute each object in a project.<br />
<br />
<!--T:346--><br />
* {{MacroLink|Icon=Replace_Part.png|Macro_Replace_Part_in_Assembly|Macro Replace Part in Assembly}}: Replaces a part (simple copy) in an "Assembly" with another Part (simple copy).<br />
<br />
<!--T:347--><br />
* {{MacroLink|Icon=Macro_Select_Hovering.png|Macro_Select_Hovering|Macro Select Hovering}}: This macro select a choice Face, Edge, Vertex hovering by the mouse.<br />
<br />
<!--T:348--><br />
* {{MacroLink|Icon=SelectVisible.png|Macro_SelectVisible|Macro SelectVisible}}: All visible objects in the tree will be selected.<br />
<br />
<!--T:349--><br />
* {{MacroLink|Icon=Macro_Shake_Sketch.png|Macro_Shake_Sketch|Macro Shake Sketch}}: Shake a sketch in order to discover its unconstrained parts.<br />
<br />
<!--T:350--><br />
* {{MacroLink|Icon=SketchUnmap.svg|Macro_SketchUnmap|Macro SketchUnmap}}: Unmap a sketch from its current support and makes its placement absolute, eventually creating a locating datum plane.<br />
<br />
<!--T:351--><br />
* {{MacroLink|Macro_TreeToAscii|Macro TreeToAscii}}: Prints model tree as "ASCII art" with custom pattern & style, and export to clipboard, file or embedded document.<br />
<br />
<!--T:352--><br />
* {{MacroLink|Icon=Macro_Unbind_Numpad_Shortcuts.png|Macro_Unbind_Numpad_Shortcuts|Macro Unbind Numpad Shortcuts}}: Rebinds standard view commands from digit keys to Ctrl+digit, so that they don't spin the view by accident when entering numbers.<br />
<br />
<!--T:353--><br />
* {{MacroLink|Icon=WF_wf.png|Macro_WorkFeatures|Macro WorkFeatures}}: Tool utility to create points, axes, planes and many other useful features to facilitate the creation of your project.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Bulb.svg|32px]] Wizards=== <!--T:131--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
* {{MacroLink|Icon=Applications-python.svg|Macro_BSurf_from_grid|Macro BSurf from grid}}: Makes a BSpline surface through a grid of points.<br />
<br />
<!--T:354--><br />
* {{MacroLink|Icon=Macro_Corner_shapes_wizard.png|Macro_Corner_shapes_wizard/update|Macro Corner shapes wizard/update}}: Pops up a dialog asking for the dimensions of your corner piece, then creates the object in the document and creates a page view with top, front and lateral views of the piece.<br />
<br />
<!--T:355--><br />
* {{MacroLink|Icon=Gearworkbech.png|Macro_FCGear|Macro FCGear}}: Additional Workbench to create different types of gears, involute gear, involute rack, cycloide gear, bevel gear.<br />
<br />
<!--T:356--><br />
* {{MacroLink|Icon=Macro_Fonts_Win10_PYMP.png|Macro_Fonts_Win10_PYMP|Macro Fonts Win10 PYMP}}: This little macro is dedicate to users of Windows 10. The explorer fonts for use the [[Draft_ShapeString|ShapeString]] is empty and this little macro can help you see easily the font to use.<br />
<br />
<!--T:357--><br />
* {{MacroLink|Icon=GenerateDrawing.svg|Macro_GenerateDrawing|Macro GenerateDrawing}}: Macro for automatic drawing generation with 3 normal projections and one isometric.<br />
<br />
<!--T:358--><br />
* {{MacroLink|Icon=GenerateViews.svg|Macro_GenerateViews|Macro GenerateViews}}: Macro for automatic 2D views generation with 6 normal projections and one isometric.<br />
<br />
<!--T:359--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel|Macro Geneva Wheel}}: Allows the user to create a Geneva wheel mechanism from scratch. Must edit values within the Macro to alter the size of the object.<br />
<br />
<!--T:360--><br />
* {{MacroLink|Icon=GW_Dim.png|Macro_Geneva_Wheel_GUI|Macro Geneva Wheel GUI}}: A GUI front end that allows the user to create a Geneva wheel mechanism from scratch.<br />
<br />
<!--T:361--><br />
* {{MacroLink|Icon=Macro_Half_turn_stairs.png|Macro_Half_turn_stairs|Macro Half turn stairs}}: Creates a half turn (left/right) stair from a Data-file.<br />
<br />
<!--T:362--><br />
* {{MacroLink|Icon=Macro_Half_Hull_Model.png|Macro_Half-Hull_Model|Macro Half-Hull Model}}: This macro generates both three dimensional [http://en.wikipedia.org/wiki/Half_hull_model_ship half-hull] and full-hull models from a series of 2D line drawings.<br />
<br />
<!--T:363--><br />
* {{MacroLink|Icon=Macro_Megaminx.png|Macro_Megaminx|Macro Megaminx}}: Display a Megaminx and interactively do slice rotations.<br />
<br />
<!--T:364--><br />
* {{MacroLink|Icon=PropertyMemo.png|Macro_PropertyMemo|Macro PropertyMemo}}: This little macro create one Property additional (memo or other text) for you object (only Draft).<br />
<br />
<!--T:365--><br />
* {{MacroLink|Icon=Macro_Rubik_Cube.png|Macro_Rubik_Cube|Macro Rubik Cube}}: Display a Rubik Cube and interactively do slice rotations.<br />
<br />
<!--T:366--><br />
* {{MacroLink|Icon=Macro_Sheet_Metal_Unfolder.png|Macro_Sheet_Metal_Unfolder|Macro Sheet Metal Unfolder}}: Creates an unfolded part from a sheet-metal-part.<br />
<br />
<!--T:367--><br />
* {{MacroLink|Icon=Macro_Stairs.png|Macro_Stairs|Macro Stairs}}: Create stair helix, create your stair nosing select and run the macro.<br />
<br />
<!--T:368--><br />
* {{MacroLink|Icon=Macro_Unfold_Box.png|Macro_Unfold_Box|Macro Unfold Box}}: Allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:369--><br />
* {{MacroLink|Icon=Macro_Unroll_Ruled_Surface.png|Macro_Unroll_Ruled_Surface|Macro Unroll Ruled Surface}}: Allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
=== [[File:Arch_Equipment.svg|32px]] Woodworking === <!--T:168--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:370--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/getDimensions getDimensions]: FreeCAD macro to get chipboards dimensions to cut (BOM, cutlist).<br />
<br />
<!--T:371--><br />
* {{MacroLink|Icon=Macro_Cabinets32.png|Macro_Cabinets32|Macro Cabinets32}}: Creates side and top/bottom walls for a cabinet with drilled holes for connection parts of manufacturer Hettich.<br />
<br />
<!--T:372--><br />
* {{MacroLink|Icon=Macro_Joint_Icon.svg|Macro_Joint|Macro Joint}}: Creates a variety of joints, such as mortise/tenon, box joints, dovetail joints, and snap joints.<br />
<br />
<!--T:373--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/dprojects/Woodworking/blob/master/Tools/makeTransparent.py makeTransparent]: Switches all parts from non-transparent to transparent, and back, allowing you to preview pilot holes, countersinks and other joints.<br />
<br />
</translate><br />
</div><br />
</div><br />
<div class="toccolours mw-collapsible mw-collapsed"><br />
<translate><br />
<br />
===[[File:Std_FreeCADWebsite.svg|32px]] Other interesting macros created by FreeCAD users=== <!--T:133--><br />
<br />
</translate><br />
<div class="mw-collapsible-content"><br />
<translate><br />
<br />
<!--T:374--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/hamish2014?tab=repositories By hamish2014]: FreeCAD_assembly2, FreeCAD_drawing_dimensioning, and more.<br />
<br />
<!--T:375--><br />
* [[Image:2364.png|24px]] [https://github.com/microelly2?tab=repositories By microelly2] : FreeCAD_macro, geodata, Animation, freecad-nurbs, PieMenu, and more.<br />
<br />
<!--T:376--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/oddtopus?tab=repositories By oddtopus]: Flamingo (workbench for metal structures).<br />
<br />
<!--T:377--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/realthunder/FreeCAD_assembly3#installation By realthunder]: Assembly3 Workbench, and more.<br />
<br />
<!--T:378--><br />
* [[Image:681.jpg|24px]] [https://github.com/j-wiedemann?tab=repositories By rockn]: FreeCAD-Timber, FreeCAD-addons, FreeCAD-library, FreeCAD-StructuresBois, and more.<br />
<br />
<!--T:379--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/Siardeni/FreeCADTools By Siardeni]: Workbench for create metal profiles, square tubing, z profile, palette, rotation, drawing, and more.<br />
<br />
<!--T:380--><br />
* [[Image:Text-x-python.png|24px]] [https://github.com/triplus?tab=repositories By triplus]: IconThemes, ShortCuts, NavigationIndicator, TabBar, Launcher, PersistentToolbars, PieMenu, and more.<br />
<br />
</translate><br />
</div><br />
</div><br />
<translate><br />
<br />
==Usage== <!--T:135--><br />
<br />
<!--T:159--><br />
See [[how to install macros|how to install macros]] for a full description, and [[Customize Toolbars|customize toolbars]] to add the macros to a toolbar for easy access.<br />
<br />
<!--T:160--><br />
Installing many macros is equivalent to installing a new workbench; see [[How to install additional workbenches|how to install additional workbenches]] for this information.<br />
<br />
=== Automatic installation === <!--T:162--><br />
<br />
<!--T:161--><br />
Use the [[Std_AddonMgr|Addon Manager]] in {{MenuCommand|Tools → Addon manager}} to install a macro that has been included in the [https://github.com/FreeCAD/FreeCAD-macros FreeCAD-macros] repository. {{Version|0.17}} <br />
<br />
=== Manual installation === <!--T:163--><br />
<br />
<!--T:136--><br />
If the [[Std_AddonMgr|Addon Manager]] is not used, the macro can be installed manually.<br />
* Copy the [[Python|Python]] code from the corresponding macro page.<br />
* Open the macros menu {{MenuCommand|Macro → Macros}}, press {{Button|Create}}, and give it a name.<br />
* Paste the Python code that you copied.<br />
* Press the {{Button|Save}} button, and restart FreeCAD.<br />
* To use it, open again the macros menu, select your new macro, and press {{Button|Execute}}.<br />
<br />
=== Add a macro to a custom toolbar === <!--T:164--><br />
<br />
<!--T:137--><br />
* Go to {{MenuCommand|Tools → Customize}}.<br />
* In the {{MenuCommand|Macros}} tab, add a new macro name, and optionally define an icon and a keyboard shortcut.<br />
* In the {{MenuCommand|Toolbars}} tab, create a new toolbar, and add your macro, taking it from the {{MenuCommand|Macros}} category.<br />
<br />
<br />
</translate><br />
[[Category:Macros{{#translation:}}]]<br />
[[Category:Python Code{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_BSurf_from_grid&diff=1167180Macro BSurf from grid2022-07-31T20:35:50Z<p>Heda: Created page with "<languages/> <translate> {{Macro |Name=BSurf_from_grid |Icon= |Description=Makes a BSpline surface through a grid of points. |Author=heda |Version=0.1 |Date=2022-07-31 |FCVer..."</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{Macro<br />
|Name=BSurf_from_grid<br />
|Icon=<br />
|Description=Makes a BSpline surface through a grid of points.<br />
|Author=heda<br />
|Version=0.1<br />
|Date=2022-07-31<br />
|FCVersion=<br />
|Download=<br />
}}<br />
<br />
==Description==<br />
<br />
Makes a BSpline surface through a grid of points. Options for only creating Wires or BSpline curves.<br />
<br />
</translate><br />
[[File:Macro_BSurf_from_grid_example.png]]<br />
<translate><br />
{{Caption|Macro BSurf from grid}}<br />
<br />
== Installation ==<br />
<br />
Available in the [[Std AddonMgr|Addon manager]].<br />
<br />
== Options ==<br />
<br />
See docstring.<br />
<br />
== Usage ==<br />
<br />
See docstring.<br />
<br />
==Script==<br />
<br />
</translate><br />
<br />
'''Macro_BSurf_from_grid.FCMacro'''<br />
<br />
<!--DO NOT CHANGE THE <pre> </pre> TAG, code contains pipe or space character which breaks the wiki macro--><br />
<pre><br />
<br />
# -*- coding: utf-8 -*-<br />
<br />
# ***************************************************************************<br />
# * *<br />
# * Copyright (c) 2022 - heda <heda@fc-forum> *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
__Name__ = 'BSurf_from_grid'<br />
__Comment__ = 'Makes a BSpline surface through a grid of points.'<br />
__Author__ = 'heda'<br />
__Version__ = '0.1'<br />
__Date__ = '2022-07-31'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = ''<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Grid_2_BSurf'<br />
__Icon__ = ''<br />
__Help__ = 'Select structured point-cloud, set options, run macro'<br />
__Status__ = 'functional'<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
"""<br />
inspired by:<br />
https://forum.freecadweb.org/viewtopic.php?f=22&t=69941&start=10<br />
cred to snow54<br />
<br />
it is assumed that the cloud is:<br />
- structured<br />
- aligned with xy grid,<br />
i.e. a constant y divides 2 horizontal rows of points,<br />
analogue for x and vertical columns of points<br />
<br />
<br />
usage:<br />
select a pointcloud and run macro <br />
<br />
options:<br />
wires: convert boundary wires to spline (draft wb),<br />
in surf wb, use boundry edges and verts on wires as vertex-constraints<br />
<br />
splines: in surf wb, use outer contour as boundry edges,<br />
inner edges can be used as edge constraints<br />
<br />
bsurf: surface directly created with poles/knots from interpolated spline<br />
<br />
mkwframe: in case of bsurf, symbolic wireframe of splines (draft wb)<br />
"""<br />
<br />
import numpy as np<br />
from scipy import interpolate<br />
<br />
import FreeCAD as App<br />
import FreeCADGui as Gui<br />
import Draft, Part<br />
<br />
Vector = App.Vector<br />
<br />
doc = App.ActiveDocument<br />
<br />
try:<br />
cloud, = Gui.Selection.getSelection()<br />
except ValueError as e:<br />
raise RuntimeWarning('a point cloud needs to be selected.')<br />
<br />
points = cloud.Points.Points<br />
bb = cloud.Points.BoundBox<br />
<br />
options = o = dict(MakeWires=False,<br />
MakeBSplines=False,<br />
MakeBSurf=True,<br />
MakeWFrame=True)<br />
<br />
## a bit of options logic...<br />
if o['MakeWires']: o['MakeBSplines'] = False<br />
if o['MakeBSplines']: o['MakeBSurf'] = o['MakeWires'] = False<br />
if o['MakeBSurf'] and o['MakeWFrame']:<br />
o['MakeBSplines'] = True; o['MakeWires'] = False<br />
if not o['MakeBSurf']: o['MakeWFrame'] = False<br />
<br />
<br />
def RGB(*args):<br />
return tuple((float(i/255) for i in args))<br />
<br />
<br />
hstep = min((p.y for p in points))<br />
vstep = min((p.x for p in points))<br />
<br />
wiregroup = doc.addObject('App::DocumentObjectGroup', 'Wires')<br />
hwires = doc.addObject('App::DocumentObjectGroup', 'HWires')<br />
vwires = doc.addObject('App::DocumentObjectGroup', 'VWires')<br />
wiregroup.addObjects([hwires, vwires])<br />
<br />
for wg, step, getter in ((hwires, hstep, 'y'),<br />
(vwires, vstep, 'x')):<br />
wires = list()<br />
empty = False<br />
cc = bb.YMin if getter == 'y' else bb.XMin<br />
cc -= step/2<br />
while not empty:<br />
polypoints = list()<br />
for pt in points:<br />
value = getattr(pt, getter)<br />
if cc < value < cc + step:<br />
polypoints.append(pt)<br />
if polypoints:<br />
if o['MakeWires'] or (o['MakeBSurf'] and not o['MakeWFrame']):<br />
maker = Draft.make_wire<br />
elif o['MakeBSplines']:<br />
maker = Draft.make_bspline<br />
wires.append(maker(polypoints, closed=False))<br />
cc += step<br />
else:<br />
empty = True<br />
<br />
wg.addObjects(wires)<br />
<br />
Gui.Selection.clearSelection()<br />
<br />
if o['MakeBSurf']:<br />
degree_u = degree_v = 3<br />
periodic = False<br />
<br />
lowerx, lowery = hwires.Group[0], vwires.Group[0]<br />
x = np.array([pt.x for pt in lowerx.Points])<br />
y = np.array([pt.y for pt in lowery.Points])<br />
Z = np.array([[pt.z for pt in hw.Points] for hw in hwires.Group])<br />
<br />
## Create spline surface<br />
g = interpolate.RectBivariateSpline(x, y, Z.T)<br />
coefgs = g.get_coeffs()<br />
coefgs = np.reshape(coefgs, Z.T.shape).T<br />
knots = g.get_knots()<br />
# Convert knot vector format<br />
knot_u, mult_u = np.unique(knots[1], return_counts=True)<br />
knot_v, mult_v = np.unique(knots[0], return_counts=True)<br />
# Normalize knot vectors<br />
knot_u = (knot_u - knot_u.min()) / (knot_u.max() - knot_u.min())<br />
knot_v = (knot_v - knot_v.min()) / (knot_v.max() - knot_v.min())<br />
<br />
# Calculate spline coefficients for x and y<br />
gx = interpolate.make_interp_spline(x, x)<br />
coefgx = gx.tck[1]<br />
gy = interpolate.make_interp_spline(y, y)<br />
coefgy = gy.tck[1]<br />
<br />
getVector = lambda iz, jz: Vector(coefgx[jz],<br />
coefgy[iz],<br />
coefgs[iz, jz])<br />
<br />
# Create control point vectors<br />
ctrl = [[getVector(iZ, jZ) for jZ, lc in enumerate(lr)]<br />
for iZ, lr in enumerate(coefgs)]<br />
<br />
# Create spline surface in FreeCAD<br />
bs = Part.BSplineSurface()<br />
bs.buildFromPolesMultsKnots(ctrl, mult_u, mult_v, knot_u, knot_v,<br />
periodic, periodic, degree_u, degree_v)<br />
<br />
surf = Part.show(bs.toShape(), 'BSplineSurf')<br />
surf.Label2 = 'spline surface through points'<br />
surf.ViewObject.ShapeColor = RGB(0, 170, 255)<br />
<br />
if not o['MakeWFrame']:<br />
for obj in hwires.Group + vwires.Group + [hwires, vwires, wiregroup]:<br />
doc.removeObject(obj.Name)<br />
<br />
<br />
doc.recompute()<br />
<br />
av = Gui.ActiveDocument.ActiveView<br />
av.viewIsometric()<br />
av.fitAll()<br />
<br />
</pre></div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_BSurf_from_grid_example.png&diff=1167179File:Macro BSurf from grid example.png2022-07-31T20:21:46Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Unroll_Ruled_Surface&diff=1165880Macro Unroll Ruled Surface2022-07-29T08:33:41Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Unroll Ruled Surface<br />
|Description=The macro allows to unroll ruled surfaces and to draw them on a page.<br />
|Author=Hervé B., heda<br />
|Version=1.1<br />
|Date=2022-07-24<br />
|Download=[https://www.freecadweb.org/wiki/images/b/ba/Macro_Unroll_Ruled_Surface.png ToolBar icon]<br />
}}<br />
<br />
== Description == <!--T:2--><br />
The macro allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
<!--T:3--><br />
[[File:Macro_unrollRuledSurface_00.png|480px]]<br />
{{Caption|Macro_unrollRuledSurface}}<br />
<br />
== Installation == <!--T:4--><br />
Available in Add-on manager.<br />
<br />
Cf [http://forum.freecadweb.org/viewtopic.php?f=17&t=4563&p=35737#p35737 Macro for unrolling ruled surfaces]<br />
<br />
== Options == <!--T:5--><br />
* Number of generatrix<br />
* Scale manual or automatic<br />
* Page format: a3/a4, cartridge (cf FreeCAD templates)<br />
* Group drawings in the same page as possible.<br />
<br />
<!--T:6--><br />
[[File:Macro_UnrollRuledSurface_start_form.png|Macro_unrollRuledSurface]] <br />
<br />
== Instruction for use == <!--T:7--><br />
# Select ruled surfaces<br />
# Explode them (cf Draft menu - downgrade)<br />
# Select the surfaces<br />
# Execute the macro<br />
<br />
==Script== <!--T:8--><br />
<br />
<!--T:9--><br />
The lastest version of the macro is here on the wiki. An earlier version can be found at [https://github.com/FreeCAD/FreeCAD-macros/blob/master/Drawing/UnrollRuledSurface.FCMacro UnrollRuledSurface.FCMacro] but the easiest way to install this macro is through the [[Std_AddonMgr|Addon Manager]] [[File:Std_AddonMgr.svg|24px|Std_AddonMgr]]<br />
.<br />
</translate><br />
<br />
ToolBar Icon [[Image:Macro_Unroll_Ruled_Surface.png]]<br />
<br />
'''Macro_unrollRuledSurface.py'''<br />
<br />
<!--DO NOT CHANGE THE <pre> </pre> TAG, code contains pipe or space character which breaks the wiki macro--><br />
<pre><br />
# -*- coding: utf-8 -*-<br />
#***************************************************************************<br />
#* *<br />
#* Copyright (c) 2013 - DoNovae/Herve BAILLY <hbl13@donovae.com> *<br />
#* Copyright (c) 2022 - heda <heda@fc-forum> *<br />
#* *<br />
#* This program is free software; you can redistribute it and/or modify *<br />
#* it under the terms of the GNU Lesser General Public License (LGPL) *<br />
#* as published by the Free Software Foundation; either version 2 of *<br />
#* the License, or (at your option) any later version. *<br />
#* for detail see the LICENCE text file. *<br />
#* *<br />
#* This program is distributed in the hope that it will be useful, *<br />
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
#* GNU Library General Public License for more details. *<br />
#* *<br />
#* You should have received a copy of the GNU Library General Public *<br />
#* License along with this program; if not, write to the Free Software *<br />
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
#* USA *<br />
#* *<br />
#***************************************************************************<br />
__Name__ = 'Unroll Ruled Surface'<br />
__Comment__ = 'Unroll of a ruled surface and draw it on a page.'<br />
__Author__ = 'Hervé B., heda'<br />
__Version__ = '1.1'<br />
__Date__ = '2022-07-24'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = 'https://wiki.freecad.org/Macro_Unroll_Ruled_Surface'<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Unroll_Ruled_Surface'<br />
__Icon__ = ''<br />
__Help__ = ('Select ruled surfaces, Explode them (cf Draft menu), '<br />
'Select the surfaces, Execute the macro')<br />
__Status__ = ''<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
__doc__ = """<br />
select a face, or several and run the macro.<br />
a shell/solid needs to be draft/downgraded to get the faces as separate objects<br />
<br />
the macro is intended to unroll lofted faces,<br />
function beyond that is (in current version) a bonus<br />
<br />
settings are not context aware, all settings not applicable are ignored.<br />
as example, using autoscaling ignores the scale-value in the form<br />
<br />
<br />
v1.1 (2022-07-24) py3/qt5 compat, cosmetic code changes, minor code tweaks,<br />
used gridlayout for form, added option to skip drawing,<br />
made new layout engine with techdraw,<br />
the drawing wb layout engine is now called "legacy"<br />
v1.0.1 (2019-02-01) - on git<br />
v1.0 (2013-09-14) - on wiki<br />
<br />
note:<br />
- unfolding sometimes works and sometimes not<br />
- not all surfaces are theoretically possible to unroll<br />
<br />
"""<br />
<br />
import os<br />
from PySide import QtGui, QtCore<br />
import FreeCAD, FreeCADGui<br />
import Part, Draft<br />
<br />
Vector = FreeCAD.Base.Vector<br />
PrintMessage = FreeCAD.Console.PrintMessage<br />
PrintError = FreeCAD.Console.PrintError<br />
<br />
settings = dict()<br />
unroll_l = []<br />
dwgtpllegacy = 'Mod/Drawing/Templates'<br />
dwgtpl = 'Mod/TechDraw/Templates'<br />
<br />
<br />
#####################################<br />
### Functions<br />
#####################################<br />
<br />
def errorDialog(msg):<br />
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical, "Error Message", msg)<br />
diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)<br />
diag.exec_()<br />
<br />
def ending():<br />
PrintMessage("UnrollRuledSurface: end.\n")<br />
PrintMessage("===========================================\n")<br />
FreeCAD.ActiveDocument.recompute()<br />
<br />
<br />
def proceed():<br />
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)<br />
<br />
PrintMessage("===========================================\n")<br />
PrintMessage("UnrollRuledSurface: start.\n")<br />
try:<br />
sts = lambda s: settings.get(s)<br />
<br />
file_name = sts("fname").text()<br />
pts_nbr = float(sts("dpts").text())<br />
makedwg = sts("mkdwg").isChecked()<br />
leglay = sts("legacylayout").isChecked()<br />
scale = float(sts("scale").text()) # ignored if autoscale is set<br />
scale_auto = sts("autoscale").isChecked()<br />
edge0 = sts("edge").checkedId() == -2<br />
a3 = sts("papersize").checkedId() == -3<br />
cartridge = sts("cartridge").isChecked()<br />
onedrawing = sts("groupdwg").isChecked()<br />
<br />
PrintMessage("UnrollRuledSurface.file_name: {}\n".format(file_name))<br />
PrintMessage("UnrollRuledSurface.pts_nbr: {}\n".format(pts_nbr))<br />
PrintMessage("UnrollRuledSurface.edge0: {}\n".format(edge0))<br />
PrintMessage("UnrollRuledSurface.makedwg: {}\n".format(makedwg))<br />
PrintMessage("UnrollRuledSurface.leglay: {}\n".format(leglay))<br />
PrintMessage("UnrollRuledSurface.scale_check: {}\n".format(scale_auto))<br />
PrintMessage("UnrollRuledSurface.scale: {}\n".format(scale))<br />
PrintMessage("UnrollRuledSurface.a3_check: {}\n".format(a3))<br />
PrintMessage("UnrollRuledSurface.cartridge: {}\n".format(cartridge))<br />
PrintMessage("UnrollRuledSurface.onedrawing: {}\n".format(onedrawing))<br />
except:<br />
msg = "UnrollRuledSurface: wrong inputs...\n"<br />
PrintError(msg)<br />
errorDialog(msg)<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
ending()<br />
return<br />
<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
unrollRS = unrollRuledSurface(file_name, pts_nbr, edge0)<br />
<br />
## Get selection<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel:<br />
PrintMessage("UnrollRuledSurface: no selection...\n")<br />
ending()<br />
return<br />
<br />
faceid = 0<br />
objnames_l, objnames0_l = [], []<br />
grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",<br />
"{}_objs".format(file_name))<br />
<br />
for objid, obji in enumerate(sel):<br />
shape = obji.Shape<br />
faces = shape.Faces<br />
for idx in range(len(faces)):<br />
msg = "UnrollRuledSurface.proceed: ObjId = {}, faceId = {}\n"<br />
PrintMessage(msg.format(objid, faceid))<br />
name = obji.Name<br />
if len(faces) > 1:<br />
name = "{}.face_{}".format(name, idx)<br />
obj = unrollRS.unroll(faces[idx], name)<br />
obj.ViewObject.Visibility = not makedwg<br />
grp.addObject(obj)<br />
<br />
objnames_l.append([obj, name])<br />
objnames0_l.append([obji, name])<br />
faceid += 1<br />
<br />
if not makedwg:<br />
ending()<br />
return<br />
<br />
if leglay:<br />
idx = 0<br />
while len(objnames_l) > 0:<br />
draw = Drawing2dLegacy(scale, scale_auto, a3,<br />
cartridge, onedrawing,<br />
"{}_page{:02}".format(file_name, idx))<br />
objnames_l = draw.all2d(objnames_l)<br />
idx += 1<br />
msg = "UnrollRuledSurface: obj_l = {}\n"<br />
PrintMessage(msg.format(len(objnames_l)))<br />
<br />
else:<br />
draw = Drawing2d(scale, scale_auto, a3, cartridge)<br />
n = 4 if onedrawing else 1<br />
chunks = [objnames_l[i:i + n] for i in range(0, len(objnames_l), n)]<br />
for i, chunk in enumerate(chunks, start=1):<br />
draw.drawpage(chunk, "{}_page{:02}".format(file_name, i))<br />
<br />
ending()<br />
<br />
<br />
def close():<br />
DialogBox.hide()<br />
<br />
def getType(obj):<br />
return type(obj).__name__<br />
<br />
<br />
class unrollRuledSurface:<br />
"""<br />
unroll ruled surfaces<br />
:file_name: ouput file<br />
:pts_nbr: nbr point of discretization<br />
"""<br />
def __init__(self, file_name, pts_nbr, edge0):<br />
self.doc = FreeCAD.ActiveDocument<br />
self.file_name = file_name<br />
self.pts_nbr = int(pts_nbr)<br />
self.edge0 = edge0<br />
msg = "UnrollRuledSurface.unroll - file_name: {}, pts_nbr: {}\n"<br />
PrintMessage(msg.format(file_name, pts_nbr))<br />
<br />
<br />
def discretize(self, curve):<br />
"""discretize a curve"""<br />
if getType(curve) in ('GeomLineSegment', 'GeomCircle'):<br />
sd = curve.discretize(self.pts_nbr)<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nodes = curve.getPoles()<br />
spline = Part.BSplineCurve()<br />
spline.buildFromPoles(nodes)<br />
sd = spline.discretize(self.pts_nbr)<br />
else:<br />
sd = curve.discretize(self.pts_nbr)<br />
return sd<br />
<br />
def nbpoles(self, curve):<br />
"""find number of poles for a curve"""<br />
if getType(curve) == 'GeomLineSegment':<br />
nbpol=1<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nbpol=curve.NbPoles<br />
elif getType(curve) == 'GeomCircle':<br />
nbpol=2<br />
elif getType(curve) == 'GeomBezierCurve':<br />
nbpol=4<br />
else:<br />
nbpol=0<br />
<br />
msg = "UnrollRulrdSurface.nbpole {:s} = {:d}\n"<br />
PrintMessage(msg.format(getType(curve), nbpol))<br />
return nbpol<br />
<br />
def unroll(self, face, name):<br />
"""unrolls a face composed of 2 to 4 edges"""<br />
nbredges = len(face.Edges)<br />
msg = "UnrollRuledSurface.unroll: Edge Nbr = {}\n"<br />
PrintMessage(msg.format(nbredges))<br />
<br />
if nbredges == 2:<br />
e1, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
elif nbredges == 3:<br />
e1, _, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
else:<br />
E0, E1, E2, E3, *_ = face.Edges<br />
## Choose more complexe curve as edge<br />
nbpol0 = self.nbpoles(E0.Curve)<br />
nbpol1 = self.nbpoles(E1.Curve)<br />
nbpol2 = self.nbpoles(E2.Curve)<br />
nbpol3 = self.nbpoles(E3.Curve)<br />
msg = ("UnrollRuledSurface.unroll: nbpol0= {:d}, nbpol1= {:d},"<br />
" nbpol2= {:d}, nbpol3= {:d}\n")<br />
PrintMessage(msg.format(nbpol0, nbpol1, nbpol2, nbpol3))<br />
<br />
if self.edge0:<br />
e1, e2 = E0, E2<br />
v = self.discretize(E1)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
else:<br />
e1, e2 = E1, E3<br />
v = self.discretize(E2)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
<br />
sd1 = self.discretize(e1)<br />
sd2 = self.discretize(e2)<br />
## Reverse if curves cross over<br />
if not (sd2[0].__eq__(v0) or not sd2[0].__eq__(v1)):<br />
sd2.reverse()<br />
<br />
## Create a polygon object and set its nodes<br />
devlxy_l = self.devlxyz(sd1, sd2)<br />
msg = "UnrollRuledSurface.unroll: size devlxy_l: {}\n"<br />
PrintMessage(msg.format(len(devlxy_l)))<br />
p = self.doc.addObject("Part::Polygon", name)<br />
p.Nodes = devlxy_l<br />
self.doc.recompute()<br />
FreeCADGui.ActiveDocument.ActiveView.fitAll()<br />
return p<br />
<br />
def vect_copy(self, vect):<br />
"""returns copy of vector"""<br />
return vect.add(Vector())<br />
<br />
def vect_cos(self, vect1, vect2):<br />
"""returns cosine angle between 2 vectors"""<br />
return vect1.dot(vect2) / vect1.Length / vect2.Length<br />
<br />
def vect_sin(self, vect1, vect2):<br />
"""returns absolute sinus angle between 2 vectors"""<br />
v = Vector()<br />
v.x = vect1.y * vect2.z - vect1.z * vect2.y<br />
v.y = vect1.z * vect2.x - vect1.x * vect2.z<br />
v.z = vect1.x * vect2.y - vect1.y * vect2.x<br />
return v.Length / vect1.Length / vect2.Length<br />
<br />
def devlxyz(self, vect1, vect2):<br />
"""<br />
unrolls a face composed of 4 edges<br />
args: vect1, vect2 --> 2 edges of the shape<br />
returns: dvlxy<br />
"""<br />
lenv1, lenv2 = len(vect1), len(vect2)<br />
if lenv1 != lenv2 or lenv1 != self.pts_nbr or lenv2 != self.pts_nbr:<br />
msg = ("UnrollRuledSurface.devlxyz: incompatility of sizes vect1,"<br />
" vect2, pts_nbr: ({}, {}, {})\n")<br />
PrintError(msg.format(lenv1, lenv2, self.pts_nbr))<br />
errorDialog(msg)<br />
<br />
devlxy_l, devl1xy_l, devl2xy_l = [], [], []<br />
errormax = 0.0<br />
## Init unroll<br />
## AB<br />
a1b1 = vect2[0].sub(vect1[0])<br />
oa1 = Vector(0, 0, 0)<br />
devl1xy_l.append(oa1) #A1<br />
ob1 = Vector(a1b1.Length, 0, 0)<br />
devl2xy_l.append(ob1) #B1<br />
#self.draw_line(devl1xy_l[0], devl2xy_l[0])<br />
#self.draw_line(vect1[0], vect2[0])<br />
for j in range(1, self.pts_nbr):<br />
<br />
## AB<br />
ab = vect2[j-1].sub(vect1[j-1])<br />
#self.draw_line(vect1[j-1], vect2[j-1])<br />
<br />
## AC<br />
ac = vect1[j].sub(vect1[j-1])<br />
<br />
## BD<br />
bd = vect2[j].sub(vect2[j-1])<br />
<br />
## CD<br />
cd = vect2[j].sub(vect1[j])<br />
<br />
## A1B1 in unroll plan<br />
a1b1 = devl2xy_l[j-1].sub(devl1xy_l[j-1])<br />
a1b1n = self.vect_copy(a1b1)<br />
a1b1n.normalize()<br />
a1b1on = Vector(-a1b1n.y, a1b1n.x, 0)<br />
<br />
## A1C1<br />
cosalp = self.vect_cos(ab, ac)<br />
sinalp = self.vect_sin(ab, ac)<br />
a1c1 = self.vect_copy(a1b1n)<br />
a1c1.multiply(cosalp * ac.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * ac.Length)<br />
a1c1 = a1c1.add(v)<br />
oa1 = self.vect_copy(devl1xy_l[j-1])<br />
oc1 = oa1.add(a1c1)<br />
devl1xy_l.append(oc1)<br />
<br />
## B1D1<br />
cosalp = self.vect_cos(ab, bd)<br />
sinalp = self.vect_sin(ab, bd)<br />
b1d1 = self.vect_copy(a1b1n)<br />
b1d1.multiply(cosalp * bd.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * bd.Length)<br />
b1d1 = b1d1.add(v)<br />
ob1 = self.vect_copy(devl2xy_l[j-1])<br />
od1 = ob1.add(b1d1)<br />
devl2xy_l.append(od1)<br />
<br />
## Draw generatrice<br />
#self.draw_line(devl1xy_l[j], devl2xy_l[j])<br />
c1d1 = devl2xy_l[j].sub(devl1xy_l[j])<br />
if ab.Length != 0:<br />
abl = ab.Length<br />
errormax = max(errormax, abs(abl - c1d1.Length) / abl)<br />
<br />
msg = "UnrollRuledSurface Error cd,c1d1: {:.1f} %\n"<br />
PrintMessage(msg.format(errormax*100))<br />
<br />
## Close polygone<br />
devlxy_l = devl1xy_l<br />
devl2xy_l.reverse()<br />
devlxy_l.extend(devl2xy_l)<br />
v = Vector()<br />
devlxy_l.append(v)<br />
<br />
return devlxy_l<br />
<br />
<br />
def draw_line(self, vect0, vect1):<br />
"""draws a Part.Line between vect0 & vect1"""<br />
l = Part.LineSegment()<br />
l.StartPoint = vect0<br />
l.EndPoint = vect1<br />
self.doc.addObject("Part::Feature", "Line").Shape = l.toShape()<br />
<br />
<br />
class Scale:<br />
"""keeps autoscaling to integers"""<br />
def __init__(self, scale):<br />
self.scale = scale if scale >= 1 else 1 / scale<br />
self.scale = int(self.scale)<br />
self.inverted = scale >= 1<br />
<br />
def get(self):<br />
if self.inverted:<br />
return self.scale, '{}:1'.format(self.scale)<br />
else:<br />
return 1/self.scale, '1:{}'.format(self.scale)<br />
<br />
<br />
class Drawing2d:<br />
"""<br />
TechDraw wb layout engine, diffeent logic compared to drawing wb layout.<br />
serves basic purpose...<br />
"""<br />
def __init__(self, scale, scale_auto, a3, cartridge):<br />
<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
if a3:<br />
self.WH = 420, 297<br />
else:<br />
self.WH = 297, 210<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
<br />
def _mkquadrants(self, nbr):<br />
"""centers of quadrants w/o margin"""<br />
w, h = self.WH<br />
w2, h2 = w/2, h/2<br />
w4, h4 = w/4, h/4<br />
<br />
q = {1: [[w, h], [[w2, h2]]],<br />
2: [[w2, h], [[w2 - w4, h2], [w2 + w4, h2]]],<br />
3: [[w2, h2], [[w2 - w4, h2 + h4], [w2 + w4, h2 + h4],<br />
[w2 - w4, h2 - h4]]],<br />
4: [[w2, h2], [[w2 - w4, h2 + h4], [w2 + w4, h2 + h4],<br />
[w2 - w4, h2 - h4], [w2 + w4, h2 - h4]]]}<br />
return q.get(nbr)<br />
<br />
<br />
def newPage(self, doc, page_name):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
page = doc.addObject('TechDraw::DrawPage', page_name)<br />
template = self.doc.addObject('TechDraw::DrawSVGTemplate', 'Template')<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = 'TD' if self.cartridge else '_blank'<br />
template.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
page.Template = template<br />
return page<br />
<br />
def drawpage(self, faces, page_name):<br />
"""max 4 per page, simple layout with halfs or quadrants"""<br />
page = self.newPage(self.doc, page_name)<br />
[W, H], ll = self._mkquadrants(len(faces))<br />
for [face, name], [x0, y0] in zip(faces, ll):<br />
bb = face.Shape.BoundBox<br />
xr, yr = W / bb.XLength, H / bb.YLength<br />
adjust = 0.7 if self.cartridge else 0.85<br />
scale = min(xr, yr) * adjust if self.scale_auto else self.scale<br />
scale, scr = Scale(scale).get()<br />
bb.scale(scale, scale, 1) # unrolled faces in xy-plane<br />
<br />
TopView = self.doc.addObject('TechDraw::DrawViewPart', name + ' view')<br />
page.addView(TopView)<br />
TopView.Source = face<br />
TopView.Direction = (0, 0, 1)<br />
TopView.XDirection = (1, 0, 0)<br />
TopView.Scale = scale<br />
TopView.X = x0<br />
TopView.Y = y0<br />
<br />
Text = self.doc.addObject('TechDraw::DrawViewAnnotation', name + ' txt')<br />
page.addView(Text)<br />
Text.Text = '{} [{}]'.format(name, scr)<br />
Text.recompute() # for size<br />
Text.X = x0<br />
yt = y0 - bb.YLength / 2 - Text.TextSize.Value * 1.5<br />
Text.Y = max(1, yt)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
FreeCADGui.runCommand('TechDraw_ToggleFrame', 0)<br />
<br />
<br />
class Drawing2dLegacy:<br />
"""<br />
makes 2d drawing with Drawing wb (original layout engine, now legacy)<br />
- obj_l: list of objects<br />
"""<br />
## untouched logic in v1.1<br />
def __init__(self, scale, scale_auto, a3, cartridge, onedrawing, page_str):<br />
self.TopX_H = self.TopY_H = 0<br />
self.TopX_V = self.TopY_V = 0<br />
self.TopX_Hmax = self.TopY_Hmax = 0<br />
self.TopX_Vmax = self.TopY_Vmax = 0<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
self.onedrawing = onedrawing<br />
self.marge = 6<br />
if self.a3:<br />
self.L, self.H = 420, 297<br />
else:<br />
self.L, self.H = 297, 210<br />
self.name = page_str<br />
<br />
def newPage(self):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpllegacy)<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.addObject('Drawing::FeaturePage', self.name)<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = '' if self.cartridge else '_plain'<br />
page.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
return page<br />
<br />
<br />
def all2d(self, objname_l):<br />
obj1_l = []<br />
for objid in range(len(objname_l)):<br />
if objid == 0 or not self.onedrawing:<br />
page = self.newPage()<br />
obj1_l.extend(self.done(objid, objname_l[objid]))<br />
return obj1_l<br />
<br />
def done(self, idx, objname):<br />
obj_l = []<br />
obj, objname = objname<br />
marge = self.marge<br />
bb = obj.Shape.BoundBox<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
if ymax > xmax:<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
scale = min((self.L-4 * marge) / xmax, (self.H-4 * marge) / ymax)<br />
<br />
if (not self.scale_auto) or self.onedrawing:<br />
scale = self.scale<br />
<br />
PrintMessage("UnrollRuledSurface.drawing: scale= {:.2f}\n".format(scale))<br />
<br />
<br />
if idx == 0 or not self.onedrawing:<br />
PrintMessage("Drawing2d: init\n")<br />
TopX = self.TopX_H = marge * 2<br />
TopY = self.TopY_H = marge * 2<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopY_H = self.TopY_H<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
self.TopY_V = marge * 2<br />
<br />
elif self.onedrawing:<br />
if self.TopX_H + xmax * scale < self.L:<br />
if self.TopY_H + ymax * scale + marge * 2 < self.H:<br />
## H Add at right on same horizontal line<br />
PrintMessage("Drawing2d: horizontal\n")<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Hmax, self.TopX_Vmax)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
## V Add at right on same horizontal line<br />
PrintMessage("Drawing2d: vertival\n")<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, self.name])<br />
return obj_l<br />
<br />
else:<br />
## H Carriage return<br />
if self.TopY_Hmax + ymax * scale + self.marge*2 < self.H:<br />
msg = "Drawing2d: carriage return: {} > {}\n"<br />
PrintMessage(msg.format(self.TopY_H + ymax * scale, self.H))<br />
TopX = self.marge * 2<br />
TopY = self.TopY_Hmax<br />
self.TopX_H = TopX + xmax * scale + self.marge<br />
self.TopY_H = TopY<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = self.TopY_Hmax + ymax * scale + self.marge<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
## V Add at right on same horizontal line<br />
msg = "Drawing2d: vertival: {} , {}\n"<br />
PrintMessage(msg.format(self.TopX_V, self.TopX_Vmax))<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, objname])<br />
return obj_l<br />
<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.getObject(self.name)<br />
<br />
Text = doc.addObject('Drawing::FeatureViewAnnotation', f"{objname}_txt")<br />
Text.Text = objname<br />
Text.X = TopX + xmax * scale / 2<br />
Text.Y = TopY + ymax * scale / 2<br />
Text.Scale = 2<br />
<br />
TopView = doc.addObject('Drawing::FeatureViewPart', objname)<br />
TopView.Source = obj<br />
TopView.Direction = (0, 0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = TopX<br />
TopView.Y = TopY<br />
TopView.ShowHiddenLines = False<br />
TopView.Scale = scale<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
return obj_l<br />
<br />
<br />
<br />
#####################################<br />
### Dialog Box<br />
#####################################<br />
<br />
DialogBox = QtGui.QDialog()<br />
DialogBox.setWindowTitle("UnrollRuledSurface")<br />
la = QtGui.QGridLayout(DialogBox)<br />
la.setSpacing(7)<br />
buttonGrpEdge = QtGui.QButtonGroup(DialogBox)<br />
buttonGrpFormat = QtGui.QButtonGroup(DialogBox)<br />
<br />
cols = 4<br />
la.addWidget(QtGui.QLabel("File Name"), 0, 0, 1, cols)<br />
fname = QtGui.QLineEdit("UnrollSurface")<br />
la.addWidget(fname, 1, 0, 1, cols)<br />
<br />
la.addWidget(QtGui.QLabel("Discretization Points Nbr"), 2, 0, 1, cols)<br />
dpts = QtGui.QLineEdit("30")<br />
la.addWidget(dpts, 3, 0, 1, 2)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Generatrices from edge:"), 4, 0, 1, 2)<br />
edgezero = QtGui.QRadioButton("0 to 3")<br />
la.addWidget(edgezero, 4, 2)<br />
edgeone = QtGui.QRadioButton("1 to 4")<br />
la.addWidget(edgeone, 4, 3)<br />
buttonGrpEdge.addButton(edgezero); buttonGrpEdge.addButton(edgeone)<br />
edgezero.setChecked(True)<br />
<br />
###<br />
mkdwg = QtGui.QCheckBox("Make drawing")<br />
mkdwg.setChecked(True)<br />
la.addWidget(mkdwg, 5, 0, 1, 2)<br />
<br />
legacylayout = QtGui.QCheckBox("Legacy layout")<br />
legacylayout.setChecked(False)<br />
la.addWidget(legacylayout, 5, 2, 1, 2)<br />
<br />
<br />
###<br />
autoscale = QtGui.QCheckBox("Auto scale")<br />
autoscale.setChecked(True)<br />
la.addWidget(autoscale, 6, 0, 1, 2)<br />
<br />
la.addWidget(QtGui.QLabel("Scale"), 6, 2)<br />
scale = QtGui.QLineEdit("1")<br />
la.addWidget(scale, 6, 3)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Paper size:"), 7, 0, 1, 2)<br />
rba4 = QtGui.QRadioButton("A4")<br />
la.addWidget(rba4, 7, 2)<br />
rba3 = QtGui.QRadioButton("A3")<br />
la.addWidget(rba3, 7, 3)<br />
buttonGrpFormat.addButton(rba4); buttonGrpFormat.addButton(rba3)<br />
rba4.setChecked(True)<br />
<br />
###<br />
cartridge = QtGui.QCheckBox("Cartridge")<br />
cartridge.setChecked(False)<br />
la.addWidget(cartridge, 8, 0, 1, 2)<br />
<br />
groupdwg = QtGui.QCheckBox("Group drawings in page")<br />
groupdwg.setChecked(True)<br />
la.addWidget(groupdwg, 8, 2, 1, 2)<br />
<br />
###<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
box.setOrientation(QtCore.Qt.Horizontal)<br />
box.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)<br />
la.addWidget(box, 9, 0, 1, cols)<br />
<br />
###<br />
settings.update(dict(fname=fname, dpts=dpts, edge=buttonGrpEdge,<br />
mkdwg=mkdwg, legacylayout=legacylayout,<br />
autoscale=autoscale, scale=scale,<br />
papersize=buttonGrpFormat,<br />
cartridge=cartridge, groupdwg=groupdwg))<br />
<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("accepted()"), proceed)<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("rejected()"), close)<br />
QtCore.QMetaObject.connectSlotsByName(DialogBox)<br />
DialogBox.show()<br />
<br />
<br />
</pre><br />
<br />
{{clear}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Unfold_Box&diff=1165862Macro Unfold Box2022-07-28T22:02:55Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Unfold Box<br />
|Icon=Macro_Unfold_Box.png<br />
|Description=The macro allows to unfold the surfaces of a box of any shape and to draw them on a page.<BR/><br />
|Author=Hervé B., heda<br />
|Version=1.1<br />
|Date=2022-07-28<br />
|FCVersion=<br />
|Download=[https://www.freecadweb.org/wiki/images/e/e4/Macro_Unfold_Box.png ToolBar Icon]<br />
}}<br />
<br />
==Description== <!--T:2--><br />
The macro allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:3--><br />
[[File:Macro_unfoldBox1.png|480px]]<br />
{{Caption|Macro_unfoldBox}}<br />
<br />
== Installation == <!--T:4--><br />
Available in Add-on manager.<br />
<br />
Cf [http://forum.freecadweb.org/viewtopic.php?f=17&t=4587 Macro for unfolding box surfaces]<br />
<br />
== Options == <!--T:5--><br />
# Scale manual or automatic<br />
# Page format: a3/a4, cartridge (cf FreeCAD templates)<br />
# Group drawings in the same page as possible.<br />
# Sew or not the edges of the pieces.<br />
<br />
[[File:Macro_UnFoldBox_start_form.png|Macro_unfoldBox]]<br />
<br />
== Instruction for use == <!--T:6--><br />
# Select a box made with Part::Loft tool for example.<br />
# Explode it (cf Draft menu) into plan pieces<br />
# Select the surfaces<br />
# Execute the macro<br />
<br />
The unfolding algorithm will place the faces on the xy-plane, however it seldom does the unfolding correctly. Thus some manual post-processing is needed to get to desired result, as shown in the picture below.<br />
<br />
[[File:MacroUnFoldBoxInstruction.png|Macro_unfoldBox]]<br />
<br />
Starting point is a box like the upper left picture.<br />
<br />
# Select all faces and run the macro<br />
# Orient to Top View<br />
# Toggle visibilty on the created set of faces, the individual clones are to be visible, not the compound<br />
# Use Draft/Move and Draft/Rotate to reposition the folded cloned faces (a handfull of clicks per face when snapping is used)<br />
# The drawing updates automatically to the new positions<br />
<br />
The finished result is shown in the lower right picture above.<br />
<br />
==Script== <!--T:7--><br />
</translate><br />
<br />
ToolBar icon [[Image:Macro_Unfold_Box.png]]<br />
<br />
'''Macro_unfoldBox.FCMacro'''<br />
<br />
<!-- Do not remove the pair of <nowiki> </nowiki> tags because the special symbols won't be parsed correctly --><br />
{{MacroCode|code=<br />
<nowiki><br />
# -*- coding: utf-8 -*-<br />
"""<br />
FreeCAD Macro unfoldBox.<br />
<br />
Unfolding of planar surfaces<br />
"""<br />
##################################################<br />
# SEE https://wiki.freecadweb.org/Macro_Unfold_Box<br />
# ***************************************************************************<br />
# * *<br />
# * Copyright (c) 2013 - DoNovae/Herve BAILLY <hbl13@donovae.com> *<br />
# * Copyright (c) 2022 - heda <heda@fc-forum> *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
__Name__ = 'Unfold Box'<br />
__Comment__ = 'Unfolds planar surfaces and draws them on a page.'<br />
__Author__ = 'Hervé B., heda'<br />
__Version__ = '1.1'<br />
__Date__ = '2022-07-28'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = 'https://wiki.freecad.org/Macro_Unfold_Box'<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Unfold_Box'<br />
__Icon__ = ''<br />
__Help__ = ('Select surfaces, Explode them (cf Draft menu Downgrade), '<br />
'Select the exploded surfaces, Execute the macro')<br />
__Status__ = ''<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
__doc__ = """<br />
select a face, or several and run the macro.<br />
a shell/solid needs to be draft/downgraded to get the faces as separate objects<br />
<br />
the macro is intended to unfold a set of planar faces,<br />
in current state, most of the times it does not place the faces correctly.<br />
thus one needs to do the final placement of the clones manually, with Draft/Move & Rotate<br />
regardless, the macro saves a lot of clicks compared to a fully manual unfold<br />
<br />
settings are not context aware, all settings not applicable are ignored.<br />
as example, using autoscaling ignores the scale-value in the form<br />
<br />
sew is always enabled, thus the drawing<br />
is always the sewed shape on a single page<br />
<br />
<br />
v1.1 (2022-07-28) py3/qt5 compat, cosmetic code changes,<br />
minor code tweaks for evolved fc-api<br />
added option to skip drawing, made layout engine with techdraw,<br />
the drawing wb layout engine is now called "legacy"<br />
v1.0.1 (2020-03-10) - on wiki<br />
v1.0 (2013-09-14) - on wiki<br />
<br />
note:<br />
- unfolding occasionally work as expected, but mostly not<br />
- anyone is free to improve functionality<br />
<br />
"""<br />
<br />
import os, math<br />
<br />
from PySide import QtGui, QtCore<br />
<br />
import FreeCAD, FreeCADGui<br />
import Draft<br />
<br />
Vector = FreeCAD.Base.Vector<br />
Units = FreeCAD.Units<br />
PrintMessage = FreeCAD.Console.PrintMessage<br />
PrintError = FreeCAD.Console.PrintError<br />
<br />
fields_l = []<br />
unroll_l = []<br />
dwgtpllegacy = 'Mod/Drawing/Templates'<br />
dwgtpl = 'Mod/TechDraw/Templates'<br />
<br />
<br />
#####################################<br />
### Functions<br />
#####################################<br />
<br />
<br />
def errorDialog(msg):<br />
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical, 'Error Message', msg)<br />
diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)<br />
diag.exec_()<br />
<br />
<br />
def proceed():<br />
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)<br />
<br />
PrintMessage('===========================================\n')<br />
PrintMessage('unfoldBox: start.\n')<br />
try:<br />
file_name = fields_l[0].text()<br />
makedwg = makedwg_check.isChecked()<br />
leglay = leglay_check.isChecked()<br />
scale = float(fields_l[1].text())<br />
scale_auto = scale_check.isChecked()<br />
a3 = a3_check.isChecked()<br />
cartridge = cartridge_check.isChecked()<br />
onedrawing = onedrawing_check.isChecked()<br />
sewed = sewed_check.isChecked()<br />
PrintMessage('unfoldBox.file_name: {}\n'.format(file_name))<br />
PrintMessage('unfoldBox.makedwg: {}\n'.format(makedwg))<br />
PrintMessage('unfoldBox.leglay: {}\n'.format(leglay))<br />
PrintMessage('unfoldBox.scale: {}\n'.format(scale))<br />
PrintMessage('unfoldBox.scale_check: {}\n'.format(scale_auto))<br />
PrintMessage('unfoldBox.a3_check: {}\n'.format(a3))<br />
PrintMessage('unfoldBox.cartridge: {}\n'.format(cartridge))<br />
PrintMessage('unfoldBox.onedrawing: {}\n'.format(onedrawing))<br />
PrintMessage('unfoldBox.sewed: {}\n'.format(sewed))<br />
except:<br />
msg = 'unfoldBox: wrong inputs...\n'<br />
PrintError(msg)<br />
errorDialog(msg)<br />
<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
<br />
## Get selection<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel or len(sel) < 2:<br />
PrintMessage('unfoldBox: requires at least 2 selected faces, ending.\n')<br />
return<br />
<br />
doc = FreeCAD.ActiveDocument<br />
<br />
objnames_l=[]<br />
grp = doc.addObject('App::DocumentObjectGroup', str(file_name))<br />
for objid in range(len(sel)):<br />
obj = Draft.make_clone(sel[objid])<br />
grp.addObject(obj)<br />
objnames_l.append([ obj, sel[objid].Name ])<br />
<br />
doc.recompute()<br />
unfold = unfoldBox(doc)<br />
if sewed:<br />
objnames_l = unfold.done(objnames_l)<br />
grp.addObject(objnames_l[0][0])<br />
else:<br />
for objid in range(len(objnames_l)):<br />
unfold.moveXY(objnames_l[objid][0])<br />
<br />
if not makedwg:<br />
return<br />
<br />
if leglay:<br />
idx = 0<br />
while len(objnames_l) > 0:<br />
draw = Drawing2dLegacy(scale, scale_auto, a3,<br />
cartridge, onedrawing,<br />
doc.Name, 'Page'+str(idx))<br />
objnames_l = draw.all_(objnames_l)<br />
idx += 1<br />
PrintMessage('unfoldBox: obj_l= {}\n'.format(len(objnames_l)))<br />
else:<br />
draw = Drawing2d(scale, scale_auto, a3, cartridge)<br />
draw.drawpage(objnames_l[0], "{}Page".format(file_name))<br />
<br />
PrintMessage('unfoldBox: end.\n')<br />
PrintMessage('===========================================\n')<br />
<br />
<br />
def close():<br />
DialogBox.hide()<br />
<br />
<br />
def getType(obj):<br />
return type(obj).__name__<br />
<br />
def mkmm(l):<br />
return Units.Quantity(l, Units.Length)<br />
<br />
class unfoldBox:<br />
def __init__(self, doc):<br />
PrintMessage('unfoldBox.unfoldBox\n')<br />
self.doc = doc<br />
self.LIMIT = 0.0001<br />
<br />
def done(self, objnames_l):<br />
tree_l = self.makeTree(objnames_l)<br />
for idx in range(len(objnames_l)):<br />
face = objnames_l[idx]<br />
self.moveXY(face[0])<br />
self.sew(objnames_l, tree_l)<br />
return self.fusion(objnames_l)<br />
<br />
def getEndPoints(self, edge):<br />
return [v.Point for v in edge.Vertexes]<br />
<br />
def makeTree(self, objnames_l):<br />
## Initialisation of tree_l.<br />
tree_l = []<br />
for k in range(len(objnames_l)):<br />
facek = objnames_l[k][0]<br />
facekEdges = facek.Shape.Edges<br />
facek_l = []<br />
for i in range(len(facekEdges)):<br />
if False and getType(facekEdges[i].Curve) != 'GeomLineSegment':<br />
## this is a no-op...<br />
facek_l.append([-1, -1])<br />
else:<br />
## Search face link to the ith edge<br />
#vki0 = facekEdges[i].Curve.StartPoint<br />
#vki1 = facekEdges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(facekEdges[i])<br />
found = False<br />
for l in range(k+1, len(objnames_l)):<br />
facel = objnames_l[l][0]<br />
facelEdges = facel.Shape.Edges<br />
for j in range(len(facelEdges)):<br />
#vlj0 = facelEdges[j].Curve.StartPoint<br />
#vlj1 = facelEdges[j].Curve.EndPoint<br />
vlj0, vlj1 = self.getEndPoints(facelEdges[j])<br />
if (vki0.isEqual(vlj0, self.LIMIT)<br />
and vki1.isEqual(vlj1, self.LIMIT)):<br />
arelinked = False<br />
isfacek = isfacel = False<br />
for kk in range(k-1):<br />
for ii in range(len(tree_l[kk])):<br />
isfacek = tree_l[kk][ii][0] == k<br />
isfacel = tree_l[kk][ii][0] == l<br />
if isfacek and isfacel:<br />
arelinked = True<br />
break<br />
if not arelinked:<br />
facek_l.append([l, j])<br />
found = True<br />
break<br />
if found:<br />
break<br />
if not found:<br />
facek_l.append([-1, -1])<br />
tree_l.append(facek_l)<br />
return tree_l<br />
<br />
def sew(self, objnames_l, tree_l):<br />
placed_l = []<br />
for k in range(len(tree_l)):<br />
iskplaced = False<br />
for p in range(len(placed_l)):<br />
iskplaced = placed_l[p] == k<br />
if not iskplaced:<br />
placed_l.append(k)<br />
facek = tree_l[k]<br />
objk = objnames_l[k][0]<br />
for i in range(len(facek)):<br />
edgeki = facek[i]<br />
l, j = edgeki[:2]<br />
islplaced = False<br />
for p in range(len(placed_l)):<br />
if placed_l[p] == l:<br />
islplaced = True<br />
break<br />
if not islplaced:<br />
placed_l.append(l)<br />
if l >= 0 and not (islplaced and iskplaced):<br />
iskplaced = True<br />
## Move facel.edgelj to facek.edgeki.<br />
objl = objnames_l[l][0]<br />
#vki0 = objk.Shape.Edges[i].Curve.StartPoint<br />
#vki1 = objk.Shape.Edges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(objk.Shape.Edges[i])<br />
#vlj0 = objl.Shape.Edges[j].Curve.StartPoint<br />
#vlj1 = objl.Shape.Edges[j].Curve.EndPoint<br />
vlj0, vlj1 = self.getEndPoints(objk.Shape.Edges[j])<br />
vk = vki1.sub(vki0)<br />
vl = vlj1.sub(vlj0)<br />
alpk = vk.getAngle(vl) * 180 / math.pi<br />
alpl = vl.getAngle(vk) * 180 / math.pi<br />
self.isPlanZ(objk)<br />
if islplaced:<br />
Draft.move(objk, vlj0.sub(vki0))<br />
else:<br />
Draft.move(objl, vki0.sub(vlj0))<br />
self.isPlanZ(objk)<br />
<br />
if math.fabs(vk.dot(Vector(-vl.y, vl.x, 0))) > self.LIMIT:<br />
if islplaced:<br />
Draft.rotate(objk, -alpl, vlj0, self.vecto(vl, vk))<br />
else:<br />
Draft.rotate(objl, -alpk, vki0, self.vecto(vk, vl))<br />
elif vk.dot(vl) < 0:<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, self.vecto(vl, Vector(-vl.y, vl.x, 0)))<br />
else:<br />
Draft.rotate(objl, 180, vki0, self.vecto(vk, Vector(-vk.y, vk.x, 0)))<br />
## Verifications.<br />
#vki0 = objk.Shape.Edges[i].Curve.StartPoint<br />
#vki1 = objk.Shape.Edges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(objk.Shape.Edges[i])<br />
#vlj0 = objl.Shape.Edges[j].Curve.StartPoint<br />
#vlj1 = objl.Shape.Edges[j].Curve.EndPoint<br />
vli0, vli1 = self.getEndPoints(objk.Shape.Edges[j])<br />
vk = vki1.sub(vki0)<br />
vl = vlj1.sub(vlj0)<br />
self.isPlanZ(objk)<br />
<br />
## Flip or not.<br />
bbl, bbk = objl.Shape.BoundBox, objk.Shape.BoundBox<br />
L = max(bbl.XMax, bbk.XMax) - min(bbl.XMin, bbk.XMin)<br />
W = max(bbl.YMax, bbk.YMax) - min(bbl.YMin, bbk.YMin)<br />
S1 = L * W<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, vl)<br />
else:<br />
Draft.rotate(objl, 180, vki0, vk)<br />
bbl, bbk = objl.Shape.BoundBox, objk.Shape.BoundBox<br />
L = max(bbl.XMax, bbk.XMax) - min(bbl.XMin, bbk.XMin)<br />
W = max(bbl.YMax, bbk.YMax) - min(bbl.YMin, bbk.YMin)<br />
S2 = L * W<br />
if S2 <= S1:<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, vl)<br />
else:<br />
Draft.rotate(objl, 180, vki0, vk)<br />
self.isPlanZ(objk)<br />
<br />
def isPlanZ(self, obj):<br />
bb = obj.Shape.BoundBox<br />
L = bb.XMax - bb.XMin<br />
W = bb.YMax - bb.YMin<br />
H = bb.ZMax - bb.ZMin<br />
return H < self.LIMIT<br />
<br />
<br />
def fusion(self, objnames_l):<br />
## Init.<br />
obj_l, objna_l =[], []<br />
obj0, name = objnames_l[0]<br />
objfuse = self.doc.addObject('Part::MultiFuse', 'Unfolding')<br />
for k in range(len(objnames_l)):<br />
objk = objnames_l[k][0]<br />
obj_l.append(objk)<br />
<br />
objfuse.Shapes = obj_l<br />
self.doc.recompute()<br />
objna_l.append([objfuse, name])<br />
return objna_l<br />
<br />
def get2Vectors(self, shape):<br />
"""not used in v1.1"""<br />
v0, v1 = Vector(), Vector()<br />
<br />
edges = shape.Edges<br />
for idx in range(len(edges) - 1):<br />
e1, e2 = edges[idx], edges[idx + 1]<br />
## .EndPoint errors out...<br />
va = e1.Curve.EndPoint.sub(e1.Curve.StartPoint)<br />
vb = e2.Curve.EndPoint.sub(e2.Curve.StartPoint)<br />
if vb.sub(va).Length > v1.sub(v0).Length:<br />
v0, v1 = self.vect_copy(va), self.vect_copy(vb)<br />
return [v0, v1]<br />
<br />
def vecto(self, vect1, vect2):<br />
'''Function vecto.'''<br />
v = Vector()<br />
v.x = vect1.y * vect2.z - vect1.z * vect2.y<br />
v.y = vect1.z * vect2.x - vect1.x * vect2.z<br />
v.z = vect1.x * vect2.y - vect1.y * vect2.x<br />
return v<br />
<br />
def vect_copy(self, vect):<br />
'''Return a copy of vector.'''<br />
return vect.add(Vector())<br />
<br />
def moveXY(self, obj):<br />
## Move to origin<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, -bb.ZMin))<br />
<br />
## Find 2 vectors defining the plan of surface<br />
#tab = self.get2Vectors(obj.Shape)<br />
#v0, v1 = tab[:2]<br />
#norm = self.vecto(v0, v1)<br />
#norm.normalize()<br />
## above gives null vector, and errors out...<br />
<br />
## probably sprung out of some api-change over time<br />
## probably part.line vs part.linesegment...<br />
## a part.line does not have edge.Curve.StartPoint, or .EndPoint any more<br />
## the semantics is to get first & second point from a line,<br />
## so edge.Curve.value(edge.Curve.FirstParameter) should get the sought values<br />
## however easier to just use edge.Vertexes...<br />
## which appears to have same orientation<br />
<br />
norm = obj.Shape.findPlane().Axis ## works for planar surfaces<br />
#norm = obj.Shape.Surface.Axis ## gives worse results...<br />
norm.normalize()<br />
<br />
## Rotate.<br />
nx, ny, nz = (math.fabs(xyz) for xyz in norm)<br />
if nx < self.LIMIT and nz < self.LIMIT:<br />
Draft.rotate(obj, 90, Vector(0, 0, 0), Vector(1, 0, 0))<br />
elif ny < self.LIMIT and nz < self.LIMIT:<br />
Draft.rotate(obj, 90, Vector(0, 0, 0), Vector(0, 1, 0))<br />
else:<br />
## Rotate following the angle to the normal direction of the plan.<br />
oz = Vector(0, 0, 1)<br />
alp = oz.getAngle(norm) * 180 / math.pi<br />
vecto = self.vecto(oz, norm)<br />
rotv = oz if vecto.isEqual(Vector(), self.LIMIT) else self.vecto(oz, norm)<br />
#rotv = norm if vecto.isEqual(Vector(), self.LIMIT) else self.vecto(oz, norm)<br />
## flipping here seems to give worse results as well...<br />
Draft.rotate(obj, -alp, Vector(0, 0, 0), rotv)<br />
<br />
## Move to z = 0.<br />
Draft.move(obj, Vector(0, 0, -obj.Shape.BoundBox.ZMin))<br />
<br />
<br />
class Scale:<br />
"""keeps autoscaling to integers"""<br />
def __init__(self, scale):<br />
self.scale = scale if scale >= 1 else 1 / scale<br />
self.scale = int(self.scale)<br />
self.inverted = scale >= 1<br />
<br />
def get(self):<br />
if self.inverted:<br />
return self.scale, '{}:1'.format(self.scale)<br />
else:<br />
return 1/self.scale, '1:{}'.format(self.scale)<br />
<br />
<br />
class Drawing2d:<br />
def __init__(self, scale, scale_auto, a3, cartridge):<br />
"""techdraw based layout for one page only"""<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.a3 = a3<br />
self.cartridge = cartridge<br />
if a3:<br />
self.WH = 420, 297<br />
else:<br />
self.WH = 297, 210<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
def newPage(self, page_name):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
page = self.doc.addObject('TechDraw::DrawPage', page_name)<br />
template = self.doc.addObject('TechDraw::DrawSVGTemplate', 'Template')<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = 'TD' if self.cartridge else '_blank'<br />
template.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
page.Template = template<br />
<br />
return page<br />
<br />
def drawpage(self, objname, page_name):<br />
page = self.newPage(page_name)<br />
faceset, name = objname<br />
<br />
bb = faceset.Shape.BoundBox<br />
## bb does not auto-update, have to pick up new bb after manipulation<br />
if bb.YLength > bb.XLength: ## auto rotate<br />
Draft.rotate(faceset, 90)<br />
bb = faceset.Shape.BoundBox<br />
<br />
Draft.move(faceset, Vector(-bb.XMin, -bb.YMin, 0))<br />
bb = faceset.Shape.BoundBox<br />
<br />
W, H = self.WH<br />
xr, yr = W / bb.XLength, H / bb.YLength<br />
adjust = 0.7 if self.cartridge else 0.85<br />
scale = min(xr, yr) * adjust if self.scale_auto else self.scale<br />
scale, scr = Scale(scale).get()<br />
bb.scale(scale, scale, 1) ## faceset in xy-plane<br />
<br />
<br />
TopView = self.doc.addObject('TechDraw::DrawViewPart', 'TopView')<br />
page.addView(TopView)<br />
TopView.Source = faceset<br />
TopView.Direction = (0, 0, 1)<br />
TopView.XDirection = (1, 0, 0)<br />
TopView.Scale = scale<br />
<br />
Text = self.doc.addObject('TechDraw::DrawViewAnnotation', name)<br />
page.addView(Text)<br />
Text.Text = name<br />
Text.recompute() # for size<br />
bb.scale(scale, scale, scale)<br />
yt = (H - bb.YLength) / 2 - Text.TextSize.Value * 1.5<br />
Text.Y = max(1, yt)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
FreeCADGui.runCommand('TechDraw_ToggleFrame', 0)<br />
<br />
<br />
class Drawing2dLegacy:<br />
def __init__(self, scale, scale_auto, a3, cartridge, onedrawing,<br />
drawing_name, page_name):<br />
"""Function __init__<br />
<br />
- scale<br />
- scale_auto<br />
- a3<br />
- cartridge<br />
- onedrawing<br />
v1.1 - renamed to legacy, functional wise untouched<br />
"""<br />
self.TopX_H = self.TopY_H = 0<br />
self.TopX_V = self.TopY_V = 0<br />
self.TopX_Hmax = self.TopY_Hmax = 0<br />
self.TopX_Vmax = self.TopY_Vmax = 0<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
self.onedrawing = onedrawing<br />
self.marge = 6<br />
if self.a3:<br />
self.L, self.H = 420, 297<br />
else:<br />
self.L, self.H = 297, 210<br />
self.page_name = page_name<br />
self.drawing_name = drawing_name<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
def newPage(self):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpllegacy)<br />
page = self.doc.addObject('Drawing::FeaturePage', self.page_name)<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = '' if self.cartridge else '_plain'<br />
page.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
return page<br />
<br />
def all_(self, objnames_l):<br />
obj_l = []<br />
for objid in range(len(objnames_l)):<br />
if objid == 0 or not self.onedrawing:<br />
self.newPage()<br />
obj_l.extend(self.done(objid, objnames_l[objid]))<br />
return obj_l<br />
<br />
def done(self, id_, objname):<br />
## Init.<br />
obj_l = []<br />
obj, objname = objname<br />
bb = obj.Shape.BoundBox<br />
xmax, ymax = bb.XMax - bb.XMin, bb.YMax - bb.YMin<br />
if ymax > xmax:<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
bb = obj.Shape.BoundBox ## does not auto-update, have to pick up new obj<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
scale = min((self.L-4*self.marge) / xmax, (self.H-4*self.marge) / ymax)<br />
<br />
if (not self.scale_auto) or (self.onedrawing):<br />
scale = self.scale<br />
<br />
if id_ == 0 or not self.onedrawing:<br />
## Init.<br />
PrintMessage('Drawing2d: init\n')<br />
self.TopX_H = self.TopY_H = self.marge * 2<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + self.marge<br />
self.TopY_H = self.TopY_H<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax*scale + self.marge)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
self.TopY_V = self.marge * 2<br />
<br />
elif self.onedrawing:<br />
if self.TopX_H + xmax * scale < self.L:<br />
if self.TopY_H + ymax * scale + self.marge*2 < self.H:<br />
## H Add at right on same horizontal line.<br />
PrintMessage('Drawing2d: horizontal\n')<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + self.marge<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax*scale + self.marge)<br />
self.TopX_Vmax = max(self.TopX_Hmax, self.TopX_Vmax)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
else:<br />
## V Add at right on same horizontal line<br />
PrintMessage('Drawing2d: vertival\n')<br />
if (self.TopX_V + ymax * scale + 2 * self.marge < self.L<br />
and self.TopY_V + xmax * scale + 2*self.marge < self.H):<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + ymax * scale + self.marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + xmax * scale + self.marge)<br />
else:<br />
obj_l.append([obj, 'name'])<br />
return obj_l<br />
else:<br />
## H Carriage return.<br />
if (self.TopY_Hmax + ymax * scale + self.marge*2 < self.H):<br />
msg = 'Drawing2d: carriage return: {} > {}\n'<br />
PrintMessage(msg.format(self.TopY_H + ymax * scale, self.H))<br />
TopX = self.marge*2<br />
TopY = self.TopY_Hmax<br />
self.TopX_H = TopX + xmax * scale + self.marge<br />
self.TopY_H = TopY<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = self.TopY_Hmax + ymax*scale+self.marge<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
else:<br />
## V Add at right on same horizontal line.<br />
msg = 'Drawing2d: vertical: {}, {}\n'<br />
PrintMessage(msg.format(self.TopX_V, self.TopX_Vmax))<br />
if (self.TopX_V + ymax * scale + 2*self.marge < self.L<br />
and self.TopY_V + xmax * scale + 2*self.marge < self.H):<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + ymax * scale + self.marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + xmax * scale + self.marge)<br />
else:<br />
obj_l.append([obj, 'name'])<br />
return obj_l<br />
<br />
page = self.doc.getObject(self.page_name)<br />
<br />
## Drawing wb (untouched)<br />
Text = self.doc.addObject('Drawing::FeatureViewAnnotation', objname + '_txt')<br />
Text.Text = objname<br />
Text.X = TopX + xmax / 2 * scale<br />
Text.Y = TopY + ymax / 2 * scale<br />
Text.Scale = 7 if self.a3 else 5<br />
<br />
TopView = self.doc.addObject('Drawing::FeatureViewPart', 'TopView')<br />
TopView.Source = obj<br />
TopView.Direction = (0.0, 0.0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = TopX<br />
TopView.Y = TopY<br />
TopView.ShowHiddenLines = True<br />
TopView.Scale = scale<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
<br />
return obj_l<br />
<br />
<br />
#####################################<br />
### Dialog Box<br />
#####################################<br />
fields = [['Group Name', 'Unfolding']]<br />
fields.append(['Scale', '1'])<br />
<br />
DialogBox = QtGui.QDialog()<br />
DialogBox.resize(250, 250)<br />
DialogBox.setWindowTitle('unfoldBox')<br />
la = QtGui.QVBoxLayout(DialogBox)<br />
<br />
# Input fields.<br />
for id_ in range(len(fields)):<br />
la.addWidget(QtGui.QLabel(fields[id_][0]))<br />
fields_l.append(QtGui.QLineEdit(fields[id_][1]))<br />
la.addWidget(fields_l[id_])<br />
<br />
makedwg_check = QtGui.QCheckBox(DialogBox)<br />
makedwg_check.setObjectName('checkBox')<br />
makedwg_check.setChecked(True)<br />
la.addWidget(QtGui.QLabel('Make drawing'))<br />
la.addWidget(makedwg_check)<br />
<br />
leglay_check = QtGui.QCheckBox(DialogBox)<br />
leglay_check.setObjectName('checkBox')<br />
leglay_check.setChecked(False)<br />
la.addWidget(QtGui.QLabel('Legacy layout'))<br />
la.addWidget(leglay_check)<br />
<br />
scale_check = QtGui.QCheckBox(DialogBox)<br />
scale_check.setObjectName('checkBox')<br />
scale_check.setChecked(True)<br />
la.addWidget(QtGui.QLabel('Scale auto'))<br />
la.addWidget(scale_check)<br />
<br />
a3_check = QtGui.QCheckBox(DialogBox)<br />
a3_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('A3 Format'))<br />
a3_check.setChecked(False)<br />
la.addWidget(a3_check)<br />
<br />
cartridge_check = QtGui.QCheckBox(DialogBox)<br />
cartridge_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Cartridge'))<br />
cartridge_check.setChecked(False)<br />
la.addWidget(cartridge_check)<br />
<br />
onedrawing_check = QtGui.QCheckBox(DialogBox)<br />
onedrawing_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Group drawings in page'))<br />
onedrawing_check.setChecked(True)<br />
la.addWidget(onedrawing_check)<br />
<br />
sewed_check = QtGui.QCheckBox(DialogBox)<br />
sewed_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Sewed surfaces'))<br />
sewed_check.setChecked(True)<br />
sewed_check.setEnabled(False)<br />
la.addWidget(sewed_check)<br />
<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
box.setOrientation(QtCore.Qt.Horizontal)<br />
box.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)<br />
la.addWidget(box)<br />
<br />
QtCore.QObject.connect(box, QtCore.SIGNAL('accepted()'), proceed)<br />
QtCore.QObject.connect(box, QtCore.SIGNAL('rejected()'), close)<br />
QtCore.QMetaObject.connectSlotsByName(DialogBox)<br />
DialogBox.show()<br />
<br />
</nowiki><br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Unfold_Box&diff=1165857Macro Unfold Box2022-07-28T21:44:40Z<p>Heda: v1.1</p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Unfold Box<br />
|Icon=Macro_Unfold_Box.png<br />
|Description=The macro allows to unfold the surfaces of a box of any shape and to draw them on a page.<BR/><br />
|Author=Hervé B., heda<br />
|Version=1.1<br />
|Date=2022-07-28<br />
|FCVersion=<br />
|Download=[https://www.freecadweb.org/wiki/images/e/e4/Macro_Unfold_Box.png ToolBar Icon]<br />
}}<br />
<br />
==Description== <!--T:2--><br />
The macro allows to unfold the surfaces of a box of any shape and to draw them on a page.<br />
<br />
<!--T:3--><br />
[[File:Macro_unfoldBox1.png|480px]]<br />
{{Caption|Macro_unfoldBox}}<br />
<br />
== Installation == <!--T:4--><br />
Available in Add-on manager.<br />
<br />
Cf [http://forum.freecadweb.org/viewtopic.php?f=17&t=4587 Macro for unfolding box surfaces]<br />
<br />
== Options == <!--T:5--><br />
# Scale manual or automatic<br />
# Page format: a3/a4, cartridge (cf FreeCAD templates)<br />
# Group drawings in the same page as possible.<br />
# Sew or not the edges of the pieces.<br />
<br />
[[File:Macro_UnFoldBox_start_form.png|Macro_unfoldBox]]<br />
<br />
== Instruction for use == <!--T:6--><br />
# Select a box made with Part::Loft tool for example.<br />
# Explode it (cf Draft menu) into plan pieces<br />
# Select the surfaces<br />
# Execute the macro<br />
<br />
The unfolding algorithm will place the faces on the xy-plane, however it seldom does the unfolding correctly. Thus some manual post-processing is needed to get to desired result, as shown in the picture below.<br />
<br />
[[File:MacroUnFoldBoxInstruction.png|Macro_unfoldBox]]<br />
<br />
Starting point is a box like the upper left picture.<br />
<br />
# Select all faces and run the macro<br />
# Orient to Top View<br />
# Toggle visibilty on the created set of faces, the individual clones are to be visible, not the compound<br />
# Use Draft/Move and Draft/Rotate to reposition the folded cloned faces (a handfull of clicks per face when snapping is used)<br />
# The drawing updates automatically to the new positions<br />
<br />
The finished result is shown in the lower right picture above.<br />
<br />
==Script== <!--T:7--><br />
</translate><br />
<br />
ToolBar icon [[Image:Macro_Unfold_Box.png]]<br />
<br />
'''Macro_unfoldBox.FCMacro'''<br />
<br />
<!-- Do not remove the pair of <nowiki> </nowiki> tags because the special symbols won't be parsed correctly --><br />
{{MacroCode|code=<br />
<nowiki><br />
# -*- coding: utf-8 -*-<br />
"""<br />
FreeCAD Macro unfoldBox.<br />
<br />
Unfolding of planar surfaces<br />
"""<br />
##################################################<br />
# SEE https://wiki.freecadweb.org/Macro_Unfold_Box<br />
# ***************************************************************************<br />
# * *<br />
# * Copyright (c) 2013 - DoNovae/Herve BAILLY <hbl13@donovae.com> *<br />
# * Copyright (c) 2022 - heda <heda@fc-forum> *<br />
# * *<br />
# * This program is free software; you can redistribute it and/or modify *<br />
# * it under the terms of the GNU Lesser General Public License (LGPL) *<br />
# * as published by the Free Software Foundation; either version 2 of *<br />
# * the License, or (at your option) any later version. *<br />
# * for detail see the LICENCE text file. *<br />
# * *<br />
# * This program is distributed in the hope that it will be useful, *<br />
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
# * GNU Library General Public License for more details. *<br />
# * *<br />
# * You should have received a copy of the GNU Library General Public *<br />
# * License along with this program; if not, write to the Free Software *<br />
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
# * USA *<br />
# * *<br />
# ***************************************************************************<br />
<br />
__Name__ = 'Unfold Box'<br />
__Comment__ = 'Unfolds planar surfaces and draws them on a page.'<br />
__Author__ = 'Hervé B., heda'<br />
__Version__ = '1.1'<br />
__Date__ = '2022-07-28'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = 'https://wiki.freecad.org/Macro_Unfold_Box'<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Unfold_Box'<br />
__Icon__ = ''<br />
__Help__ = ('Select surfaces, Explode them (cf Draft menu Downgrade), '<br />
'Select the exploded surfaces, Execute the macro')<br />
__Status__ = ''<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
__doc__ = """<br />
select a face, or several and run the macro.<br />
a shell/solid needs to be draft/downgraded to get the faces as separate objects<br />
<br />
the macro is intended to unfold a set of planar faces,<br />
in current state, most of the times it does not place the faces correctly.<br />
thus one needs to do the final placement of the clones manually, with Draft/Move & Rotate<br />
regardless, the macro saves a lot of clicks compared to a fully manual unfold<br />
<br />
settings are not context aware, all settings not applicable are ignored.<br />
as example, using autoscaling ignores the scale-value in the form<br />
<br />
sew is always enabled, thus the drawing<br />
is always the sewed shape on a single page<br />
<br />
<br />
v1.1 (2022-07-28) py3/qt5 compat, cosmetic code changes,<br />
minor code tweaks for evolved fc-api<br />
added option to skip drawing, made layout engine with techdraw,<br />
the drawing wb layout engine is now called "legacy"<br />
v1.0.1 (2020-03-10) - on wiki<br />
v1.0 (2013-09-14) - on wiki<br />
<br />
note:<br />
- unfolding occasionally work as expected, but mostly not<br />
- anyone is free to improve functionality<br />
<br />
"""<br />
<br />
import os, math<br />
<br />
from PySide import QtGui, QtCore<br />
<br />
import FreeCAD, FreeCADGui<br />
import Draft<br />
<br />
Vector = FreeCAD.Base.Vector<br />
Units = FreeCAD.Units<br />
PrintMessage = FreeCAD.Console.PrintMessage<br />
PrintError = FreeCAD.Console.PrintError<br />
<br />
fields_l = []<br />
unroll_l = []<br />
dwgtpllegacy = 'Mod/Drawing/Templates'<br />
dwgtpl = 'Mod/TechDraw/Templates'<br />
<br />
<br />
#####################################<br />
### Functions<br />
#####################################<br />
<br />
<br />
def errorDialog(msg):<br />
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical, 'Error Message', msg)<br />
diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)<br />
diag.exec_()<br />
<br />
<br />
def proceed():<br />
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)<br />
<br />
PrintMessage('===========================================\n')<br />
PrintMessage('unfoldBox: start.\n')<br />
try:<br />
file_name = fields_l[0].text()<br />
makedwg = makedwg_check.isChecked()<br />
leglay = leglay_check.isChecked()<br />
scale = float(fields_l[1].text())<br />
scale_auto = scale_check.isChecked()<br />
a3 = a3_check.isChecked()<br />
cartridge = cartridge_check.isChecked()<br />
onedrawing = onedrawing_check.isChecked()<br />
sewed = sewed_check.isChecked()<br />
PrintMessage('unfoldBox.file_name: {}\n'.format(file_name))<br />
PrintMessage('unfoldBox.makedwg: {}\n'.format(makedwg))<br />
PrintMessage('unfoldBox.leglay: {}\n'.format(leglay))<br />
PrintMessage('unfoldBox.scale: {}\n'.format(scale))<br />
PrintMessage('unfoldBox.scale_check: {}\n'.format(scale_auto))<br />
PrintMessage('unfoldBox.a3_check: {}\n'.format(a3))<br />
PrintMessage('unfoldBox.cartridge: {}\n'.format(cartridge))<br />
PrintMessage('unfoldBox.onedrawing: {}\n'.format(onedrawing))<br />
PrintMessage('unfoldBox.sewed: {}\n'.format(sewed))<br />
except:<br />
msg = 'unfoldBox: wrong inputs...\n'<br />
PrintError(msg)<br />
errorDialog(msg)<br />
<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
<br />
## Get selection<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel or len(sel) < 2:<br />
PrintMessage('unfoldBox: requires at least 2 selected faces, ending.\n')<br />
return<br />
<br />
doc = FreeCAD.ActiveDocument<br />
<br />
objnames_l=[]<br />
grp = doc.addObject('App::DocumentObjectGroup', str(file_name))<br />
for objid in range(len(sel)):<br />
obj = Draft.make_clone(sel[objid])<br />
grp.addObject(obj)<br />
objnames_l.append([ obj, sel[objid].Name ])<br />
print('xxx', obj, obj.Placement)<br />
<br />
doc.recompute()<br />
unfold = unfoldBox(doc)<br />
if sewed:<br />
objnames_l = unfold.done(objnames_l)<br />
grp.addObject(objnames_l[0][0])<br />
else:<br />
for objid in range(len(objnames_l)):<br />
unfold.moveXY(objnames_l[objid][0])<br />
<br />
if not makedwg:<br />
return<br />
<br />
if leglay:<br />
idx = 0<br />
while len(objnames_l) > 0:<br />
draw = Drawing2dLegacy(scale, scale_auto, a3,<br />
cartridge, onedrawing,<br />
doc.Name, 'Page'+str(idx))<br />
objnames_l = draw.all_(objnames_l)<br />
idx += 1<br />
PrintMessage('unfoldBox: obj_l= {}\n'.format(len(objnames_l)))<br />
else:<br />
draw = Drawing2d(scale, scale_auto, a3, cartridge)<br />
draw.drawpage(objnames_l[0], "{}Page".format(file_name))<br />
<br />
PrintMessage('unfoldBox: end.\n')<br />
PrintMessage('===========================================\n')<br />
<br />
<br />
def close():<br />
DialogBox.hide()<br />
<br />
<br />
def getType(obj):<br />
return type(obj).__name__<br />
<br />
def mkmm(l):<br />
return Units.Quantity(l, Units.Length)<br />
<br />
class unfoldBox:<br />
def __init__(self, doc):<br />
PrintMessage('unfoldBox.unfoldBox\n')<br />
self.doc = doc<br />
self.LIMIT = 0.0001<br />
<br />
def done(self, objnames_l):<br />
tree_l = self.makeTree(objnames_l)<br />
for idx in range(len(objnames_l)):<br />
face = objnames_l[idx]<br />
self.moveXY(face[0])<br />
self.sew(objnames_l, tree_l)<br />
return self.fusion(objnames_l)<br />
<br />
def getEndPoints(self, edge):<br />
return [v.Point for v in edge.Vertexes]<br />
<br />
def makeTree(self, objnames_l):<br />
## Initialisation of tree_l.<br />
tree_l = []<br />
for k in range(len(objnames_l)):<br />
facek = objnames_l[k][0]<br />
facekEdges = facek.Shape.Edges<br />
facek_l = []<br />
for i in range(len(facekEdges)):<br />
if False and getType(facekEdges[i].Curve) != 'GeomLineSegment':<br />
## this is a no-op...<br />
facek_l.append([-1, -1])<br />
else:<br />
## Search face link to the ith edge<br />
#vki0 = facekEdges[i].Curve.StartPoint<br />
#vki1 = facekEdges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(facekEdges[i])<br />
found = False<br />
for l in range(k+1, len(objnames_l)):<br />
facel = objnames_l[l][0]<br />
facelEdges = facel.Shape.Edges<br />
for j in range(len(facelEdges)):<br />
#vlj0 = facelEdges[j].Curve.StartPoint<br />
#vlj1 = facelEdges[j].Curve.EndPoint<br />
vlj0, vlj1 = self.getEndPoints(facelEdges[j])<br />
if (vki0.isEqual(vlj0, self.LIMIT)<br />
and vki1.isEqual(vlj1, self.LIMIT)):<br />
arelinked = False<br />
isfacek = isfacel = False<br />
for kk in range(k-1):<br />
for ii in range(len(tree_l[kk])):<br />
isfacek = tree_l[kk][ii][0] == k<br />
isfacel = tree_l[kk][ii][0] == l<br />
if isfacek and isfacel:<br />
arelinked = True<br />
break<br />
if not arelinked:<br />
facek_l.append([l, j])<br />
found = True<br />
break<br />
if found:<br />
break<br />
if not found:<br />
facek_l.append([-1, -1])<br />
tree_l.append(facek_l)<br />
return tree_l<br />
<br />
def sew(self, objnames_l, tree_l):<br />
placed_l = []<br />
for k in range(len(tree_l)):<br />
iskplaced = False<br />
for p in range(len(placed_l)):<br />
iskplaced = placed_l[p] == k<br />
if not iskplaced:<br />
placed_l.append(k)<br />
facek = tree_l[k]<br />
objk = objnames_l[k][0]<br />
for i in range(len(facek)):<br />
edgeki = facek[i]<br />
l, j = edgeki[:2]<br />
islplaced = False<br />
for p in range(len(placed_l)):<br />
if placed_l[p] == l:<br />
islplaced = True<br />
break<br />
if not islplaced:<br />
placed_l.append(l)<br />
if l >= 0 and not (islplaced and iskplaced):<br />
iskplaced = True<br />
## Move facel.edgelj to facek.edgeki.<br />
objl = objnames_l[l][0]<br />
#vki0 = objk.Shape.Edges[i].Curve.StartPoint<br />
#vki1 = objk.Shape.Edges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(objk.Shape.Edges[i])<br />
#vlj0 = objl.Shape.Edges[j].Curve.StartPoint<br />
#vlj1 = objl.Shape.Edges[j].Curve.EndPoint<br />
vlj0, vlj1 = self.getEndPoints(objk.Shape.Edges[j])<br />
vk = vki1.sub(vki0)<br />
vl = vlj1.sub(vlj0)<br />
alpk = vk.getAngle(vl) * 180 / math.pi<br />
alpl = vl.getAngle(vk) * 180 / math.pi<br />
self.isPlanZ(objk)<br />
if islplaced:<br />
Draft.move(objk, vlj0.sub(vki0))<br />
else:<br />
Draft.move(objl, vki0.sub(vlj0))<br />
self.isPlanZ(objk)<br />
<br />
if math.fabs(vk.dot(Vector(-vl.y, vl.x, 0))) > self.LIMIT:<br />
if islplaced:<br />
Draft.rotate(objk, -alpl, vlj0, self.vecto(vl, vk))<br />
else:<br />
Draft.rotate(objl, -alpk, vki0, self.vecto(vk, vl))<br />
elif vk.dot(vl) < 0:<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, self.vecto(vl, Vector(-vl.y, vl.x, 0)))<br />
else:<br />
Draft.rotate(objl, 180, vki0, self.vecto(vk, Vector(-vk.y, vk.x, 0)))<br />
## Verifications.<br />
#vki0 = objk.Shape.Edges[i].Curve.StartPoint<br />
#vki1 = objk.Shape.Edges[i].Curve.EndPoint<br />
vki0, vki1 = self.getEndPoints(objk.Shape.Edges[i])<br />
#vlj0 = objl.Shape.Edges[j].Curve.StartPoint<br />
#vlj1 = objl.Shape.Edges[j].Curve.EndPoint<br />
vli0, vli1 = self.getEndPoints(objk.Shape.Edges[j])<br />
vk = vki1.sub(vki0)<br />
vl = vlj1.sub(vlj0)<br />
self.isPlanZ(objk)<br />
<br />
## Flip or not.<br />
bbl, bbk = objl.Shape.BoundBox, objk.Shape.BoundBox<br />
L = max(bbl.XMax, bbk.XMax) - min(bbl.XMin, bbk.XMin)<br />
W = max(bbl.YMax, bbk.YMax) - min(bbl.YMin, bbk.YMin)<br />
S1 = L * W<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, vl)<br />
else:<br />
Draft.rotate(objl, 180, vki0, vk)<br />
bbl, bbk = objl.Shape.BoundBox, objk.Shape.BoundBox<br />
L = max(bbl.XMax, bbk.XMax) - min(bbl.XMin, bbk.XMin)<br />
W = max(bbl.YMax, bbk.YMax) - min(bbl.YMin, bbk.YMin)<br />
S2 = L * W<br />
if S2 <= S1:<br />
if islplaced:<br />
Draft.rotate(objk, 180, vlj0, vl)<br />
else:<br />
Draft.rotate(objl, 180, vki0, vk)<br />
self.isPlanZ(objk)<br />
<br />
def isPlanZ(self, obj):<br />
bb = obj.Shape.BoundBox<br />
L = bb.XMax - bb.XMin<br />
W = bb.YMax - bb.YMin<br />
H = bb.ZMax - bb.ZMin<br />
return H < self.LIMIT<br />
<br />
<br />
def fusion(self, objnames_l):<br />
## Init.<br />
obj_l, objna_l =[], []<br />
obj0, name = objnames_l[0]<br />
objfuse = self.doc.addObject('Part::MultiFuse', 'Unfolding')<br />
for k in range(len(objnames_l)):<br />
objk = objnames_l[k][0]<br />
obj_l.append(objk)<br />
<br />
objfuse.Shapes = obj_l<br />
self.doc.recompute()<br />
objna_l.append([objfuse, name])<br />
return objna_l<br />
<br />
def get2Vectors(self, shape):<br />
"""not used in v1.1"""<br />
v0, v1 = Vector(), Vector()<br />
<br />
edges = shape.Edges<br />
for idx in range(len(edges) - 1):<br />
e1, e2 = edges[idx], edges[idx + 1]<br />
## .EndPoint errors out...<br />
va = e1.Curve.EndPoint.sub(e1.Curve.StartPoint)<br />
vb = e2.Curve.EndPoint.sub(e2.Curve.StartPoint)<br />
if vb.sub(va).Length > v1.sub(v0).Length:<br />
v0, v1 = self.vect_copy(va), self.vect_copy(vb)<br />
return [v0, v1]<br />
<br />
def vecto(self, vect1, vect2):<br />
'''Function vecto.'''<br />
v = Vector()<br />
v.x = vect1.y * vect2.z - vect1.z * vect2.y<br />
v.y = vect1.z * vect2.x - vect1.x * vect2.z<br />
v.z = vect1.x * vect2.y - vect1.y * vect2.x<br />
return v<br />
<br />
def vect_copy(self, vect):<br />
'''Return a copy of vector.'''<br />
return vect.add(Vector())<br />
<br />
def moveXY(self, obj):<br />
## Move to origin<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, -bb.ZMin))<br />
<br />
## Find 2 vectors defining the plan of surface<br />
#tab = self.get2Vectors(obj.Shape)<br />
#v0, v1 = tab[:2]<br />
#norm = self.vecto(v0, v1)<br />
#norm.normalize()<br />
## above gives null vector, and errors out...<br />
<br />
## probably sprung out of some api-change over time<br />
## probably part.line vs part.linesegment...<br />
## a part.line does not have edge.Curve.StartPoint, or .EndPoint any more<br />
## the semantics is to get first & second point from a line,<br />
## so edge.Curve.value(edge.Curve.FirstParameter) should get the sought values<br />
## however easier to just use edge.Vertexes...<br />
## which appears to have same orientation<br />
<br />
norm = obj.Shape.findPlane().Axis ## works for planar surfaces<br />
#norm = obj.Shape.Surface.Axis ## gives worse results...<br />
norm.normalize()<br />
#print(obj, obj.Shape, obj.Shape.findPlane(), norm, norm.normalize())<br />
<br />
## Rotate.<br />
nx, ny, nz = (math.fabs(xyz) for xyz in norm)<br />
if nx < self.LIMIT and nz < self.LIMIT:<br />
Draft.rotate(obj, 90, Vector(0, 0, 0), Vector(1, 0, 0))<br />
elif ny < self.LIMIT and nz < self.LIMIT:<br />
Draft.rotate(obj, 90, Vector(0, 0, 0), Vector(0, 1, 0))<br />
else:<br />
## Rotate following the angle to the normal direction of the plan.<br />
oz = Vector(0, 0, 1)<br />
alp = oz.getAngle(norm) * 180 / math.pi<br />
print('yyy', oz, alp, self.vecto(oz, norm))<br />
vecto = self.vecto(oz, norm)<br />
rotv = oz if vecto.isEqual(Vector(), self.LIMIT) else self.vecto(oz, norm)<br />
#rotv = norm if vecto.isEqual(Vector(), self.LIMIT) else self.vecto(oz, norm)<br />
## flipping here seems to give worse results as well...<br />
Draft.rotate(obj, -alp, Vector(0, 0, 0), rotv)<br />
<br />
## Move to z = 0.<br />
Draft.move(obj, Vector(0, 0, -obj.Shape.BoundBox.ZMin))<br />
<br />
<br />
class Scale:<br />
"""keeps autoscaling to integers"""<br />
def __init__(self, scale):<br />
self.scale = scale if scale >= 1 else 1 / scale<br />
self.scale = int(self.scale)<br />
self.inverted = scale >= 1<br />
<br />
def get(self):<br />
if self.inverted:<br />
return self.scale, '{}:1'.format(self.scale)<br />
else:<br />
return 1/self.scale, '1:{}'.format(self.scale)<br />
<br />
<br />
class Drawing2d:<br />
def __init__(self, scale, scale_auto, a3, cartridge):<br />
"""techdraw based layout for one page only"""<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.a3 = a3<br />
self.cartridge = cartridge<br />
if a3:<br />
self.WH = 420, 297<br />
else:<br />
self.WH = 297, 210<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
def newPage(self, page_name):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
page = self.doc.addObject('TechDraw::DrawPage', page_name)<br />
template = self.doc.addObject('TechDraw::DrawSVGTemplate', 'Template')<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = 'TD' if self.cartridge else '_blank'<br />
template.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
page.Template = template<br />
<br />
return page<br />
<br />
def drawpage(self, objname, page_name):<br />
page = self.newPage(page_name)<br />
faceset, name = objname<br />
<br />
bb = faceset.Shape.BoundBox<br />
## bb does not auto-update, have to pick up new bb after manipulation<br />
if bb.YLength > bb.XLength: ## auto rotate<br />
Draft.rotate(faceset, 90)<br />
bb = faceset.Shape.BoundBox<br />
<br />
Draft.move(faceset, Vector(-bb.XMin, -bb.YMin, 0))<br />
bb = faceset.Shape.BoundBox<br />
<br />
W, H = self.WH<br />
xr, yr = W / bb.XLength, H / bb.YLength<br />
adjust = 0.7 if self.cartridge else 0.85<br />
scale = min(xr, yr) * adjust if self.scale_auto else self.scale<br />
scale, scr = Scale(scale).get()<br />
bb.scale(scale, scale, 1) ## faceset in xy-plane<br />
<br />
<br />
TopView = self.doc.addObject('TechDraw::DrawViewPart', 'TopView')<br />
page.addView(TopView)<br />
TopView.Source = faceset<br />
TopView.Direction = (0, 0, 1)<br />
TopView.XDirection = (1, 0, 0)<br />
TopView.Scale = scale<br />
<br />
Text = self.doc.addObject('TechDraw::DrawViewAnnotation', name)<br />
page.addView(Text)<br />
Text.Text = name<br />
Text.recompute() # for size<br />
bb.scale(scale, scale, scale)<br />
yt = (H - bb.YLength) / 2 - Text.TextSize.Value * 1.5<br />
Text.Y = max(1, yt)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
FreeCADGui.runCommand('TechDraw_ToggleFrame', 0)<br />
<br />
<br />
class Drawing2dLegacy:<br />
def __init__(self, scale, scale_auto, a3, cartridge, onedrawing,<br />
drawing_name, page_name):<br />
"""Function __init__<br />
<br />
- scale<br />
- scale_auto<br />
- a3<br />
- cartridge<br />
- onedrawing<br />
v1.1 - renamed to legacy, functional wise untouched<br />
"""<br />
self.TopX_H = self.TopY_H = 0<br />
self.TopX_V = self.TopY_V = 0<br />
self.TopX_Hmax = self.TopY_Hmax = 0<br />
self.TopX_Vmax = self.TopY_Vmax = 0<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
self.onedrawing = onedrawing<br />
self.marge = 6<br />
if self.a3:<br />
self.L, self.H = 420, 297<br />
else:<br />
self.L, self.H = 297, 210<br />
self.page_name = page_name<br />
self.drawing_name = drawing_name<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
def newPage(self):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpllegacy)<br />
page = self.doc.addObject('Drawing::FeaturePage', self.page_name)<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = '' if self.cartridge else '_plain'<br />
page.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
return page<br />
<br />
def all_(self, objnames_l):<br />
obj_l = []<br />
for objid in range(len(objnames_l)):<br />
if objid == 0 or not self.onedrawing:<br />
self.newPage()<br />
obj_l.extend(self.done(objid, objnames_l[objid]))<br />
return obj_l<br />
<br />
def done(self, id_, objname):<br />
## Init.<br />
obj_l = []<br />
obj, objname = objname<br />
bb = obj.Shape.BoundBox<br />
xmax, ymax = bb.XMax - bb.XMin, bb.YMax - bb.YMin<br />
if ymax > xmax:<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
bb = obj.Shape.BoundBox ## does not auto-update, have to pick up new obj<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
scale = min((self.L-4*self.marge) / xmax, (self.H-4*self.marge) / ymax)<br />
<br />
if (not self.scale_auto) or (self.onedrawing):<br />
scale = self.scale<br />
<br />
if id_ == 0 or not self.onedrawing:<br />
## Init.<br />
PrintMessage('Drawing2d: init\n')<br />
self.TopX_H = self.TopY_H = self.marge * 2<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + self.marge<br />
self.TopY_H = self.TopY_H<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax*scale + self.marge)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
self.TopY_V = self.marge * 2<br />
<br />
elif self.onedrawing:<br />
if self.TopX_H + xmax * scale < self.L:<br />
if self.TopY_H + ymax * scale + self.marge*2 < self.H:<br />
## H Add at right on same horizontal line.<br />
PrintMessage('Drawing2d: horizontal\n')<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + self.marge<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax*scale + self.marge)<br />
self.TopX_Vmax = max(self.TopX_Hmax, self.TopX_Vmax)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
else:<br />
## V Add at right on same horizontal line<br />
PrintMessage('Drawing2d: vertival\n')<br />
if (self.TopX_V + ymax * scale + 2 * self.marge < self.L<br />
and self.TopY_V + xmax * scale + 2*self.marge < self.H):<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + ymax * scale + self.marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + xmax * scale + self.marge)<br />
else:<br />
obj_l.append([obj, 'name'])<br />
return obj_l<br />
else:<br />
## H Carriage return.<br />
if (self.TopY_Hmax + ymax * scale + self.marge*2 < self.H):<br />
msg = 'Drawing2d: carriage return: {} > {}\n'<br />
PrintMessage(msg.format(self.TopY_H + ymax * scale, self.H))<br />
TopX = self.marge*2<br />
TopY = self.TopY_Hmax<br />
self.TopX_H = TopX + xmax * scale + self.marge<br />
self.TopY_H = TopY<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = self.TopY_Hmax + ymax*scale+self.marge<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
else:<br />
## V Add at right on same horizontal line.<br />
msg = 'Drawing2d: vertical: {}, {}\n'<br />
PrintMessage(msg.format(self.TopX_V, self.TopX_Vmax))<br />
if (self.TopX_V + ymax * scale + 2*self.marge < self.L<br />
and self.TopY_V + xmax * scale + 2*self.marge < self.H):<br />
Draft.rotate(obj, 90)<br />
bb = obj.Shape.BoundBox<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + ymax * scale + self.marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + xmax * scale + self.marge)<br />
else:<br />
obj_l.append([obj, 'name'])<br />
return obj_l<br />
<br />
page = self.doc.getObject(self.page_name)<br />
<br />
## Drawing wb (untouched)<br />
Text = self.doc.addObject('Drawing::FeatureViewAnnotation', objname + '_txt')<br />
Text.Text = objname<br />
Text.X = TopX + xmax / 2 * scale<br />
Text.Y = TopY + ymax / 2 * scale<br />
Text.Scale = 7 if self.a3 else 5<br />
<br />
TopView = self.doc.addObject('Drawing::FeatureViewPart', 'TopView')<br />
TopView.Source = obj<br />
TopView.Direction = (0.0, 0.0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = TopX<br />
TopView.Y = TopY<br />
TopView.ShowHiddenLines = True<br />
TopView.Scale = scale<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
<br />
return obj_l<br />
<br />
<br />
#####################################<br />
### Dialog Box<br />
#####################################<br />
fields = [['Group Name', 'Unfolding']]<br />
fields.append(['Scale', '1'])<br />
<br />
DialogBox = QtGui.QDialog()<br />
DialogBox.resize(250, 250)<br />
DialogBox.setWindowTitle('unfoldBox')<br />
la = QtGui.QVBoxLayout(DialogBox)<br />
<br />
# Input fields.<br />
for id_ in range(len(fields)):<br />
la.addWidget(QtGui.QLabel(fields[id_][0]))<br />
fields_l.append(QtGui.QLineEdit(fields[id_][1]))<br />
la.addWidget(fields_l[id_])<br />
<br />
makedwg_check = QtGui.QCheckBox(DialogBox)<br />
makedwg_check.setObjectName('checkBox')<br />
makedwg_check.setChecked(True)<br />
la.addWidget(QtGui.QLabel('Make drawing'))<br />
la.addWidget(makedwg_check)<br />
<br />
leglay_check = QtGui.QCheckBox(DialogBox)<br />
leglay_check.setObjectName('checkBox')<br />
leglay_check.setChecked(False)<br />
la.addWidget(QtGui.QLabel('Legacy layout'))<br />
la.addWidget(leglay_check)<br />
<br />
scale_check = QtGui.QCheckBox(DialogBox)<br />
scale_check.setObjectName('checkBox')<br />
scale_check.setChecked(True)<br />
la.addWidget(QtGui.QLabel('Scale auto'))<br />
la.addWidget(scale_check)<br />
<br />
a3_check = QtGui.QCheckBox(DialogBox)<br />
a3_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('A3 Format'))<br />
a3_check.setChecked(False)<br />
la.addWidget(a3_check)<br />
<br />
cartridge_check = QtGui.QCheckBox(DialogBox)<br />
cartridge_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Cartridge'))<br />
cartridge_check.setChecked(False)<br />
la.addWidget(cartridge_check)<br />
<br />
onedrawing_check = QtGui.QCheckBox(DialogBox)<br />
onedrawing_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Group drawings in page'))<br />
onedrawing_check.setChecked(True)<br />
la.addWidget(onedrawing_check)<br />
<br />
sewed_check = QtGui.QCheckBox(DialogBox)<br />
sewed_check.setObjectName('checkBox')<br />
la.addWidget(QtGui.QLabel('Sewed surfaces'))<br />
sewed_check.setChecked(True)<br />
sewed_check.setEnabled(False)<br />
la.addWidget(sewed_check)<br />
<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
box.setOrientation(QtCore.Qt.Horizontal)<br />
box.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)<br />
la.addWidget(box)<br />
<br />
QtCore.QObject.connect(box, QtCore.SIGNAL('accepted()'), proceed)<br />
QtCore.QObject.connect(box, QtCore.SIGNAL('rejected()'), close)<br />
QtCore.QMetaObject.connectSlotsByName(DialogBox)<br />
DialogBox.show()<br />
<br />
</nowiki><br />
}}</div>Hedahttps://wiki.freecad.org/index.php?title=File:MacroUnFoldBoxInstruction.png&diff=1165856File:MacroUnFoldBoxInstruction.png2022-07-28T21:33:54Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_UnFoldBox_start_form.png&diff=1165855File:Macro UnFoldBox start form.png2022-07-28T21:33:02Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Unroll_Ruled_Surface&diff=1165854Macro Unroll Ruled Surface2022-07-28T21:32:06Z<p>Heda: </p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Unroll Ruled Surface<br />
|Description=The macro allows to unroll ruled surfaces and to draw them on a page.<br />
|Author=Hervé B., heda<br />
|Version=1.1<br />
|Date=2022-07-24<br />
|Download=[https://www.freecadweb.org/wiki/images/b/ba/Macro_Unroll_Ruled_Surface.png ToolBar icon]<br />
}}<br />
<br />
== Description == <!--T:2--><br />
The macro allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
<!--T:3--><br />
[[File:Macro_unrollRuledSurface_00.png|480px]]<br />
{{Caption|Macro_unrollRuledSurface}}<br />
<br />
== Installation == <!--T:4--><br />
Available in Add-on manager.<br />
<br />
Cf [http://forum.freecadweb.org/viewtopic.php?f=17&t=4563&p=35737#p35737 Macro for unrolling ruled surfaces]<br />
<br />
== Options == <!--T:5--><br />
* Number of generatrix<br />
* Scale manual or automatic<br />
* Page format: a3/a4, cartridge (cf FreeCAD templates)<br />
* Group drawings in the same page as possible.<br />
<br />
<!--T:6--><br />
[[File:Macro_UnrollRuledSurface_start_form1.png|Macro_unrollRuledSurface]] <br />
<br />
== Instruction for use == <!--T:7--><br />
# Select ruled surfaces<br />
# Explode them (cf Draft menu - downgrade)<br />
# Select the surfaces<br />
# Execute the macro<br />
<br />
==Script== <!--T:8--><br />
<br />
<!--T:9--><br />
The lastest version of the macro is here on the wiki. An earlier version can be found at [https://github.com/FreeCAD/FreeCAD-macros/blob/master/Drawing/UnrollRuledSurface.FCMacro UnrollRuledSurface.FCMacro] but the easiest way to install this macro is through the [[Std_AddonMgr|Addon Manager]] [[File:Std_AddonMgr.svg|24px|Std_AddonMgr]]<br />
.<br />
</translate><br />
<br />
ToolBar Icon [[Image:Macro_Unroll_Ruled_Surface.png]]<br />
<br />
'''Macro_unrollRuledSurface.py'''<br />
<br />
<!--DO NOT CHANGE THE <pre> </pre> TAG, code contains pipe or space character which breaks the wiki macro--><br />
<pre><br />
# -*- coding: utf-8 -*-<br />
#***************************************************************************<br />
#* *<br />
#* Copyright (c) 2013 - DoNovae/Herve BAILLY <hbl13@donovae.com> *<br />
#* Copyright (c) 2022 - heda <heda@fc-forum> *<br />
#* *<br />
#* This program is free software; you can redistribute it and/or modify *<br />
#* it under the terms of the GNU Lesser General Public License (LGPL) *<br />
#* as published by the Free Software Foundation; either version 2 of *<br />
#* the License, or (at your option) any later version. *<br />
#* for detail see the LICENCE text file. *<br />
#* *<br />
#* This program is distributed in the hope that it will be useful, *<br />
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
#* GNU Library General Public License for more details. *<br />
#* *<br />
#* You should have received a copy of the GNU Library General Public *<br />
#* License along with this program; if not, write to the Free Software *<br />
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
#* USA *<br />
#* *<br />
#***************************************************************************<br />
__Name__ = 'Unroll Ruled Surface'<br />
__Comment__ = 'Unroll of a ruled surface and draw it on a page.'<br />
__Author__ = 'Hervé B., heda'<br />
__Version__ = '1.1'<br />
__Date__ = '2022-07-24'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = 'https://wiki.freecad.org/Macro_Unroll_Ruled_Surface'<br />
__Wiki__ = 'https://wiki.freecad.org/Macro_Unroll_Ruled_Surface'<br />
__Icon__ = ''<br />
__Help__ = ('Select ruled surfaces, Explode them (cf Draft menu), '<br />
'Select the surfaces, Execute the macro')<br />
__Status__ = ''<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
__doc__ = """<br />
select a face, or several and run the macro.<br />
a shell/solid needs to be draft/downgraded to get the faces as separate objects<br />
<br />
the macro is intended to unroll lofted faces,<br />
function beyond that is (in current version) a bonus<br />
<br />
settings are not context aware, all settings not applicable are ignored.<br />
as example, using autoscaling ignores the scale-value in the form<br />
<br />
<br />
v1.1 (2022-07-24) py3/qt5 compat, cosmetic code changes, minor code tweaks,<br />
used gridlayout for form, added option to skip drawing,<br />
made new layout engine with techdraw,<br />
the drawing wb layout engine is now called "legacy"<br />
v1.0.1 (2019-02-01) - on git<br />
v1.0 (2013-09-14) - on wiki<br />
<br />
note:<br />
- unfolding sometimes works and sometimes not<br />
- not all surfaces are theoretically possible to unroll<br />
<br />
"""<br />
<br />
import os<br />
from PySide import QtGui, QtCore<br />
import FreeCAD, FreeCADGui<br />
import Part, Draft<br />
<br />
Vector = FreeCAD.Base.Vector<br />
PrintMessage = FreeCAD.Console.PrintMessage<br />
PrintError = FreeCAD.Console.PrintError<br />
<br />
settings = dict()<br />
unroll_l = []<br />
dwgtpllegacy = 'Mod/Drawing/Templates'<br />
dwgtpl = 'Mod/TechDraw/Templates'<br />
<br />
<br />
#####################################<br />
### Functions<br />
#####################################<br />
<br />
def errorDialog(msg):<br />
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical, "Error Message", msg)<br />
diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)<br />
diag.exec_()<br />
<br />
def ending():<br />
PrintMessage("UnrollRuledSurface: end.\n")<br />
PrintMessage("===========================================\n")<br />
FreeCAD.ActiveDocument.recompute()<br />
<br />
<br />
def proceed():<br />
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)<br />
<br />
PrintMessage("===========================================\n")<br />
PrintMessage("UnrollRuledSurface: start.\n")<br />
try:<br />
sts = lambda s: settings.get(s)<br />
<br />
file_name = sts("fname").text()<br />
pts_nbr = float(sts("dpts").text())<br />
makedwg = sts("mkdwg").isChecked()<br />
leglay = sts("legacylayout").isChecked()<br />
scale = float(sts("scale").text()) # ignored if autoscale is set<br />
scale_auto = sts("autoscale").isChecked()<br />
edge0 = sts("edge").checkedId() == -2<br />
a3 = sts("papersize").checkedId() == -3<br />
cartridge = sts("cartridge").isChecked()<br />
onedrawing = sts("groupdwg").isChecked()<br />
<br />
PrintMessage("UnrollRuledSurface.file_name: {}\n".format(file_name))<br />
PrintMessage("UnrollRuledSurface.pts_nbr: {}\n".format(pts_nbr))<br />
PrintMessage("UnrollRuledSurface.edge0: {}\n".format(edge0))<br />
PrintMessage("UnrollRuledSurface.makedwg: {}\n".format(makedwg))<br />
PrintMessage("UnrollRuledSurface.leglay: {}\n".format(leglay))<br />
PrintMessage("UnrollRuledSurface.scale_check: {}\n".format(scale_auto))<br />
PrintMessage("UnrollRuledSurface.scale: {}\n".format(scale))<br />
PrintMessage("UnrollRuledSurface.a3_check: {}\n".format(a3))<br />
PrintMessage("UnrollRuledSurface.cartridge: {}\n".format(cartridge))<br />
PrintMessage("UnrollRuledSurface.onedrawing: {}\n".format(onedrawing))<br />
except:<br />
msg = "UnrollRuledSurface: wrong inputs...\n"<br />
PrintError(msg)<br />
errorDialog(msg)<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
ending()<br />
return<br />
<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
unrollRS = unrollRuledSurface(file_name, pts_nbr, edge0)<br />
<br />
## Get selection<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel:<br />
PrintMessage("UnrollRuledSurface: no selection...\n")<br />
ending()<br />
return<br />
<br />
faceid = 0<br />
objnames_l, objnames0_l = [], []<br />
grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",<br />
"{}_objs".format(file_name))<br />
<br />
for objid, obji in enumerate(sel):<br />
shape = obji.Shape<br />
faces = shape.Faces<br />
for idx in range(len(faces)):<br />
msg = "UnrollRuledSurface.proceed: ObjId = {}, faceId = {}\n"<br />
PrintMessage(msg.format(objid, faceid))<br />
name = obji.Name<br />
if len(faces) > 1:<br />
name = "{}.face_{}".format(name, idx)<br />
obj = unrollRS.unroll(faces[idx], name)<br />
obj.ViewObject.Visibility = not makedwg<br />
grp.addObject(obj)<br />
<br />
objnames_l.append([obj, name])<br />
objnames0_l.append([obji, name])<br />
faceid += 1<br />
<br />
if not makedwg:<br />
ending()<br />
return<br />
<br />
if leglay:<br />
idx = 0<br />
while len(objnames_l) > 0:<br />
draw = Drawing2dLegacy(scale, scale_auto, a3,<br />
cartridge, onedrawing,<br />
"{}_page{:02}".format(file_name, idx))<br />
objnames_l = draw.all2d(objnames_l)<br />
idx += 1<br />
msg = "UnrollRuledSurface: obj_l = {}\n"<br />
PrintMessage(msg.format(len(objnames_l)))<br />
<br />
else:<br />
draw = Drawing2d(scale, scale_auto, a3, cartridge)<br />
n = 4 if onedrawing else 1<br />
chunks = [objnames_l[i:i + n] for i in range(0, len(objnames_l), n)]<br />
for i, chunk in enumerate(chunks, start=1):<br />
draw.drawpage(chunk, "{}_page{:02}".format(file_name, i))<br />
<br />
ending()<br />
<br />
<br />
def close():<br />
DialogBox.hide()<br />
<br />
def getType(obj):<br />
return type(obj).__name__<br />
<br />
<br />
class unrollRuledSurface:<br />
"""<br />
unroll ruled surfaces<br />
:file_name: ouput file<br />
:pts_nbr: nbr point of discretization<br />
"""<br />
def __init__(self, file_name, pts_nbr, edge0):<br />
self.doc = FreeCAD.ActiveDocument<br />
self.file_name = file_name<br />
self.pts_nbr = int(pts_nbr)<br />
self.edge0 = edge0<br />
msg = "UnrollRuledSurface.unroll - file_name: {}, pts_nbr: {}\n"<br />
PrintMessage(msg.format(file_name, pts_nbr))<br />
<br />
<br />
def discretize(self, curve):<br />
"""discretize a curve"""<br />
if getType(curve) in ('GeomLineSegment', 'GeomCircle'):<br />
sd = curve.discretize(self.pts_nbr)<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nodes = curve.getPoles()<br />
spline = Part.BSplineCurve()<br />
spline.buildFromPoles(nodes)<br />
sd = spline.discretize(self.pts_nbr)<br />
else:<br />
sd = curve.discretize(self.pts_nbr)<br />
return sd<br />
<br />
def nbpoles(self, curve):<br />
"""find number of poles for a curve"""<br />
if getType(curve) == 'GeomLineSegment':<br />
nbpol=1<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nbpol=curve.NbPoles<br />
elif getType(curve) == 'GeomCircle':<br />
nbpol=2<br />
elif getType(curve) == 'GeomBezierCurve':<br />
nbpol=4<br />
else:<br />
nbpol=0<br />
<br />
msg = "UnrollRulrdSurface.nbpole {:s} = {:d}\n"<br />
PrintMessage(msg.format(getType(curve), nbpol))<br />
return nbpol<br />
<br />
def unroll(self, face, name):<br />
"""unrolls a face composed of 2 to 4 edges"""<br />
nbredges = len(face.Edges)<br />
msg = "UnrollRuledSurface.unroll: Edge Nbr = {}\n"<br />
PrintMessage(msg.format(nbredges))<br />
<br />
if nbredges == 2:<br />
e1, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
elif nbredges == 3:<br />
e1, _, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
else:<br />
E0, E1, E2, E3, *_ = face.Edges<br />
## Choose more complexe curve as edge<br />
nbpol0 = self.nbpoles(E0.Curve)<br />
nbpol1 = self.nbpoles(E1.Curve)<br />
nbpol2 = self.nbpoles(E2.Curve)<br />
nbpol3 = self.nbpoles(E3.Curve)<br />
msg = ("UnrollRuledSurface.unroll: nbpol0= {:d}, nbpol1= {:d},"<br />
" nbpol2= {:d}, nbpol3= {:d}\n")<br />
PrintMessage(msg.format(nbpol0, nbpol1, nbpol2, nbpol3))<br />
<br />
if self.edge0:<br />
e1, e2 = E0, E2<br />
v = self.discretize(E1)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
else:<br />
e1, e2 = E1, E3<br />
v = self.discretize(E2)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
<br />
sd1 = self.discretize(e1)<br />
sd2 = self.discretize(e2)<br />
## Reverse if curves cross over<br />
if not (sd2[0].__eq__(v0) or not sd2[0].__eq__(v1)):<br />
sd2.reverse()<br />
<br />
## Create a polygon object and set its nodes<br />
devlxy_l = self.devlxyz(sd1, sd2)<br />
msg = "UnrollRuledSurface.unroll: size devlxy_l: {}\n"<br />
PrintMessage(msg.format(len(devlxy_l)))<br />
p = self.doc.addObject("Part::Polygon", name)<br />
p.Nodes = devlxy_l<br />
self.doc.recompute()<br />
FreeCADGui.ActiveDocument.ActiveView.fitAll()<br />
return p<br />
<br />
def vect_copy(self, vect):<br />
"""returns copy of vector"""<br />
return vect.add(Vector())<br />
<br />
def vect_cos(self, vect1, vect2):<br />
"""returns cosine angle between 2 vectors"""<br />
return vect1.dot(vect2) / vect1.Length / vect2.Length<br />
<br />
def vect_sin(self, vect1, vect2):<br />
"""returns absolute sinus angle between 2 vectors"""<br />
v = Vector()<br />
v.x = vect1.y * vect2.z - vect1.z * vect2.y<br />
v.y = vect1.z * vect2.x - vect1.x * vect2.z<br />
v.z = vect1.x * vect2.y - vect1.y * vect2.x<br />
return v.Length / vect1.Length / vect2.Length<br />
<br />
def devlxyz(self, vect1, vect2):<br />
"""<br />
unrolls a face composed of 4 edges<br />
args: vect1, vect2 --> 2 edges of the shape<br />
returns: dvlxy<br />
"""<br />
lenv1, lenv2 = len(vect1), len(vect2)<br />
if lenv1 != lenv2 or lenv1 != self.pts_nbr or lenv2 != self.pts_nbr:<br />
msg = ("UnrollRuledSurface.devlxyz: incompatility of sizes vect1,"<br />
" vect2, pts_nbr: ({}, {}, {})\n")<br />
PrintError(msg.format(lenv1, lenv2, self.pts_nbr))<br />
errorDialog(msg)<br />
<br />
devlxy_l, devl1xy_l, devl2xy_l = [], [], []<br />
errormax = 0.0<br />
## Init unroll<br />
## AB<br />
a1b1 = vect2[0].sub(vect1[0])<br />
oa1 = Vector(0, 0, 0)<br />
devl1xy_l.append(oa1) #A1<br />
ob1 = Vector(a1b1.Length, 0, 0)<br />
devl2xy_l.append(ob1) #B1<br />
#self.draw_line(devl1xy_l[0], devl2xy_l[0])<br />
#self.draw_line(vect1[0], vect2[0])<br />
for j in range(1, self.pts_nbr):<br />
<br />
## AB<br />
ab = vect2[j-1].sub(vect1[j-1])<br />
#self.draw_line(vect1[j-1], vect2[j-1])<br />
<br />
## AC<br />
ac = vect1[j].sub(vect1[j-1])<br />
<br />
## BD<br />
bd = vect2[j].sub(vect2[j-1])<br />
<br />
## CD<br />
cd = vect2[j].sub(vect1[j])<br />
<br />
## A1B1 in unroll plan<br />
a1b1 = devl2xy_l[j-1].sub(devl1xy_l[j-1])<br />
a1b1n = self.vect_copy(a1b1)<br />
a1b1n.normalize()<br />
a1b1on = Vector(-a1b1n.y, a1b1n.x, 0)<br />
<br />
## A1C1<br />
cosalp = self.vect_cos(ab, ac)<br />
sinalp = self.vect_sin(ab, ac)<br />
a1c1 = self.vect_copy(a1b1n)<br />
a1c1.multiply(cosalp * ac.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * ac.Length)<br />
a1c1 = a1c1.add(v)<br />
oa1 = self.vect_copy(devl1xy_l[j-1])<br />
oc1 = oa1.add(a1c1)<br />
devl1xy_l.append(oc1)<br />
<br />
## B1D1<br />
cosalp = self.vect_cos(ab, bd)<br />
sinalp = self.vect_sin(ab, bd)<br />
b1d1 = self.vect_copy(a1b1n)<br />
b1d1.multiply(cosalp * bd.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * bd.Length)<br />
b1d1 = b1d1.add(v)<br />
ob1 = self.vect_copy(devl2xy_l[j-1])<br />
od1 = ob1.add(b1d1)<br />
devl2xy_l.append(od1)<br />
<br />
## Draw generatrice<br />
#self.draw_line(devl1xy_l[j], devl2xy_l[j])<br />
c1d1 = devl2xy_l[j].sub(devl1xy_l[j])<br />
if ab.Length != 0:<br />
abl = ab.Length<br />
errormax = max(errormax, abs(abl - c1d1.Length) / abl)<br />
<br />
msg = "UnrollRuledSurface Error cd,c1d1: {:.1f} %\n"<br />
PrintMessage(msg.format(errormax*100))<br />
<br />
## Close polygone<br />
devlxy_l = devl1xy_l<br />
devl2xy_l.reverse()<br />
devlxy_l.extend(devl2xy_l)<br />
v = Vector()<br />
devlxy_l.append(v)<br />
<br />
return devlxy_l<br />
<br />
<br />
def draw_line(self, vect0, vect1):<br />
"""draws a Part.Line between vect0 & vect1"""<br />
l = Part.LineSegment()<br />
l.StartPoint = vect0<br />
l.EndPoint = vect1<br />
self.doc.addObject("Part::Feature", "Line").Shape = l.toShape()<br />
<br />
<br />
class Scale:<br />
"""keeps autoscaling to integers"""<br />
def __init__(self, scale):<br />
self.scale = scale if scale >= 1 else 1 / scale<br />
self.scale = int(self.scale)<br />
self.inverted = scale >= 1<br />
<br />
def get(self):<br />
if self.inverted:<br />
return self.scale, '{}:1'.format(self.scale)<br />
else:<br />
return 1/self.scale, '1:{}'.format(self.scale)<br />
<br />
<br />
class Drawing2d:<br />
"""<br />
TechDraw wb layout engine, diffeent logic compared to drawing wb layout.<br />
serves basic purpose...<br />
"""<br />
def __init__(self, scale, scale_auto, a3, cartridge):<br />
<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
if a3:<br />
self.WH = 420, 297<br />
else:<br />
self.WH = 297, 210<br />
self.doc = FreeCAD.ActiveDocument<br />
<br />
<br />
def _mkquadrants(self, nbr):<br />
"""centers of quadrants w/o margin"""<br />
w, h = self.WH<br />
w2, h2 = w/2, h/2<br />
w4, h4 = w/4, h/4<br />
<br />
q = {1: [[w, h], [[w2, h2]]],<br />
2: [[w2, h], [[w2 - w4, h2], [w2 + w4, h2]]],<br />
3: [[w2, h2], [[w2 - w4, h2 + h4], [w2 + w4, h2 + h4],<br />
[w2 - w4, h2 - h4]]],<br />
4: [[w2, h2], [[w2 - w4, h2 + h4], [w2 + w4, h2 + h4],<br />
[w2 - w4, h2 - h4], [w2 + w4, h2 - h4]]]}<br />
return q.get(nbr)<br />
<br />
<br />
def newPage(self, doc, page_name):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
page = doc.addObject('TechDraw::DrawPage', page_name)<br />
template = self.doc.addObject('TechDraw::DrawSVGTemplate', 'Template')<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = 'TD' if self.cartridge else '_blank'<br />
template.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
page.Template = template<br />
return page<br />
<br />
def drawpage(self, faces, page_name):<br />
"""max 4 per page, simple layout with halfs or quadrants"""<br />
page = self.newPage(self.doc, page_name)<br />
[W, H], ll = self._mkquadrants(len(faces))<br />
for [face, name], [x0, y0] in zip(faces, ll):<br />
bb = face.Shape.BoundBox<br />
xr, yr = W / bb.XLength, H / bb.YLength<br />
adjust = 0.7 if self.cartridge else 0.85<br />
scale = min(xr, yr) * adjust if self.scale_auto else self.scale<br />
scale, scr = Scale(scale).get()<br />
bb.scale(scale, scale, 1) # unrolled faces in xy-plane<br />
<br />
TopView = self.doc.addObject('TechDraw::DrawViewPart', name + ' view')<br />
page.addView(TopView)<br />
TopView.Source = face<br />
TopView.Direction = (0, 0, 1)<br />
TopView.XDirection = (1, 0, 0)<br />
TopView.Scale = scale<br />
TopView.X = x0<br />
TopView.Y = y0<br />
<br />
Text = self.doc.addObject('TechDraw::DrawViewAnnotation', name + ' txt')<br />
page.addView(Text)<br />
Text.Text = '{} [{}]'.format(name, scr)<br />
Text.recompute() # for size<br />
Text.X = x0<br />
yt = y0 - bb.YLength / 2 - Text.TextSize.Value * 1.5<br />
Text.Y = max(1, yt)<br />
<br />
self.doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
FreeCADGui.runCommand('TechDraw_ToggleFrame', 0)<br />
<br />
<br />
class Drawing2dLegacy:<br />
"""<br />
makes 2d drawing with Drawing wb (original layout engine, now legacy)<br />
- obj_l: list of objects<br />
"""<br />
## untouched logic in v1.1<br />
def __init__(self, scale, scale_auto, a3, cartridge, onedrawing, page_str):<br />
self.TopX_H = self.TopY_H = 0<br />
self.TopX_V = self.TopY_V = 0<br />
self.TopX_Hmax = self.TopY_Hmax = 0<br />
self.TopX_Vmax = self.TopY_Vmax = 0<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
self.onedrawing = onedrawing<br />
self.marge = 6<br />
if self.a3:<br />
self.L, self.H = 420, 297<br />
else:<br />
self.L, self.H = 297, 210<br />
self.name = page_str<br />
<br />
def newPage(self):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpllegacy)<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.addObject('Drawing::FeaturePage', self.name)<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = '' if self.cartridge else '_plain'<br />
page.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
return page<br />
<br />
<br />
def all2d(self, objname_l):<br />
obj1_l = []<br />
for objid in range(len(objname_l)):<br />
if objid == 0 or not self.onedrawing:<br />
page = self.newPage()<br />
obj1_l.extend(self.done(objid, objname_l[objid]))<br />
return obj1_l<br />
<br />
def done(self, idx, objname):<br />
obj_l = []<br />
obj, objname = objname<br />
marge = self.marge<br />
bb = obj.Shape.BoundBox<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
if ymax > xmax:<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
scale = min((self.L-4 * marge) / xmax, (self.H-4 * marge) / ymax)<br />
<br />
if (not self.scale_auto) or self.onedrawing:<br />
scale = self.scale<br />
<br />
PrintMessage("UnrollRuledSurface.drawing: scale= {:.2f}\n".format(scale))<br />
<br />
<br />
if idx == 0 or not self.onedrawing:<br />
PrintMessage("Drawing2d: init\n")<br />
TopX = self.TopX_H = marge * 2<br />
TopY = self.TopY_H = marge * 2<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopY_H = self.TopY_H<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
self.TopY_V = marge * 2<br />
<br />
elif self.onedrawing:<br />
if self.TopX_H + xmax * scale < self.L:<br />
if self.TopY_H + ymax * scale + marge * 2 < self.H:<br />
## H Add at right on same horizontal line<br />
PrintMessage("Drawing2d: horizontal\n")<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Hmax, self.TopX_Vmax)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
## V Add at right on same horizontal line<br />
PrintMessage("Drawing2d: vertival\n")<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, self.name])<br />
return obj_l<br />
<br />
else:<br />
## H Carriage return<br />
if self.TopY_Hmax + ymax * scale + self.marge*2 < self.H:<br />
msg = "Drawing2d: carriage return: {} > {}\n"<br />
PrintMessage(msg.format(self.TopY_H + ymax * scale, self.H))<br />
TopX = self.marge * 2<br />
TopY = self.TopY_Hmax<br />
self.TopX_H = TopX + xmax * scale + self.marge<br />
self.TopY_H = TopY<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = self.TopY_Hmax + ymax * scale + self.marge<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
## V Add at right on same horizontal line<br />
msg = "Drawing2d: vertival: {} , {}\n"<br />
PrintMessage(msg.format(self.TopX_V, self.TopX_Vmax))<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, objname])<br />
return obj_l<br />
<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.getObject(self.name)<br />
<br />
Text = doc.addObject('Drawing::FeatureViewAnnotation', f"{objname}_txt")<br />
Text.Text = objname<br />
Text.X = TopX + xmax * scale / 2<br />
Text.Y = TopY + ymax * scale / 2<br />
Text.Scale = 2<br />
<br />
TopView = doc.addObject('Drawing::FeatureViewPart', objname)<br />
TopView.Source = obj<br />
TopView.Direction = (0, 0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = TopX<br />
TopView.Y = TopY<br />
TopView.ShowHiddenLines = False<br />
TopView.Scale = scale<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
return obj_l<br />
<br />
<br />
<br />
#####################################<br />
### Dialog Box<br />
#####################################<br />
<br />
DialogBox = QtGui.QDialog()<br />
DialogBox.setWindowTitle("UnrollRuledSurface")<br />
la = QtGui.QGridLayout(DialogBox)<br />
la.setSpacing(7)<br />
buttonGrpEdge = QtGui.QButtonGroup(DialogBox)<br />
buttonGrpFormat = QtGui.QButtonGroup(DialogBox)<br />
<br />
cols = 4<br />
la.addWidget(QtGui.QLabel("File Name"), 0, 0, 1, cols)<br />
fname = QtGui.QLineEdit("UnrollSurface")<br />
la.addWidget(fname, 1, 0, 1, cols)<br />
<br />
la.addWidget(QtGui.QLabel("Discretization Points Nbr"), 2, 0, 1, cols)<br />
dpts = QtGui.QLineEdit("30")<br />
la.addWidget(dpts, 3, 0, 1, 2)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Generatrices from edge:"), 4, 0, 1, 2)<br />
edgezero = QtGui.QRadioButton("0 to 3")<br />
la.addWidget(edgezero, 4, 2)<br />
edgeone = QtGui.QRadioButton("1 to 4")<br />
la.addWidget(edgeone, 4, 3)<br />
buttonGrpEdge.addButton(edgezero); buttonGrpEdge.addButton(edgeone)<br />
edgezero.setChecked(True)<br />
<br />
###<br />
mkdwg = QtGui.QCheckBox("Make drawing")<br />
mkdwg.setChecked(True)<br />
la.addWidget(mkdwg, 5, 0, 1, 2)<br />
<br />
legacylayout = QtGui.QCheckBox("Legacy layout")<br />
legacylayout.setChecked(False)<br />
la.addWidget(legacylayout, 5, 2, 1, 2)<br />
<br />
<br />
###<br />
autoscale = QtGui.QCheckBox("Auto scale")<br />
autoscale.setChecked(True)<br />
la.addWidget(autoscale, 6, 0, 1, 2)<br />
<br />
la.addWidget(QtGui.QLabel("Scale"), 6, 2)<br />
scale = QtGui.QLineEdit("1")<br />
la.addWidget(scale, 6, 3)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Paper size:"), 7, 0, 1, 2)<br />
rba4 = QtGui.QRadioButton("A4")<br />
la.addWidget(rba4, 7, 2)<br />
rba3 = QtGui.QRadioButton("A3")<br />
la.addWidget(rba3, 7, 3)<br />
buttonGrpFormat.addButton(rba4); buttonGrpFormat.addButton(rba3)<br />
rba4.setChecked(True)<br />
<br />
###<br />
cartridge = QtGui.QCheckBox("Cartridge")<br />
cartridge.setChecked(False)<br />
la.addWidget(cartridge, 8, 0, 1, 2)<br />
<br />
groupdwg = QtGui.QCheckBox("Group drawings in page")<br />
groupdwg.setChecked(True)<br />
la.addWidget(groupdwg, 8, 2, 1, 2)<br />
<br />
###<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
box.setOrientation(QtCore.Qt.Horizontal)<br />
box.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)<br />
la.addWidget(box, 9, 0, 1, cols)<br />
<br />
###<br />
settings.update(dict(fname=fname, dpts=dpts, edge=buttonGrpEdge,<br />
mkdwg=mkdwg, legacylayout=legacylayout,<br />
autoscale=autoscale, scale=scale,<br />
papersize=buttonGrpFormat,<br />
cartridge=cartridge, groupdwg=groupdwg))<br />
<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("accepted()"), proceed)<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("rejected()"), close)<br />
QtCore.QMetaObject.connectSlotsByName(DialogBox)<br />
DialogBox.show()<br />
<br />
<br />
</pre><br />
<br />
{{clear}}</div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_UnrollRuledSurface_start_form.png&diff=1165852File:Macro UnrollRuledSurface start form.png2022-07-28T21:12:41Z<p>Heda: Heda uploaded a new version of File:Macro UnrollRuledSurface start form.png</p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1164964Creating a simple part with Draft and Part WB2022-07-24T06:20:08Z<p>Heda: /* Quality of models */</p>
<hr />
<div><languages/><br />
<br />
<translate><br />
<br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
==Introduction==<br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
<br />
==The tutorial covers==<br />
* The model to make<br />
* Creating the 2d profile<br />
* Why does not extruding work<br />
* Extruding the profile<br />
* Creating the through hole<br />
* Making a sketch out of the 2d profile<br />
* Wrapping up<br />
<br />
<br />
==The model to make==<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center|372px]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
==Creating the 2d profile==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
<br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft Workbench''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft Workbench'''.<br />
<br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft Workbench''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
<br />
===Creating the fillet===<br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft Workbench'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{KEY|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use of [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft Workbench''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Move the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click '''LMB'''. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
<br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std_Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system. To move things in and out of the group, use ''drag and drop'' in the tree-view.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
==Why does not extruding work==<br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
<br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a normal (direction), this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
<br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
<br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on different types of [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
<br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire is not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simply becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
<br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
<br />
==Extruding the profile==<br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{KEY|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
==Creating the through hole==<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
<br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
<br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a sketch out of the 2d profile==<br />
Using '''Draft Workbench''' is one way of creating a 2d profile. In '''Draft Workbench''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft Workbench''' can be converted to an ''unconstrained'' sketch.<br />
<br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in the profile from the earlier made group '''Profile'''. From '''Draft Workbench''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
<br />
With '''Sketch''' closed and selected, from '''Part Workbench''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
==Quality of models==<br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
<br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part Workbench''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''. A solid can only be made from a watertight shell. A not watertight shell is a common source of troublesome cad-models, it can for example happen with imported geometry created in a different software, especially when using the commonly available neutral file formats.<br />
<br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
<br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to an under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps, since it is originating from a draft profile where it has been constructed in such way that exact edge endpoints matching is ensured (for example by use of snap). If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the geometric kernel cannot consider them to be matching endpoints, i.e. edges are not geometrically joined.<br />
<br />
==Wrapping up==<br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher Workbench''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign Workbench'''. It is suggested that you learn ''sketches'' and '''PartDesign Workbench''' next if your focus is on creating solids. The sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]'' makes the same model as this tutorial. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
<br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Macro_Unroll_Ruled_Surface&diff=1164963Macro Unroll Ruled Surface2022-07-24T06:13:25Z<p>Heda: v1.1 - py3/qt5 compat</p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=Macro Unroll Ruled Surface<br />
|Description=The macro allows to unroll ruled surfaces and to draw them on a page.<br />
|Author=Hervé B., heda<br />
|Version=1.1<br />
|Date=2022-07-24<br />
|Download=[https://www.freecadweb.org/wiki/images/b/ba/Macro_Unroll_Ruled_Surface.png ToolBar icon]<br />
}}<br />
<br />
== Description == <!--T:2--><br />
The macro allows to unroll ruled surfaces and to draw them on a page.<br />
<br />
<!--T:3--><br />
[[File:Macro_unrollRuledSurface_00.png|480px]]<br />
{{Caption|Macro_unrollRuledSurface}}<br />
<br />
== Installation == <!--T:4--><br />
Available in Add-on manager.<br />
<br />
Cf [http://forum.freecadweb.org/viewtopic.php?f=17&t=4563&p=35737#p35737 Macro for unrolling ruled surfaces]<br />
<br />
== Options == <!--T:5--><br />
* Number of generatrix<br />
* Scale manual or automatic<br />
* Page format: a3/a4, cartridge (cf FreeCAD templates)<br />
* Group drawings in the same page as possible.<br />
<br />
<!--T:6--><br />
[[File:Macro_UnrollRuledSurface_start_form.png|Macro_unrollRuledSurface]] <br />
<br />
== Instruction for use == <!--T:7--><br />
# Select ruled surfaces<br />
# Explode them (cf Draft menu - downgrade)<br />
# Select the surfaces<br />
# Execute the macro<br />
<br />
==Script== <!--T:8--><br />
<br />
<!--T:9--><br />
The lastest version of the macro is here on the wiki. An earlier version can be found at [https://github.com/FreeCAD/FreeCAD-macros/blob/master/Drawing/UnrollRuledSurface.FCMacro UnrollRuledSurface.FCMacro] but the easiest way to install this macro is through the [[Std_AddonMgr|Addon Manager]] [[File:Std_AddonMgr.svg|24px|Std_AddonMgr]]<br />
.<br />
</translate><br />
<br />
ToolBar Icon [[Image:Macro_Unroll_Ruled_Surface.png]]<br />
<br />
'''Macro_unrollRuledSurface.py'''<br />
<br />
<!--DO NOT CHANGE THE <pre> </pre> TAG, code contains pipe or space character which breaks the wiki macro--><br />
<pre><br />
# -*- coding: utf-8 -*-<br />
<br />
#***************************************************************************<br />
#* *<br />
#* Copyright (c) 2013 - DoNovae/Herve BAILLY <hbl13@donovae.com> *<br />
#* Copyright (c) 2022 - heda <heda@fc-forum> *<br />
#* *<br />
#* This program is free software; you can redistribute it and/or modify *<br />
#* it under the terms of the GNU Lesser General Public License (LGPL) *<br />
#* as published by the Free Software Foundation; either version 2 of *<br />
#* the License, or (at your option) any later version. *<br />
#* for detail see the LICENCE text file. *<br />
#* *<br />
#* This program is distributed in the hope that it will be useful, *<br />
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *<br />
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *<br />
#* GNU Library General Public License for more details. *<br />
#* *<br />
#* You should have received a copy of the GNU Library General Public *<br />
#* License along with this program; if not, write to the Free Software *<br />
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *<br />
#* USA *<br />
#* *<br />
#***************************************************************************<br />
__Name__ = 'Unroll Ruled Surface'<br />
__Comment__ = 'Unroll of a ruled surface and draw it on a page.'<br />
__Author__ = 'Hervé B., heda'<br />
__Version__ = '1.1'<br />
__Date__ = '2022-07-24'<br />
__License__ = 'LGPL-2.0-or-later'<br />
__Web__ = 'https://www.freecadweb.org/wiki/Macro_Unroll_Ruled_Surface'<br />
__Wiki__ = 'https://www.freecadweb.org/wiki/Macro_Unroll_Ruled_Surface'<br />
__Icon__ = ''<br />
__Help__ = ('Select ruled surfaces, Explode them (cf Draft menu), '<br />
'Select the surfaces, Execute the macro')<br />
__Status__ = ''<br />
__Requires__ = ''<br />
__Communication__ = ''<br />
__Files__ = ''<br />
<br />
__doc__ = """<br />
select a face, or several and run the macro.<br />
a solid needs to be draft/downgraded to get the faces as separate objects<br />
<br />
the macro is intended to unroll lofted faces,<br />
function beyond that is (in current version) a bonus<br />
<br />
settings are not context aware, all settings not applicable are ignored.<br />
as example, using autoscaling ignores the scale-value in the form<br />
<br />
<br />
v1.1 (2022-07-24) py3/qt5 compat, cosmetic code changes, minor code tweaks,<br />
used gridlayout for form, added option to skip drawing,<br />
added simplistic alternative layout engine<br />
v1.0.1 (2019-02-01) - on git<br />
v1.0 (2013-09-14) - on wiki<br />
<br />
note:<br />
- unfolding sometimes works and sometimes not<br />
- should be converted to use techdraw<br />
<br />
"""<br />
<br />
import os<br />
from PySide import QtGui, QtCore<br />
import FreeCAD, FreeCADGui<br />
import Part, Draft<br />
<br />
Vector = FreeCAD.Base.Vector<br />
PrintMessage = FreeCAD.Console.PrintMessage<br />
PrintError = FreeCAD.Console.PrintError<br />
<br />
settings = dict()<br />
unroll_l = []<br />
dwgtpl = 'Mod/Drawing/Templates'<br />
<br />
<br />
#####################################<br />
### Functions<br />
#####################################<br />
<br />
def errorDialog(msg):<br />
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical, "Error Message", msg)<br />
diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)<br />
diag.exec_()<br />
<br />
def ending():<br />
PrintMessage("UnrollRuledSurface: end.\n")<br />
PrintMessage("===========================================\n")<br />
FreeCAD.ActiveDocument.recompute()<br />
<br />
<br />
def proceed():<br />
QtGui.QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)<br />
<br />
PrintMessage("===========================================\n")<br />
PrintMessage("UnrollRuledSurface: start.\n")<br />
try:<br />
sts = lambda s: settings.get(s)<br />
<br />
file_name = sts("fname").text()<br />
pts_nbr = float(sts("dpts").text())<br />
makedwg = sts("mkdwg").isChecked()<br />
altlay = sts("altlayout").isChecked()<br />
scale = float(sts("scale").text()) # ignored if autoscale is set<br />
scale_auto = sts("autoscale").isChecked()<br />
edge0 = sts("edge").checkedId() == -2<br />
a3 = sts("papersize").checkedId() == -3<br />
cartridge = sts("cartridge").isChecked()<br />
onedrawing = sts("groupdwg").isChecked()<br />
<br />
PrintMessage("UnrollRuledSurface.file_name: {}\n".format(file_name))<br />
PrintMessage("UnrollRuledSurface.pts_nbr: {}\n".format(pts_nbr))<br />
PrintMessage("UnrollRuledSurface.edge0: {}\n".format(edge0))<br />
PrintMessage("UnrollRuledSurface.makedwg: {}\n".format(makedwg))<br />
PrintMessage("UnrollRuledSurface.altlay: {}\n".format(altlay))<br />
PrintMessage("UnrollRuledSurface.scale_check: {}\n".format(scale_auto))<br />
PrintMessage("UnrollRuledSurface.scale: {}\n".format(scale))<br />
PrintMessage("UnrollRuledSurface.a3_check: {}\n".format(a3))<br />
PrintMessage("UnrollRuledSurface.cartridge: {}\n".format(cartridge))<br />
PrintMessage("UnrollRuledSurface.onedrawing: {}\n".format(onedrawing))<br />
except:<br />
msg = "UnrollRuledSurface: wrong inputs...\n"<br />
PrintError(msg)<br />
errorDialog(msg)<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
ending()<br />
return<br />
<br />
QtGui.QApplication.restoreOverrideCursor()<br />
DialogBox.hide()<br />
unrollRS = unrollRuledSurface(file_name, pts_nbr, edge0)<br />
<br />
## Get selection<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel:<br />
PrintMessage("UnrollRuledSurface: no selection...\n")<br />
ending()<br />
return<br />
<br />
faceid = 0<br />
objnames_l, objnames0_l = [], []<br />
grp = FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup",<br />
"{}_objs".format(file_name))<br />
<br />
for objid, obji in enumerate(sel):<br />
shape = obji.Shape<br />
faces = shape.Faces<br />
for idx in range(len(faces)):<br />
msg = "UnrollRuledSurface.proceed: ObjId = {}, faceId = {}\n"<br />
PrintMessage(msg.format(objid, faceid))<br />
name = obji.Name<br />
if len(faces) > 1:<br />
name = "{}.face_{}".format(name, idx)<br />
obj = unrollRS.unroll(faces[idx], name)<br />
obj.ViewObject.Visibility = not makedwg<br />
grp.addObject(obj)<br />
<br />
objnames_l.append([obj, name])<br />
objnames0_l.append([obji, name])<br />
faceid += 1<br />
<br />
<br />
if not makedwg:<br />
ending()<br />
return<br />
<br />
<br />
if altlay:<br />
draw = Drawing2dAlt(scale, scale_auto, a3)<br />
n = 4 if onedrawing else 1<br />
chunks = [objnames_l[i:i + n] for i in range(0, len(objnames_l), n)]<br />
for i, chunk in enumerate(chunks, start=1):<br />
draw.drawpage(chunk, "{}_page{:02}".format(file_name, i))<br />
<br />
else:<br />
idx = 0<br />
while len(objnames_l) > 0:<br />
draw = Drawing2d(scale, scale_auto, a3, cartridge, onedrawing,<br />
"{}_page{:02}".format(file_name, idx))<br />
objnames_l = draw.all2d(objnames_l)<br />
idx += 1<br />
msg = "UnrollRuledSurface: obj_l = {}\n"<br />
PrintMessage(msg.format(len(objnames_l)))<br />
<br />
<br />
<br />
def close():<br />
DialogBox.hide()<br />
<br />
def getType(obj):<br />
return type(obj).__name__<br />
<br />
<br />
class unrollRuledSurface:<br />
"""<br />
unroll ruled surfaces<br />
:file_name: ouput file<br />
:pts_nbr: nbr point of discretization<br />
"""<br />
def __init__(self, file_name, pts_nbr, edge0):<br />
self.doc = FreeCAD.ActiveDocument<br />
self.file_name = file_name<br />
self.pts_nbr = int(pts_nbr)<br />
self.edge0 = edge0<br />
msg = "UnrollRuledSurface.unroll - file_name: {}, pts_nbr: {}\n"<br />
PrintMessage(msg.format(file_name, pts_nbr))<br />
<br />
<br />
def discretize(self, curve):<br />
"""discretize a curve"""<br />
if getType(curve) in ('GeomLineSegment', 'GeomCircle'):<br />
sd = curve.discretize(self.pts_nbr)<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nodes = curve.getPoles()<br />
spline = Part.BSplineCurve()<br />
spline.buildFromPoles(nodes)<br />
sd = spline.discretize(self.pts_nbr)<br />
else:<br />
sd = curve.discretize(self.pts_nbr)<br />
return sd<br />
<br />
def nbpoles(self, curve):<br />
"""find number of poles for a curve"""<br />
if getType(curve) == 'GeomLineSegment':<br />
nbpol=1<br />
elif getType(curve) == 'GeomBSplineCurve':<br />
nbpol=curve.NbPoles<br />
elif getType(curve) == 'GeomCircle':<br />
nbpol=2<br />
elif getType(curve) == 'GeomBezierCurve':<br />
nbpol=4<br />
else:<br />
nbpol=0<br />
<br />
msg = "UnrollRulrdSurface.nbpole {:s} = {:d}\n"<br />
PrintMessage(msg.format(getType(curve), nbpol))<br />
return nbpol<br />
<br />
def unroll(self, face, name):<br />
"""unrolls a face composed of 2 to 4 edges"""<br />
nbredges = len(face.Edges)<br />
msg = "UnrollRuledSurface.unroll: Edge Nbr = {}\n"<br />
PrintMessage(msg.format(nbredges))<br />
<br />
if nbredges == 2:<br />
e1, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
elif nbredges == 3:<br />
e1, _, e2 = face.Edges<br />
sd1 = e1.Curve.discretize(self.pts_nbr)<br />
sd2 = e2.Curve.discretize(self.pts_nbr)<br />
<br />
else:<br />
E0, E1, E2, E3, *_ = face.Edges<br />
# Choose more complexe curve as edge<br />
nbpol0 = self.nbpoles(E0.Curve)<br />
nbpol1 = self.nbpoles(E1.Curve)<br />
nbpol2 = self.nbpoles(E2.Curve)<br />
nbpol3 = self.nbpoles(E3.Curve)<br />
msg = ("UnrollRuledSurface.unroll: nbpol0= {:d}, nbpol1= {:d},"<br />
" nbpol2= {:d}, nbpol3= {:d}\n")<br />
PrintMessage(msg.format(nbpol0, nbpol1, nbpol2, nbpol3))<br />
<br />
if self.edge0:<br />
e1, e2 = E0, E2<br />
v = self.discretize(E1)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
else:<br />
e1, e2 = E1, E3<br />
v = self.discretize(E2)<br />
v0, v1 = v[0], v[self.pts_nbr-1]<br />
<br />
sd1 = self.discretize(e1)<br />
sd2 = self.discretize(e2)<br />
# Reverse if curves cross over<br />
if not (sd2[0].__eq__(v0) or not sd2[0].__eq__(v1)):<br />
sd2.reverse()<br />
<br />
# Create a polygon object and set its nodes<br />
devlxy_l = self.devlxyz(sd1, sd2)<br />
msg = "UnrollRuledSurface.unroll: size devlxy_l: {}\n"<br />
PrintMessage(msg.format(len(devlxy_l)))<br />
p = self.doc.addObject("Part::Polygon", name)<br />
p.Nodes = devlxy_l<br />
self.doc.recompute()<br />
FreeCADGui.ActiveDocument.ActiveView.fitAll()<br />
return p<br />
<br />
def vect_copy(self, vect):<br />
"""returns copy of vector"""<br />
return vect.add(Vector())<br />
<br />
def vect_cos(self, vect1, vect2):<br />
"""returns cosine angle between 2 vectors"""<br />
return vect1.dot(vect2) / vect1.Length / vect2.Length<br />
<br />
def vect_sin(self, vect1, vect2):<br />
"""returns absolute sinus angle between 2 vectors"""<br />
v = Vector()<br />
v.x = vect1.y * vect2.z - vect1.z * vect2.y<br />
v.y = vect1.z * vect2.x - vect1.x * vect2.z<br />
v.z = vect1.x * vect2.y - vect1.y * vect2.x<br />
return v.Length / vect1.Length / vect2.Length<br />
<br />
def devlxyz(self, vect1, vect2):<br />
"""<br />
unrolls a face composed of 4 edges<br />
args: vect1, vect2 --> 2 edges of the shape<br />
returns: dvlxy<br />
"""<br />
lenv1, lenv2 = len(vect1), len(vect2)<br />
if lenv1 != lenv2 or lenv1 != self.pts_nbr or lenv2 != self.pts_nbr:<br />
msg = ("UnrollRuledSurface.devlxyz: incompatility of sizes vect1,"<br />
" vect2, pts_nbr: ({}, {}, {})\n")<br />
PrintError(msg.format(lenv1, lenv2, self.pts_nbr))<br />
errorDialog(msg)<br />
<br />
devlxy_l, devl1xy_l, devl2xy_l = [], [], []<br />
errormax = 0.0<br />
# Init unroll<br />
# AB<br />
a1b1 = vect2[0].sub(vect1[0])<br />
oa1 = Vector(0, 0, 0)<br />
devl1xy_l.append(oa1) #A1<br />
ob1 = Vector(a1b1.Length, 0, 0)<br />
devl2xy_l.append(ob1) #B1<br />
#self.draw_line(devl1xy_l[0], devl2xy_l[0])<br />
#self.draw_line(vect1[0], vect2[0])<br />
for j in range(1, self.pts_nbr):<br />
<br />
# AB<br />
ab = vect2[j-1].sub(vect1[j-1])<br />
#self.draw_line(vect1[j-1], vect2[j-1])<br />
<br />
# AC<br />
ac = vect1[j].sub(vect1[j-1])<br />
<br />
# BD<br />
bd = vect2[j].sub(vect2[j-1])<br />
<br />
# CD<br />
cd = vect2[j].sub(vect1[j])<br />
<br />
# A1B1 in unroll plan<br />
a1b1 = devl2xy_l[j-1].sub(devl1xy_l[j-1])<br />
a1b1n = self.vect_copy(a1b1)<br />
a1b1n.normalize()<br />
a1b1on = Vector(-a1b1n.y, a1b1n.x, 0)<br />
<br />
# A1C1<br />
cosalp = self.vect_cos(ab, ac)<br />
sinalp = self.vect_sin(ab, ac)<br />
a1c1 = self.vect_copy(a1b1n)<br />
a1c1.multiply(cosalp * ac.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * ac.Length)<br />
a1c1 = a1c1.add(v)<br />
oa1 = self.vect_copy(devl1xy_l[j-1])<br />
oc1 = oa1.add(a1c1)<br />
devl1xy_l.append(oc1)<br />
<br />
# B1D1<br />
cosalp = self.vect_cos(ab, bd)<br />
sinalp = self.vect_sin(ab, bd)<br />
b1d1 = self.vect_copy(a1b1n)<br />
b1d1.multiply(cosalp * bd.Length)<br />
v = self.vect_copy(a1b1on)<br />
v.multiply(sinalp * bd.Length)<br />
b1d1 = b1d1.add(v)<br />
ob1 = self.vect_copy(devl2xy_l[j-1])<br />
od1 = ob1.add(b1d1)<br />
devl2xy_l.append(od1)<br />
<br />
# Draw generatrice<br />
#self.draw_line(devl1xy_l[j], devl2xy_l[j])<br />
c1d1 = devl2xy_l[j].sub(devl1xy_l[j])<br />
if ab.Length != 0:<br />
abl = ab.Length<br />
errormax = max(errormax, abs(abl - c1d1.Length) / abl)<br />
<br />
msg = "UnrollRuledSurface Error cd,c1d1: {:.1f} %\n"<br />
PrintMessage(msg.format(errormax*100))<br />
<br />
# Close polygone<br />
devlxy_l = devl1xy_l<br />
devl2xy_l.reverse()<br />
devlxy_l.extend(devl2xy_l)<br />
v = Vector()<br />
devlxy_l.append(v)<br />
<br />
return devlxy_l<br />
<br />
<br />
def draw_line(self, vect0, vect1):<br />
"""draws a Part.Line between vect0 & vect1"""<br />
l = Part.LineSegment()<br />
l.StartPoint = vect0<br />
l.EndPoint = vect1<br />
self.doc.addObject("Part::Feature", "Line").Shape = l.toShape()<br />
<br />
<br />
class Scale:<br />
"""keeps autoscaling to known integers"""<br />
def __init__(self, scale):<br />
self.scale = scale if scale >= 1 else 1 / scale<br />
self.scale = int(self.scale)<br />
self.inverted = scale >= 1<br />
<br />
def get(self):<br />
if self.inverted:<br />
return self.scale, '{}:1'.format(self.scale)<br />
else:<br />
return 1/self.scale, '1:{}'.format(self.scale)<br />
<br />
<br />
class Drawing2dAlt:<br />
"""<br />
Alternative layout engine (Drawing wb), only does plain templates.<br />
not much testing done, not perfect, however probably good enough...<br />
makes 2d drawing with Drawing wb<br />
- obj_l: list of objects<br />
"""<br />
# untouched in v1.1<br />
def __init__(self, scale, scale_auto, a3):<br />
<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
if self.a3:<br />
self.WH = 420, 297<br />
else:<br />
self.WH = 297, 210<br />
<br />
<br />
def _mkquadrants(self, nbr):<br />
"""lower lefts w/o margin"""<br />
w, h = self.WH<br />
w2, h2 = w/2, h/2<br />
d = (w**2 + h**2)**(1/2)<br />
<br />
q = {1: [[w, h, d], [[0, h]]],<br />
2: [[w2, h, d/2], [[0, h], [w2, h]]],<br />
3: [[w2, h2, d/4], [[0, h2], [w2, h2], [0, h]]],<br />
4: [[w2, h2, d/4], [[0, h2], [w2, h2], [0, h], [w2, h]]]}<br />
return q.get(nbr)<br />
<br />
<br />
def newPage(self, doc, page_name):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
page = doc.addObject('Drawing::FeaturePage', page_name)<br />
size = 'A3' if self.a3 else 'A4'<br />
page.Template = freecad_dir + '/{}_Landscape_plain.svg'.format(size)<br />
return page<br />
<br />
<br />
def drawpage(self, faces, page_name):<br />
"""max 4 per page, simple layout with halfs or quadrants"""<br />
doc = FreeCAD.ActiveDocument<br />
page = self.newPage(doc, page_name)<br />
fontsize = 5 if self.a3 else 7<br />
[W, H, D], ll = self._mkquadrants(len(faces))<br />
for [face, name], [x0, y0] in zip(faces, ll):<br />
bb = face.Shape.BoundBox<br />
aspect = max(bb.XLength / bb.YLength, bb.YLength / bb.XLength)<br />
adjusted = max(W / H, H / W) / aspect<br />
<br />
if self.scale_auto:<br />
scale = D / (bb.DiagonalLength * adjusted)<br />
else:<br />
scale = self.scale<br />
sc, scr = Scale(scale * 0.95).get()<br />
<br />
dx = (W - bb.XLength * sc) / 2<br />
dy = (H - bb.YLength * sc) / 2<br />
dyt = dy - fontsize * 2 if dy > fontsize else dy<br />
<br />
Text = doc.addObject('Drawing::FeatureViewAnnotation', f"{name}_txt")<br />
Text.Text = '{} [{}]'.format(name, scr)<br />
Text.X = int(x0 + dx + fontsize / 2)<br />
Text.Y = int(y0 - dyt - fontsize / 2)<br />
Text.Scale = fontsize<br />
<br />
TopView = doc.addObject('Drawing::FeatureViewPart', name)<br />
TopView.Source = face<br />
TopView.Direction = (0, 0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = int(x0 + dx)<br />
TopView.Y = int(y0 - dy)<br />
TopView.ShowHiddenLines = False<br />
TopView.Scale = sc<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
<br />
doc.recompute()<br />
page.ViewObject.doubleClicked()<br />
<br />
<br />
class Drawing2d:<br />
"""<br />
makes 2d drawing with Drawing wb (original layout engine)<br />
- obj_l: list of objects<br />
"""<br />
# untouched in v1.1<br />
def __init__(self, scale, scale_auto, a3, cartridge, onedrawing, page_str):<br />
self.TopX_H = self.TopY_H = 0<br />
self.TopX_V = self.TopY_V = 0<br />
self.TopX_Hmax = self.TopY_Hmax = 0<br />
self.TopX_Vmax = self.TopY_Vmax = 0<br />
self.a3 = a3<br />
self.scale = scale<br />
self.scale_auto = scale_auto<br />
self.cartridge = cartridge<br />
self.onedrawing = onedrawing<br />
self.marge = 6<br />
if self.a3:<br />
self.L, self.H = 420, 297<br />
else:<br />
self.L, self.H = 297, 210<br />
self.name = page_str<br />
<br />
def newPage(self):<br />
freecad_dir = os.path.join(FreeCAD.getResourceDir(), dwgtpl)<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.addObject('Drawing::FeaturePage', self.name)<br />
size = 'A3' if self.a3 else 'A4'<br />
frame = '' if self.cartridge else '_plain'<br />
page.Template = freecad_dir + '/{}_Landscape{}.svg'.format(size, frame)<br />
return page<br />
<br />
<br />
def all2d(self, objname_l):<br />
obj1_l = []<br />
for objid in range(len(objname_l)):<br />
if objid == 0 or not self.onedrawing:<br />
page = self.newPage()<br />
obj1_l.extend(self.done(objid, objname_l[objid]))<br />
return obj1_l<br />
<br />
def done(self, idx, objname):<br />
obj_l = []<br />
obj, objname = objname<br />
marge = self.marge<br />
bb = obj.Shape.BoundBox<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
if ymax > xmax:<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
xmax = bb.XMax - bb.XMin<br />
ymax = bb.YMax - bb.YMin<br />
<br />
scale = min((self.L-4 * marge) / xmax, (self.H-4 * marge) / ymax)<br />
<br />
if (not self.scale_auto) or self.onedrawing:<br />
scale = self.scale<br />
<br />
PrintMessage("UnrollRuledSurface.drawing: scale= {:.2f}\n".format(scale))<br />
<br />
<br />
if idx == 0 or not self.onedrawing:<br />
PrintMessage("Dawing2d: init\n")<br />
TopX = self.TopX_H = marge * 2<br />
TopY = self.TopY_H = marge * 2<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopY_H = self.TopY_H<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
self.TopY_V = marge * 2<br />
<br />
elif self.onedrawing:<br />
if self.TopX_H + xmax * scale < self.L:<br />
if self.TopY_H + ymax * scale + marge * 2 < self.H:<br />
# H Add at right on same horizontal line<br />
PrintMessage("Dawing2d: horizontal\n")<br />
TopX, TopY = self.TopX_H, self.TopY_H<br />
self.TopX_H = self.TopX_H + xmax * scale + marge<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = max(self.TopY_Hmax,<br />
self.TopY_H + ymax * scale + marge)<br />
self.TopX_Vmax = max(self.TopX_Hmax, self.TopX_Vmax)<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
# V Add at right on same horizontal line<br />
PrintMessage("Dawing2d: vertival\n")<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, self.name])<br />
return obj_l<br />
<br />
else:<br />
# H Carriage return<br />
if self.TopY_Hmax + ymax * scale + self.marge*2 < self.H:<br />
msg = "Drawing2d: carriage return: {} > {}\n"<br />
PrintMessage(msg.format(self.TopY_H + ymax * scale, self.H))<br />
TopX = self.marge * 2<br />
TopY = self.TopY_Hmax<br />
self.TopX_H = TopX + xmax * scale + self.marge<br />
self.TopY_H = TopY<br />
self.TopX_Hmax = max(self.TopX_Hmax, self.TopX_H)<br />
self.TopY_Hmax = self.TopY_Hmax + ymax * scale + self.marge<br />
self.TopX_Vmax = max(self.TopX_Vmax, self.TopX_Hmax)<br />
self.TopX_V = max(self.TopX_Vmax, self.TopX_V)<br />
<br />
else:<br />
# V Add at right on same horizontal line<br />
msg = "Drawing2d: vertival: {} , {}\n"<br />
PrintMessage(msg.format(self.TopX_V, self.TopX_Vmax))<br />
if (self.TopX_V + ymax * scale + 2 * marge < self.L<br />
and self.TopY_V + xmax * scale + 2 * marge < self.H):<br />
Draft.rotate(obj, 90)<br />
Draft.move(obj, Vector(-bb.XMin, -bb.YMin, 0))<br />
x0 = xmax; xmax = ymax; ymax = x0<br />
TopX, TopY = self.TopX_V, self.TopY_V<br />
self.TopX_V = self.TopX_V + xmax * scale + marge<br />
self.TopY_Vmax = max(self.TopY_Vmax,<br />
self.TopY_V + ymax * scale + marge)<br />
<br />
else:<br />
obj_l.append([obj, objname])<br />
return obj_l<br />
<br />
doc = FreeCAD.ActiveDocument<br />
page = doc.getObject(self.name)<br />
<br />
Text = doc.addObject('Drawing::FeatureViewAnnotation', f"{objname}_txt")<br />
Text.Text = objname<br />
Text.X = TopX + xmax * scale / 2<br />
Text.Y = TopY + ymax * scale / 2<br />
Text.Scale = 2<br />
<br />
TopView = doc.addObject('Drawing::FeatureViewPart', objname)<br />
TopView.Source = obj<br />
TopView.Direction = (0, 0, 1)<br />
TopView.Rotation = 0<br />
TopView.X = TopX<br />
TopView.Y = TopY<br />
TopView.ShowHiddenLines = False<br />
TopView.Scale = scale<br />
page.addObject(TopView)<br />
page.addObject(Text)<br />
doc.recompute()<br />
return obj_l<br />
<br />
<br />
<br />
<br />
#####################################<br />
### Dialog Box<br />
#####################################<br />
<br />
DialogBox = QtGui.QDialog()<br />
DialogBox.setWindowTitle("UnrollRuledSurface")<br />
la = QtGui.QGridLayout(DialogBox)<br />
la.setSpacing(7)<br />
buttonGrpEdge = QtGui.QButtonGroup(DialogBox)<br />
buttonGrpFormat = QtGui.QButtonGroup(DialogBox)<br />
<br />
cols = 4<br />
la.addWidget(QtGui.QLabel("File Name"), 0, 0, 1, cols)<br />
fname = QtGui.QLineEdit("UnrollSurface")<br />
la.addWidget(fname, 1, 0, 1, cols)<br />
<br />
la.addWidget(QtGui.QLabel("Discretization Points Nbr"), 2, 0, 1, cols)<br />
dpts = QtGui.QLineEdit("30")<br />
la.addWidget(dpts, 3, 0, 1, 2)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Generatrices from edge:"), 4, 0, 1, 2)<br />
edgezero = QtGui.QRadioButton("0 to 3")<br />
la.addWidget(edgezero, 4, 2)<br />
edgeone = QtGui.QRadioButton("1 to 4")<br />
la.addWidget(edgeone, 4, 3)<br />
buttonGrpEdge.addButton(edgezero); buttonGrpEdge.addButton(edgeone)<br />
edgezero.setChecked(True)<br />
<br />
###<br />
mkdwg = QtGui.QCheckBox("Make drawing")<br />
mkdwg.setChecked(True)<br />
la.addWidget(mkdwg, 5, 0, 1, 2)<br />
<br />
altlayout = QtGui.QCheckBox("Alternative layout")<br />
altlayout.setChecked(True)<br />
la.addWidget(altlayout, 5, 2, 1, 2)<br />
<br />
<br />
###<br />
autoscale = QtGui.QCheckBox("Auto scale")<br />
autoscale.setChecked(True)<br />
la.addWidget(autoscale, 6, 0, 1, 2)<br />
<br />
la.addWidget(QtGui.QLabel("Scale"), 6, 2)<br />
scale = QtGui.QLineEdit("1")<br />
la.addWidget(scale, 6, 3)<br />
<br />
###<br />
la.addWidget(QtGui.QLabel("Paper size:"), 7, 0, 1, 2)<br />
rba4 = QtGui.QRadioButton("A4")<br />
la.addWidget(rba4, 7, 2)<br />
rba3 = QtGui.QRadioButton("A3")<br />
la.addWidget(rba3, 7, 3)<br />
buttonGrpFormat.addButton(rba4); buttonGrpFormat.addButton(rba3)<br />
rba4.setChecked(True)<br />
<br />
###<br />
cartridge = QtGui.QCheckBox("Cartridge")<br />
cartridge.setChecked(True)<br />
la.addWidget(cartridge, 8, 0, 1, 2)<br />
<br />
groupdwg = QtGui.QCheckBox("Group drawings in page")<br />
groupdwg.setChecked(True)<br />
la.addWidget(groupdwg, 8, 2, 1, 2)<br />
<br />
###<br />
box = QtGui.QDialogButtonBox(DialogBox)<br />
box.setOrientation(QtCore.Qt.Horizontal)<br />
box.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)<br />
la.addWidget(box, 9, 0, 1, cols)<br />
<br />
###<br />
settings.update(dict(fname=fname, dpts=dpts, edge=buttonGrpEdge,<br />
mkdwg=mkdwg, altlayout=altlayout,<br />
autoscale=autoscale, scale=scale,<br />
papersize=buttonGrpFormat,<br />
cartridge=cartridge, groupdwg=groupdwg))<br />
<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("accepted()"), proceed)<br />
QtCore.QObject.connect(box, QtCore.SIGNAL("rejected()"), close)<br />
QtCore.QMetaObject.connectSlotsByName(DialogBox)<br />
DialogBox.show()<br />
<br />
</pre><br />
<br />
{{clear}}</div>Hedahttps://wiki.freecad.org/index.php?title=File:Macro_UnrollRuledSurface_start_form.png&diff=1164962File:Macro UnrollRuledSurface start form.png2022-07-24T05:33:57Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1150440Creating a simple part with Draft and Part WB2022-06-11T09:17:17Z<p>Heda: </p>
<hr />
<div><languages/><br />
<br />
<translate><br />
<br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
==Introduction==<br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
<br />
==The tutorial covers==<br />
* The model to make<br />
* Creating the 2d profile<br />
* Why does not extruding work<br />
* Extruding the profile<br />
* Creating the through hole<br />
* Making a sketch out of the 2d profile<br />
* Wrapping up<br />
<br />
<br />
==The model to make==<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center|372px]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
==Creating the 2d profile==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
<br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft Workbench''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft Workbench'''.<br />
<br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft Workbench''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
<br />
===Creating the fillet===<br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft Workbench'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{KEY|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use of [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft Workbench''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Move the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click '''LMB'''. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
<br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std_Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system. To move things in and out of the group, use ''drag and drop'' in the tree-view.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
==Why does not extruding work==<br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
<br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a normal (direction), this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
<br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
<br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on different types of [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
<br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire is not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simply becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
<br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
<br />
==Extruding the profile==<br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{KEY|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
==Creating the through hole==<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
<br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
<br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a sketch out of the 2d profile==<br />
Using '''Draft Workbench''' is one way of creating a 2d profile. In '''Draft Workbench''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft Workbench''' can be converted to an ''unconstrained'' sketch.<br />
<br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in the profile from the earlier made group '''Profile'''. From '''Draft Workbench''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
<br />
With '''Sketch''' closed and selected, from '''Part Workbench''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
==Quality of models==<br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
<br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part Workbench''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''.<br />
<br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
<br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to an under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps, since it is originating from a draft profile where it has been constructed in such way that exact edge endpoints matching is ensured (for example by use of snap). If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the geometric kernel cannot consider them to be matching endpoints, i.e. edges are not geometrically joined.<br />
<br />
==Wrapping up==<br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher Workbench''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign Workbench'''. It is suggested that you learn ''sketches'' and '''PartDesign Workbench''' next if your focus is on creating solids. The sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]'' makes the same model as this tutorial. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
<br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Part_WB&diff=1150426Creating a simple part with Part WB2022-06-11T08:11:32Z<p>Heda: /* The model to make */</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=2 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
==Introduction==<br />
<br />
This tutorial aims to be used as a first introduction to 3D modeling using the [[Part_Workbench|Part Workbench]] [[Image:Switch_PartWorkbench.JPG]] of FreeCAD. After having finished this tutorial you should be able to make simple 3d models by using primitives like cubes, cylinders, etc with a technique called [https://en.wikipedia.org/wiki/Constructive_solid_geometry Constructive Solid Geometry], short '''CSG''' modeling. Another way to create 3d models is by using a 2d shape to create a 3d shape by for example extruding or revolving the 2d shape in 3d space. For an introduction of that technique please follow the sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''. The two tutorials intentionally have exactly the same model generated, this presents the beginner with a hands on experience of the two different techniques and how they are implemented in FreeCAD. The definition of the two techniques can be viewed as strictly divided from a semantic point of view, however there is nothing directly hindering a mix of the techniques when creating models. There are some caveats to watch out for when mixing modeling techniques, those are mainly related to aspect of how FreeCAD is programmed. There is a [[Creating_a_simple_part_with_Draft_and_Part_WB|third tutorial]] intended as a first introduction to a mixed modeling example. That tutorial uses '''Draft Workbench''' to create a 2d profile utilized to extrude a solid in '''Part Workbench''' to make the same model as in this tutorial.<br />
<br />
Before you start please have a look at how to '''[[Mouse_navigation|navigate]]''' the 3d space.<br />
When hoovering over the mouse model selector in the lower right corner of the FreeCAD window a cheat-sheet of current mouse model appears as in the picture below.<br />
<br />
</translate><br />
[[Image:T101pwb00-01_navi.png|center]]<br />
<translate><br />
<br />
Many newcomers to cad programs get stuck while learning the software, if that happens to you, please go ahead and search the wiki or forum for further information – chances are that others also have been stuck on the same specific thing in the past so there is already an answer to your specific question. Or make a post on the forum with your questions or findings. The forum has several threads where users are helped to complete all sorts of different tasks, those threads are often similar to tutorials, and often have specific illustrations included.<br />
<br />
===The tutorial covers===<br />
<br />
* The model to make<br />
* Using Part Workbench to create and manipulate the primitive building blocks<br />
* Changing color and transparency<br />
* A different way to locate the hole<br />
* Making the hole a countersunk hole<br />
* Editing dimensions<br />
* A different way to position the chamfer<br />
* Making a hollow piece<br />
* Organizing the tree a bit differently<br />
<br />
===The model to make===<br />
<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center|372px]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<translate><br />
<br />
==Using Part Workbench to create and manipulate the primitive building blocks==<br />
<br />
Create a new document and save it directly under a new name, it is good practice to make sure that you save the document at regular intervals, or just before larger operations. Then switch to the '''[[Part_Workbench|Part Workbench]]''' using either the [[Getting_started#Exploring_FreeCAD|workbench selector]] (labeled 10 in the linked image) or by going to the {{MenuCommand|View → Workbench}} menu. FreeCAD will start with toolbars at the top, the combo view to the left and the 3D view at the right.<br />
<br />
===Create the main solid block===<br />
<br />
Press [[Image:Part_Box.svg|24px|link=Part_Box]] [[Part_Box|Box]] to make a default solid cube. The cube appears in the 3d view and also as a new object in the [[Tree_view|tree-view]] in the sidebar.<br />
<br />
Press [[Image:Std_ViewIsometric.svg|24px|link=Std_ViewIsometric]] [[Std_ViewIsometric|Isometric]] to see the cube in 3d.<br />
<br />
</translate><br />
[[Image:T101pwb01-03_cube1.png|center]]<br />
<translate><br />
<br />
Select the cube in the [[Tree_view|tree-view]], it becomes green in the 3d view. Below the tree-view you will now see that the cube by default is created with the dimensions '''Length x Width x Height''' as ''10 x 10 x 10 mm''. Change those dimensions to '''100 x 30 x 50''' as per the initial drawing of the model.<br />
<br />
</translate><br />
[[Image:T101pwb01-04_cubedims.png|center]]<br />
<translate><br />
<br />
When changing a property, like ''Length'' through the spinbox, one can either enter the values, or use the scroll-wheel to tick values up or down. The arrows for ticking values up or down can of course also be used. In the right most picture above, the ''Height'' property is in edit mode, rolling the scroll wheel when the mouse is over that cell will change the value by one up or down.<br />
<br />
Click [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] '''[[Std_ViewFitAll|Fit all]]''' to see the whole cube.<br />
<br />
</translate><br />
[[Image:T101pwb01-05_cube2.png|center]]<br />
<translate><br />
<br />
===Create fillet===<br />
<br />
To make the filleted corner, in the toolbar press [[Image:Part_Fillet.svg|24px|link=Part_Fillet]] '''[[Part_Fillet|Fillet]]''' which opens the task panel for fillets in the combo view to the side. Change the ''radius'' spinbox to 20 mm, then in the 3d view, select the width edge to the upper right and click {{Button|OK}}.<br />
<br />
</translate><br />
[[Image:T101pwb01-06_filletrad.png|center]] <br />
<translate><br />
<br />
The task panel closes and you are back to the tree-view which now has a fillet object instead of the earlier cube.<br />
<br />
===Visibility of children===<br />
<br />
Click the plus sign/caret to expand the children of the fillet, which in this case is the ''cube'' we created earlier, but it is grayed out. Select the cube and press the space bar – this toggles visibility so the cube is now visible again and the icon is no longer grayed out. To deselect the cube click in a blank area in the tree-view or the 3d view.<br />
<br />
</translate><br />
[[Image:T101pwb01-07_fillet.png|center]]<br />
<translate><br />
<br />
===Creating the chamfer===<br />
<br />
Next is to create the 30 degree ''chamfer'', start by toggling the visibility of the child cube of the fillet. There is a chamfer tool in [[Part_Workbench|Part Workbench]], but we cannot use it since it currently only makes a 45 degree chamfer. We will make it with another block and a boolean cut instead.<br />
<br />
Create a new [[Image:Part_Box.svg|24px|link=Part_Box]] '''[[Part_Box|cube]]''' with dimensions 60 x 30 x 30. Change the '''placement angle''' to -30 degrees.<br />
<br />
</translate><br />
[[Image:T101pwb01-08_chamfer1.png|center]]<br />
<translate><br />
<br />
The placement angle is using the '''placement vector''' (Axis) as axis of rotation. The default is the z-axis, which is not matching our target direction, changing the placement vector to the '''y-axis''' produces the desired orientation of the cutting tool for the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-09_chamfer2.png|center]]<br />
<translate><br />
<br />
The same placement can be attained with other values as well, the simplest alternative example of a placement that is the same is an angle of +30 degrees and a y-axis of -1.<br />
<br />
====Python console====<br />
<br />
Furthermore the position needs to be adjusted, looking at the drawing of the finished part, there is no direct dimension to use for the intended translation upwards. Since the upward dimension is the one needed, we have to calculate it. Let’s make use of the built in '''[[Python_console|python console]]''' for those calculations, it is basic trigonometry. If the FreeCAD python console is not visible for you, just right-click in an empty space in the toolbar area and check the ''python console'' and it should appear in the workspace, when there you should as well add the '''[[Report_view|report view]]''' if not already visible. The ''report view'' most of the times provides useful information or even hints of what to do next for different commands.<br />
<br />
</translate><br />
[[Image:T101pwb01-10_pyconsole.png|center]]<br />
<translate><br />
<br />
After importing the '''[https://docs.python.org/3/library/math.html#module-math math]''' module from the standard libraries in python we can use the formula ''(50 - math.tan(math.radians(30)) * 50)'' to find the distance in z-direction that the block should be moved. Copy the result of the formula from the python console and paste it into the z position for '''Cube001'''. The ''tool'' to use for the chamfer ''cut'' is now properly oriented and positioned.<br />
<br />
</translate><br />
[[Image:T101pwb01-11_chamfer3.png|center]]<br />
<translate><br />
<br />
====Expressions====<br />
<br />
One does not have to use the python console to do the calculation, In most cases when dealing with numeric parametric values, FreeCAD has a short-cut to a built-in calculator. It is called '''[[Expressions|Expressions]]''' in FreeCAD, you can enter the ''expression mode'' by first clicking in the spinbox for the z-position, a small blueish circular icon will appear at the right side.<br />
<br />
</translate><br />
[[Image:T101pwb01-12_expression1.png|center]] <br />
<translate><br />
<br />
Clicking that icon opens new window ''Formula editor'' where formulas and expressions can be entered as shown below. Using expressions is a powerful tool, since one can access parameters from the model, effectively making all parameters in the model available as variables to be used when creating an expression. In short, in our formula, instead of entering the number 50 when in the formula editor, we could enter a ''named parameter'' holding the value 50 from the cube, with the benefit that if we change the cube ''height'', the position of the chamfer will automatically follow. The value of 50 in the current model is referred to as ''Cube.Length'', i.e. the ''Length'' property of the ''Cube'' feature. Further information on this can be found on the wiki.<br />
<br />
</translate><br />
[[Image:T101pwb01-13_expression2.png|center]] <br />
<translate><br />
<br />
To make the cut, with the {{KEY|Ctrl}} key pressed down first select the '''Fillet''' in the tree-view and then the latest created cube (named '''Cube001''') and finally in the toolbar press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button. Your tree-view should now again be a single object in the root called '''Cut'''.<br />
<br />
</translate><br />
[[Image:T101pwb01-14_model1.png|center]]<br />
<translate><br />
<br />
====The measurement tool====<br />
<br />
The '''[[Part_Measure_Menu|measurement tool]]''' in the '''Part Workbench''' can be used to check that our calculation and placement of the chamfer is correct.<br />
Press the [[Image:Part_Measure_Linear.svg|24px|link=Part_Measure_Linear]] '''[[Part_Measure_Linear|Measure Linear]]''' button and a task panel opens up, then select the 2 endpoints of one side of the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-15_model1measure1.png|center]]<br />
<translate><br />
<br />
It checks out with an x dimension of 50 mm, clear the measurement and close the dialogue.<br />
<br />
===Creating the hole===<br />
<br />
To make the hole, press the [[Image:Part_Cylinder.svg|24px|link=Part_Cylinder]] '''[[Part_Cylinder|Cylinder]]''' button, set the ''radius'' to 5 mm and ''height'' to 50 mm.<br />
<br />
</translate><br />
[[Image:T101pwb01-16_cyl1.png|center]]<br />
<translate><br />
<br />
Next we need to position the hole according to the dimensions in the drawing. Change the view to [[Image:Std_ViewTop.svg|24px|link=Std_ViewTop]] '''[[Std_ViewTop|Top]]''' view, then right-click the '''Cylinder''' in the tree-view and select '''Transform''' from the pop-up menu.<br />
<br />
</translate><br />
[[Image:T101pwb01-17_cyl1translate.png|center]]<br />
<translate><br />
<br />
Change the ''Translation increment'' to 5 and use the red and green arrow to position the cylinder in the right position, moving it 15 mm in y and 65 in x by dragging the arrow ends with the mouse. Click {{Button|OK}} to close the ''Transform'' dialogue. To make the hole press the {{KEY|Ctrl}} key and select the '''Cut''' and '''Cylinder''' in the tree-view, then press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button in the toolbar. Your tree-view should once again have a single object in the root called '''Cut001'''.<br />
<br />
Congratulations, the model is now ready.<br />
<br />
</translate><br />
[[Image:T101pwb01-18_model1complete.png|center]]<br />
<translate><br />
<br />
With the basic model ready, let us explore different ways to alter this model, some examples are related to the appearance, additional features, or simply a different way to do the same.<br />
<br />
==Changing color and transparency==<br />
<br />
There are several different ways one can change the appearance of objects, for this case, let's use the view tab in the property part of the combo view. First select the object in the tree-view and then edit any property like line color, shape color or transparency via the '''view tab''' (found at the bottom of the ''combo view'').<br />
<br />
</translate><br />
[[Image:T101pwb02-01_appearance1.png|center]]<br />
<translate><br />
<br />
Unfortunately when the object is selected it is a bit hard to see how it will look when tuning the new appearance. To see the final result one has to deselect the object. Here is the new look of the model, where one now can see the through hole also in the iso-view. Another way to edit the appearance is via the {{MenuCommand|View → [[Image:Std_SetAppearance.svg|24px|link=Std_SetAppearance]] Appearance...}} menu.<br />
<br />
</translate><br />
[[Image:T101pwb02-02_appearance2.png|center]]<br />
<translate><br />
<br />
==A different way to locate the hole==<br />
<br />
Do a ''save-as'' under a new name. Then delete the cut that added the hole and move the cylinder back to zero position. Your model should look like the below picture, which is the starting point for using a different technique to locate the hole at the center of the upper face. Note that the color is back to the default gray, the change in appearance we did was on the cut object which now is deleted.<br />
<br />
</translate><br />
[[Image:T101pwb03-01_cyl.png|center]] <br />
<translate><br />
<br />
This time the [[Image:Workbench_Draft.svg|24px|link=Draft_Workbench]] '''[[Draft_Workbench|Draft Workbench]]''' will be used to locate the hole. The hole is as before to be located at the center of the upper face, which is the same as the midpoint of the diagonal of the upper face.<br />
Start by switching workbench to '''Draft''', it might be that a ''grid'' appears in the 3d view, the grid visibility can be toggled with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]] in the toolbar. When making use of the '''[[Draft_Snap|snap]]''' functionality in the '''Draft Workbench''' it helps to only have the ''snap types'' of interest enabled, this time it is sufficient to leave ''endpoint, midpoint and circle center enabled'', so the settings for snapping should look something like below.<br />
<br />
</translate><br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<translate><br />
<br />
Finding the point to place the center of the cylinder could be done by making a diagonal as helpline and use the center of the cylinder and midpoint of the diagonal to identify the points to move between, however it turns out that we do not even need to make any helplines, we can snap on already existing solid geometry.<br />
<br />
Select the '''Cylinder''' in the tree-view (it turns green in the 3d view) and press the [[Image:Draft_Move.svg|24px|link=Draft_Move]] '''[[Draft_Move|Move]]''' button in the toolbar. A task panel opens for moving objects, make sure that ''Copy'' is unchecked.<br />
<br />
</translate><br />
[[Image:T101pwb03-03_move.png|center]]<br />
<translate><br />
<br />
Then move the mouse to the upper face of the cylinder so that you see a ''white dot'' in the center of the circle as per left picture below, this together with the center symbol next to the mouse pointer means that a left button mouse click will snap to the white point.<br />
<br />
</translate><br />
[[Image:T101pwb03-04_snapselect.png|center]]<br />
<translate><br />
<br />
When you have the white dot on the upper face, click the left mouse button, and repeat for the upper square face of the main solid, like the right picture above, and confirm the choice with a left mouse button click. The snap function makes use of ''mass-center'' for any type of face, and in this case the mass center is the same as the geometrical center that is sought after. You will by now have noticed that the move of the cylinder is animated, so you always see what is about to happen.<br />
<br />
Repeating the step of the '''boolean cut''' from earlier once again will make the through hole that completes the model. Using the '''linear measurement tool''' in Part Workbench, a check that the hole is correctly placed is done. The measurement can only be done between ''points'', so the measurement is done from main body zero to the seam point of the cylinder, meaning that the correct distance is 70 mm instead of the 65 that is on the drawing when accounting for the extra radius that needs to be included in the distance.<br />
<br />
</translate><br />
[[Image:T101pwb03-05_modelmeasure.png|center]]<br />
<translate><br />
<br />
==Making the hole a countersunk hole==<br />
<br />
Switch back to the [[Part_Workbench|Part Workbench]] and create a ''cone'' by pressing the [[Image:Part_Cone.svg|24px|link=Part_Cone]] '''[[Part_Cone|Cone]]''' button in the toolbar. Change ''radius1'' to 0 mm and ''radius2'' to 7 mm – this will give a 2 mm ''countersink'' on the radius. Making the ''height'' of the cone 7 mm results in a 90 degree top angle of the cone, or 45 degree countersink angle. Worth to note is that for a 45 degree countersink one could as well use the [[Image:Part_Chamfer.svg|24px|link=Part_Chamfer]] [[Part_Chamfer|Chamfer]] operation, currently limited to only 45 degrees. By using a cone we can easily edit the top angle of the cone by changing the height of the cone.<br />
<br />
When working with FreeCAD you will continuously be faced with several different ways to achieve seemingly the same result. There is hardly any absolute truth in what is the right way to achieve a particular end result – however when looking in a specific context one specific workflow can be more flexible, allow for later features to actually be used etc. How you build 3d models will evolve over time as you along the way learn more and more about the features and capabilities of FreeCAD.<br />
<br />
</translate><br />
[[Image:T101pwb04-01_cone.png|center]]<br />
<translate><br />
<br />
Translate the cone so that it is ''concentric'' with the hole and ''coplanar'' with the main solid upper surface. Use any method described earlier in this tutorial to accomplish that.<br />
In the picture below the move is made with ''Transform'' and an ''increment'' setting of 1 mm, since the cone has a characteristic dimension of 7 mm, meaning that the earlier increment setting of 5 mm will not allow for correct positioning. The [[Image:Std_DrawStyleWireFrame.svg|24px|link=Std_DrawStyle#Wireframe]] '''[[Std_DrawStyle#Wireframe|Wireframe]]''' rendering is used to easier see that the cone is in the right position.<br />
<br />
</translate><br />
[[Image:T101pwb04-02_conetranslate.png|center]]<br />
<translate><br />
<br />
To complete the model, let's make use of the [[Image:Part_Boolean.svg|24px|link=Part_Boolean]] '''[[Part_Boolean|Boolean]]''' command instead of first selecting objects and apply a specific boolean operation. Press the toolbar button and a task panel opens as per below picture to the left.<br />
<br />
</translate><br />
[[Image:T101pwb04-03_boolean.png|center]]<br />
<translate><br />
<br />
Three items needs to be specified, the ''operation type'', the ''first shape'' and the ''second shape''. The cone is supposed to be cut, this is called ''Difference'' in this command, instead of ''Cut''. The first shape is our '''Cut001''', it is listed under ''compounds'', since it is build from several solids. The second shape is the '''Cone'''. Once the correct settings are made for the command, click the {{Button|Apply}} button to execute the operation. This has all been done in the picture to the right, and there one can also see that a ''compound'' '''Cut002''' is now listed, this is our final model shape. After having changed the appearance the final model looks like this.<br />
<br />
</translate><br />
[[Image:T101pwb04-04_modelcomplete.png|center]]<br />
<translate><br />
<br />
==Making a hollow piece==<br />
<br />
Do a ''save-as'' under a new name. FreeCAD has all of the typical operations of a 3D modeller, one of them is [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''', which is used to ''hollow out'' parts.<br />
<br />
Rotate the view so that the bottom face of the model is visible.<br />
<br />
</translate><br />
[[Image:T101pwb05-01_frombottom.png|center]]<br />
<translate><br />
<br />
Select the ''bottom face'' of the model, then in the [[Part_Workbench|Part Workbench]] select [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''' and the screen should look like below.<br />
<br />
</translate><br />
[[Image:T101pwb05-02_thickness_cmd.png|center]]<br />
<translate><br />
<br />
Click {{Button|OK}}, as you can see there are now a ''radius'' on the hollowed out part.<br />
<br />
</translate><br />
[[Image:T101pwb05-03_thickness_dimension.png|center]]<br />
<translate><br />
<br />
Moreover, when taking a measurement of the width of the part, it is now 32 mm, so the ''thickness'' has been applied ''outwards''. Let’s edit that, double-click the model in the tree-view and modify the ''join-type'' settings to ''intersection'' and the ''thickness'' setting to -1.<br />
<br />
</translate><br />
[[Image:T101pwb05-04_thickness_modify.png |center]]<br />
<translate><br />
<br />
Now the outer width of the part is 30 mm, same as before and the corners are all sharp corners.<br />
<br />
</translate><br />
[[Image:T101pwb05-05_thickness_modified.png|center]]<br />
<translate><br />
<br />
==A different way to position the chamfer==<br />
<br />
Do a ''save-as'' under a new name. Then delete features so that the model looks like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-01_startingpoint.png|center]]<br />
<translate><br />
<br />
Make a '''Cube''' with dimensions '''30x30x60''', ending up like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-02_with_cube.png|center]]<br />
<translate><br />
<br />
Change '''placement''' by first rotating -120 degrees around Y-axis.<br />
<br />
</translate><br />
[[Image:T101pwb06-03_rotated_cube.png|center]]<br />
<translate><br />
<br />
Finally, change position to '''X=50''' and '''Z=50''' and make the ''cut'' to produce the same result as earlier.<br />
<br />
</translate><br />
[[Image:T101pwb06-04_cube_cut.png|center]]<br />
<translate><br />
<br />
This once again highlights that there are always several ways to produce the same outcome, which is a reoccurring theme when it comes to 3d modeling. When it comes to basic geometries or solids, one can use different workbenches in FreeCAD as well as different commands and still have the same outer shape of a solid. You simply need to find your own way to a set of preferred tools and workflow that you are comfortable in using. Modeling in parametric 3d is a process of constant learning, and takes practice to master.<br />
<br />
==Editing dimensions, face colors and TNP==<br />
<br />
FreeCAD is a parametric 3d modeler, this allows you to change any ''placement'' or ''dimension'' and the model will update accordingly. In general this works, but it is possible to break a model when edited – for example when a fillet is based on an edge that no longer exists due to editing. When a model breaks during editing, it is referred to as '''TNP, Topological Naming Problem'''.<br />
<br />
Go ahead and experiment with changing dimensions and placements to see if you can break the model, do not forget to recalculate the model after changes if required. This can be done with the [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] button in the toolbar, if the icon is grayed out it is not needed to refresh the object.<br />
<br />
===Reposition the cylinder===<br />
<br />
Here is an example of the cylinder moved from the center to one side of the main body by using ''Transform'' on the cylinder. As can be seen in the picture, the cone is still in the original position, not affected by the move of the cylinder.<br />
<br />
</translate><br />
[[Image:T101pwb07-01_cylindermoved.png|center]]<br />
<translate><br />
<br />
When you move the cylinder and break through the outer surface, in version 0.19 you are loosing part of the color settings on your model. FreeCAD reverts to the user default settings for shape colors and transparency in the 3D-view, however the '''Cut002''' shape still shows the colors and transparency that it had before as seen in below picture.<br />
<br />
===Fixing the colors===<br />
<br />
</translate><br />
[[Image:T101pwb07-02_wrongcolor.png|center]]<br />
<translate><br />
<br />
Here is one way to get it back. First change ''transparency'' one tick up or down and then back, that brings back the transparency. You can do the same trick on shape color. Another way to get the color back is to ''right-click'' '''Cut002''' in the tree-view and select '''Set Colors''' in the context menu. In the ''task panel'' that displays, click {{Button|Set to Default}}, that brings back the color to the one set in the view-properties.<br />
<br />
</translate><br />
[[Image:T101pwb07-03_set_colors.png|center]]<br />
<translate><br />
<br />
The '''Set Colors''' command allows you to select individual faces of a shape and set a unique color on the selected faces.<br />
<br />
===Multiple solids===<br />
<br />
Another example where the cube that is making the chamfer has been translated and rotated.<br />
<br />
</translate><br />
[[Image:T101pwb07-04_3solids.png|center]]<br />
<translate><br />
<br />
As can be seen when repositioning the chamfer in this way, the end result is ''3 disjoint solids''. [[Part_Workbench|Part Workbench]] allows this, [[PartDesign_Workbench|PartDesign Workbench]] does not, either you will get an ''multiple solids error'' or it will simply not render all solids.<br />
<br />
===TNP===<br />
<br />
Going back to the original completed model, let’s explore how the faces are named.<br />
Here the '''[[Selection_view|selection view]]''' has been made active, just to show clearly what is selected and not, also coloring is adjusted so that selection becomes easier to see.<br />
<br />
</translate><br />
[[Image:T101pwb07-05_face2and9.png|center]]<br />
<translate><br />
<br />
Selecting one side face and the cylinder inner face gives that they are internally called face ''2'' and ''9'', where face ''2'' is the side face. Face numbering can be different for you.<br />
Moving the cylinder so that the cavity ends up on the side face, and doing the selection of faces now gives a different number for the cylindrical face.<br />
<br />
</translate><br />
[[Image:T101pwb07-06_newfacenumbers.png|center]]<br />
<translate><br />
<br />
Face 2 is the right side of the original face 2, the left side of former face 2 is now face 8. The cylindrical part was face 9, but is now face 7. FreeCAD reassigns the numbering and the order is not necessarily preserved. The total face count in the first model is 10, in the version with the cylindrical face piercing the side face, the total face count is 11. So obviously face numbering has to change when the so called ''topology'' changes. This probably feels like a minute detail, but turns out to be quite important in parametric 3d cad. Imagine that you have used the cylindrical face as reference for another feature, it used to be called face 9, but is now called face 8. The reference to the intended cylindrical surface is lost. Since FreeCAD, at least in currently released versions does not keep track of the ''intended face'', it only keeps track of the ''numbered face'' a model breaks when a reference is made to a face that later is renumbered. This is called '''TNP, Topological Naming Problem'''.<br />
<br />
You are encouraged to learn how to avoid broken models due to TNP, further reading can be done elsewhere on the [[Topological_naming_problem|wiki]], which largely focus on a ''sketch driven'' workflow, the underlying mechanism is the same though. The renumbering described here for faces goes for all geometrical entities, faces, edges and vertexes.<br />
<br />
==Organizing the tree a bit differently==<br />
<br />
Do a ''save-as'' under a new name. Then delete all the cuts ending up in a model looking like below.<br />
<br />
</translate><br />
[[Image:T101pwb08-01_primitives.png|center]]<br />
<translate><br />
<br />
When using '''Part Workbench''' and modelling feature rich solids, then the tree structure of a solid can become cumbersome to decipher. So far we have created one primitive / feature and applied a boolean operation. In Part Workbench one can bundle primitives into one boolean operation. In our case we have the cylinder, cone and cube that are all a cut boolean operation.<br />
Instead of making a cut for each primitive, we can first apply a boolean union, [[Image:Part_Fuse.svg|24px|link=Part_Fuse]] '''[[Part_Fuse|Fuse]]''' the primitives intended for the boolean cut, and then make the ''cut'' between the '''Fillet''' and the '''Fusion'''.<br />
<br />
Using this approach, the tree-view ends up looking like below, which is just a different way of building the same model. Compare this with the original tree-view, none is better than the other, however when making more complex models one approach over the other, can have benefits in ease of modifying/reorganizing the model if needed.<br />
<br />
</translate><br />
[[Image:T101pwb08-02_fused.png|center]]<br />
<translate><br />
<br />
==Wrapping up==<br />
<br />
Having gone through the tutorial you are now briefly acquainted with the user interface of FreeCAD and you have learned the basics in using '''Part Workbench'''. You should now be able to build simple models after your own liking. '''Part Workbench''' is one of the workbenches that can be used to create solids, '''PartDesign Workbench''' is another. The different workbenches have different capabilities and workflows. Learning FreeCAD in full, especially considering all add-ons and macros takes years, so keep on exploring new and different ways of making models – take different tutorials on the wiki, the learning never stops when working with FreeCAD. It is suggested that you learn ''sketches'' and '''PartDesign Workbench''' next if your focus is on creating solids. If your focus is modelling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
<br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
<br />
<br />
</translate><br />
[[Category:Part{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Part_WB&diff=1150424Creating a simple part with Part WB2022-06-11T08:05:12Z<p>Heda: /* TNP */</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=2 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
==Introduction==<br />
<br />
This tutorial aims to be used as a first introduction to 3D modeling using the [[Part_Workbench|Part Workbench]] [[Image:Switch_PartWorkbench.JPG]] of FreeCAD. After having finished this tutorial you should be able to make simple 3d models by using primitives like cubes, cylinders, etc with a technique called [https://en.wikipedia.org/wiki/Constructive_solid_geometry Constructive Solid Geometry], short '''CSG''' modeling. Another way to create 3d models is by using a 2d shape to create a 3d shape by for example extruding or revolving the 2d shape in 3d space. For an introduction of that technique please follow the sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''. The two tutorials intentionally have exactly the same model generated, this presents the beginner with a hands on experience of the two different techniques and how they are implemented in FreeCAD. The definition of the two techniques can be viewed as strictly divided from a semantic point of view, however there is nothing directly hindering a mix of the techniques when creating models. There are some caveats to watch out for when mixing modeling techniques, those are mainly related to aspect of how FreeCAD is programmed. There is a [[Creating_a_simple_part_with_Draft_and_Part_WB|third tutorial]] intended as a first introduction to a mixed modeling example. That tutorial uses '''Draft Workbench''' to create a 2d profile utilized to extrude a solid in '''Part Workbench''' to make the same model as in this tutorial.<br />
<br />
Before you start please have a look at how to '''[[Mouse_navigation|navigate]]''' the 3d space.<br />
When hoovering over the mouse model selector in the lower right corner of the FreeCAD window a cheat-sheet of current mouse model appears as in the picture below.<br />
<br />
</translate><br />
[[Image:T101pwb00-01_navi.png|center]]<br />
<translate><br />
<br />
Many newcomers to cad programs get stuck while learning the software, if that happens to you, please go ahead and search the wiki or forum for further information – chances are that others also have been stuck on the same specific thing in the past so there is already an answer to your specific question. Or make a post on the forum with your questions or findings. The forum has several threads where users are helped to complete all sorts of different tasks, those threads are often similar to tutorials, and often have specific illustrations included.<br />
<br />
===The tutorial covers===<br />
<br />
* The model to make<br />
* Using Part Workbench to create and manipulate the primitive building blocks<br />
* Changing color and transparency<br />
* A different way to locate the hole<br />
* Making the hole a countersunk hole<br />
* Editing dimensions<br />
* A different way to position the chamfer<br />
* Making a hollow piece<br />
* Organizing the tree a bit differently<br />
<br />
===The model to make===<br />
<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<translate><br />
<br />
==Using Part Workbench to create and manipulate the primitive building blocks==<br />
<br />
Create a new document and save it directly under a new name, it is good practice to make sure that you save the document at regular intervals, or just before larger operations. Then switch to the '''[[Part_Workbench|Part Workbench]]''' using either the [[Getting_started#Exploring_FreeCAD|workbench selector]] (labeled 10 in the linked image) or by going to the {{MenuCommand|View → Workbench}} menu. FreeCAD will start with toolbars at the top, the combo view to the left and the 3D view at the right.<br />
<br />
===Create the main solid block===<br />
<br />
Press [[Image:Part_Box.svg|24px|link=Part_Box]] [[Part_Box|Box]] to make a default solid cube. The cube appears in the 3d view and also as a new object in the [[Tree_view|tree-view]] in the sidebar.<br />
<br />
Press [[Image:Std_ViewIsometric.svg|24px|link=Std_ViewIsometric]] [[Std_ViewIsometric|Isometric]] to see the cube in 3d.<br />
<br />
</translate><br />
[[Image:T101pwb01-03_cube1.png|center]]<br />
<translate><br />
<br />
Select the cube in the [[Tree_view|tree-view]], it becomes green in the 3d view. Below the tree-view you will now see that the cube by default is created with the dimensions '''Length x Width x Height''' as ''10 x 10 x 10 mm''. Change those dimensions to '''100 x 30 x 50''' as per the initial drawing of the model.<br />
<br />
</translate><br />
[[Image:T101pwb01-04_cubedims.png|center]]<br />
<translate><br />
<br />
When changing a property, like ''Length'' through the spinbox, one can either enter the values, or use the scroll-wheel to tick values up or down. The arrows for ticking values up or down can of course also be used. In the right most picture above, the ''Height'' property is in edit mode, rolling the scroll wheel when the mouse is over that cell will change the value by one up or down.<br />
<br />
Click [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] '''[[Std_ViewFitAll|Fit all]]''' to see the whole cube.<br />
<br />
</translate><br />
[[Image:T101pwb01-05_cube2.png|center]]<br />
<translate><br />
<br />
===Create fillet===<br />
<br />
To make the filleted corner, in the toolbar press [[Image:Part_Fillet.svg|24px|link=Part_Fillet]] '''[[Part_Fillet|Fillet]]''' which opens the task panel for fillets in the combo view to the side. Change the ''radius'' spinbox to 20 mm, then in the 3d view, select the width edge to the upper right and click {{Button|OK}}.<br />
<br />
</translate><br />
[[Image:T101pwb01-06_filletrad.png|center]] <br />
<translate><br />
<br />
The task panel closes and you are back to the tree-view which now has a fillet object instead of the earlier cube.<br />
<br />
===Visibility of children===<br />
<br />
Click the plus sign/caret to expand the children of the fillet, which in this case is the ''cube'' we created earlier, but it is grayed out. Select the cube and press the space bar – this toggles visibility so the cube is now visible again and the icon is no longer grayed out. To deselect the cube click in a blank area in the tree-view or the 3d view.<br />
<br />
</translate><br />
[[Image:T101pwb01-07_fillet.png|center]]<br />
<translate><br />
<br />
===Creating the chamfer===<br />
<br />
Next is to create the 30 degree ''chamfer'', start by toggling the visibility of the child cube of the fillet. There is a chamfer tool in [[Part_Workbench|Part Workbench]], but we cannot use it since it currently only makes a 45 degree chamfer. We will make it with another block and a boolean cut instead.<br />
<br />
Create a new [[Image:Part_Box.svg|24px|link=Part_Box]] '''[[Part_Box|cube]]''' with dimensions 60 x 30 x 30. Change the '''placement angle''' to -30 degrees.<br />
<br />
</translate><br />
[[Image:T101pwb01-08_chamfer1.png|center]]<br />
<translate><br />
<br />
The placement angle is using the '''placement vector''' (Axis) as axis of rotation. The default is the z-axis, which is not matching our target direction, changing the placement vector to the '''y-axis''' produces the desired orientation of the cutting tool for the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-09_chamfer2.png|center]]<br />
<translate><br />
<br />
The same placement can be attained with other values as well, the simplest alternative example of a placement that is the same is an angle of +30 degrees and a y-axis of -1.<br />
<br />
====Python console====<br />
<br />
Furthermore the position needs to be adjusted, looking at the drawing of the finished part, there is no direct dimension to use for the intended translation upwards. Since the upward dimension is the one needed, we have to calculate it. Let’s make use of the built in '''[[Python_console|python console]]''' for those calculations, it is basic trigonometry. If the FreeCAD python console is not visible for you, just right-click in an empty space in the toolbar area and check the ''python console'' and it should appear in the workspace, when there you should as well add the '''[[Report_view|report view]]''' if not already visible. The ''report view'' most of the times provides useful information or even hints of what to do next for different commands.<br />
<br />
</translate><br />
[[Image:T101pwb01-10_pyconsole.png|center]]<br />
<translate><br />
<br />
After importing the '''[https://docs.python.org/3/library/math.html#module-math math]''' module from the standard libraries in python we can use the formula ''(50 - math.tan(math.radians(30)) * 50)'' to find the distance in z-direction that the block should be moved. Copy the result of the formula from the python console and paste it into the z position for '''Cube001'''. The ''tool'' to use for the chamfer ''cut'' is now properly oriented and positioned.<br />
<br />
</translate><br />
[[Image:T101pwb01-11_chamfer3.png|center]]<br />
<translate><br />
<br />
====Expressions====<br />
<br />
One does not have to use the python console to do the calculation, In most cases when dealing with numeric parametric values, FreeCAD has a short-cut to a built-in calculator. It is called '''[[Expressions|Expressions]]''' in FreeCAD, you can enter the ''expression mode'' by first clicking in the spinbox for the z-position, a small blueish circular icon will appear at the right side.<br />
<br />
</translate><br />
[[Image:T101pwb01-12_expression1.png|center]] <br />
<translate><br />
<br />
Clicking that icon opens new window ''Formula editor'' where formulas and expressions can be entered as shown below. Using expressions is a powerful tool, since one can access parameters from the model, effectively making all parameters in the model available as variables to be used when creating an expression. In short, in our formula, instead of entering the number 50 when in the formula editor, we could enter a ''named parameter'' holding the value 50 from the cube, with the benefit that if we change the cube ''height'', the position of the chamfer will automatically follow. The value of 50 in the current model is referred to as ''Cube.Length'', i.e. the ''Length'' property of the ''Cube'' feature. Further information on this can be found on the wiki.<br />
<br />
</translate><br />
[[Image:T101pwb01-13_expression2.png|center]] <br />
<translate><br />
<br />
To make the cut, with the {{KEY|Ctrl}} key pressed down first select the '''Fillet''' in the tree-view and then the latest created cube (named '''Cube001''') and finally in the toolbar press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button. Your tree-view should now again be a single object in the root called '''Cut'''.<br />
<br />
</translate><br />
[[Image:T101pwb01-14_model1.png|center]]<br />
<translate><br />
<br />
====The measurement tool====<br />
<br />
The '''[[Part_Measure_Menu|measurement tool]]''' in the '''Part Workbench''' can be used to check that our calculation and placement of the chamfer is correct.<br />
Press the [[Image:Part_Measure_Linear.svg|24px|link=Part_Measure_Linear]] '''[[Part_Measure_Linear|Measure Linear]]''' button and a task panel opens up, then select the 2 endpoints of one side of the chamfer.<br />
<br />
</translate><br />
[[Image:T101pwb01-15_model1measure1.png|center]]<br />
<translate><br />
<br />
It checks out with an x dimension of 50 mm, clear the measurement and close the dialogue.<br />
<br />
===Creating the hole===<br />
<br />
To make the hole, press the [[Image:Part_Cylinder.svg|24px|link=Part_Cylinder]] '''[[Part_Cylinder|Cylinder]]''' button, set the ''radius'' to 5 mm and ''height'' to 50 mm.<br />
<br />
</translate><br />
[[Image:T101pwb01-16_cyl1.png|center]]<br />
<translate><br />
<br />
Next we need to position the hole according to the dimensions in the drawing. Change the view to [[Image:Std_ViewTop.svg|24px|link=Std_ViewTop]] '''[[Std_ViewTop|Top]]''' view, then right-click the '''Cylinder''' in the tree-view and select '''Transform''' from the pop-up menu.<br />
<br />
</translate><br />
[[Image:T101pwb01-17_cyl1translate.png|center]]<br />
<translate><br />
<br />
Change the ''Translation increment'' to 5 and use the red and green arrow to position the cylinder in the right position, moving it 15 mm in y and 65 in x by dragging the arrow ends with the mouse. Click {{Button|OK}} to close the ''Transform'' dialogue. To make the hole press the {{KEY|Ctrl}} key and select the '''Cut''' and '''Cylinder''' in the tree-view, then press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button in the toolbar. Your tree-view should once again have a single object in the root called '''Cut001'''.<br />
<br />
Congratulations, the model is now ready.<br />
<br />
</translate><br />
[[Image:T101pwb01-18_model1complete.png|center]]<br />
<translate><br />
<br />
With the basic model ready, let us explore different ways to alter this model, some examples are related to the appearance, additional features, or simply a different way to do the same.<br />
<br />
==Changing color and transparency==<br />
<br />
There are several different ways one can change the appearance of objects, for this case, let's use the view tab in the property part of the combo view. First select the object in the tree-view and then edit any property like line color, shape color or transparency via the '''view tab''' (found at the bottom of the ''combo view'').<br />
<br />
</translate><br />
[[Image:T101pwb02-01_appearance1.png|center]]<br />
<translate><br />
<br />
Unfortunately when the object is selected it is a bit hard to see how it will look when tuning the new appearance. To see the final result one has to deselect the object. Here is the new look of the model, where one now can see the through hole also in the iso-view. Another way to edit the appearance is via the {{MenuCommand|View → [[Image:Std_SetAppearance.svg|24px|link=Std_SetAppearance]] Appearance...}} menu.<br />
<br />
</translate><br />
[[Image:T101pwb02-02_appearance2.png|center]]<br />
<translate><br />
<br />
==A different way to locate the hole==<br />
<br />
Do a ''save-as'' under a new name. Then delete the cut that added the hole and move the cylinder back to zero position. Your model should look like the below picture, which is the starting point for using a different technique to locate the hole at the center of the upper face. Note that the color is back to the default gray, the change in appearance we did was on the cut object which now is deleted.<br />
<br />
</translate><br />
[[Image:T101pwb03-01_cyl.png|center]] <br />
<translate><br />
<br />
This time the [[Image:Workbench_Draft.svg|24px|link=Draft_Workbench]] '''[[Draft_Workbench|Draft Workbench]]''' will be used to locate the hole. The hole is as before to be located at the center of the upper face, which is the same as the midpoint of the diagonal of the upper face.<br />
Start by switching workbench to '''Draft''', it might be that a ''grid'' appears in the 3d view, the grid visibility can be toggled with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]] in the toolbar. When making use of the '''[[Draft_Snap|snap]]''' functionality in the '''Draft Workbench''' it helps to only have the ''snap types'' of interest enabled, this time it is sufficient to leave ''endpoint, midpoint and circle center enabled'', so the settings for snapping should look something like below.<br />
<br />
</translate><br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<translate><br />
<br />
Finding the point to place the center of the cylinder could be done by making a diagonal as helpline and use the center of the cylinder and midpoint of the diagonal to identify the points to move between, however it turns out that we do not even need to make any helplines, we can snap on already existing solid geometry.<br />
<br />
Select the '''Cylinder''' in the tree-view (it turns green in the 3d view) and press the [[Image:Draft_Move.svg|24px|link=Draft_Move]] '''[[Draft_Move|Move]]''' button in the toolbar. A task panel opens for moving objects, make sure that ''Copy'' is unchecked.<br />
<br />
</translate><br />
[[Image:T101pwb03-03_move.png|center]]<br />
<translate><br />
<br />
Then move the mouse to the upper face of the cylinder so that you see a ''white dot'' in the center of the circle as per left picture below, this together with the center symbol next to the mouse pointer means that a left button mouse click will snap to the white point.<br />
<br />
</translate><br />
[[Image:T101pwb03-04_snapselect.png|center]]<br />
<translate><br />
<br />
When you have the white dot on the upper face, click the left mouse button, and repeat for the upper square face of the main solid, like the right picture above, and confirm the choice with a left mouse button click. The snap function makes use of ''mass-center'' for any type of face, and in this case the mass center is the same as the geometrical center that is sought after. You will by now have noticed that the move of the cylinder is animated, so you always see what is about to happen.<br />
<br />
Repeating the step of the '''boolean cut''' from earlier once again will make the through hole that completes the model. Using the '''linear measurement tool''' in Part Workbench, a check that the hole is correctly placed is done. The measurement can only be done between ''points'', so the measurement is done from main body zero to the seam point of the cylinder, meaning that the correct distance is 70 mm instead of the 65 that is on the drawing when accounting for the extra radius that needs to be included in the distance.<br />
<br />
</translate><br />
[[Image:T101pwb03-05_modelmeasure.png|center]]<br />
<translate><br />
<br />
==Making the hole a countersunk hole==<br />
<br />
Switch back to the [[Part_Workbench|Part Workbench]] and create a ''cone'' by pressing the [[Image:Part_Cone.svg|24px|link=Part_Cone]] '''[[Part_Cone|Cone]]''' button in the toolbar. Change ''radius1'' to 0 mm and ''radius2'' to 7 mm – this will give a 2 mm ''countersink'' on the radius. Making the ''height'' of the cone 7 mm results in a 90 degree top angle of the cone, or 45 degree countersink angle. Worth to note is that for a 45 degree countersink one could as well use the [[Image:Part_Chamfer.svg|24px|link=Part_Chamfer]] [[Part_Chamfer|Chamfer]] operation, currently limited to only 45 degrees. By using a cone we can easily edit the top angle of the cone by changing the height of the cone.<br />
<br />
When working with FreeCAD you will continuously be faced with several different ways to achieve seemingly the same result. There is hardly any absolute truth in what is the right way to achieve a particular end result – however when looking in a specific context one specific workflow can be more flexible, allow for later features to actually be used etc. How you build 3d models will evolve over time as you along the way learn more and more about the features and capabilities of FreeCAD.<br />
<br />
</translate><br />
[[Image:T101pwb04-01_cone.png|center]]<br />
<translate><br />
<br />
Translate the cone so that it is ''concentric'' with the hole and ''coplanar'' with the main solid upper surface. Use any method described earlier in this tutorial to accomplish that.<br />
In the picture below the move is made with ''Transform'' and an ''increment'' setting of 1 mm, since the cone has a characteristic dimension of 7 mm, meaning that the earlier increment setting of 5 mm will not allow for correct positioning. The [[Image:Std_DrawStyleWireFrame.svg|24px|link=Std_DrawStyle#Wireframe]] '''[[Std_DrawStyle#Wireframe|Wireframe]]''' rendering is used to easier see that the cone is in the right position.<br />
<br />
</translate><br />
[[Image:T101pwb04-02_conetranslate.png|center]]<br />
<translate><br />
<br />
To complete the model, let's make use of the [[Image:Part_Boolean.svg|24px|link=Part_Boolean]] '''[[Part_Boolean|Boolean]]''' command instead of first selecting objects and apply a specific boolean operation. Press the toolbar button and a task panel opens as per below picture to the left.<br />
<br />
</translate><br />
[[Image:T101pwb04-03_boolean.png|center]]<br />
<translate><br />
<br />
Three items needs to be specified, the ''operation type'', the ''first shape'' and the ''second shape''. The cone is supposed to be cut, this is called ''Difference'' in this command, instead of ''Cut''. The first shape is our '''Cut001''', it is listed under ''compounds'', since it is build from several solids. The second shape is the '''Cone'''. Once the correct settings are made for the command, click the {{Button|Apply}} button to execute the operation. This has all been done in the picture to the right, and there one can also see that a ''compound'' '''Cut002''' is now listed, this is our final model shape. After having changed the appearance the final model looks like this.<br />
<br />
</translate><br />
[[Image:T101pwb04-04_modelcomplete.png|center]]<br />
<translate><br />
<br />
==Making a hollow piece==<br />
<br />
Do a ''save-as'' under a new name. FreeCAD has all of the typical operations of a 3D modeller, one of them is [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''', which is used to ''hollow out'' parts.<br />
<br />
Rotate the view so that the bottom face of the model is visible.<br />
<br />
</translate><br />
[[Image:T101pwb05-01_frombottom.png|center]]<br />
<translate><br />
<br />
Select the ''bottom face'' of the model, then in the [[Part_Workbench|Part Workbench]] select [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''' and the screen should look like below.<br />
<br />
</translate><br />
[[Image:T101pwb05-02_thickness_cmd.png|center]]<br />
<translate><br />
<br />
Click {{Button|OK}}, as you can see there are now a ''radius'' on the hollowed out part.<br />
<br />
</translate><br />
[[Image:T101pwb05-03_thickness_dimension.png|center]]<br />
<translate><br />
<br />
Moreover, when taking a measurement of the width of the part, it is now 32 mm, so the ''thickness'' has been applied ''outwards''. Let’s edit that, double-click the model in the tree-view and modify the ''join-type'' settings to ''intersection'' and the ''thickness'' setting to -1.<br />
<br />
</translate><br />
[[Image:T101pwb05-04_thickness_modify.png |center]]<br />
<translate><br />
<br />
Now the outer width of the part is 30 mm, same as before and the corners are all sharp corners.<br />
<br />
</translate><br />
[[Image:T101pwb05-05_thickness_modified.png|center]]<br />
<translate><br />
<br />
==A different way to position the chamfer==<br />
<br />
Do a ''save-as'' under a new name. Then delete features so that the model looks like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-01_startingpoint.png|center]]<br />
<translate><br />
<br />
Make a '''Cube''' with dimensions '''30x30x60''', ending up like below.<br />
<br />
</translate><br />
[[Image:T101pwb06-02_with_cube.png|center]]<br />
<translate><br />
<br />
Change '''placement''' by first rotating -120 degrees around Y-axis.<br />
<br />
</translate><br />
[[Image:T101pwb06-03_rotated_cube.png|center]]<br />
<translate><br />
<br />
Finally, change position to '''X=50''' and '''Z=50''' and make the ''cut'' to produce the same result as earlier.<br />
<br />
</translate><br />
[[Image:T101pwb06-04_cube_cut.png|center]]<br />
<translate><br />
<br />
This once again highlights that there are always several ways to produce the same outcome, which is a reoccurring theme when it comes to 3d modeling. When it comes to basic geometries or solids, one can use different workbenches in FreeCAD as well as different commands and still have the same outer shape of a solid. You simply need to find your own way to a set of preferred tools and workflow that you are comfortable in using. Modeling in parametric 3d is a process of constant learning, and takes practice to master.<br />
<br />
==Editing dimensions, face colors and TNP==<br />
<br />
FreeCAD is a parametric 3d modeler, this allows you to change any ''placement'' or ''dimension'' and the model will update accordingly. In general this works, but it is possible to break a model when edited – for example when a fillet is based on an edge that no longer exists due to editing. When a model breaks during editing, it is referred to as '''TNP, Topological Naming Problem'''.<br />
<br />
Go ahead and experiment with changing dimensions and placements to see if you can break the model, do not forget to recalculate the model after changes if required. This can be done with the [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] button in the toolbar, if the icon is grayed out it is not needed to refresh the object.<br />
<br />
===Reposition the cylinder===<br />
<br />
Here is an example of the cylinder moved from the center to one side of the main body by using ''Transform'' on the cylinder. As can be seen in the picture, the cone is still in the original position, not affected by the move of the cylinder.<br />
<br />
</translate><br />
[[Image:T101pwb07-01_cylindermoved.png|center]]<br />
<translate><br />
<br />
When you move the cylinder and break through the outer surface, in version 0.19 you are loosing part of the color settings on your model. FreeCAD reverts to the user default settings for shape colors and transparency in the 3D-view, however the '''Cut002''' shape still shows the colors and transparency that it had before as seen in below picture.<br />
<br />
===Fixing the colors===<br />
<br />
</translate><br />
[[Image:T101pwb07-02_wrongcolor.png|center]]<br />
<translate><br />
<br />
Here is one way to get it back. First change ''transparency'' one tick up or down and then back, that brings back the transparency. You can do the same trick on shape color. Another way to get the color back is to ''right-click'' '''Cut002''' in the tree-view and select '''Set Colors''' in the context menu. In the ''task panel'' that displays, click {{Button|Set to Default}}, that brings back the color to the one set in the view-properties.<br />
<br />
</translate><br />
[[Image:T101pwb07-03_set_colors.png|center]]<br />
<translate><br />
<br />
The '''Set Colors''' command allows you to select individual faces of a shape and set a unique color on the selected faces.<br />
<br />
===Multiple solids===<br />
<br />
Another example where the cube that is making the chamfer has been translated and rotated.<br />
<br />
</translate><br />
[[Image:T101pwb07-04_3solids.png|center]]<br />
<translate><br />
<br />
As can be seen when repositioning the chamfer in this way, the end result is ''3 disjoint solids''. [[Part_Workbench|Part Workbench]] allows this, [[PartDesign_Workbench|PartDesign Workbench]] does not, either you will get an ''multiple solids error'' or it will simply not render all solids.<br />
<br />
===TNP===<br />
<br />
Going back to the original completed model, let’s explore how the faces are named.<br />
Here the '''[[Selection_view|selection view]]''' has been made active, just to show clearly what is selected and not, also coloring is adjusted so that selection becomes easier to see.<br />
<br />
</translate><br />
[[Image:T101pwb07-05_face2and9.png|center]]<br />
<translate><br />
<br />
Selecting one side face and the cylinder inner face gives that they are internally called face ''2'' and ''9'', where face ''2'' is the side face. Face numbering can be different for you.<br />
Moving the cylinder so that the cavity ends up on the side face, and doing the selection of faces now gives a different number for the cylindrical face.<br />
<br />
</translate><br />
[[Image:T101pwb07-06_newfacenumbers.png|center]]<br />
<translate><br />
<br />
Face 2 is the right side of the original face 2, the left side of former face 2 is now face 8. The cylindrical part was face 9, but is now face 7. FreeCAD reassigns the numbering and the order is not necessarily preserved. The total face count in the first model is 10, in the version with the cylindrical face piercing the side face, the total face count is 11. So obviously face numbering has to change when the so called ''topology'' changes. This probably feels like a minute detail, but turns out to be quite important in parametric 3d cad. Imagine that you have used the cylindrical face as reference for another feature, it used to be called face 9, but is now called face 8. The reference to the intended cylindrical surface is lost. Since FreeCAD, at least in currently released versions does not keep track of the ''intended face'', it only keeps track of the ''numbered face'' a model breaks when a reference is made to a face that later is renumbered. This is called '''TNP, Topological Naming Problem'''.<br />
<br />
You are encouraged to learn how to avoid broken models due to TNP, further reading can be done elsewhere on the [[Topological_naming_problem|wiki]], which largely focus on a ''sketch driven'' workflow, the underlying mechanism is the same though. The renumbering described here for faces goes for all geometrical entities, faces, edges and vertexes.<br />
<br />
==Organizing the tree a bit differently==<br />
<br />
Do a ''save-as'' under a new name. Then delete all the cuts ending up in a model looking like below.<br />
<br />
</translate><br />
[[Image:T101pwb08-01_primitives.png|center]]<br />
<translate><br />
<br />
When using '''Part Workbench''' and modelling feature rich solids, then the tree structure of a solid can become cumbersome to decipher. So far we have created one primitive / feature and applied a boolean operation. In Part Workbench one can bundle primitives into one boolean operation. In our case we have the cylinder, cone and cube that are all a cut boolean operation.<br />
Instead of making a cut for each primitive, we can first apply a boolean union, [[Image:Part_Fuse.svg|24px|link=Part_Fuse]] '''[[Part_Fuse|Fuse]]''' the primitives intended for the boolean cut, and then make the ''cut'' between the '''Fillet''' and the '''Fusion'''.<br />
<br />
Using this approach, the tree-view ends up looking like below, which is just a different way of building the same model. Compare this with the original tree-view, none is better than the other, however when making more complex models one approach over the other, can have benefits in ease of modifying/reorganizing the model if needed.<br />
<br />
</translate><br />
[[Image:T101pwb08-02_fused.png|center]]<br />
<translate><br />
<br />
==Wrapping up==<br />
<br />
Having gone through the tutorial you are now briefly acquainted with the user interface of FreeCAD and you have learned the basics in using '''Part Workbench'''. You should now be able to build simple models after your own liking. '''Part Workbench''' is one of the workbenches that can be used to create solids, '''PartDesign Workbench''' is another. The different workbenches have different capabilities and workflows. Learning FreeCAD in full, especially considering all add-ons and macros takes years, so keep on exploring new and different ways of making models – take different tutorials on the wiki, the learning never stops when working with FreeCAD. It is suggested that you learn ''sketches'' and '''PartDesign Workbench''' next if your focus is on creating solids. If your focus is modelling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
<br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
<br />
<br />
</translate><br />
[[Category:Part{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1148857Creating a simple part with Draft and Part WB2022-06-06T15:10:28Z<p>Heda: /* The tutorial covers */</p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
</translate><br />
<br />
<translate><br />
==The tutorial covers==<br />
</translate><br />
<translate><br />
* The model to make<br />
* Creating the 2d profile<br />
* Why does not extruding work<br />
* Extruding the profile<br />
* Creating the through hole<br />
* Making a sketch out of the 2d profile<br />
* Wrapping up<br />
</translate><br />
<br />
<translate><br />
<br />
==The model to make==<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
==Creating the 2d profile==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
</translate><br />
<br />
<translate><br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft WB''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft WB'''.<br />
</translate><br />
<br />
<translate><br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft WB''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
</translate><br />
<br />
<translate><br />
===Creating the fillet===<br />
</translate><br />
<translate><br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft WB'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{Button|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
</translate><br />
<translate><br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft WB''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Drag the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click LMB. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
</translate><br />
<br />
<translate><br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
==Why does not extruding work==<br />
</translate><br />
<translate><br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
</translate><br />
<br />
<translate><br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a direction, this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
</translate><br />
<br />
<translate><br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
</translate><br />
<br />
<translate><br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
</translate><br />
<br />
<translate><br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simple becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
</translate><br />
<br />
<translate><br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
</translate><br />
<br />
<translate><br />
==Extruding the profile==<br />
</translate><br />
<translate><br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{Button|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
==Creating the through hole==<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
</translate><br />
<br />
<translate><br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
</translate><br />
<br />
<translate><br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a sketch out of the 2d profile==<br />
</translate><br />
<translate><br />
Using '''Draft WB''' is one way of creating a 2d profile. In '''Draft WB''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft WB''' can be converted to an ''unconstrained'' sketch.<br />
</translate><br />
<br />
<translate><br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in profile from the earlier made group '''Profile'''. From '''Draft WB''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
</translate><br />
<br />
<translate><br />
With '''Sketch''' closed and selected, from '''Part WB''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
==Quality of models==<br />
</translate><br />
<translate><br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
</translate><br />
<br />
<translate><br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part WB''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''.<br />
</translate><br />
<br />
<translate><br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
</translate><br />
<br />
<translate><br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to a under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps. If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the sketch solver cannot consider them to be matching endpoints.<br />
</translate><br />
<br />
<translate><br />
==Wrapping up==<br />
</translate><br />
<translate><br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher WB''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign WB'''. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. The sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]'' makes the same model as this tutorial. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1148856Creating a simple part with Draft and Part WB2022-06-06T15:09:30Z<p>Heda: /* Wrapping up */</p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
</translate><br />
<br />
<translate><br />
==The tutorial covers==<br />
</translate><br />
<translate><br />
# The model to make<br />
# Creating the 2d profile<br />
# Why does not extruding work<br />
# Extruding the profile<br />
# Creating the through hole<br />
# Making a sketch out of the 2d profile<br />
# Wrapping up<br />
</translate><br />
<br />
<translate><br />
==The model to make==<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
==Creating the 2d profile==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
</translate><br />
<br />
<translate><br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft WB''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft WB'''.<br />
</translate><br />
<br />
<translate><br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft WB''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
</translate><br />
<br />
<translate><br />
===Creating the fillet===<br />
</translate><br />
<translate><br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft WB'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{Button|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
</translate><br />
<translate><br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft WB''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Drag the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click LMB. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
</translate><br />
<br />
<translate><br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
==Why does not extruding work==<br />
</translate><br />
<translate><br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
</translate><br />
<br />
<translate><br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a direction, this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
</translate><br />
<br />
<translate><br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
</translate><br />
<br />
<translate><br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
</translate><br />
<br />
<translate><br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simple becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
</translate><br />
<br />
<translate><br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
</translate><br />
<br />
<translate><br />
==Extruding the profile==<br />
</translate><br />
<translate><br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{Button|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
==Creating the through hole==<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
</translate><br />
<br />
<translate><br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
</translate><br />
<br />
<translate><br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a sketch out of the 2d profile==<br />
</translate><br />
<translate><br />
Using '''Draft WB''' is one way of creating a 2d profile. In '''Draft WB''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft WB''' can be converted to an ''unconstrained'' sketch.<br />
</translate><br />
<br />
<translate><br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in profile from the earlier made group '''Profile'''. From '''Draft WB''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
</translate><br />
<br />
<translate><br />
With '''Sketch''' closed and selected, from '''Part WB''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
==Quality of models==<br />
</translate><br />
<translate><br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
</translate><br />
<br />
<translate><br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part WB''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''.<br />
</translate><br />
<br />
<translate><br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
</translate><br />
<br />
<translate><br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to a under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps. If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the sketch solver cannot consider them to be matching endpoints.<br />
</translate><br />
<br />
<translate><br />
==Wrapping up==<br />
</translate><br />
<translate><br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher WB''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign WB'''. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. The sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]'' makes the same model as this tutorial. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Part_WB&diff=1148855Creating a simple part with Part WB2022-06-06T15:06:05Z<p>Heda: /* Introduction */</p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=2 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to 3D modeling using the [[Part_Workbench|Part Workbench]] [[Image:Switch_PartWorkbench.JPG]] of FreeCAD. After having finished this tutorial you should be able to make simple 3d models by using primitives like cubes, cylinders, etc with a technique called [https://en.wikipedia.org/wiki/Constructive_solid_geometry Constructive Solid Geometry], short '''CSG''' modeling. Another way to create 3d models is by using a 2d shape to create a 3d shape by for example extruding or revolving the 2d shape in 3d space. For an introduction of that technique please follow the sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''. The 2 tutorials intentionally have exactly the same model generated, this presents the beginner with a hands on experience of the 2 different techniques and aspects of how they are implemented in FreeCAD. The definition of the 2 techniques can be viewed as strictly divided from a semantic point of view, however there is nothing directly hindering a mix of the techniques when creating models. There are some caveats to watch out for when mixing modeling techniques, those are mainly related to aspect of how FreeCAD is programmed. There is a [[Creating_a_simple_part_with_Draft_and_Part_WB|third tutorial]] intended as a first introduction to a mixed modeling example. That tutorial uses '''Draft WB''' to create a 2d profile utilized to extrude a solid in '''Part WB''' to make the same model as in this tutorial.<br />
</translate><br />
<br />
<translate><br />
Before you start please have a look at how to '''[[Mouse_navigation|navigate]]''' the 3d space.<br />
When hoovering over the mouse model selector in the lower right corner of the FreeCAD window a cheat-sheet of current mouse model appears as in the picture below.<br />
</translate><br />
<br />
[[Image:T101pwb00-01_navi.png|center]]<br />
<br />
<translate><br />
Many newcomers to cad programs get stuck while learning the software, if that happens to you, please go ahead and search the wiki or forum for further information – chances are that others also have been stuck on the same specific thing in the past so there is already an answer to your specific question. Or make a post on the forum with your questions or findings. The forum has several threads where users are helped to complete all sort of different tasks, those threads are often similar to tutorials, and often has specific illustrations included.<br />
</translate><br />
<br />
<translate><br />
===The tutorial covers===<br />
</translate><br />
<translate><br />
* The model to make<br />
* Using Part workbench to create and manipulate the primitive building blocks<br />
* Changing color and transparency<br />
* A different way to locate the hole<br />
* Making the hole a countersunk hole<br />
* Editing dimensions<br />
* A different way to position the chamfer<br />
* Making a hollow piece<br />
* Organizing the tree a bit differently<br />
</translate><br />
<br />
<translate><br />
===The model to make===<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<translate><br />
<br />
==Using Part workbench to create and manipulate the primitive building blocks==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name, it is good practice to make sure that you save the document at regular intervals, or just before larger operations. Then switch to the '''[[Part_Workbench|Part Workbench]]''' using either the [[Getting_started#Exploring_FreeCAD|workbench selector]] (labeled 6 in the linked image) or by going to the {{MenuCommand|View → Workbench}} menu. FreeCAD will start with toolbars at the top, the combo view to the left and the 3D view at the right.<br />
</translate><br />
<br />
<translate><br />
===Create the main solid block===<br />
</translate><br />
<translate><br />
Press [[Image:Part_Box.svg|24px|link=Part_Box]] [[Part_Box|Box]] to make a default solid cube. The cube appears in the 3d view as well as a new object in the “model treeview” in the sidebar.<br />
</translate><br />
<br />
<translate><br />
Press [[Image:Std_ViewIsometric.svg|24px|link=Std_ViewIsometric]] [[Std_ViewIsometric|Isometric]] to see the cube in 3d.<br />
</translate><br />
<br />
[[Image:T101pwb01-03_cube1.png|center]]<br />
<br />
<translate><br />
Select the cube in the [[Tree_view|tree-view]], it becomes green in the 3d view. Below the tree-view you will now see that the cube by default is created with the dimensions '''Length x Width x Height''' as ''10 x 10 x 10 mm''. Change those dimensions to '''100 x 30 x 50''' as per the initial drawing of the model.<br />
</translate><br />
<br />
[[Image:T101pwb01-04_cubedims.png|center]]<br />
<br />
<translate><br />
When changing a property, like ''Length'' through the spinbox, one can either enter the values, or use the scroll-wheel to tick values up or down. The arrows for ticking values up or down can of course also be used. In the right most picture above, the ''Height'' property is in edit mode, rolling the scroll wheel when the mouse is over that cell will change the value by one up or down.<br />
</translate><br />
<br />
<translate><br />
Click [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] '''[[Std_ViewFitAll|Fit all]]''' to see the whole cube.<br />
</translate><br />
<br />
[[Image:T101pwb01-05_cube2.png|center]]<br />
<br />
<translate><br />
===Create fillet===<br />
</translate><br />
<translate><br />
To make the filleted corner, in the toolbar press [[Image:Part_Fillet.svg|24px|link=Part_Fillet]] '''[[Part_Fillet|Fillet]]''' which opens the task dialogue for fillets in the combo view to the side. Change the ''radius'' spinbox to 20 mm, then in the 3d view, select the width edge to the upper right and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101pwb01-06_filletrad.png|center]] <br />
<br />
<translate><br />
The task dialogue closes and you are back to the tree-view which now has a fillet object instead of the earlier cube.<br />
</translate><br />
<br />
<translate><br />
===Visibility of children===<br />
</translate><br />
<translate><br />
Click the plus sign/caret to expand the children of the fillet, which in this case is the ''cube'' we created earlier, but it is grayed out. Select the cube and press the space bar – this toggles visibility so the cube is now visible again and the icon is no longer grayed out. To deselect the cube click in a blank area in the tree-view or the 3d view.<br />
</translate><br />
<br />
[[Image:T101pwb01-07_fillet.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
</translate><br />
<translate><br />
Next is to create the 30 degree ''chamfer'', start by toggle the visibility of the child cube of the fillet. There is a chamfer tool in [[Part_Workbench|Part Workbench]], but we cannot use it since it currently only makes a 45 degree chamfer. We will make it with another block and a boolean cut instead.<br />
</translate><br />
<br />
<translate><br />
Create a new [[Image:Part_Box.svg|24px|link=Part_Box]] '''[[Part_Box|cube]]''' with dimensions 60 x 30 x 30. Change the '''placement angle''' to -30 degrees.<br />
</translate><br />
<br />
[[Image:T101pwb01-08_chamfer1.png|center]]<br />
<br />
<translate><br />
The placement angle is using the '''placement vector''' (Axis) as axis of rotation. The default is the z-axis, which is not matching our target direction, changing the placement vector to the '''y-axis''' produces the desired orientation of the cutting tool for the chamfer.<br />
</translate><br />
<br />
[[Image:T101pwb01-09_chamfer2.png|center]]<br />
<br />
<translate><br />
The same placement can be attained with other values as well, the simplest alternative example of a placement that is the same is an angle of +30 degrees and a y-axis of -1.<br />
</translate><br />
<br />
<translate><br />
====Python console====<br />
</translate><br />
<translate><br />
Furthermore the position needs to be adjusted, looking at the drawing of the finished part, there is no direct dimension to use for the intended translation upwards. Since the upward dimension is the one needed, we have to calculate it. Let’s make use of the built in '''[[Python_console|python console]]''' for those calculations, it is basic trigonometry. If the FreeCAD python console is not visible for you, just right-click in an empty space in the toolbar area and check the ''python console'' and it should appear in the workspace, when there you should as well add the '''[[Report_view|report view]]''' if not already visible. The ''report view'' most of the times provides useful information or even hints of what to do next for different commands.<br />
</translate><br />
<br />
[[Image:T101pwb01-10_pyconsole.png|center]]<br />
<br />
<translate><br />
After importing the '''[https://docs.python.org/3/library/math.html#module-math math]''' module from the standard libraries in python we can use the formula ''(50 - math.tan(math.radians(30)) * 50)'' to find the distance in z-direction that the block should be moved. Copy the result of the formula from the python console and paste it into the z position for '''Cube001'''. The ''tool'' to use for the chamfer ''cut'' is now properly oriented and positioned.<br />
</translate><br />
<br />
[[Image:T101pwb01-11_chamfer3.png|center]]<br />
<br />
<translate><br />
====Expressions====<br />
</translate><br />
<translate><br />
One does not have to use the python console to do the calculation, In most cases when dealing with numeric parametric values, FreeCAD has a short-cut to a built-in calculator. It is called '''[[Expressions|Expressions]]''' in FreeCAD, you can enter the ''expression mode'' by first clicking in the spinbox for the z-position, a small blueish circular icon will appear at the right side.<br />
</translate><br />
<br />
[[Image:T101pwb01-12_expression1.png|center]] <br />
<br />
<translate><br />
Clicking that icon opens new window ''Formula editor'' where formulas and expressions can be entered as shown below. Using expressions is a powerful tool, since one can access parameters from the model, effectively making all parameters in the model available as variables to be used when creating an expression. In short, in our formula, instead of entering the number 50 when in the formula editor, we could enter a ''named parameter'' holding the value 50 from the cube, with the benefit that if we change the cube ''height'', the position of the chamfer will automatically follow. The value of 50 in the current model is referred to as ''Cube.Length'', i.e. the ''Length'' property of the ''Cube'' feature. Further information on this can be found on the wiki.<br />
</translate><br />
<br />
[[Image:T101pwb01-13_expression2.png|center]] <br />
<br />
<translate><br />
To make the cut, with the {{Button|Ctrl}} key pressed down first select the '''Fillet''' in the tree-view and then the latest created cube (named '''Cube001''') and finally in the toolbar press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]'''. Your tree-view should now again be a single object in the root called '''Cut'''.<br />
</translate><br />
<br />
[[Image:T101pwb01-14_model1.png|center]]<br />
<br />
<translate><br />
====The measurement tool====<br />
</translate><br />
<translate><br />
The '''[[Part_Measure_Menu|measurement tool]]''' in the '''Part WB''' can be used to check that our calculation and placement of the chamfer is correct.<br />
Press the [[Image:Part_Measure_Linear.svg|24px|link=Part_Measure_Linear]] '''[[Part_Measure_Linear|Measure Linear]]''' button and a ''task dialogue'' opens up, then select the 2 endpoints of one side of the chamfer.<br />
</translate><br />
<br />
[[Image:T101pwb01-15_model1measure1.png|center]]<br />
<br />
<translate><br />
It checks out with an x dimension of 50 mm, clear the measurement and close the dialogue.<br />
</translate><br />
<br />
<translate><br />
===Creating the hole===<br />
</translate><br />
<translate><br />
To make the hole, press the [[Image:Part_Cylinder.svg|24px|link=Part_Cylinder]] '''[[Part_Cylinder|Cylinder]]''' button, set the ''radius'' to 5 mm and ''height'' to 50 mm.<br />
</translate><br />
<br />
[[Image:T101pwb01-16_cyl1.png|center]]<br />
<br />
<translate><br />
Next we need to position the hole according to the dimensions in the drawing. Change the view to [[Image:Std_ViewTop.svg|24px|link=Std_ViewTop]] '''[[Std_ViewTop|Top]]''' view, then right-click the '''Cylinder''' in the tree-view and select '''Transform''' from the pop-up menu.<br />
</translate><br />
<br />
[[Image:T101pwb01-17_cyl1translate.png|center]]<br />
<br />
<translate><br />
Change the ''Translation increment'' to 5 and use the red and green arrow to position the cylinder in the right position, moving it 15 mm in y and 65 in x by dragging the arrow ends with the mouse. Click {{Button|OK}} to close the ''Transform'' dialogue. To make the hole press the {{Button|Ctrl}} key and select the '''Cut''' and '''Cylinder''' in the tree-view, then press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button in the toolbar. Your tree-view should once again have a single object in the root called '''Cut001'''.<br />
</translate><br />
<br />
<translate><br />
Congratulations, the model is now ready.<br />
</translate><br />
<br />
[[Image:T101pwb01-18_model1complete.png|center]]<br />
<br />
<translate><br />
With the basic model ready, let us explore different ways to alter this model, some examples are related to the appearance, additional features, or simply a different way to do the same.<br />
</translate><br />
<br />
<translate><br />
==Changing color and transparency==<br />
</translate><br />
<translate><br />
There are several different ways one can change appearance of objects, for this case, lets use the view tab in the property part of the combo view. First select the object in the tree-view and then edit any property like line color, face colors or transparency via the '''view tab''' (found at the bottom of the ''combo view'').<br />
</translate><br />
<br />
[[Image:T101pwb02-01_appearance1.png|center]]<br />
<br />
<translate><br />
Unfortunately when the object is selected it is a bit hard to see how it will look like when tuning the new appearance. To see the final look one has to deselect the object. Here is the new look of the model, where one now can see the through hole also in the iso-view. Another way to edit the appearance is via the {{MenuCommand|View → [[Image:Std_SetAppearance.svg|24px|link=Std_SetAppearance]] Appearance...}} menu.<br />
</translate><br />
<br />
[[Image:T101pwb02-02_appearance2.png|center]]<br />
<br />
<translate><br />
==A different way to locate the hole==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete the cut that added the hole and move the cylinder back to zero position. Your model should look like the below picture, which is the starting point for using a different technique to locate the hole at the center of the upper face. Note that the color is back to the default gray, the change in appearance we did was on the cut-feature which now is deleted.<br />
</translate><br />
<br />
[[Image:T101pwb03-01_cyl.png|center]] <br />
<br />
<translate><br />
This time the [[Image:Workbench_Draft.svg|24px|link=Draft_Workbench]] '''[[Draft_Workbench|Draft Workbench]]''' will be used to locate the hole. The hole is as before to be located at the center of the upper face, which is the same as the midpoint of the diagonal of the upper face.<br />
Start by switching workbench to '''Draft''', it might be that a ''grid'' appears in the 3d view, the grid visibility can be toggled with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]] in the toolbar. When making use of the '''[[Draft_Snap|snap]]''' functionality in the '''Draft WB''' it helps if one only have the ''snap types'' of interest enabled, this time it is sufficient to leave ''endpoint, midpoint and circle center enabled'', so the settings for snapping should look something like below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Finding the point to place the center of the cylinder could be done by making a diagonal as helpline and use the center of the cylinder and midpoint of the diagonal to identify the points to move between, however it turns out that we do not even need to make any helplines, we can snap on already existing solid geometry.<br />
</translate><br />
<translate><br />
Select the '''Cylinder''' in the tree-view (it turns green in the 3d view) and press the [[Image:Draft_Move.svg|24px|link=Draft_Move]] '''[[Draft_Move|Move]]''' button in the toolbar. A ''task dialogue'' opens for moving objects, make sure that ''Copy'' is unchecked.<br />
</translate><br />
<br />
[[Image:T101pwb03-03_move.png|center]]<br />
<br />
<translate><br />
Then move the mouse to the upper face of the cylinder so that you see a ''white dot'' in the center of the circle as per left picture below, this together with the center symbol next to the mouse pointer means that a left button mouse click will snap to the white point.<br />
</translate><br />
<br />
[[Image:T101pwb03-04_snapselect.png|center]]<br />
<br />
<translate><br />
When you have the white dot on the upper face, click the left mouse button, and repeat for the upper square face of the main solid, like the right picture above, and confirm the choice with a left mouse button click. The snap function makes use of ''mass-center'' for any type of face, and in this case the mass center is the same as the geometrical center that is sought after. You will by now have noticed that the move of the cylinder is animated, so you always see what is about to happen.<br />
</translate><br />
<translate><br />
Repeating the step of the '''boolean cut''' from earlier once again will make the through hole that completes the model. Using the '''linear measurement tool''' in part wb, a check that the hole is correctly placed is done. The measurement can only be done between ''points'', so the measurement is done from main body zero to the seam point of the cylinder, meaning that the correct distance is 70 mm instead of the 65 that is on the drawing when accounting for the extra radius that needs to be included in the distance.<br />
</translate><br />
<br />
[[Image:T101pwb03-05_modelmeasure.png|center]]<br />
<br />
<translate><br />
==Making the hole a countersunk hole==<br />
</translate><br />
<translate><br />
Create a ''cone'' by pressing the [[Image:Part_Cone.svg|24px|link=Part_Cone]] '''[[Part_Cone|Cone]]''' button in the toolbar (part wb), change ''radius1'' to 0 mm and ''radius2'' to 7 mm – this will give a 2 mm ''countersink'' on the radius. Making the ''height'' of the cone to 7 mm results in a 90 degree top angle of the cone, or 45 degree countersink angle. Worth to note is that for a 45 degree countersink one could as well use the [[Image:Part_Chamfer.svg|24px|link=Part_Chamfer]] [[Part_Chamfer|Chamfer]] operation, currently limited to only 45 degrees. By using a cone we can easily edit the top angle of the cone by changing the height of the cone.<br />
</translate><br />
<br />
<translate><br />
When working with FreeCAD you will continuously be faced with several different ways to achieve seemingly the same end result. There is hardly any absolute truth in what is the right way to achieve a particular end result – however when looking in a specific context one specific workflow can be more flexible, allow for later features to actually be used etc. How you build 3d models will evolve over time as you along the way learn more and more about the features and capabilities of FreeCAD.<br />
</translate><br />
<br />
[[Image:T101pwb04-01_cone.png|center]]<br />
<br />
<translate><br />
Translate the cone so that it is ''concentric'' with the hole and ''coplanar'' with the main solid upper surface. Use any method described earlier in this tutorial to accomplish that.<br />
In the picture below the move is made with ''Transform'' and an ''increment'' setting of 1 mm, since the cone has a characteristic dimension of 7 mm, meaning that the earlier increment setting of 5 mm will not allow for correct positioning. The [[Image:Std_DrawStyleWireFrame.svg|24px|link=Std_DrawStyle#Wireframe]] '''[[Std_DrawStyle#Wireframe|Wireframe]]''' rendering is used to easier see that the cone is in the right position.<br />
</translate><br />
<br />
[[Image:T101pwb04-02_conetranslate.png|center]]<br />
<br />
<translate><br />
To complete the model, lets make use of the [[Image:Part_Boolean.svg|24px|link=Part_Boolean]] '''[[Part_Boolean|Boolean]]''' command instead of first selecting objects and apply a specific boolean operation. Press the toolbar button and a ''taskpanel'' opens as per below picture to the left.<br />
</translate><br />
<br />
[[Image:T101pwb04-03_boolean.png|center]]<br />
<br />
<translate><br />
Three items needs to be specified, the ''operation type'', the ''first shape'' and the ''second shape''. The cone is supposed to be cut, this is called ''Difference'' in this command, instead of ''Cut''. The first shape is our '''Cut001''', it is listed under ''compounds'', since it is build from several solids. The second shape is the '''Cone'''. Once the correct settings are made for the command, click the {{Button|Apply}} button to execute the operation. This has all been done in the picture to the right, and there one can also see that a ''compound'' '''Cut002''' is now listed, this is our final model shape. After having changed appearance the final model looks like this.<br />
</translate><br />
<br />
[[Image:T101pwb04-04_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a hollow piece==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. FreeCAD has all of the typical operations of a 3D modeller, one of them is [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''', which is used to ''hollow out'' parts.<br />
</translate><br />
<br />
<translate><br />
Rotate your model so that the bottom face is visible.<br />
</translate><br />
<br />
[[Image:T101pwb05-01_frombottom.png|center]]<br />
<br />
<translate><br />
Select the ''bottom face'' of the model, then In [[Part_Workbench|Part Workbench]] select [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''' and the screen should look like below.<br />
</translate><br />
<br />
[[Image: T101pwb05-02_thickness_cmd.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}}, as you can see there are now a ''radius'' on the hollowed out part.<br />
</translate><br />
<br />
[[Image:T101pwb05-03_thickness_dimension.png|center]]<br />
<br />
<translate><br />
Moreover, when taking a measurement of the width of the part, it is now 32 mm, so the ''thickness'' has been applied ''outwards''. Let’s edit that, double-click the model in the tree-view and modify the ''join-type'' settings to ''intersection'' and the ''thickness'' setting to -1.<br />
</translate><br />
<br />
[[Image:T101pwb05-04_thickness_modify.png |center]]<br />
<br />
<translate><br />
Now the outer width of the part is 30 mm, same as before and the corners are all sharp corners.<br />
</translate><br />
<br />
[[Image:T101pwb05-05_thickness_modified.png|center]]<br />
<br />
<translate><br />
==A different way to position the chamfer==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete features so that the model looks like below.<br />
</translate><br />
<br />
[[Image:T101pwb06-01_startingpoint.png|center]]<br />
<br />
<translate><br />
Make a '''Cube''' with dimensions '''30x30x60''', ending up like below.<br />
</translate><br />
<br />
[[Image:T101pwb06-02_with_cube.png|center]]<br />
<br />
<translate><br />
Change '''placement''' by first rotating -120 degrees around Y-axis.<br />
</translate><br />
<br />
[[Image:T101pwb06-03_rotated_cube.png|center]]<br />
<br />
<translate><br />
Finally, change position to '''X=50''' and '''Z=50''' and make the ''cut'' to produce the same result as earlier.<br />
</translate><br />
<br />
[[Image:T101pwb06-04_cube_cut.png|center]]<br />
<br />
<translate><br />
This once again highlights that there are always several ways to produce the same outcome, which is a reoccurring theme when it comes to 3d modeling. When it comes to basic geometries or solids, one can use different workbenches in FreeCAD as well as different commands and still have the same outer shape of a solid. You simply need to find your own way to a set of preferred tools and workflow that you are comfortable in using. Modeling in parametric 3d is a process of constant learning, and takes practice to master.<br />
</translate><br />
<br />
<translate><br />
==Editing dimensions, face colors and TNP==<br />
</translate><br />
<translate><br />
FreeCAD is a parametric 3d modeler, this allows you to change any ''placement'' or ''dimension'' and the model is updating accordingly. In general this works, but it is possible to break a model when edited – for example when a fillet is based on an edge that no longer exists due to editing. When a model breaks during editing, it is referred to as '''TNP, Topological Naming Problem'''.<br />
</translate><br />
<br />
<translate><br />
Go ahead and experiment with changing dimensions and placements to see if you can break the model, do not forget to recalculate the model after changes if required. This can be done with the [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] button in the toolbar, if the icon is grayed out it is not needed to refresh the object.<br />
</translate><br />
<br />
<translate><br />
===Reposition the cylinder===<br />
</translate><br />
<translate><br />
Here is an example of the cylinder moved from the center to one side of the main body by using ''Transform'' on the cylinder. As can be seen in the picture, the cone is still in the original position, not affected by the move of the cylinder.<br />
</translate><br />
<br />
[[Image:T101pwb07-01_cylindermoved.png|center]]<br />
<br />
<translate><br />
When you move the cylinder and break through the outer surface, in version 0.19 you are loosing part of the color settings on your model. FreeCAD reverts to the user default settings for shape colors and transparency in the 3D-view, however the '''Cut002''' shape still shows the colors and transparency that it had before as seen in below picture.<br />
</translate><br />
<br />
<translate><br />
===Fixing the colors===<br />
</translate><br />
[[Image:T101pwb07-02_wrongcolor.png|center]]<br />
<br />
<translate><br />
Here is one way to get it back. First change ''transparency'' one tick up or down and then back, that brings back the transparency. You can do the same trick on shape color. Another way to get the color back is to ''right-click'' '''Cut002''' in the tree-view and select '''Set Colors''' in the context menu. In the ''task panel'' that displays, click {{Button|Set to Default}}, that brings back the color to the one set in the view-properties.<br />
</translate><br />
<br />
[[Image:T101pwb07-03_set_colors.png|center]]<br />
<br />
<translate><br />
The '''Set Colors''' command allows you to select individual faces of a shape and set a unique color on the selected faces.<br />
</translate><br />
<br />
<translate><br />
===Multiple solids===<br />
</translate><br />
<translate><br />
Another example where the cube that is making the chamfer has been translated and rotated.<br />
</translate><br />
<br />
[[Image:T101pwb07-04_3solids.png|center]]<br />
<br />
<translate><br />
As can be seen when repositioning the chamfer in this way, the end result is ''3 disjoint solids''. [[Part_Workbench|Part Workbench]] allows this, [[PartDesign_Workbench|PartDesign Workbench]] does not, either you will get an ''multiple solids error'' or it will simply not render all solids.<br />
</translate><br />
<br />
<translate><br />
===TNP===<br />
</translate><br />
<translate><br />
Going back to the original completed model, let’s explore how the faces are named.<br />
Here the '''[[Selection_view|selection view]]''' has been made active, just to show clearly what is selected and not, also coloring is adjusted so that selection becomes easier to see.<br />
</translate><br />
<br />
[[Image:T101pwb07-05_face2and9.png|center]]<br />
<br />
<translate><br />
Selecting one side face and the cylinder inner face gives that they are internally called face ''2'' and ''6'', where face ''2'' is the side face. Face numbering can be different for you.<br />
Moving the cylinder so that the cavity ends up on the side face, and doing the selection of faces now gives a different number for the cylindrical face.<br />
</translate><br />
<br />
[[Image:T101pwb07-06_newfacenumbers.png|center]]<br />
<br />
<translate><br />
Face 2 is the right side of the original face 2, the left side of former face 2 is now face 8. The cylindrical part was face 9, but is now face 7. FreeCAD reassigns the numbering and the order is not necessarily preserved. The total face count in the first model is 10, in the version with the cylindrical face piercing the side face, the total face count is 11. So obviously face numbering has to change when the so called ''topology'' changes. This probably feels like a minute detail, but turns out to be quite important in parametric 3d cad. Imagine that you have used the cylindrical face as reference for another feature, it used to be called face 9, but is now called face 8. The reference to the intended cylindrical surface is lost. Since FreeCAD, at least in currently released versions does not keep track of the ''intended face'', it only keeps track of the ''numbered face'' a model breaks when a reference is made to a face that later is renumbered. This is called '''TNP, Topological Naming Problem'''.<br />
</translate><br />
<translate><br />
You are encouraged to learn how to avoid broken models due to TNP, further reading can be done elsewhere on the [[Topological_naming_problem|wiki]], which largely focus on a ''sketch driven'' workflow, the underlying mechanism is the same though. The renumbering described here for faces goes for all geometrical entities, faces, edges and vertexes.<br />
</translate><br />
<br />
<translate><br />
==Organizing the tree a bit differently==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete all the cuts ending up in a model looking like below.<br />
</translate><br />
<br />
[[Image:T101pwb08-01_primitives.png|center]]<br />
<br />
<translate><br />
When using '''Part WB''' and modelling feature rich solids, then the tree structure of a solid can become cumbersome to decipher. So far we have created one primitive / feature and applied a boolean operation. In Part WB one can bundle primitives into one boolean operation. In our case we have the cylinder, cone and cube that are all a cut boolean operation.<br />
Instead of making a cut for each primitive, we can first apply a boolean union, [[Image:Part_Fuse.svg|24px|link=Part_Fuse]] '''[[Part_Fuse|Fuse]]''' the primitives intended for the boolean cut, and then make the ''cut'' between the '''Fillet''' and the '''Fusion'''.<br />
</translate><br />
<translate><br />
Using this approach, the tree-view ends up looking like below, which is just a different way of building the same model. Compare this with the original tree-view, none is better than the other, however when making more complex models one approach over the other, can have benefits in ease of modifying/reorganizing the model if needed.<br />
</translate><br />
<br />
[[Image:T101pwb08-02_fused.png|center]]<br />
<br />
<translate><br />
==Wrapping up==<br />
</translate><br />
<translate><br />
Having gone through the tutorial you are now briefly acquainted with the user interface of FreeCAD and you have learned the basics in using '''Part WB'''. You should now be able to build simple models after your own liking. '''Part WB''' is one of the workbenches that can be used to create solids, '''PartDesign WB''' is another. The different workbenches have different capabilities and workflows. Learning FreeCAD in full, especially considering all add-ons and macros takes years, so keep on exploring new and different ways of making models – take different tutorials on the wiki, the learning never stops when working with FreeCAD. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. If your focus is modelling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Macro_HealArcs&diff=1148783Macro HealArcs2022-06-05T22:34:32Z<p>Heda: py2 print to py3</p>
<hr />
<div><languages/><br />
<translate><br />
<!--T:1--><br />
{{Macro<br />
|Name=HealArcs<br />
|Icon=Macro_HealArcs.png<br />
|Description=Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf. Useful before exporting to dxf.<br />
|Author=Yorik<br />
|Version=0.1<br />
|Date=2011-09-24<br />
|FCVersion=All<br />
|Download=[https://www.freecadweb.org/wiki/images/5/5a/Macro_HealArcs.png ToolBar Icon]<br />
}}<br />
<br />
==Description== <!--T:2--><br />
Sometimes arcs are transformed into BSplines, for example when scale operations have been applied to them. This macro recreates valid arcs from them. Useful before exporting to dxf<br />
<br />
==Script== <!--T:3--><br />
<br />
<!--T:4--><br />
ToolBar Icon [[Image:Macro_HealArcs.png]]<br />
</translate><br />
'''Macro_HealArcs.FCMacro'''<br />
<br />
{{MacroCode|code=<br />
<br />
try:<br />
import DraftGeomUtils as fcgeo<br />
except:<br />
from draftlibs import fcgeo<br />
import FreeCAD,FreeCADGui,Part<br />
<br />
sel = FreeCADGui.Selection.getSelection()<br />
if not sel:<br />
FreeCAD.Console.PrintWarning("Select something first!")<br />
else:<br />
removeList = []<br />
for obj in sel:<br />
ed = obj.Shape.Edges[0]<br />
arc = fcgeo.arcFromSpline(ed)<br />
if arc:<br />
Part.show(arc)<br />
removeList.append(obj.Name)<br />
FreeCAD.ActiveDocument.recompute()<br />
print("removing", removeList)<br />
for n in removeList:<br />
FreeCAD.ActiveDocument.removeObject(n)<br />
}}<br />
{{clear}}</div>Hedahttps://wiki.freecad.org/index.php?title=Tutorials&diff=1148647Tutorials2022-06-05T13:37:28Z<p>Heda: added sister tutorials for "creating simple part"</p>
<hr />
<div><languages/><br />
<translate><br />
<br />
<!--T:113--><br />
{{Docnav<br />
|[[Frequently_asked_questions|FAQ]]<br />
|[[Interface_Customization|Interface Customization]]<br />
}}<br />
<br />
</translate><br />
{{TOCright}}<br />
<translate><br />
<br />
<!--T:1--><br />
This page presents a selection of high quality written tutorials. A complete, unsorted list of tutorials can be found in [[:Category:Tutorials]], a complete and sortable one can be found in the [[Tutorials#Tutorials - Comprehensive list|table below]].<br />
<br />
<!--T:24--><br />
If you'd like to contribute with writing wiki documentation and tutorials, see the general wiki guidelines in [[WikiPages]],<br />
and read the [[tutorial guidelines]].<br />
<br />
<!--T:25--><br />
Please notice the version of FreeCAD used in the tutorial as some tutorials may use an old version of the program. Although the general modelling process may still work, some tools may have changed.<br />
<br />
<!--T:118--><br />
See also [[Video_tutorials|video tutorials]].<br />
<br />
==Architecture and BIM== <!--T:2--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:3--><br />
File:Arch tutorial 00.jpg|link=[[Arch tutorial]]|[[Arch tutorial]] (v0.14) <br/>This is the essential introduction to the Arch Workbench. It is extensive and showcases a typical workflow, from importing plans in DXF format to building the 3D model.<br />
File:Exercise arch 01.jpg|link=[[Manual:BIM_modeling]]|[[Manual:BIM_modeling|BIM modeling]] <br/>How to model a small house, produce a blueprint with TechDraw, and export to IFC.<br />
File:11_T01_window_all_symbol_top.png|link=[[Tutorial_for_open_windows]]|[[Tutorial for open windows|Open windows and doors]] (v0.18) <br/>How to display windows and doors as open, with elevation and plan symbols, and produce a basic floor plan with TechDraw.<br />
File:17_T02_sketch_2_attached_correctly.png|link=[[Tutorial custom placing of windows and doors]]|[[Tutorial custom placing of windows and doors|Design custom windows]] (v0.18) <br/>How to draw custom doors and windows using the Sketcher, and adjust their normals to correctly place them in walls.<br />
File:Arch_panel_tutorial_01.jpg|link=[[Arch panel tutorial]]|[[Arch panel tutorial]] (v0.15) <br/>Modeling a microhouse roof panel by using the Sketcher, the Window tool, and the Panel tool.<br />
File:Arch_Wikihouse_01.jpg|link=[[Wikihouse porting tutorial]]|[[Wikihouse porting tutorial|WikiHouse modelling]] <br/>Re-modeling the WikiHouse project using sketches and panels, starting from importing a mesh model created in SketchUp.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==Modeling parts== <!--T:4--><br />
<br />
<!--T:5--><br />
FreeCAD provides two main workflows to modeling parts:<br />
* combining objects, a method called [[Constructive solid geometry|Constructive solid geometry]] (CSG) using the [[Part_Workbench|Part Workbench]], and<br />
* using parametric modelling and [[Feature editing|feature editing]] with the [[PartDesign Workbench|PartDesign Workbench]].<br />
<br />
<!--T:23--><br />
Please note that the [[PartDesign Workbench|PartDesign Workbench]] workflow was considerably changed from FreeCAD 0.17 onward; some of the tutorials haven't been updated and may refer to the 0.16 version.<br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:6--><br />
File:GGTuto1 Vue.PNG|link=[[Creating a simple part with Part WB]]|[[Creating a simple part with Part WB]]<br/>An introduction to FreeCAD and Part Workbench using primitive solids.<br />
<br />
File:GGTuto1 Vue.PNG|link=[[Creating a simple part with Draft and Part WB]]|[[Creating a simple part with Draft and Part WB]]<br/>An introduction to modeling solids with Draft Workbench by creating a 2d profile in draft.<br />
<br />
File:GGTuto1 Vue.PNG|link=[[Creating a simple part with PartDesign]]|[[Creating a simple part with PartDesign]] (v0.17)<br/>An introduction to the PartDesign workflow: tracing a sketch, using pad, pocket, and moving the object.<br />
PD WB Tutorial018.png|link=[[Basic_Part_Design_Tutorial]]|[[Basic_Part_Design_Tutorial|Basic Part Design Tutorial]] (v0.17)<br/>Model a simple part using a feature editing methodology: creating a sketch, using pad, external references, pocket, and mirror.<br />
TBHS-model.png|link=[[Toothbrush Head Stand]]|[[Toothbrush Head Stand|Model an electric toothbrush head stand]] (v0.16 or above)<br/>Multiple features used: sketch, distance and coincident constraints, pad, external references, fillet, chamfer, linear pattern, and draft.<br />
Exercise lego 01.jpg|link=[[Manual:Modeling for product design]]|[[Manual:Modeling for product design|Modeling for product design]] (v0.16)<br/>Modeling a Lego block: sketches, vertical and horizontal distance constraints, pad, pocket, external reference, linear pattern, and assembly.<br />
Exercise table complete.jpg|link=[[Manual:Traditional modeling, the CSG way]]|[[Manual:Traditional modeling, the CSG way|Traditional modeling, the CSG way]]<br/>Modeling a table by using simple solids like cubes and cylinders, and performing boolean operations (fusions and cuts) with them.<br />
08_T04_Part_ShapesString_Extrude_final_cut.png|link=[[Draft ShapeString tutorial]]|[[Draft ShapeString tutorial]] (v0.19)<br/>Create engraved text on a solid: extrude a shapestring to make it solid, then use a boolean cut to carve it from another solid.<br />
10_T03_Part_ball_fillet.png|link=[[Whiffle Ball tutorial]]|[[Whiffle Ball tutorial|Create a wiffle ball]] (v0.19)<br/>Use solid primitives, like cubes and cylinders, and boolean operations, like union and cut, to create a hollowed ball.<br />
Tutorial-normand06.jpg|link=[[Basic modeling tutorial]]|[[Basic modeling tutorial]] <br/>Create an iron angle by two methods: using solid primitives, and boolean operations (CSG); and by extruding a planar profile.<br />
File:HTCaeroplane04.png|link=[[Aeroplane]]|[[Aeroplane|Aeroplane tutorial]] <br/>Understand placements in FreeCAD by creating a simple aeroplane model. Then learn about rotation angles, yaw (Z), pitch (Y), and roll (X).<br />
File:T13_14_Threads_components.png|link=[[Thread_for_Screw_Tutorial]]|[[Thread_for_Screw_Tutorial|Thread for screw tutorial]] (v0.19)<br/>Understand how to create threads with several techniques that include use of the tools [[Part_Helix|Part Helix]], [[PartDesign_AdditivePipe|PartDesign AdditivePipe]], [[Part_Sweep|Part Sweep]], [[Part_Fuse|Part Fuse]], and [[Part_Cut|Part Cut]].<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
<!--T:30--><br />
The Raspberry Pi project has made simple tutorials that are easy to follow, particularly for those new to CAD systems:<br />
* [https://projects.raspberrypi.org/en/projects/freecad-dice freecad-dice], model a die with six faces, and optionally 3D print it.<br />
* [https://projects.raspberrypi.org/en/projects/freecad-headphone-tidy freecad-headphone-tidy], model a spool to organize and store earphones, and optionally 3D print it.<br />
* [https://projects.raspberrypi.org/en/projects/freecad-chess-set freecad-chess-set], model and entire chess set in Bauhaus modernist style.<br />
* [https://github.com/raspberrypilearning?utf8=%E2%9C%93&q=freecad&type=source&language= raspberrypilearning] repository (CC-BY 4.0) with other examples.<br />
<br />
==Drafting and Sketching == <!--T:7--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:8--><br />
Exercise cabin 01.jpg|link=[[Manual:Traditional 2D drafting]]|[[Manual:Traditional 2D drafting|Traditional 2D drafting]] <br/>Draw a floor plan with lines, wires, rectangles, circular arcs, and add hatch patterns, annotations, and dimensions. Export the result to DXF.<br />
00_Dr01_Draft_Tutorial_final.png|link=[[Draft_tutorial]]|[[Draft tutorial]] (v0.19) <br/>This is a basic introduction to the tools of the [[Draft Workbench|Draft Workbench]]: working plane, grid, line, arc, upgrade, rectangle, circle, polygon, arrays, dimensions, annotations, and shapestring.<br />
Sketcher_reference.png|link=[[Sketcher reference]]|[[Sketcher_reference|Sketcher reference]] (v0.18) <br/> This is a 70-page long PDF document that serves as a detailed manual for the [[Sketcher Workbench|Sketcher Workbench]]. It explains the basics of Sketcher usage, and goes into a lot of detail about the creation of geometrical shapes, and each of the constraints.<br />
09b_Sk01_Sketcher_fully_constrained_clean.png|link=[[Basic Sketcher Tutorial]]|[[Basic Sketcher Tutorial]] (v0.19) <br/>This is a basic introduction to the tools of the Sketcher Workbench: construction mode, line, circle, arc, constraints (equality, vertical, horizontal, tangential, distance, angle, radius).<br />
03d_Sk02_Sketcher_Rectangle_constrained_length.png|link=[[Sketcher_Micro_Tutorial_-_Constraint_Practices]]|[[Sketcher_Micro_Tutorial_-_Constraint_Practices|Sketcher constraints practices]] (v0.19)<br/>Learn to efficiently constrain a sketch. Prefer geometric constraints over datum constraints.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==Technical Drawings == <!--T:9--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:10--><br />
TDTut ProjGroup21.png|link=[[Basic TechDraw Tutorial]]|[[Basic TechDraw Tutorial|Basic TechDraw Tutorial]] (v0.17) <br/>This is the essential introduction to the tools of the TechDraw Workbench: page, view, scale, vertical and horizontal dimensions, annotations, projection groups, linking dimensions to the 3D view.<br />
File:FCTemplateHow.png|link=[[TechDraw_TemplateHowTo]]|[[TechDraw_TemplateHowTo|Creating a new background template]] (v0.17) <br/>Instructions to create a page template in Inkscape for using it with the TechDraw Workbench. Determine the size of the sheet, draw a frame for the page, define fixed text, and editable text fields.<br />
File:AnHi1.png|link=[[Measurement Of Angles On Holes]]|[[Measurement Of Angles On Holes|Measurement Of Angles On Holes]] (v0.19) <br/> Instructions for adding center lines and subsequent angle representations on holes.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==FEM == <!--T:11--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:12--><br />
FEM example01 pic00.jpg|link=[[FEM CalculiX Cantilever 3D]]|[[FEM CalculiX Cantilever 3D|CalculiX cantilever FEM analysis]] (v0.17) <br/>This in an example included in every installation of FreeCAD; it demonstrates a basic analysis with the CalculiX FE solver. Purge the current result, re-run the solver, and view the displacements and stresses in the deformed mesh in the viewport.<br />
<br />
<!--T:120--><br />
FEM tutorial result.png|link=[[FEM tutorial]]|[[FEM tutorial|Simple FEM introduction]] (v0.17) <br/>This is a short introduction to the steps required to perform an analysis in the FEM Workbench: model your object, create a mesh, add constraints and forces, add a material, run the solver, and visualize the results.<br />
<br />
<!--T:121--><br />
Figure 11 Deformed Mesh.png|link=[[FEM Shear of a Composite Block]]|[[FEM Shear of a Composite Block|FEM shear analysis of a composite block]] (v0.17) <br/>Study the deformation of a block made of a hard nucleus surrounded by a softer material: create mesh regions, add materials, set up sliding constraints, add shear loads, run the solver, and visualize the results with a clip plane.<br />
<br />
<!--T:122--><br />
Femconcrete_Wall_3D_rx_PSS.png|link=[[Analysis_of_reinforced_concrete_with_FEM]]|[[Analysis_of_reinforced_concrete_with_FEM|Analysis of reinforced concrete with FEM]] (v0.19) <br/>Estimate the level of reinforcement required in a concrete structure to prevent brittle failure under tension or shear.<br />
<br />
<!--T:123--><br />
Two_balls_result_2-cropped.png|link=[[FEM_Example_Capacitance_Two_Balls]]|[[FEM_Example_Capacitance_Two_Balls|Electrostatic equation – Capacitance of two balls]] (v0.19)<br/>This example shows how to simulate a capacitance. It illustrates how to setup the example, study it's various parts, solve it using the [[FEM_SolverElmer|Elmer Solver]] and visualize the results using [[FEM_PostFilterClipRegion|Clip Filter]].<br />
<br />
<!--T:124--><br />
FEM_post-processing_Paraview.png|link=[[Post-Processing_of_FEM_Results_with_Paraview]]|[[Post-Processing_of_FEM_Results_with_Paraview|Post-Processing of FEM results with Paraview]] (v0.19)<br/>This tutorial explains the basics of transferring data from the FEM Workbench to Paraview and shows some of the options and settings for displaying data.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==CNC & 3D Printing == <!--T:13--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:14--><br />
Path-WalkThroughResult.gif|link=[[Path Walkthrough for the Impatient]]|[[Path Walkthrough for the Impatient|Path Workbench for the impatient]] <br/>This is a quick presentation of the workflow for the Path Workbench: create a job, define the output, define the milling tool, define the path operations, start the simulation, and generate a G-code output file.<br />
Exercise meshing 03.jpg|link=[[Manual:Preparing models for 3D printing]]|[[Manual:Preparing models for 3D printing|Preparing models for 3D printing]] (v0.16)<br/>Convert a solid object to a mesh object using the Mesh Workbench, export the mesh to STL format, and use Slic3r to prepare the G-code. Alternatively use the Cura Workbench or the Path Workbench to generate the G-code.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==Rendering == <!--T:17--><br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:18--><br />
Exercise raytracing 05.jpg|link=[[Manual:Creating renderings]]|[[Manual:Creating renderings|Creating renderings]] <br/>Quickly produce a rendered image of your bodies with POV-Ray and LuxRender, if they are installed in your system.<br />
Raytracing tutorial result.png|link=[[Raytracing tutorial]]|[[Raytracing tutorial]] (v0.16) <br/>Describes the basic workflow of the Raytracing Workbench using POV-Ray or LuxRender: set the path to the renderers, create a project, set the camera position, select the model, run the renderer.<br />
12_T04_FreeCAD_POVray_render_floor_wood_walls_radiosity_final.png|link=[[Tutorial FreeCAD POV ray]]|[[Tutorial FreeCAD POV ray|Intermediate FreeCAD and POV-ray tutorial]] (v0.18) <br/>Workflow to produce a better render with POV-Ray: create a project, add objects, set the camera, save the .pov file, manually edit the file to improve the textures, planes, lights, and then run the renderer.<br />
07_T03_FreeCAD_Blender_EEVEE_render.png|link=[[Tutorial_Render_with_Blender]]|[[Tutorial Render with Blender|Rendering a FreeCAD assembly with Blender]] (v0.18) <br/>Export bodies from FreeCAD to Wavefront .obj, import the file into Blender, set up a simple Sun light, assign basic materials with the Principled BSDF shader, and produce a rendered image with EEVEE and Cycles.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
==Robot workbench == <!--T:116--><br />
<br />
<!--T:19--><br />
{{VeryImportantMessage|Development of the [[Robot_Workbench|Robot Workbench]] is currently abandoned. Please inquire on our forum regarding any news or alternative workbenches.}}<br />
<br />
</translate><br />
<gallery mode=packed heights=200px style="font-size:1.1em"><br />
<translate><br />
<!--T:20--><br />
Robot Tutorial RobotSimulation.gif|link=[[Robot tutorial]]|[[Robot_tutorial|Robot tutorial]] (v0.17) <br/>Simulate the movement of an industrial robot: set up a trajectory, set up home position, change the robot position, insert various waypoints, and simulate the robot movement.<br />
</translate><br />
</gallery><br />
<translate><br />
<br />
== Scripting == <!--T:107--><br />
<br />
<!--T:108--><br />
These are tutorials that are related to scripting or programming. They are geared towards more experienced users, who are already somewhat familiar with the program.<br />
* [[Python_scripting_tutorial|Python scripting tutorial]]<br />
* [[How_to_install_macros|How to install macros]]<br />
* [[How_to_install_additional_workbenches|How to install additional workbenches]]<br />
<br />
== Tutorials - Comprehensive list == <!--T:125--><br />
<br />
<!--T:33--><br />
Here are listed all the tutorials that are not in the manual '''regardless of their quality'''. If a tutorial is listed in the [[:Category:Tutorials]] and not in this table please insert it.<br />
<br />
<!--T:34--><br />
{| class="wikitable sortable"<br />
|-<br />
! Tutorial<br />
! Topic<br />
! Level<br />
! Time to complete hh:mm<br />
! Authors<br />
! FreeCAD version<br />
! Example files<br />
<br />
<!--T:35--><br />
<!-- Template for new entries<br />
|-<br />
| [[Tutorial|Tutorial]]<br />
| Topic<br />
| Level<br />
| 0:00<br />
| [[User:Name|Name]]<br />
| 1.0<br />
| None<br />
--><br />
<br />
<!--T:117--><br />
|-<br />
| [[Add_Button_to_FEM_Toolbar_Tutorial|Add Button to FEM Toolbar Tutorial]]<br />
| Finite Element Analysis<br />
|<br />
|<br />
| [[User:JohnWang|JohnWang]]<br />
|<br />
|<br />
<br />
<!--T:36--><br />
|-<br />
| [[Add_FEM_Constraint_Tutorial|Add FEM Constraint Tutorial]]<br />
| Finite Element Analysis<br />
|<br />
|<br />
| [[User:M42kus|M42kus]]<br />
|<br />
|<br />
<br />
<!--T:37--><br />
|-<br />
| [[Add_FEM_Equation_Tutorial|Add FEM Equation Tutorial]]<br />
| Finite Element Analysis<br />
|<br />
|<br />
| [[User:JohnWang|JohnWang]]<br />
|<br />
|<br />
<br />
<!--T:38--><br />
|-<br />
| [[Aeroplane|Aeroplane]]<br />
| Part Workbench<br />
| Beginner<br />
| 0:10<br />
| Hughthecat<br />
|<br />
|<br />
<br />
<!--T:39--><br />
|-<br />
| [[Analysis_of_reinforced_concrete_with_FEM|Analysis of reinforced concrete with FEM]]<br />
| Reinforced concrete with FEM<br />
| Intermediate<br />
| 1:00<br />
| [[User:HarryvL|HarryvL]]<br />
| 0.19 or above<br />
|<br />
<br />
<!--T:40--><br />
|-<br />
| [[Arch_panel_tutorial|Arch panel tutorial]]<br />
| Modeling an architectural panel<br />
| Beginner<br />
| 1:00<br />
| Yorik<br />
|<br />
|<br />
<br />
<!--T:41--><br />
|-<br />
| [[Arch_tutorial|Arch tutorial]]<br />
| Modeling<br />
| Intermediate<br />
|<br />
| [[User:Yorik|Yorik]]<br />
| 0.14<br />
|<br />
<br />
<!--T:106--><br />
|-<br />
| [[Basic_Attachment_Tutorial|Basic Attachment Tutorial]]<br />
| Sketch attachment<br />
| Beginner/intermediate<br />
| 1:00<br />
| [[User:Bance|Bance]]<br />
| 0.17 and above<br />
| [https://github.com/BanceFC/Examples/blob/master/Basic_Attachment_Tutorial.FCStd Basic Attachment Tutorial.FCStd]<br />
<br />
<!--T:42--><br />
|-<br />
| [[Basic_modeling_tutorial|Basic modeling tutorial]]<br />
| Introduction to modelling<br />
| Beginner<br />
| 0:15<br />
| [[User:NormandC|NormandC]]<br />
| Any<br />
| None<br />
<br />
<!--T:44--><br />
|-<br />
| [[Basic_Part_Design_Tutorial|Basic Part Design Tutorial]]<br />
| Modeling<br />
| Beginner<br />
|<br />
| [[User:Quick61|Mark Stephen (Quick61)]] and [[User:HarryGeier|HarryGeier]]<br />
| 0.17 or above<br />
| [https://github.com/FreeCAD/Examples/blob/master/Basic_Part_Design_Tutorial_Example_017_Files/Basic_Part_Design_Tutorial_017.fcstd Basic Part Design for v0.17]<br />
<br />
<!--T:45--><br />
|-<br />
| [[Basic_Sketcher_Tutorial|Basic Sketcher Tutorial]]<br />
| Sketcher<br />
| Beginner<br />
| 1:00<br />
| [[User:Drei|Drei]] and [[User:Vocx|Vocx]]<br />
| 0.19<br />
| [https://forum.freecadweb.org/viewtopic.php?f=36&t=43594 Basic Sketcher tutorial ]<br />
<br />
<!--T:46--><br />
|-<br />
| [[Basic_TechDraw_Tutorial|Basic TechDraw Tutorial]]<br />
| TechDraw Workbench<br />
| Beginner<br />
|<br />
| [[User:WandererFan|WandererFan]]<br />
| 0.17 and above<br />
| [https://github.com/FreeCAD/Examples/blob/master/Basic_Part_Design_Tutorial_Example_017_Files/Basic_Part_Design_Tutorial_017.fcstd Basic Part Design for v0.17 Sample] [https://github.com/FreeCAD/Examples/blob/master/Basic_TechDraw_Tutorial_Example_Files/Basic_TechDraw_Tutorial.fcstd Basic TechDraw Tutorial Sample]<br />
<br />
<!--T:47--><br />
|-<br />
| [[Code_snippets|Code snippets]]<br />
| Python<br />
| Beginner<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:48--><br />
|-<br />
| [[Creating_a_simple_part_with_Part_WB|Creating a simple part with Part WB]]<br />
| Modeling<br />
| Beginner<br />
| 2:00<br />
| Heda<br />
| -<br />
| -<br />
<br />
|-<br />
| [[Creating_a_simple_part_with_Draft_and_Part_WB|Creating a simple part with Draft and Part WB]]<br />
| Modeling<br />
| Beginner<br />
| 1:30<br />
| Heda<br />
| -<br />
| -<br />
<br />
|-<br />
| [[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]<br />
| Modeling<br />
| Beginner<br />
| 1:00<br />
| GlouGlou<br />
| 0.17 or above<br />
| [https://github.com/FreeCAD/Examples/blob/master/Creating_a_simple_PartDesign_Body.FCStd Creating a simple PartDesign Body.FCStd]<br />
<br />
<!--T:49--><br />
|-<br />
| [[Customize_Toolbars|Customize Toolbars]]<br />
|<br />
| Beginner<br />
| 0:05<br />
| [[User:Mario52|Mario52]]<br />
| Any<br />
| None<br />
<br />
<!--T:50--><br />
|-<br />
| [[Draft_ShapeString_tutorial|Draft ShapeString tutorial]]<br />
| Product Design<br />
| Beginner<br />
| 0:30<br />
| r-frank and vocx<br />
| 0.17 and above<br />
| [https://github.com/FreeCAD/Examples/blob/master/Draft_Shapestring_Tutorial_Examples/Draft_Shapestring_Tutorial_Text.FCStd?raw=true Draft_Shapestring_Text]<br />
<br />
<!--T:51--><br />
|-<br />
| [[Draft_tutorial|Draft tutorial]]<br />
| Drafting<br />
| Beginner<br />
| 0:30<br />
| [[User:Drei|Drei]] and vocx<br />
| 0.19<br />
| [https://forum.freecadweb.org/viewtopic.php?f=36&t=43651 Draft tutorial updated]<br />
<br />
<!--T:53--><br />
|-<br />
| [[Drawing_Template_HowTo|Drawing Template HowTo (obsolete)]]<br />
| 2D Drafting<br />
| Intermediate<br />
| 1:00<br />
| [[User:Quick61|Mark Stephen (Quick61)]]<br />
| 0.14.3700 or above<br />
| None<br />
<br />
<!--T:54--><br />
|-<br />
| [[Drawing_tutorial|Drawing tutorial (obsolete)]]<br />
| Blueprints / Drawings<br />
| Beginner<br />
| 0:15<br />
| [[User:Drei|Drei]]<br />
| 0.16 or above<br />
|<br />
<br />
<!--T:55--><br />
|-<br />
| [[Dxf_Importer_Install|Dxf Importer Install]]<br />
|<br />
| Intermediate<br />
| 0:05<br />
| [[User:Mario52|Mario52]]<br />
| Any<br />
| None<br />
<br />
<!--T:56--><br />
|-<br />
| [[Engine_Block_Tutorial|Engine Block Tutorial]]<br />
| Part Workbench<br />
| Beginner<br />
| 1:00<br />
| Andrewbuck40<br />
| 0.14.3700<br />
|<br />
<br />
<!--T:57--><br />
|-<br />
| [[Export_to_STL_or_OBJ|Export to STL or OBJ]]<br />
| Export to STL or OBJ<br />
| Beginner<br />
| 0:20<br />
| r-frank<br />
| 0.16.6703<br />
|<br />
<br />
<!--T:58--><br />
|-<br />
| [[Extend_FEM_Module|Extend FEM Module]]<br />
| Finite Element Analysis<br />
|<br />
|<br />
| [[User:M42kus|M42kus]]<br />
|<br />
|<br />
<br />
<!--T:60--><br />
|-<br />
| [[FEM_CalculiX_Cantilever_3D|FEM CalculiX Cantilever 3D]]<br />
| Finite Element Analysis<br />
| Beginner<br />
| 0:10<br />
| [[User:Bernd|Bernd]]<br />
| 0.16.6377 or above<br />
|<br />
<br />
<!--T:61--><br />
|-<br />
| [[FEM_Shear_of_a_Composite_Block|FEM Shear of a Composite Block]]<br />
| Finite Element Analysis<br />
| Beginner/Intermediate<br />
| 0:30<br />
| [[User:HarryvL|HarryvL]]<br />
| 0.17.12960 or above<br />
|<br />
<br />
<!--T:62--><br />
|-<br />
| [[FEM_tutorial|FEM tutorial]]<br />
| Finite Element Analysis<br />
| Beginner<br />
| 0:10<br />
| [[User:Drei|Drei]]<br />
| 0.16.6700 or above<br />
|<br />
<br />
<!--T:63--><br />
|-<br />
| [[FEM_Tutorial_Python|FEM Tutorial Python]]<br />
| Finite Element Analysis<br />
| Intermediate<br />
| 0:30<br />
| [[User:Bernd|Bernd]]<br />
| 0.18.15985 or above<br />
|<br />
<br />
<!--T:64--><br />
|-<br />
| [[FreeCAD-Ship_s60_tutorial|FreeCAD-Ship s60 tutorial]]<br />
| Ship Workbench<br />
| Beginner<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:65--><br />
|-<br />
| [[FreeCAD-Ship_s60_tutorial_(II)|FreeCAD-Ship s60 tutorial (II)]]<br />
| Ship Workbench<br />
| Beginner<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:66--><br />
|-<br />
| [[How_to_install_additional_workbenches|How to install additional workbenches]]<br />
| Programming<br />
| Medium programmer<br />
| 0:15<br />
| [[User:R-frank|r-frank]]<br />
| Any<br />
| None<br />
<br />
<!--T:67--><br />
|-<br />
| [[How_to_install_macros|How to install macros]]<br />
| Programming<br />
| Medium programmer<br />
| 0:15<br />
| [[User:Mario52|Mario52]]<br />
| Any<br />
| None<br />
<br />
<!--T:68--><br />
|-<br />
| [[Import_from_STL_or_OBJ|Import from STL or OBJ]]<br />
| Import from STL or OBJ<br />
| Beginner<br />
| 0:30<br />
| r-frank<br />
| 1.0<br />
| 0.16.6703<br />
<br />
<!--T:69--><br />
|-<br />
| [[Import_OpenSCAD_code|Import OpenSCAD code]]<br />
| Import OpenSCAD code<br />
| Beginner<br />
| 0:30<br />
| r-frank<br />
| 0.16.6704<br />
| None<br />
<br />
<!--T:70--><br />
|-<br />
| [[Import_text_and_geometry_from_Inkscape|Import text and geometry from Inkscape]]<br />
| Import text and geometry from Inkscape<br />
| Beginner<br />
| 0:30<br />
| r-frank<br />
| 0.16.6704<br />
|<br />
<br />
<!--T:114--><br />
|-<br />
| [[Import/Export_IFC_-_compiling_IfcOpenShell|Import/Export IFC - compiling IfcOpenShell]]<br />
| Arch Workbench<br />
| Advanced<br />
| 2:00<br />
| Pablo Gil<br />
|<br />
|<br />
<br />
<!--T:71--><br />
|-<br />
| [[Measurement_Of_Angles_On_Holes|Measurement Of Angles On Holes]]<br />
| TechDraw Workbench<br />
| Beginner<br />
| 0:01<br />
| AnHi<br />
| 0.19<br />
|<br />
<br />
<!--T:109--><br />
|-<br />
| [[PartDesign_Bearingholder_Tutorial_I|PartDesign Bearingholder Tutorial I]]<br />
| Product design - Bearingholder #1<br />
| Beginner<br />
| 1:00<br />
| NormandC<br />
|<br />
|<br />
<br />
<!--T:110--><br />
|-<br />
| [[PartDesign_Bearingholder_Tutorial_II|PartDesign Bearingholder Tutorial II]]<br />
| Product design - Bearingholder #2<br />
| Beginner<br />
| 1:00<br />
| NormandC<br />
|<br />
|<br />
<br />
<!--T:72--><br />
|-<br />
| [[PartDesign_tutorial|PartDesign tutorial]]<br />
| Sketcher<br />
| Beginner<br />
| 0:15<br />
| [[User:Drei|Drei]]<br />
| 0.16 or above<br />
|<br />
<br />
<!--T:77--><br />
|-<br />
| [[Path_Walkthrough_for_the_Impatient|Path Walkthrough for the Impatient]]<br />
| Path Workbench<br />
|<br />
|<br />
| Chrisb<br />
|<br />
|<br />
<br />
<!--T:78--><br />
|-<br />
| [[Plot_Basic_tutorial|Plot Basic tutorial]]<br />
| Plot Workbench Basic Tutorial<br />
| Beginner<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:79--><br />
|-<br />
| [[Plot_MultiAxes_tutorial|Plot MultiAxes tutorial]]<br />
| Plot workbench<br />
| Intermediate<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:80--><br />
|-<br />
| [[Post-Processing_of_FEM_Results_with_Paraview|Post-Processing of FEM Results with Paraview]]<br />
| Post-Processing of FEM Results with ParaView<br />
| Intermediate<br />
| 2:00<br />
| [[User:HarryvL|HarryvL]]<br />
| 0.19<br />
| [https://forum.freecadweb.org/download/file.php?id=103403 Beam] and [https://forum.freecadweb.org/download/file.php?id=103557 wall]<br />
<br />
<!--T:81--><br />
|-<br />
| [[Python_scripting_tutorial|Python scripting tutorial]]<br />
| Programming<br />
| Intermediate<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:82--><br />
|-<br />
| [[Raytracing_tutorial|Raytracing tutorial]]<br />
| Raytracing<br />
| Beginner<br />
| 0:10<br />
| [[User:Drei|Drei]]<br />
| 0.16 or above<br />
|<br />
<br />
<!--T:83--><br />
|-<br />
| [[Robot_6-Axis|Robot 6-Axis]]<br />
| Robot Workbench<br />
| Intermediate<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:84--><br />
|-<br />
| [[Robot_tutorial|Robot tutorial]]<br />
| Robot Workbench<br />
| Beginner<br />
|<br />
| r-frank<br />
|<br />
|<br />
<br />
<!--T:85--><br />
|-<br />
| [[Scripted_Parts:_Ball_Bearing_-_Part_1|Scripted Parts: Ball Bearing - Part 1]]<br />
| Part Scripting - Ball Bearing #1<br />
| Beginner<br />
| 0:30<br />
| r-frank<br />
| 0.16.6706<br />
|<br />
<br />
<!--T:86--><br />
|-<br />
| [[Scripted_Parts:_Ball_Bearing_-_Part_2|Scripted Parts: Ball Bearing - Part 2]]<br />
| Part Scripting - Ball Bearing #2<br />
| Beginner<br />
| 0:30<br />
| r-frank<br />
| 0.16.6706<br />
|<br />
<br />
<!--T:87--><br />
|-<br />
| [[Scripts|Scripts]]<br />
| Scripting<br />
| Beginner<br />
|<br />
| onekk Carlo<br />
| 0.19<br />
|<br />
<br />
<!--T:89--><br />
|-<br />
| [[Sketcher_Micro_Tutorial_-_Constraint_Practices|Sketcher Micro Tutorial - Constraint Practices]]<br />
| Sketcher<br />
| Beginner<br />
| 0:30<br />
| [[User:Quick61|Mark Stephen (Quick61)]] and vocx<br />
| 0.19<br />
| [https://forum.freecadweb.org/viewtopic.php?f=36&p=371659#p371659 Sketcher Constraints practices]<br />
<br />
<!--T:90--><br />
|-<br />
| [[Sketcher_reference|Sketcher reference]]<br />
|<br />
|<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:91--><br />
|-<br />
| [[Sketcher_requirement_for_a_sketch|Sketcher requirement for a sketch]]<br />
| Sketcher<br />
| Beginner<br />
|<br />
| [[User:Maker|Maker]]<br />
|<br />
| None<br />
<br />
<!--T:92--><br />
|-<br />
| [[Sketcher_Tutorial|Sketcher Tutorial]]<br />
| Sketcher<br />
| Beginner<br />
|<br />
| Ulrich<br />
|<br />
|<br />
<br />
<!--T:115--><br />
|-<br />
| [[TechDraw_Pitch_Circle_Tutorial|TechDraw Pitch Circle Tutorial]]<br />
| TechDraw Workbench<br />
| Beginner<br />
| 0:10<br />
| Andergrin<br />
| 0.19<br />
| None<br />
<br />
<!--T:119--><br />
|-<br />
| [[TechDraw_TemplateGenerator|TechDraw TemplateGenerator]]<br />
| TechDraw Workbench<br />
| Intermediate<br />
|<br />
| [[User:FBXL5|FBXL5]]<br />
| 0.19<br />
| None<br />
<br />
<!--T:93--><br />
|-<br />
| [[TechDraw_TemplateHowTo|TechDraw TemplateHowTo]]<br />
| TechDraw Workbench<br />
| Intermediate<br />
| 1:00<br />
| wandererfan<br />
| 0.17<br />
| None<br />
<br />
<!--T:94--><br />
|-<br />
| [[Thread_for_Screw_Tutorial|Thread for Screw Tutorial]]<br />
| Product design<br />
| Advanced<br />
| 1:00<br />
| [[User:DeepSOIC|DeepSOIC]], [[User:Murdic|Murdic]], vocx<br />
| 0.19<br />
| [https://forum.freecadweb.org/viewtopic.php?f=36&t=44668 Updated: Thread for screw tutorial]<br />
<br />
<!--T:95--><br />
|-<br />
| [[Toothbrush_Head_Stand|Toothbrush Head Stand]]<br />
| Modeling<br />
| Beginner<br />
| 1:00<br />
| [[User:EmmanuelG|EmmanuelG]]<br />
| 0.16 or above<br />
| [https://www.thingiverse.com/thing:2403310 Thingiverse 2403310]<br />
<br />
<!--T:96--><br />
|-<br />
| [[Topological_data_scripting|Topological data scripting]]<br />
| Programming<br />
| Intermediate<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:97--><br />
|-<br />
| [[Transient_FEM_analysis|Transient FEM analysis]]<br />
| Transient FEM analysis<br />
|<br />
|<br />
|<br />
|<br />
|<br />
<br />
<!--T:98--><br />
|-<br />
| [[Tutorial_custom_placing_of_windows_and_doors|Tutorial custom placing of windows and doors]]<br />
| Architecture<br />
| Intermediate<br />
| 1:00<br />
| [[User:Vocx|Vocx]]<br />
| 0.18 or above<br />
| None<br />
<br />
<!--T:99--><br />
|-<br />
| [[Tutorial_for_open_windows|Tutorial for open windows]]<br />
| Architecture<br />
| Beginner<br />
| 1:00<br />
| [[User:Vocx|Vocx]]<br />
| 0.18 or above<br />
| None<br />
<br />
<!--T:100--><br />
|-<br />
| [[Tutorial_FreeCAD_POV_ray|Tutorial FreeCAD POV ray]]<br />
| Rendering<br />
| Intermediate<br />
| 2:00<br />
| [[User:Vocx|Vocx]]<br />
| 0.18 or above<br />
| None<br />
<br />
<!--T:126--><br />
|-<br />
| [[Tutorial_KinematicAssembly|Tutorial KinematicAssembly]]<br />
| Assembly3<br />
| Beginner<br />
| 0:30<br />
| [[User:FBXL5|FBXL5]]<br />
| 0.20 or above<br />
| None<br />
<br />
<!--T:127--><br />
|-<br />
| [[Tutorial_KinematicController|Tutorial KinematicController]]<br />
| Programming<br />
| Intermediate<br />
| 1:00<br />
| [[User:FBXL5|FBXL5]]<br />
| 0.20 or above<br />
| None<br />
<br />
<!--T:101--><br />
|-<br />
| [[Tutorial_Render_with_Blender|Tutorial Render with Blender]]<br />
| Rendering<br />
| Intermediate<br />
| 1:00<br />
| [[User:Vocx|Vocx]]<br />
| 0.18 or above<br />
| None<br />
<br />
<!--T:102--><br />
|-<br />
| [[VRML_Preparation_for_Robot_Simulation|VRML Preparation for Robot Simulation]]<br />
| Robot Workbench<br />
| Intermediate<br />
|<br />
|<br />
| 0.11.4252ppa1<br />
|<br />
<br />
<!--T:104--><br />
|-<br />
| [[Whiffle_Ball_tutorial|Whiffle Ball tutorial]]<br />
| Product design<br />
| Beginner<br />
| 0:30<br />
| r-frank and vocx<br />
| 0.17 and above<br />
| [https://github.com/FreeCAD/Examples/blob/master/Whiffle_Ball_Tutorial_ExampleFiles/WhiffleBall_Tutorial_FCWiki.FCStd?raw=true WhiffleBall_Tutorial_FCWiki.FCStd]<br />
<br />
<!--T:105--><br />
|-<br />
| [[Wikihouse_porting_tutorial|Wikihouse porting tutorial]]<br />
| Wikihouse porting tutorial<br />
| Intermediate/Advanced<br />
| 1:00<br />
|<br />
|<br />
|<br />
<br />
<!--T:112--><br />
|}<br />
<br />
<br />
<!--T:21--><br />
{{Docnav<br />
|[[Frequently_asked_questions|FAQ]]<br />
|[[Interface_Customization|Interface Customization]]<br />
}}<br />
<br />
</translate><br />
{{Userdocnavi{{#translation:}}}}<br />
[[Category:Tutorials{{#translation:}}]]</div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1148591Creating a simple part with Draft and Part WB2022-06-05T13:22:00Z<p>Heda: </p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
</translate><br />
<br />
<translate><br />
==The tutorial covers==<br />
</translate><br />
<translate><br />
# The model to make<br />
# Creating the 2d profile<br />
# Why does not extruding work<br />
# Extruding the profile<br />
# Creating the through hole<br />
# Making a sketch out of the 2d profile<br />
# Wrapping up<br />
</translate><br />
<br />
<translate><br />
==The model to make==<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
==Creating the 2d profile==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
</translate><br />
<br />
<translate><br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft WB''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft WB'''.<br />
</translate><br />
<br />
<translate><br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft WB''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
</translate><br />
<br />
<translate><br />
===Creating the fillet===<br />
</translate><br />
<translate><br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft WB'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{Button|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
</translate><br />
<translate><br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft WB''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Drag the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click LMB. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
</translate><br />
<br />
<translate><br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
==Why does not extruding work==<br />
</translate><br />
<translate><br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
</translate><br />
<br />
<translate><br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a direction, this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
</translate><br />
<br />
<translate><br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
</translate><br />
<br />
<translate><br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
</translate><br />
<br />
<translate><br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simple becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
</translate><br />
<br />
<translate><br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
</translate><br />
<br />
<translate><br />
==Extruding the profile==<br />
</translate><br />
<translate><br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{Button|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
==Creating the through hole==<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
</translate><br />
<br />
<translate><br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
</translate><br />
<br />
<translate><br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a sketch out of the 2d profile==<br />
</translate><br />
<translate><br />
Using '''Draft WB''' is one way of creating a 2d profile. In '''Draft WB''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft WB''' can be converted to an ''unconstrained'' sketch.<br />
</translate><br />
<br />
<translate><br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in profile from the earlier made group '''Profile'''. From '''Draft WB''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
</translate><br />
<br />
<translate><br />
With '''Sketch''' closed and selected, from '''Part WB''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
==Quality of models==<br />
</translate><br />
<translate><br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
</translate><br />
<br />
<translate><br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part WB''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''.<br />
</translate><br />
<br />
<translate><br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
</translate><br />
<br />
<translate><br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to a under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps. If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the sketch solver cannot consider them to be matching endpoints.<br />
</translate><br />
<br />
<translate><br />
==Wrapping up==<br />
</translate><br />
<translate><br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher WB''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign WB'''. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Draft_and_Part_WB&diff=1148578Creating a simple part with Draft and Part WB2022-06-05T13:17:00Z<p>Heda: Created page with " {{TutorialInfo |Topic=Modeling |Level=Beginner |Author=heda |Time=1.5 hours |FCVersion=0.19 or above |Files=n/a }} <translate> ==Introduction== </translate> <translate> This..."</p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=1.5 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to [[Draft_Workbench|Draft Workbench]] [[Image:Switch_DraftWorkbench.JPG]] in FreeCAD. The tutorial uses a ''2d shape'' to create a ''3d solid'', the latter is accomplished through [[Part_Workbench|Part Workbench]]. The reader is recommended to first work through the sister tutorial ''[[Creating_a_simple_part_with_Part WB|Creating a simple part with Part WB]]'', which is creating the same model with a different technique, while at the same time covering more of the basics of FreeCAD’s user interface. This tutorial expects the user to be briefly familiar with both the user interface and some workflows available in FreeCAD. The tutorial is composed such that the aim is not necessarily to show the most efficient way to use the program, but rather to make the reader aware of different functionalities available in FreeCAD, how to use them, and where to find them.<br />
</translate><br />
<br />
<translate><br />
===The tutorial covers===<br />
</translate><br />
<translate><br />
# The model to make<br />
# Creating the 2d profile<br />
# Why does not extruding work<br />
# Extruding the profile<br />
# Creating the through hole<br />
# Making a sketch out of the 2d profile<br />
# Wrapping up<br />
</translate><br />
<br />
<translate><br />
===The model to make===<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<br />
<translate><br />
===Creating the 2d profile===<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name. Switch to '''[[Draft_Workbench|Draft Workbench]]''', your screen should look like below. If the grid does not show, toggle it on/off with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]].<br />
</translate><br />
<br />
[[Image:T101dwb01-01draftgrid.png|center]]<br />
<br />
<translate><br />
If you have not altered the default settings, the [[Navigation_Cube|navigation cube]] is in the upper right corner of the 3d-view, and the view is the ''TOP'' view, the global orientation ''XY-plane''.<br />
</translate><br />
<br />
<translate><br />
To start off the profile, draw a random [[Image:Draft_Rectangle.svg|24px|link=Draft_Rectangle]] [[Draft_Rectangle|Rectangle]] on the screen in the XY-plane by clicking 2 points in the 3d-view forming any diagonal of a rectangle. A ''task panel'' will open once the command is invoked, this time we are not going to use it at all, but you could of course enter the coordinates directly for the rectangle. Your 3d-view should now have a rectangle drawn, similar to below picture.<br />
</translate><br />
<br />
[[Image:T101dwb01-02rectangleraw.png|center]]<br />
<br />
<translate><br />
When working in '''Draft WB''' one always draws on a 2d plane, that 2d plane is called ''[[Draft_SelectPlane|Working plane]]'', and is in default setting always automatically aligning itself to the same orientation as the current 3d-view camera position. So, until the 2d profile is completed, it is best to simply keep the TOP view (camera position) and not mock around with rotating the view. If you happened to have changed it, just change back to the TOP view before starting any new command in '''Draft WB'''.<br />
</translate><br />
<br />
<translate><br />
The side view of our final model has the outer contour of 100 x 50 mm, and it would be nice if the lower left corner was placed in global zero position. This can be accomplished through the ''property-view'' of the created '''Rectangle'''. First change ''Position'' of the rectangle to '''(0, 0, 0)''', then modify ''height'' to '''50''' mm and ''length'' to '''100''' mm as per images below.<br />
</translate><br />
<br />
[[Image:T101dwb01-03rectangleprops.png|center]]<br />
<br />
<translate><br />
The '''Rectangle''' is finished and it should look like this after applying [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] [[Std_ViewFitAll|Fit all]] to the view.<br />
</translate><br />
<br />
[[Image:T101dwb01-04rectangledone.png|center]]<br />
<br />
<translate><br />
Next we will break up the rectangle into its four edges, this is done by first selecting the '''Rectangle''' and then invoking the command [[Image:Draft_Downgrade.svg|24px|link=Draft_Downgrade]] [[Draft_Downgrade|Draft Downgrade]], the filled face will disappear and the object in the ''tree-view'' is now a '''Wire''' instead of a '''Rectangle''', shown in the left picture below. Invoking '''Draft Downgrade''' once more will break up the ''wire'' into its ''edges'', shown in the middle picture below.<br />
</translate><br />
<br />
[[Image:T101dwb01-05rectangledowngrade.png|center]]<br />
<br />
<translate><br />
The observant will notice that the object icon in the tree-view already for the wire changed to a ''blue box''. This blue box is the icon used for generic geometric objects (Part Module geometric objects to be specific, but that is for advanced readers). Select the left vertical edge and invoke the command [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]], the former ''edge'' will now have a different icon and has changed ''label'' to '''Line'''. It is now a '''Draft WB''' object where one can edit for example ''start-point'' and ''end-point'' through the ''properties-view'', this is not possible with the ''edge'' objects.<br />
</translate><br />
<br />
<translate><br />
====Creating the fillet====<br />
</translate><br />
<translate><br />
Start by selecting the upper right corner edges, use menu {{MenuCommand|Edit → Box selection}} [[Image:Std_BoxSelection.svg|24px|link=Std_BoxSelection]] [[Std_BoxSelection|Box selection]], hold down the [[Image:Mouse_LMB.svg|24px]] '''LMB''' and drag ''from right to left'' and release '''LMB'''. When dragging ''from right to left'' the resulting selection includes everything fully or partially within the selection area. If one drags from left to right, only objects fully enclosed by the selection area are included in the resulting selection. The actual selection happens when the left mouse button is released, and there is no preview of what will be selected.<br />
</translate><br />
<br />
[[Image:T101dwb02-01filletboxselection.png|center]]<br />
<br />
<translate><br />
With the top right corner edges selected, invoke command [[Image:Draft_Fillet.svg|24px|link=Draft_Fillet]] [[Draft_Fillet|Fillet]] in '''Draft WB'''. Check ''Delete original objects'' and change ''radius'' to 20 mm and hit {{Button|enter}}.<br />
</translate><br />
<br />
[[Image:T101dwb02-02fillettaskpanel.png|center]]<br />
<br />
<translate><br />
The '''Fillet''' is created and your model should now look like below.<br />
</translate><br />
<br />
[[Image:T101dwb02-03filletdone.png|center]]<br />
<br />
<translate><br />
====Creating the chamfer====<br />
</translate><br />
<translate><br />
To make the ''chamfer'' we need to have a line with the correct inclination and also be able to position it correctly. Let us begin with the position, which is on coordinate ''(50, 50, 0)''. In the current profile we do not have a point there, so lets create one by making a ''temporary help line''. First select the left vertical '''Line''', then create the help line by [[Image:Std_DuplicateSelection.svg|24px|link=Std_DuplicateSelection]] [[Std_DuplicateSelection|Duplicate selection]] in {{MenuCommand|Edit → Duplicate selection}}, '''Line001''' is created. Use the ''property-view'' and move '''Line001''' 50 mm in x-direction using the ''Placement'' property. Next duplicate the ''lower horizontal edge'', and change the ''angle'' of the edge to 30 degrees, once again using the ''Placement'' property. The model should now look like the image below.<br />
</translate><br />
<br />
[[Image:T101dwb03-01chamferhelp.png|center]]<br />
<br />
<translate><br />
Next, move the ''angled line'' into position. For this we make use [[Image:Draft_Move.svg|24px|link=Draft_Move]] [[Draft_Move|Draft Move]] along with the ''snap'' functionality in '''Draft WB''', more specifically ''end-point'' snap. First make sure that your snap toolbar looks similar to below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Then select the ''angled line'', '''Edge001''', press '''Move''' and a ''task panel'' opens up.<br />
</translate><br />
<br />
[[Image:T101dwb03-03_movetaskpanel.png|center]]<br />
<br />
<translate><br />
Make sure that ''Copy'' is unchecked. Hoover the mouse over the ''upper quarter'' of the ''angled line'', once the ''white dot'' and ''end-point'' symbol shows at the right spot, click [[Image:Mouse_LMB.svg|24px]] '''LMB'''. Drag the mouse to the upper quarter of the help line, once the white dot and end point symbol appears, click LMB. The sequence is illustrated below.<br />
</translate><br />
<br />
[[Image:T101dwb03-04_moveline.png|center]]<br />
<br />
<translate><br />
The line is now in the correct position, but it is too long. To adjust the lengths of the lines [[Image:Draft_Trimex.svg|24px|link=Draft_Trimex]] [[Draft_Trimex|Draft Trimex]] will be used. Click on the ''left part'' of the ''angled line'', i.e. the part of '''Edge001''' that is to be removed. Once the line is selected, press '''Trim''' and then click on the ''left-most vertical line'', '''Line'''. The image below shows the '''Trim''' command invoked, and the pre-selected vertical line.<br />
</translate><br />
<br />
[[Image:T101dwb03-05_trimline.png|center]]<br />
<br />
<translate><br />
Repeat the trimming of the left-most vertical line to form the lower corner of the chamfer. Here you probably need to do the trimming in 2 steps. The trim function can make an ''undesired flip'', keeping the longest part of the object to be trimmed. In those cases, trim a shorter distance first by simply clicking in the 3d-view for example halfway of your intended trim. The trim function accepts any click in the 3d view. If you get it wrong, just use [[Image:Std_Undo.svg|24px|link=Std_Undo]] [[Std_Undo|Undo]] and [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] (the latter often called ''recompute'') and try again.<br />
</translate><br />
<br />
[[Image:T101dwb03-06_chamferlowercornerdone.png|center]]<br />
<br />
<translate><br />
To trim the ''upper horizontal'' edge, the '''Fillet''' needs to be ''downgraded'' so that the upper edge is it’s own object in the tree-view. If you attempt to trim it without first having done the downgrade, the trimming function attempts to trim the arc in the fillet. You will need to trim the line in steps to avoid the resulting trim to flip.<br />
</translate><br />
<br />
<translate><br />
The profile is ready and shown below with the edges organized in a [[Image:Std_Group.svg|24px|link=Std_Group]] [[Std Group|Group]] named '''Profile''' (or ''labeled'' to be precise in FreeCAD lingo), along with the help line deleted. Groups can be used to organize the features in your ''FreeCAD documents'', it’s usage is analogue to a folder structure on a computers file system.<br />
</translate><br />
<br />
[[Image:T101dwb03-07_profiledone.png|center]]<br />
<br />
<translate><br />
===Why does not extruding work===<br />
</translate><br />
<translate><br />
Let’s jump right into it, select all the edges in the ''group'' '''Profile''', in [[Image:Workbench_Part.svg|24px|link=Part_Workbench]] [[Part_Workbench|Part Workbench]], invoke command [[Image:Part_Extrude.svg|24px|link=Part_Extrude]] [[Part_Extrude|Extrude]]. A ''task panel'' opens, accept all the defaults and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-01_extrudelineserror.png|center]]<br />
<br />
<translate><br />
That did not work out, but it sounds easy enough to fix the error, we just need to specify a direction. Click {{Button|OK}} to get back to the ''task panel'' and select ''custom direction''.<br />
</translate><br />
<br />
[[Image:T101dwb04-02_extrudelineszaxis.png|center]]<br />
<br />
<translate><br />
Accept the default z-axis and once more click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-03_extrudelinessheets.png|center]]<br />
<br />
<translate><br />
We managed to make a fence like structure, judging from the tree-view every edge is treated separately. It is not the wanted filled solid that we want. Hit [[Std_Undo|Undo]], and let’s try something else.<br />
</translate><br />
<br />
<translate><br />
Scrolling all the way to the bottom of the '''Extrude''' ''task panel'' there is an option ''Create solid'', check that option and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb04-04_extrudelinesfilled.png|center]]<br />
<br />
<translate><br />
Everything disappeared, clearly that did not work either. Let’s go through why none of these ways are working. In the first case we got an error that the direction could not be determined. A flat face has a normal, i.e. direction, a line does not. Since from our second attempt we know that it worked when providing a direction, the error simply comes from trying to extrude a line without knowing into which direction to extrude that line. The observant will say that an arc has a direction, this is true. If you select only the edge that is the arc, FreeCAD will extrude that arc, also with default settings.<br />
</translate><br />
<br />
<translate><br />
In the second case it worked, but we also got an extrusion for each edge we had in our selection. The resulting features, however are not what we want, i.e. a solid.<br />
</translate><br />
<br />
<translate><br />
In the third case we checked ''Create solid'', and ended up with everything disappearing. The icon in the tree-view has a different icon as well, there is a ''white exclamation'' mark on red background, that particular ''overlay icon'' means that the feature has an error that has to be tended to. One can read up on [[Tree_view#Overlay_icons|overlay icons]] on the wiki. <br />
</translate><br />
<br />
<translate><br />
Hoovering over the tree-view overlay icon a tool tip is displayed, it says ''Wire not closed''.<br />
</translate><br />
<br />
[[Image:T101dwb04-05_extrudelineserrortooltip.png|center]]<br />
<br />
<translate><br />
In our case the error is not fixable. It is ''geometrically impossible'' to create a solid out of an extruded single line. An extruded line simple becomes a sheet, or ''shell'' in FreeCAD lingo. In other words, this is not a FreeCAD limitation, it is a fundamental outcome of geometrical theory. The reason why the 3d-view goes completely blank is that the created features, or objects in the tree-view, has errors in the produced ''shape'', and thus contains nothing to render. FreeCAD does however create the new document objects (in this case extrusions) and thus hides any geometry/object used for making the new document objects. The is why the screen goes blank when trying to make a solid out of a line, or lines.<br />
</translate><br />
<br />
<translate><br />
The tool-tip says it all, in order to extrude into a solid one needs a ''closed wire, or a face''. A face is, per definition, simply a closed wire that is filled. One way to create a closed wire out of our profile edges is to select them all and apply [[Image:Draft_Upgrade.svg|24px|link=Draft_Upgrade]] [[Draft_Upgrade|Draft Upgrade]]. If applied once it becomes a wire, while at the same time it consumes the individual edges from the tree-view. If applied twice it becomes a face, either of those allows for a successful solid extrusion.<br />
</translate><br />
<br />
<translate><br />
===Extruding the profile===<br />
</translate><br />
<translate><br />
Another way to create the closed wire is [[Image:Part_Builder.svg|24px|link=Part_Builder]] [[Part_Builder|Shape builder]], which allows for making a wire without consuming the individual edges. '''Part Shape builder''' is a powerful tool to create any geometric entity in FreeCAD that can be used further to create complex solids from lower level entities, the simplest example is creating a line between two vertexes. Click '''Part Shape builder''' to bring up the ''task panel''.<br />
</translate><br />
<br />
[[Image:T101dwb05-01_shapebuildertaskpanel.png|center]]<br />
<br />
<translate><br />
We can use either ''Wire from edges'' or ''Face from edges''. Multiple selections has to be made with {{Button|ctrl}}-key pressed down. Let’s use ''Face from edges'', once that option is selected one can also select ''Planar'', do that as well. Then select all edges in the profile, order does not matter (in this case) and click {{Button|Create}}, and then {{Button|Close}} to come back to the tree-view. The ''face'' has been created.<br />
</translate><br />
<br />
[[Image:T101dwb05-02_shapebuilderfacedone.png|center]]<br />
<br />
<translate><br />
Select the '''Face''' and invoke '''Part Extrude''', set the extrusion ''length'' to '''30''' mm and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101dwb05-03_extrusiondone.png|center]]<br />
<br />
<translate><br />
===Creating the through hole===<br />
</translate><br />
<translate><br />
To make the through hole we need a ''cylinder'' correctly ''positioned'' to make a boolean ''cut'' with.<br />
</translate><br />
<br />
<translate><br />
Create a cylinder, and position it correctly. In this case the ''radius'' is 5 mm, ''height'' is made to be 60 mm. For the placement, first it is ''rotated'' -90 degrees around x-axis, then positioned in ''(65, -5, 15)''. The negative 5 in y-direction originates from that the height is 10 mm longer than needed.<br />
</translate><br />
<br />
[[Image:T101dwb05-04_cylinderplaced.png|center]]<br />
<br />
<translate><br />
It does not hurt to make the height of the cylinder longer than seemingly needed. For a simple model like this it will not matter if the cylinder is the exact height of the profile. It is however good practice to avoid co-planar faces, potentially that avoids numerical errors in the geometric kernel that can lurk around behind the scenes resulting in strange effects, or failures in subsequent operations when making co-planar faces on more complex models.<br />
</translate><br />
<br />
<translate><br />
With a final boolean cut and changing appearance of the model, the model is completed.<br />
</translate><br />
<br />
[[Image:T101dwb05-05_modelcomplete.png|center]]<br />
<br />
<translate><br />
===Making a sketch out of the 2d profile===<br />
</translate><br />
<translate><br />
Using '''Draft WB''' is one way of creating a 2d profile. In '''Draft WB''' a wire can be made in 3d-space. FreeCAD provides another tool to make 2d profiles – [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]]. Using a ''sketch'' to make a 2d profile is a more versatile way to create a 2d profile. Any 2d profile made in '''Draft WB''' can be converted to an ''unconstrained'' sketch.<br />
</translate><br />
<br />
<translate><br />
Start by hiding the '''Cut''' feature and make the edges in the profile visible. Select the edges in profile from the earlier made group '''Profile'''. From '''Draft WB''' press toolbar button [[Image:Draft_Draft2Sketch.svg|24px|link=Draft_Draft2Sketch]] [[Draft_Draft2Sketch|Draft to Sketch]] and you should see the same as in the image below.<br />
</translate><br />
<br />
[[Image:T101dwb06-01_draft2sketch.png|center]]<br />
<br />
<translate><br />
Next, hide the original edges and double-click the '''Sketch''' object in the tree-view, bringing you to the following state, i.e. the ''sketcher task panel'' opened.<br />
</translate><br />
<br />
[[Image:T101dwb06-02_sketchedit.png|center]]<br />
<br />
<translate><br />
This is how it looks when one ''edits a sketch''. Since this is not a tutorial for using the sketcher just go ahead and close it. If you want an introduction to sketching, which is a core workflow in any 3d parametric cad, please follow the sister tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''.<br />
</translate><br />
<br />
<translate><br />
With '''Sketch''' closed and selected, from '''Part WB''' use Extrude in the same way as for the earlier extruded profile '''Face'''. The basic block of the simple model is ready once again.<br />
</translate><br />
<br />
[[Image:T101dwb06-03_sketchextruded.png|center]]<br />
<br />
<translate><br />
===Quality of models===<br />
</translate><br />
<translate><br />
Sooner or later when working with 3d parametric cad you will come across a broken model, either one you have made yourself, or a model that you have imported. A broken model can work for its purpose, but more often than not, there are subsequent operations that simply will not work with a broken model. To repair a broken model one has to know what to repair, this is where the built-in quality check tools in FreeCAD come in.<br />
</translate><br />
<br />
<translate><br />
First let us check the quality of the recently created '''Extrude001'''. With '''Part WB''' active, first select '''Extrude001''' and then use command [[Image:Part_CheckGeometry.svg|24px|link=Part_CheckGeometry]] [[Part_CheckGeometry|Check geometry]].<br />
</translate><br />
<br />
[[Image:T101dwb07-01_geocheck.png|center]]<br />
<br />
<translate><br />
Our model is OK, no errors are reported. There is also a listing of the models content, or in FreeCAD lingo, the content of the ''shape'', i.e. how it is put together from ground up. Here one can see that apparently to make a ''solid'' one also needs a ''shell'', and the shell is made out of ''faces'', and so on. In other words, you can create any solid by simply starting out by making points, or ''vertices'', from those one makes ''edges'', and from those one creates ''wires'', and out of the wires one makes ''faces'' which are then stitched into a ''shell'', from which one finally arrives at a ''solid''.<br />
</translate><br />
<br />
<translate><br />
One other check one can do is related to the '''Sketch'''. Close the ''task panel'' for the geometry check. Select the '''Sketch''', expand '''Extrude001''' in the tree-view if needed in order to see the sketch-object. Switch to [[Image:Workbench_Sketcher.svg|24px|link=Sketcher_Workbench]] [[Sketcher_Workbench|Sketcher Workbench]], use command [[Image:Sketcher_ValidateSketch.svg|24px|link=Sketcher_ValidateSketch]] [[Sketcher_ValidateSketch|Validate sketch]], a ''task panel'' opens. In the ''task panel'', click the {{Button|Find}}-button for ''Missing coincidences''. It highlights and reports ''6'' of them, i.e. all the points where the edges meet.<br />
</translate><br />
<br />
[[Image:T101dwb07-02_sketchvalidate.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}} in the pop-up dialogue and then click the {{Button|Fix}}-button to heal the ''Missing coincidences''. If you close the ''task panel'', and go into ''edit mode'' of the '''Sketch''', it reports ''12 degrees of freedom'', as opposed to the earlier ''24''. That was achieved through adding ''coincident constraints'' to the endpoints of the edges. The observant reader notices that when using edges from draft those had to be joined into a closed wire to make a solid extrusion, whereas in sketcher that was not apparently needed. The logic here is that the sketch is one object, and the extrusion of one object is treated as if it was a closed wire (in this case).<br />
</translate><br />
<br />
<translate><br />
Finally it should be pointed out that although it can work creating subsequent objects with ''open vertices'' in sketches, it is ''best practice'' to ''not have any'', as well as having a ''fully constrained sketch'' (as opposed to a under constrained ditto). The reason why it works here is that the ''sketch'' is created from a profile that has all edge ''endpoints matching'' without any gaps. If you in the sketcher draw by hand and also try to match endpoints by hand, it is virtually guaranteed that the endpoint will ''not be matched'' from the ''sketch solver'' point of view, i.e. the gap (although not really visible on the screen) is large enough that the sketch solver cannot consider them to be matching endpoints.<br />
</translate><br />
<br />
<translate><br />
===Wrapping up===<br />
</translate><br />
<translate><br />
Having gone through the tutorial you have become somewhat familiar with the basic functionality of FreeCAD, along with the core workbenches '''Part''' and '''Draft'''. You are also aware of the existence of '''Sketcher WB''', which for many experienced users is the sole tool used to create 2d profiles later utilized in solid feature operations. The use of ''sketches'' is a core concept in '''PartDesign WB'''. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. If your focus is modeling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=Creating_a_simple_part_with_Part_WB&diff=1148470Creating a simple part with Part WB2022-06-05T12:53:43Z<p>Heda: Created page with " {{TutorialInfo |Topic=Modeling |Level=Beginner |Author=heda |Time=2 hours |FCVersion=0.19 or above |Files=n/a }} <translate> ==Introduction== </translate> <translate> This t..."</p>
<hr />
<div><br />
{{TutorialInfo<br />
|Topic=Modeling<br />
|Level=Beginner<br />
|Author=heda<br />
|Time=2 hours<br />
|FCVersion=0.19 or above<br />
|Files=n/a<br />
}}<br />
<br />
<translate><br />
==Introduction==<br />
</translate><br />
<translate><br />
This tutorial aims to be used as a first introduction to 3D modeling using the [[Part_Workbench|Part Workbench]] [[Image:Switch_PartWorkbench.JPG]] of FreeCAD. After having finished this tutorial you should be able to make simple 3d models by using primitives like cubes, cylinders, etc with a technique called [https://en.wikipedia.org/wiki/Constructive_solid_geometry Constructive Solid Geometry], short '''CSG''' modeling. Another way to create 3d models is by using a 2d shape to create a 3d shape by for example extruding or revolving the 2d shape in 3d space. For an introduction of that technique please follow the sister-tutorial ''[[Creating_a_simple_part_with_PartDesign|Creating a simple part with PartDesign]]''. The 2 tutorials intentionally have exactly the same model generated, this presents the beginner with a hands on experience of the 2 different techniques and aspects of how they are implemented in FreeCAD. The definition of the 2 techniques can be viewed as strictly divided from a semantic point of view, however there is nothing directly hindering a mix of the techniques when creating models. There are some caveats to watch out for when mixing modeling techniques, those are mainly related to aspect of how FreeCAD is programmed. There is a third tutorial intended as a minimal introduction to a mixed modeling example. That tutorial mixes primitives with sketches in part design workbench to make the same model as in this tutorial.<br />
</translate><br />
<br />
<translate><br />
Before you start please have a look at how to '''[[Mouse_navigation|navigate]]''' the 3d space.<br />
When hoovering over the mouse model selector in the lower right corner of the FreeCAD window a cheat-sheet of current mouse model appears as in the picture below.<br />
</translate><br />
<br />
[[Image:T101pwb00-01_navi.png|center]]<br />
<br />
<translate><br />
Many newcomers to cad programs get stuck while learning the software, if that happens to you, please go ahead and search the wiki or forum for further information – chances are that others also have been stuck on the same specific thing in the past so there is already an answer to your specific question. Or make a post on the forum with your questions or findings. The forum has several threads where users are helped to complete all sort of different tasks, those threads are often similar to tutorials, and often has specific illustrations included.<br />
</translate><br />
<br />
<translate><br />
===The tutorial covers===<br />
</translate><br />
<translate><br />
* The model to make<br />
* Using Part workbench to create and manipulate the primitive building blocks<br />
* Changing color and transparency<br />
* A different way to locate the hole<br />
* Making the hole a countersunk hole<br />
* Editing dimensions<br />
* A different way to position the chamfer<br />
* Making a hollow piece<br />
* Organizing the tree a bit differently<br />
</translate><br />
<br />
<translate><br />
===The model to make===<br />
</translate><br />
[[Image:GGTuto1_Vue.PNG|center]]<br />
<br />
[[Image:T101pwb01-02_dims.png|center]]<br />
<br />
<translate><br />
==Using Part workbench to create and manipulate the primitive building blocks==<br />
</translate><br />
<translate><br />
Create a new document and save it directly under a new name, it is good practice to make sure that you save the document at regular intervals, or just before larger operations. Then switch to the '''[[Part_Workbench|Part Workbench]]''' using either the [[Getting_started#Exploring_FreeCAD|workbench selector]] (labeled 6 in the linked image) or by going to the {{MenuCommand|View → Workbench}} menu. FreeCAD will start with toolbars at the top, the combo view to the left and the 3D view at the right.<br />
</translate><br />
<br />
<translate><br />
===Create the main solid block===<br />
</translate><br />
<translate><br />
Press [[Image:Part_Box.svg|24px|link=Part_Box]] [[Part_Box|Box]] to make a default solid cube. The cube appears in the 3d view as well as a new object in the “model treeview” in the sidebar.<br />
</translate><br />
<br />
<translate><br />
Press [[Image:Std_ViewIsometric.svg|24px|link=Std_ViewIsometric]] [[Std_ViewIsometric|Isometric]] to see the cube in 3d.<br />
</translate><br />
<br />
[[Image:T101pwb01-03_cube1.png|center]]<br />
<br />
<translate><br />
Select the cube in the [[Tree_view|tree-view]], it becomes green in the 3d view. Below the tree-view you will now see that the cube by default is created with the dimensions '''Length x Width x Height''' as ''10 x 10 x 10 mm''. Change those dimensions to '''100 x 30 x 50''' as per the initial drawing of the model.<br />
</translate><br />
<br />
[[Image:T101pwb01-04_cubedims.png|center]]<br />
<br />
<translate><br />
When changing a property, like ''Length'' through the spinbox, one can either enter the values, or use the scroll-wheel to tick values up or down. The arrows for ticking values up or down can of course also be used. In the right most picture above, the ''Height'' property is in edit mode, rolling the scroll wheel when the mouse is over that cell will change the value by one up or down.<br />
</translate><br />
<br />
<translate><br />
Click [[Image:Std_ViewFitAll.svg|24px|link=Std_ViewFitAll]] '''[[Std_ViewFitAll|Fit all]]''' to see the whole cube.<br />
</translate><br />
<br />
[[Image:T101pwb01-05_cube2.png|center]]<br />
<br />
<translate><br />
===Create fillet===<br />
</translate><br />
<translate><br />
To make the filleted corner, in the toolbar press [[Image:Part_Fillet.svg|24px|link=Part_Fillet]] '''[[Part_Fillet|Fillet]]''' which opens the task dialogue for fillets in the combo view to the side. Change the ''radius'' spinbox to 20 mm, then in the 3d view, select the width edge to the upper right and click {{Button|OK}}.<br />
</translate><br />
<br />
[[Image:T101pwb01-06_filletrad.png|center]] <br />
<br />
<translate><br />
The task dialogue closes and you are back to the tree-view which now has a fillet object instead of the earlier cube.<br />
</translate><br />
<br />
<translate><br />
===Visibility of children===<br />
</translate><br />
<translate><br />
Click the plus sign/caret to expand the children of the fillet, which in this case is the ''cube'' we created earlier, but it is grayed out. Select the cube and press the space bar – this toggles visibility so the cube is now visible again and the icon is no longer grayed out. To deselect the cube click in a blank area in the tree-view or the 3d view.<br />
</translate><br />
<br />
[[Image:T101pwb01-07_fillet.png|center]]<br />
<br />
<translate><br />
===Creating the chamfer===<br />
</translate><br />
<translate><br />
Next is to create the 30 degree ''chamfer'', start by toggle the visibility of the child cube of the fillet. There is a chamfer tool in [[Part_Workbench|Part Workbench]], but we cannot use it since it currently only makes a 45 degree chamfer. We will make it with another block and a boolean cut instead.<br />
</translate><br />
<br />
<translate><br />
Create a new [[Image:Part_Box.svg|24px|link=Part_Box]] '''[[Part_Box|cube]]''' with dimensions 60 x 30 x 30. Change the '''placement angle''' to -30 degrees.<br />
</translate><br />
<br />
[[Image:T101pwb01-08_chamfer1.png|center]]<br />
<br />
<translate><br />
The placement angle is using the '''placement vector''' (Axis) as axis of rotation. The default is the z-axis, which is not matching our target direction, changing the placement vector to the '''y-axis''' produces the desired orientation of the cutting tool for the chamfer.<br />
</translate><br />
<br />
[[Image:T101pwb01-09_chamfer2.png|center]]<br />
<br />
<translate><br />
The same placement can be attained with other values as well, the simplest alternative example of a placement that is the same is an angle of +30 degrees and a y-axis of -1.<br />
</translate><br />
<br />
<translate><br />
====Python console====<br />
</translate><br />
<translate><br />
Furthermore the position needs to be adjusted, looking at the drawing of the finished part, there is no direct dimension to use for the intended translation upwards. Since the upward dimension is the one needed, we have to calculate it. Let’s make use of the built in '''[[Python_console|python console]]''' for those calculations, it is basic trigonometry. If the FreeCAD python console is not visible for you, just right-click in an empty space in the toolbar area and check the ''python console'' and it should appear in the workspace, when there you should as well add the '''[[Report_view|report view]]''' if not already visible. The ''report view'' most of the times provides useful information or even hints of what to do next for different commands.<br />
</translate><br />
<br />
[[Image:T101pwb01-10_pyconsole.png|center]]<br />
<br />
<translate><br />
After importing the '''[https://docs.python.org/3/library/math.html#module-math math]''' module from the standard libraries in python we can use the formula ''(50 - math.tan(math.radians(30)) * 50)'' to find the distance in z-direction that the block should be moved. Copy the result of the formula from the python console and paste it into the z position for '''Cube001'''. The ''tool'' to use for the chamfer ''cut'' is now properly oriented and positioned.<br />
</translate><br />
<br />
[[Image:T101pwb01-11_chamfer3.png|center]]<br />
<br />
<translate><br />
====Expressions====<br />
</translate><br />
<translate><br />
One does not have to use the python console to do the calculation, In most cases when dealing with numeric parametric values, FreeCAD has a short-cut to a built-in calculator. It is called '''[[Expressions|Expressions]]''' in FreeCAD, you can enter the ''expression mode'' by first clicking in the spinbox for the z-position, a small blueish circular icon will appear at the right side.<br />
</translate><br />
<br />
[[Image:T101pwb01-12_expression1.png|center]] <br />
<br />
<translate><br />
Clicking that icon opens new window ''Formula editor'' where formulas and expressions can be entered as shown below. Using expressions is a powerful tool, since one can access parameters from the model, effectively making all parameters in the model available as variables to be used when creating an expression. In short, in our formula, instead of entering the number 50 when in the formula editor, we could enter a ''named parameter'' holding the value 50 from the cube, with the benefit that if we change the cube ''height'', the position of the chamfer will automatically follow. The value of 50 in the current model is referred to as ''Cube.Length'', i.e. the ''Length'' property of the ''Cube'' feature. Further information on this can be found on the wiki.<br />
</translate><br />
<br />
[[Image:T101pwb01-13_expression2.png|center]] <br />
<br />
<translate><br />
To make the cut, with the {{Button|Ctrl}} key pressed down first select the '''Fillet''' in the tree-view and then the latest created cube (named '''Cube001''') and finally in the toolbar press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]'''. Your tree-view should now again be a single object in the root called '''Cut'''.<br />
</translate><br />
<br />
[[Image:T101pwb01-14_model1.png|center]]<br />
<br />
<translate><br />
====The measurement tool====<br />
</translate><br />
<translate><br />
The '''[[Part_Measure_Menu|measurement tool]]''' in the '''Part WB''' can be used to check that our calculation and placement of the chamfer is correct.<br />
Press the [[Image:Part_Measure_Linear.svg|24px|link=Part_Measure_Linear]] '''[[Part_Measure_Linear|Measure Linear]]''' button and a ''task dialogue'' opens up, then select the 2 endpoints of one side of the chamfer.<br />
</translate><br />
<br />
[[Image:T101pwb01-15_model1measure1.png|center]]<br />
<br />
<translate><br />
It checks out with an x dimension of 50 mm, clear the measurement and close the dialogue.<br />
</translate><br />
<br />
<translate><br />
===Creating the hole===<br />
</translate><br />
<translate><br />
To make the hole, press the [[Image:Part_Cylinder.svg|24px|link=Part_Cylinder]] '''[[Part_Cylinder|Cylinder]]''' button, set the ''radius'' to 5 mm and ''height'' to 50 mm.<br />
</translate><br />
<br />
[[Image:T101pwb01-16_cyl1.png|center]]<br />
<br />
<translate><br />
Next we need to position the hole according to the dimensions in the drawing. Change the view to [[Image:Std_ViewTop.svg|24px|link=Std_ViewTop]] '''[[Std_ViewTop|Top]]''' view, then right-click the '''Cylinder''' in the tree-view and select '''Transform''' from the pop-up menu.<br />
</translate><br />
<br />
[[Image:T101pwb01-17_cyl1translate.png|center]]<br />
<br />
<translate><br />
Change the ''Translation increment'' to 5 and use the red and green arrow to position the cylinder in the right position, moving it 15 mm in y and 65 in x by dragging the arrow ends with the mouse. Click {{Button|OK}} to close the ''Transform'' dialogue. To make the hole press the {{Button|Ctrl}} key and select the '''Cut''' and '''Cylinder''' in the tree-view, then press the [[Image:Part_Cut.svg|24px|link=Part_Cut]] '''[[Part_Cut|Cut]]''' button in the toolbar. Your tree-view should once again have a single object in the root called '''Cut001'''.<br />
</translate><br />
<br />
<translate><br />
Congratulations, the model is now ready.<br />
</translate><br />
<br />
[[Image:T101pwb01-18_model1complete.png|center]]<br />
<br />
<translate><br />
With the basic model ready, let us explore different ways to alter this model, some examples are related to the appearance, additional features, or simply a different way to do the same.<br />
</translate><br />
<br />
<translate><br />
==Changing color and transparency==<br />
</translate><br />
<translate><br />
There are several different ways one can change appearance of objects, for this case, lets use the view tab in the property part of the combo view. First select the object in the tree-view and then edit any property like line color, face colors or transparency via the '''view tab''' (found at the bottom of the ''combo view'').<br />
</translate><br />
<br />
[[Image:T101pwb02-01_appearance1.png|center]]<br />
<br />
<translate><br />
Unfortunately when the object is selected it is a bit hard to see how it will look like when tuning the new appearance. To see the final look one has to deselect the object. Here is the new look of the model, where one now can see the through hole also in the iso-view. Another way to edit the appearance is via the {{MenuCommand|View → [[Image:Std_SetAppearance.svg|24px|link=Std_SetAppearance]] Appearance...}} menu.<br />
</translate><br />
<br />
[[Image:T101pwb02-02_appearance2.png|center]]<br />
<br />
<translate><br />
==A different way to locate the hole==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete the cut that added the hole and move the cylinder back to zero position. Your model should look like the below picture, which is the starting point for using a different technique to locate the hole at the center of the upper face. Note that the color is back to the default gray, the change in appearance we did was on the cut-feature which now is deleted.<br />
</translate><br />
<br />
[[Image:T101pwb03-01_cyl.png|center]] <br />
<br />
<translate><br />
This time the [[Image:Workbench_Draft.svg|24px|link=Draft_Workbench]] '''[[Draft_Workbench|Draft Workbench]]''' will be used to locate the hole. The hole is as before to be located at the center of the upper face, which is the same as the midpoint of the diagonal of the upper face.<br />
Start by switching workbench to '''Draft''', it might be that a ''grid'' appears in the 3d view, the grid visibility can be toggled with [[Image:Draft_ToggleGrid.svg|24px|link=Draft_ToggleGrid]] [[Draft_ToggleGrid|Toggle Grid]] in the toolbar. When making use of the '''[[Draft_Snap|snap]]''' functionality in the '''Draft WB''' it helps if one only have the ''snap types'' of interest enabled, this time it is sufficient to leave ''endpoint, midpoint and circle center enabled'', so the settings for snapping should look something like below.<br />
</translate><br />
<br />
[[Image:T101pwb03-02_snap.png|center]]<br />
<br />
<translate><br />
Finding the point to place the center of the cylinder could be done by making a diagonal as helpline and use the center of the cylinder and midpoint of the diagonal to identify the points to move between, however it turns out that we do not even need to make any helplines, we can snap on already existing solid geometry.<br />
</translate><br />
<translate><br />
Select the '''Cylinder''' in the tree-view (it turns green in the 3d view) and press the [[Image:Draft_Move.svg|24px|link=Draft_Move]] '''[[Draft_Move|Move]]''' button in the toolbar. A ''task dialogue'' opens for moving objects, make sure that ''Copy'' is unchecked.<br />
</translate><br />
<br />
[[Image:T101pwb03-03_move.png|center]]<br />
<br />
<translate><br />
Then move the mouse to the upper face of the cylinder so that you see a ''white dot'' in the center of the circle as per left picture below, this together with the center symbol next to the mouse pointer means that a left button mouse click will snap to the white point.<br />
</translate><br />
<br />
[[Image:T101pwb03-04_snapselect.png|center]]<br />
<br />
<translate><br />
When you have the white dot on the upper face, click the left mouse button, and repeat for the upper square face of the main solid, like the right picture above, and confirm the choice with a left mouse button click. The snap function makes use of ''mass-center'' for any type of face, and in this case the mass center is the same as the geometrical center that is sought after. You will by now have noticed that the move of the cylinder is animated, so you always see what is about to happen.<br />
</translate><br />
<translate><br />
Repeating the step of the '''boolean cut''' from earlier once again will make the through hole that completes the model. Using the '''linear measurement tool''' in part wb, a check that the hole is correctly placed is done. The measurement can only be done between ''points'', so the measurement is done from main body zero to the seam point of the cylinder, meaning that the correct distance is 70 mm instead of the 65 that is on the drawing when accounting for the extra radius that needs to be included in the distance.<br />
</translate><br />
<br />
[[Image:T101pwb03-05_modelmeasure.png|center]]<br />
<br />
<translate><br />
==Making the hole a countersunk hole==<br />
</translate><br />
<translate><br />
Create a ''cone'' by pressing the [[Image:Part_Cone.svg|24px|link=Part_Cone]] '''[[Part_Cone|Cone]]''' button in the toolbar (part wb), change ''radius1'' to 0 mm and ''radius2'' to 7 mm – this will give a 2 mm ''countersink'' on the radius. Making the ''height'' of the cone to 7 mm results in a 90 degree top angle of the cone, or 45 degree countersink angle. Worth to note is that for a 45 degree countersink one could as well use the [[Image:Part_Chamfer.svg|24px|link=Part_Chamfer]] [[Part_Chamfer|Chamfer]] operation, currently limited to only 45 degrees. By using a cone we can easily edit the top angle of the cone by changing the height of the cone.<br />
</translate><br />
<br />
<translate><br />
When working with FreeCAD you will continuously be faced with several different ways to achieve seemingly the same end result. There is hardly any absolute truth in what is the right way to achieve a particular end result – however when looking in a specific context one specific workflow can be more flexible, allow for later features to actually be used etc. How you build 3d models will evolve over time as you along the way learn more and more about the features and capabilities of FreeCAD.<br />
</translate><br />
<br />
[[Image:T101pwb04-01_cone.png|center]]<br />
<br />
<translate><br />
Translate the cone so that it is ''concentric'' with the hole and ''coplanar'' with the main solid upper surface. Use any method described earlier in this tutorial to accomplish that.<br />
In the picture below the move is made with ''Transform'' and an ''increment'' setting of 1 mm, since the cone has a characteristic dimension of 7 mm, meaning that the earlier increment setting of 5 mm will not allow for correct positioning. The [[Image:Std_DrawStyleWireFrame.svg|24px|link=Std_DrawStyle#Wireframe]] '''[[Std_DrawStyle#Wireframe|Wireframe]]''' rendering is used to easier see that the cone is in the right position.<br />
</translate><br />
<br />
[[Image:T101pwb04-02_conetranslate.png|center]]<br />
<br />
<translate><br />
To complete the model, lets make use of the [[Image:Part_Boolean.svg|24px|link=Part_Boolean]] '''[[Part_Boolean|Boolean]]''' command instead of first selecting objects and apply a specific boolean operation. Press the toolbar button and a ''taskpanel'' opens as per below picture to the left.<br />
</translate><br />
<br />
[[Image:T101pwb04-03_boolean.png|center]]<br />
<br />
<translate><br />
Three items needs to be specified, the ''operation type'', the ''first shape'' and the ''second shape''. The cone is supposed to be cut, this is called ''Difference'' in this command, instead of ''Cut''. The first shape is our '''Cut001''', it is listed under ''compounds'', since it is build from several solids. The second shape is the '''Cone'''. Once the correct settings are made for the command, click the {{Button|Apply}} button to execute the operation. This has all been done in the picture to the right, and there one can also see that a ''compound'' '''Cut002''' is now listed, this is our final model shape. After having changed appearance the final model looks like this.<br />
</translate><br />
<br />
[[Image:T101pwb04-04_modelcomplete.png|center]]<br />
<br />
<translate><br />
==Making a hollow piece==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. FreeCAD has all of the typical operations of a 3D modeller, one of them is [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''', which is used to ''hollow out'' parts.<br />
</translate><br />
<br />
<translate><br />
Rotate your model so that the bottom face is visible.<br />
</translate><br />
<br />
[[Image:T101pwb05-01_frombottom.png|center]]<br />
<br />
<translate><br />
Select the ''bottom face'' of the model, then In [[Part_Workbench|Part Workbench]] select [[Image:Part_Thickness.svg|24px|link=Part_Thickness]] '''[[Part_Thickness|Thickness]]''' and the screen should look like below.<br />
</translate><br />
<br />
[[Image: T101pwb05-02_thickness_cmd.png|center]]<br />
<br />
<translate><br />
Click {{Button|OK}}, as you can see there are now a ''radius'' on the hollowed out part.<br />
</translate><br />
<br />
[[Image:T101pwb05-03_thickness_dimension.png|center]]<br />
<br />
<translate><br />
Moreover, when taking a measurement of the width of the part, it is now 32 mm, so the ''thickness'' has been applied ''outwards''. Let’s edit that, double-click the model in the tree-view and modify the ''join-type'' settings to ''intersection'' and the ''thickness'' setting to -1.<br />
</translate><br />
<br />
[[Image:T101pwb05-04_thickness_modify.png |center]]<br />
<br />
<translate><br />
Now the outer width of the part is 30 mm, same as before and the corners are all sharp corners.<br />
</translate><br />
<br />
[[Image:T101pwb05-05_thickness_modified.png|center]]<br />
<br />
<translate><br />
==A different way to position the chamfer==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete features so that the model looks like below.<br />
</translate><br />
<br />
[[Image:T101pwb06-01_startingpoint.png|center]]<br />
<br />
<translate><br />
Make a '''Cube''' with dimensions '''30x30x60''', ending up like below.<br />
</translate><br />
<br />
[[Image:T101pwb06-02_with_cube.png|center]]<br />
<br />
<translate><br />
Change '''placement''' by first rotating -120 degrees around Y-axis.<br />
</translate><br />
<br />
[[Image:T101pwb06-03_rotated_cube.png|center]]<br />
<br />
<translate><br />
Finally, change position to '''X=50''' and '''Z=50''' and make the ''cut'' to produce the same result as earlier.<br />
</translate><br />
<br />
[[Image:T101pwb06-04_cube_cut.png|center]]<br />
<br />
<translate><br />
This once again highlights that there are always several ways to produce the same outcome, which is a reoccurring theme when it comes to 3d modeling. When it comes to basic geometries or solids, one can use different workbenches in FreeCAD as well as different commands and still have the same outer shape of a solid. You simply need to find your own way to a set of preferred tools and workflow that you are comfortable in using. Modeling in parametric 3d is a process of constant learning, and takes practice to master.<br />
</translate><br />
<br />
<translate><br />
==Editing dimensions, face colors and TNP==<br />
</translate><br />
<translate><br />
FreeCAD is a parametric 3d modeler, this allows you to change any ''placement'' or ''dimension'' and the model is updating accordingly. In general this works, but it is possible to break a model when edited – for example when a fillet is based on an edge that no longer exists due to editing. When a model breaks during editing, it is referred to as '''TNP, Topological Naming Problem'''.<br />
</translate><br />
<br />
<translate><br />
Go ahead and experiment with changing dimensions and placements to see if you can break the model, do not forget to recalculate the model after changes if required. This can be done with the [[Image:Std_Refresh.svg|24px|link=Std_Refresh]] [[Std_Refresh|Refresh]] button in the toolbar, if the icon is grayed out it is not needed to refresh the object.<br />
</translate><br />
<br />
<translate><br />
===Reposition the cylinder===<br />
</translate><br />
<translate><br />
Here is an example of the cylinder moved from the center to one side of the main body by using ''Transform'' on the cylinder. As can be seen in the picture, the cone is still in the original position, not affected by the move of the cylinder.<br />
</translate><br />
<br />
[[Image:T101pwb07-01_cylindermoved.png|center]]<br />
<br />
<translate><br />
When you move the cylinder and break through the outer surface, in version 0.19 you are loosing part of the color settings on your model. FreeCAD reverts to the user default settings for shape colors and transparency in the 3D-view, however the '''Cut002''' shape still shows the colors and transparency that it had before as seen in below picture.<br />
</translate><br />
<br />
<translate><br />
===Fixing the colors===<br />
</translate><br />
[[Image:T101pwb07-02_wrongcolor.png|center]]<br />
<br />
<translate><br />
Here is one way to get it back. First change ''transparency'' one tick up or down and then back, that brings back the transparency. You can do the same trick on shape color. Another way to get the color back is to ''right-click'' '''Cut002''' in the tree-view and select '''Set Colors''' in the context menu. In the ''task panel'' that displays, click {{Button|Set to Default}}, that brings back the color to the one set in the view-properties.<br />
</translate><br />
<br />
[[Image:T101pwb07-03_set_colors.png|center]]<br />
<br />
<translate><br />
The '''Set Colors''' command allows you to select individual faces of a shape and set a unique color on the selected faces.<br />
</translate><br />
<br />
<translate><br />
===Multiple solids===<br />
</translate><br />
<translate><br />
Another example where the cube that is making the chamfer has been translated and rotated.<br />
</translate><br />
<br />
[[Image:T101pwb07-04_3solids.png|center]]<br />
<br />
<translate><br />
As can be seen when repositioning the chamfer in this way, the end result is ''3 disjoint solids''. [[Part_Workbench|Part Workbench]] allows this, [[PartDesign_Workbench|PartDesign Workbench]] does not, either you will get an ''multiple solids error'' or it will simply not render all solids.<br />
</translate><br />
<br />
<translate><br />
===TNP===<br />
</translate><br />
<translate><br />
Going back to the original completed model, let’s explore how the faces are named.<br />
Here the '''[[Selection_view|selection view]]''' has been made active, just to show clearly what is selected and not, also coloring is adjusted so that selection becomes easier to see.<br />
</translate><br />
<br />
[[Image:T101pwb07-05_face2and9.png|center]]<br />
<br />
<translate><br />
Selecting one side face and the cylinder inner face gives that they are internally called face ''2'' and ''6'', where face ''2'' is the side face. Face numbering can be different for you.<br />
Moving the cylinder so that the cavity ends up on the side face, and doing the selection of faces now gives a different number for the cylindrical face.<br />
</translate><br />
<br />
[[Image:T101pwb07-06_newfacenumbers.png|center]]<br />
<br />
<translate><br />
Face 2 is the right side of the original face 2, the left side of former face 2 is now face 8. The cylindrical part was face 9, but is now face 7. FreeCAD reassigns the numbering and the order is not necessarily preserved. The total face count in the first model is 10, in the version with the cylindrical face piercing the side face, the total face count is 11. So obviously face numbering has to change when the so called ''topology'' changes. This probably feels like a minute detail, but turns out to be quite important in parametric 3d cad. Imagine that you have used the cylindrical face as reference for another feature, it used to be called face 9, but is now called face 8. The reference to the intended cylindrical surface is lost. Since FreeCAD, at least in currently released versions does not keep track of the ''intended face'', it only keeps track of the ''numbered face'' a model breaks when a reference is made to a face that later is renumbered. This is called '''TNP, Topological Naming Problem'''.<br />
</translate><br />
<translate><br />
You are encouraged to learn how to avoid broken models due to TNP, further reading can be done elsewhere on the [[Topological_naming_problem|wiki]], which largely focus on a ''sketch driven'' workflow, the underlying mechanism is the same though. The renumbering described here for faces goes for all geometrical entities, faces, edges and vertexes.<br />
</translate><br />
<br />
<translate><br />
==Organizing the tree a bit differently==<br />
</translate><br />
<translate><br />
Do a ''save-as'' under a new name. Then delete all the cuts ending up in a model looking like below.<br />
</translate><br />
<br />
[[Image:T101pwb08-01_primitives.png|center]]<br />
<br />
<translate><br />
When using '''Part WB''' and modelling feature rich solids, then the tree structure of a solid can become cumbersome to decipher. So far we have created one primitive / feature and applied a boolean operation. In Part WB one can bundle primitives into one boolean operation. In our case we have the cylinder, cone and cube that are all a cut boolean operation.<br />
Instead of making a cut for each primitive, we can first apply a boolean union, [[Image:Part_Fuse.svg|24px|link=Part_Fuse]] '''[[Part_Fuse|Fuse]]''' the primitives intended for the boolean cut, and then make the ''cut'' between the '''Fillet''' and the '''Fusion'''.<br />
</translate><br />
<translate><br />
Using this approach, the tree-view ends up looking like below, which is just a different way of building the same model. Compare this with the original tree-view, none is better than the other, however when making more complex models one approach over the other, can have benefits in ease of modifying/reorganizing the model if needed.<br />
</translate><br />
<br />
[[Image:T101pwb08-02_fused.png|center]]<br />
<br />
<translate><br />
==Wrapping up==<br />
</translate><br />
<translate><br />
Having gone through the tutorial you are now briefly acquainted with the user interface of FreeCAD and you have learned the basics in using '''Part WB'''. You should now be able to build simple models after your own liking. '''Part WB''' is one of the workbenches that can be used to create solids, '''PartDesign WB''' is another. The different workbenches have different capabilities and workflows. Learning FreeCAD in full, especially considering all add-ons and macros takes years, so keep on exploring new and different ways of making models – take different tutorials on the wiki, the learning never stops when working with FreeCAD. It is suggested that you learn ''sketches'' and '''PartDesign WB''' next if your focus is on creating solids. If your focus is modelling buildings your next learning should be the '''Draft''' and '''Arch''' workbenches.<br />
</translate><br />
<br />
<translate><br />
At last, FreeCAD is made by volunteers in their spare time. If you want to further advance FreeCAD’s capabilities, consider [[Help_FreeCAD|contributing]] to FreeCAD, for example by improving documentation.<br />
</translate></div>Hedahttps://wiki.freecad.org/index.php?title=File:T101dwb07-02_sketchvalidate.png&diff=1148294File:T101dwb07-02 sketchvalidate.png2022-06-05T10:29:55Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=File:T101dwb07-01_geocheck.png&diff=1148293File:T101dwb07-01 geocheck.png2022-06-05T10:29:33Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=File:T101dwb06-03_sketchextruded.png&diff=1148292File:T101dwb06-03 sketchextruded.png2022-06-05T10:28:48Z<p>Heda: </p>
<hr />
<div></div>Hedahttps://wiki.freecad.org/index.php?title=File:T101dwb06-02_sketchedit.png&diff=1148291File:T101dwb06-02 sketchedit.png2022-06-05T10:28:24Z<p>Heda: </p>
<hr />
<div></div>Heda