|
home -
services - guestblog |
last update: 16.10.2008 | ||
| THE FREECAD DRAFT MODULE | ||
![]() | ||
| more or less recent screenshot | ||
| This is my work
plan for playing with
basic 2D CAD functions in FreeCAD.
The latest release of the Draft
module can always be downloaded here....
Just unzip it in your "Mod" folder and run FreeCAD, it is as
simple as that. Note: From now on, the Draft module has been adapted to work with new features availible in FreeCAD since build 1615. So, if you have an older build of FreeCAD, you must use the older 0.0 version of draft, still availible here. With recent FreeCAD, it is also possible to install your new modules in 2 different places: either the system-wide Mod directory that lies inside the FreeCAD dir, either in ~/.FreeCAD/Mod (~ is your user dir). From now on you need pyqt4 (python extension for accessing Qt interfaces) and pivy (python extension for accessing coin scenes) working on your system. If you are on linux, PyQt4 is generally availible from standard repositories, while for pivy you'll probably need to build it yourself. You'll find instructions on the FreeCAD forums (see the thread below) or on this page on the FreeCAD wiki. Other note: in official windows builds, those 2 modules are already included in FreeCAD, so, nothing to install, yay! This plan shows what I would like to make, just for me to have a path to follow. I am not sure all that is here is possible to implement, neither if I will be able to do it. It is just something I would like to try. I am until now using only python with the standard modules (included in the official dist) and PyQt which is not but seems highly indispensable... The overall strategy is to make something as simple and non-obstrusive as possible, to keep te interface clean. Ideally, the module should have just a small toolbar, that you can just hide once you know all its keyboard shortcuts. If you find all this interesting and have the will and capacity (python programming mainly) to help me, you are welcome... Drop me a line on this site (main page or guestblog) or on the FreeCAD forums. There is also a dedicated forum thread on sourceforge where I put news and thoughts about this. |
||
| HISTORY | ||
| 08.04.2007 When I am writing this plan, the DXF import function is working. I am now playing a bit with PyQt... 17.04.2007 SVG importer working! 09.07.2007 PyQt4 working again in FreeCAD. 16.07.2007 Trying to achieve mouse click detection from a PyQt4 widget. I think the most we can do in pyqt the best FreeCad is kept "clean"... 30.11.2007 From now on, pyqt4 is required to use this module. I have now a basic line/polyline drawing function working. 15.12.2007 Line drawing function working (only tested on Linux until now). SVG import not working anymore :( 20.12.2007 Line function upgraded 31.12.2007 As a new-year goodie, the circle drawing function works now! 17.01.2008 Arc function working, and text input workflow enhanced 27.01.2008 Escape key now cancels the current command Snap extended to midpoints and circle quadrants 28.02.2008 Move function is working 04.03.2008 added a copy behaviour to the move function, and a function to apply current style to selected objects 17.03.2008 rotate function added 30.04.2008 bugs corrected, code cleaned, added import mode to dxf import 19.06.2008 after a long stop, development continues! I added an offset function now, that I modestly believe is better than Autocad! 21.06.2008 DXF export is working, but still very basic 28.08.2008 Adapted to the new Part module. New Part module rocks!!! 04.09.2008 Added upgrade & downgrade tools 23.09.2008 Added rectangle and text tools 16.10.2008 Lots of cleanup, dxf export now working inside FreeCAD export framework. There is also intersection snap now |
||
| A. IMPORT/OPEN FUNCTIONS | ||
| 1. DXF import | A function to import DXF files | |
| Status: | ||
| Working Partially implemented. Some object types are imported, some not. I will work further on this part when FreeCAD will gain more object types. Right now, all object types contained in the DXF file that are compatible with FreeCAD objects import without problems. Screenshots here. DXF object types read by this script + implementation in FreeCAD:
At the moment, everything is imported in black. I intend to put something in the preferences screen to be able to choose if you want color , b&w, or color mapped to b&w thickness. |
||
| 2. SVG import | A function to import SVG files as workable 2D objects, in opposition to the built-in drawing module which imports svg files as sheet drawings. | |
| Status: | ||
| Working SVG objects that import at the moment:
|
||
| 3. OCA import | A function to import Open Cad Format files | |
| Status: | ||
| nothing yet | ||
| B. CREATION FUNCTIONS | ||
| 1. Line/Polyline | A tool for drawing lines, and polylines by clicking points on screen or entering their coordinates. | |
| Actions needed from FreeCAD developers: | ||
| Done - A method for clicking on the screen and getting 3d coordinates from it. Ideal would be the ability to query the mouse cursor position (I mean a 3d point under the cursor), and, separated, some mouseclick event. | ||
| Status: | ||
| Working USAGE:
|
||
| 2. Arc/Circle | A tool for drawing arcs and circles by specifying a center, a ray, a start and an end (to begin with. Later this can be diversified). Skipping start and end steps would simply produce a circle. If the line function is working, we should already have all we need. | |
| Status: | ||
| Working USAGE: About the same as the line function: Circle:
|
||
| 3. Rectangle | A tool to draw a rectangle. This might seem idiot, but rectangle is a very often used form in architecture. Many programs such as Vectorworks rely heavily on it. It would serve as a first experiment to draw "custom" objects in FreeCAD. Since it would involve quite a bit of programming from the developers, It will probably need some time to get done. | |
| Actions needed from FreeCAD developers: | ||
| A "custom" object, or a python object. Something that could "contain" other geometry, where we could define our own data and "onchanged" (redraw) methods. Since this touches the heart of parametric modelling, developers will certainly have many thoughts on it, so it might not happen the way I think. | ||
| Status: | ||
| Working but not parametric yet. | ||
| 4. Filled Shape | This would be a first step towards passing from 2D to 3D, as well as a tool to get closed shapes. So we could later make some kind of "hatch" function easily by assigning a texture, a procedure or any other kind of function to its filling. | |
| Actions needed from FreeCAD developers: | ||
| I'm afraid this feature must be almost completely installed in FreeCAD by the developers. | ||
| Status: | ||
| Working Simply create a closed polyline and upgrade it with the upgrade tool |
||
| 5. Complex Polyline/Object | This would basically be a polyline that can contain arcs. If my idea of the rectangle goes through and is working, I think it shouldn't be too difficult to make. | |
| Status: | ||
| Working just upgrade an arc and a polyline together. | ||
| 6. Text | I guess I don't need to explain. This is much less important, but would be nice... Well I give this a kind of low priority. The way to input text, interface to define fonts, etc... is all subject for a later time. | |
| Status: | ||
| Working but at the moment only 2d (screen) text, not 3d | ||
| 7. Complex Text | This would be text combined with other geometry, in order to produce interesting things like dimensions, arrows, signs, etc. Depends on the python object concept... | |
| Status: | ||
| Nothing | ||
| C. MODIFICATION FUNCTIONS | ||
| 1. Move | Select one or several objects, give a start point, give an end point, that's it. Something like with CTRL you would make a copy, with CTRL+SHIFT a linked copy (instance), etc... Normally it shouldn't require anything special once all the previous items are in place | |
| Status: | ||
| Working Moves all draft entities. Uses a provisory code, when more complex transformation matrix will be working in FreeCAD I'll adapt this code. Basically, select entities you want to move, and pick the start and end points.
|
||
| Actions needed from FreeCAD developers: | ||
| A tree with more functionality and some copy/link functions. | ||
| 2. Rotate | Same as above, sort of. | |
| Status: | ||
| Working Same behaviour as the move function |
||
| 3. Scale | Same thing again. | |
| Status: | ||
| Cancelled. Actually not very much used, so I'll focus on offset instead. | ||
| 4. Join | Quite simple: It joins the selected objects. Here I should study all the combinations, but to resume the resulting object is the simplest possible object type that can contain all the geometry of the selected ones. | |
| Status: | ||
| Working This tool upgrades selected objects in different ways, following this list (in order):
|
||
| 5. Explode/Separate | Easy too, selected objects get separated into smallest possible elements | |
| Status: | ||
| Working This tool downgrades selected objects in different ways, following this list (in order):
|
||
| 6. Trim/Extend/Fillet/Chamfer | This would be a kind of "magic" function that does all this with shift , alt, control combinations. maybe. I need to think better. | |
| Status: | ||
| Nothing | ||
| 7. Offset | This is certainly a bit tricky, I've seen that with other programs. It is hard to program. Well, later on I try. | |
| Status: | ||
| Working Just test it, it is fairly simple. You can choose which segment the offset is taken from with SHIFT, snap to points with CTRL, and create a copy with ALT. Note: Still some bugs around with arcs |
||
| 8. Add/Move/Delete points | This is way more complicated, as it would need some graphical "gadgets" (points?) in the viewport. Let's say I put this here to discuss it much later on. | |
| Status: | ||
| Completely remote... | ||
| D. EXPORT/SAVE FUNCTIONS | ||
| 1. DXF Export | No description needed, I guess... | |
| Status: | ||
Working. Things that get exported:
import exportDXF from the python interpreter.exportDXF.export() |
||
| 2. SVG Export | Same as above | |
| Status: | ||
| Nothing | ||
| 3. OCA Export | Open Cad Format exporter | |
| Status: | ||
| Nothing | ||
| E. DOCUMENTATION | ||
| And if all this manages to go somewhere, I'll write some docs too. | ||
| Status: | ||
| User documentation availible here. | ||