From 465cd38670a4184e39b3a7b9007a437d319f9f61 Mon Sep 17 00:00:00 2001 From: Will Date: Thu, 25 Oct 2018 18:56:16 +1100 Subject: [PATCH 1/2] added some more information about placements and placement matrices --- python_scripting/a_gentle_introduction.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/python_scripting/a_gentle_introduction.md b/python_scripting/a_gentle_introduction.md index 3d42849..0295d42 100644 --- a/python_scripting/a_gentle_introduction.md +++ b/python_scripting/a_gentle_introduction.md @@ -96,6 +96,26 @@ otherpla.Base = FreeCAD.Vector(5,5,0) box.Placement = otherpla ``` +Placement can be a difficult concept to grasp at first. Calling FreeCAD.Placement, you can optionally enter in position, rotation, and center values. This will generate you a placement matrix. + +For example, + +``` +yaw = 3.5 +pos = App.Vector(0, 0, 0) +rot = App.Rotation(yaw, 0, 0) +center = App.Vector(0, 0, 0) +newplace = App.Placement(pos, rot, center) +``` + +After that, you can alter your placement matrix by multiplying it, + +``` +pitch = 2.3 +rot = App.Rotation(0, pitch, 0) +newplace = App.Placement(pos, rot, center).multiply(newplace) +``` + **Read more** * Python: https://www.python.org/ From d6fdbb655e6139dc459e36a94b590cfdeb1228bf Mon Sep 17 00:00:00 2001 From: Will Date: Thu, 25 Oct 2018 19:13:02 +1100 Subject: [PATCH 2/2] added comments about scripting with 2D drawings --- working_with_freecad/generating_2d_drawings.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/working_with_freecad/generating_2d_drawings.md b/working_with_freecad/generating_2d_drawings.md index 6d917f2..007a345 100644 --- a/working_with_freecad/generating_2d_drawings.md +++ b/working_with_freecad/generating_2d_drawings.md @@ -69,6 +69,9 @@ Our page can now be exported to SVG to be worked further in graphical applicatio * The file created during this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/drawing.FCStd * The SVG sheet produced from that file: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/drawing.svg +**Scripting with 2D Drawings** +To script with 2D drawings can be a challenging process. For the moment we will discuss this with the 0.16 version of FreeCAD. In general, you can only place one part onto the sheet, so you will need to recursively compound your various parts into 1 part. The second difficulty in producing automated drawings is in the placement of the views. In general there is a way to dump SVG of 1 view, but not of all the views at once. As such, you need to selectively dump the SVG of the views you are after, and then place them onto the SVG of the drawing sheet with SVG methods. + **Read more** * The Drawing Workbench: http://www.freecadweb.org/wiki/index.php?title=Drawing_Module