Proiect de tutorial Învechit
|Time to complete|
Acest tutorial vă va învăța cum să utilizați aplicația FreeCAD 2D drafting module (numit și Draft module) pentru a crea un desen simplu de arhitectură. În acest scop, vom desena o cabină de zidărie simplă. Să presupunem că avem un desen CAD care arată locația cabinei și o vom folosi pentru proiectul nostru. Vom desena un plan, o secțiune și două elevații.
Înainte de a începe
Rețineți că FreeCAD se află încă în faza incipientă a dezvoltării, astfel încât să nu puteți fi la fel de productivi comparativ cu altele de genul CAD și veți întâlni cu siguranță bug-uri sau veți experimenta accidente. FreeCAD are acum posibilitatea de a salva fișierele de rezervă. Numărul fișierelor de rezervă poate fi specificat în dialogul de preferințe. Nu ezitați să permiteți 2 sau 3 fișiere de rezervă până când nu știți cum să faceți față cu FreeCAD.
Salvați-vă munca din când în când, sub un nume diferit, astfel încât să aveți o copie "sigură" pentru a reveni și să fiți pregătiți pentru posibilitatea ca unele comenzi să nu vă dea rezultatele așteptate.
Configurarea spațiului de lucru FreeCAD
FreeCAD este un modelator 3D, dar în acest tutorial îl vom folosi doar pentru lucrul în 2D. Așadar, vom desena în planul solului și tot ceea ce vom face va avea o coordonată Z zero. Deci, în primul rând, să ne punem în vedere prin apăsarea butonuluiși asigurați-vă că suntem în proiecție ortografică (key ) altfel s-ar putea să fim păcăliți de unele efecte ale perspectivei.
Another very important thing to do, is to give custom hotkeys to your Draft commands. So you can do all the commands from the keyboard, which will drastically improve your speed. Basically you can do about everything from the keyboard, and will need the mouse only to draw points and select objects. Go to menu Customize -> Keyboard -> Category Python and select shortcuts as you like, a good idea is to make them easy to remember. For example, I use L for Line, W for Polyline (also called Wire in FreeCAD), A for Arc, C for Circle, M for Move, R for Rotate, F for Offset (O is already taken by Orthographic), D for Dimension, T for Text, etc...
Now we are set up, we can begin to draw.
Importing CAD drawings
If you are going to import a 2D cad drawing, chances are high that they will be in a proprietary format such as .dwg (from AutoCAD) or .mcd (from VectorWorks). The specification of those file formats are being kept secret by their vendors, so it is extremely difficult or totally impossible for FreeCAD to support them. However, One file format that is fairly well documented is the DXF format, and the Draft module supports it partially.
Almost all CAD applications can export to the DXF format, and you also have several free converters such as openDWG's "Teigha file Converter" utility, that will allow you to convert your file to the DXF format. For example, Doublecad is a free, fully functional CAD program that allows you to export DXF files:
Open your DXF file simply with the File -> Open dialog. Several import settings can be configured in the Draft Preferences screen. For example, you can configure if you want the DXF file to be imported with original colors and linewidths, or converted to current Draft color, that you see at the right side of the Draft command bar. But in FreeCAD you won't need to attribute ugly colors to your objects to determine their linewidth. Objects all have independent color and linewidth attributes. So, you can very well forget about DXF colors, or convert everything to the colors of your choice.
After importing your drawing in FreeCAD, it will look like this:
Let's begin with doing some cleaning.
Let's put all our objects into one new group, and turn off everything we won't use, like vegetation and dimensions, to speed up our work.
Drawing the plan view
Using the drawing tools
The only thing we'll need at the moment is the area that is assigned to our cabin. It lies in a separate group named "projection". So we can basically turn off everything else with thekey, and start drawing on top of it. We will draw a small cabin with a guard room and a WC, in very simple structural masonry, so there won't be any need for special concretework in the plan itself. But we'll put a layer of plaster inside, and a layer of ceramics outside.
So, let's begin with doing the general shape of our walls:
Our DXF drawing was drawn in meters, so unless we have any reason to change that, we'll continue with the same units. FreeCAD currently does not have a friendly system to work with real-world units, so we simply assume that "one" means "one meter".
Another good thing to remember is to construct temporary geometry whenever you need. You want a point that lies 2 meters away horizontally? Draw a vertical line, move it 2m away, pass a horizontal line through it, there is your point.
- Create a rectangle: Snap its cornerpoints with to the corners of the assigned area
- Offset the rectangle: With the rectangle selected, press Offset, press to turn on copy mode, move your mouse inside the first rectangle so offset knows in which direction to go, and type 0.20, Enter
- Turn them into a face: Upgrade the first rectangle, upgrade the second rectangle, then select the outer rectangle, CTRL-select the inner rectangle and press Downgrade
- Create the door opening: Make a 1.00 x 0.50 rectangle, move it to the upper corner of our main wall (press to turn copy mode off).
- Move the door opening to the right position: Move it 0.10 to the left. We won't put our opening directly on the corner, because it would make the door difficult to open.
- Subtract the door opening: Select the wall, CTRL-select the door opening, and press downgrade.
A note about upgrade & downgrade
Now, you must be aware that the openCasCade kernel that FreeCAD is built upon, is a 3D kernel. It is made primarily for 3D operations. When it has to cut or unite planar faces, like we are doing now with upgrade/downgrade operations, it sometimes does strange things, and subsequent operations (like other upgrades/downgrades) sometimes don't give the expected results. Of course with time those behaviours will end up being corrected by the FreeCAD developers, but it is wise to know alternative ways to solve immediate problems.
The best way to solve a face that isn't upgrading/downgrading/offsetting correctly, is simply to downgrade it until it is all exploded to single edges, then upgrade those edges together again up to a new face. In case that doesn't work either, simply redraw a new wire (polyline) on top of the problematic face, snapping to its endpoints, then delete the old face and upgrade the new wire. Usually a face that you draw yourself is in much better shape than a face that you obtained by upgrade/downgrade.
Another thing to keep in mind is that when you subtract a shape from another, you can find yourself with one object containing several faces. This might difficult your further work (they don't offset correctly, etc), so a good thing in that case is always to separate them with the downgrade tool.
Another note about snapping
There are two forms of snapping in the Draft module: passive snap, which occurs when you simply pass your mouse cursor over an object (an open circle symbol appears), and active snap, which is when you press. Active snapping allows you to snap to specific points on an object, like its endpoints, midpoints, centers, or intersections with other objects. If you press , which is the key for constraining horizontally and vertically, you gain even more snapping points. But this has a cost, because FreeCAD must do many calculations in real time. If you have many objects, you'll begin to feel the difference. So a good trick to speedup your work is to take the habit of working as much as possible with and passive snapping only. You will see quickly that you'll obtain accurate results and work much faster.
So let's go back to work:
- Create a 10cm-wide wall between the main room and the WC. Upgrade it, then upgrade it together with the main wall to unite them
- Create other rectangles for your other openings. I put a 60cm-wide window in what will become the WC, a 80cm door between the main room and the WC, and for the big window in the main room I simply left 40cm wall at the left and right side.
- Offset all the walls of 1cm, to make a cement/plaster layer, then downgrade the offsetted copies to turn them into simple wires
- Create a layer of ceramics on the exterior side, by offsetting our plaster line 2cm, then drawing a 2cm-thick shape between the two lines
- Delete the 2cm offset. that we don't need anymore, as well as all construction geometry. If you feel you might need them later, simply put them in a separate group and turn that group off with .
This is where we are now (I kept construction geometry there, in blue, for you to see):
Importing and building compound objects
In FreeCAD, compound objects are objects made with the geometry of several other objects. In other softwares, it is called blocks, symbols or components. It is a very handy way to group geometry under one single object. Any of the objects created with the draft module can be grouped into a compound. The command to create a compound is the Upgrade command. The use is simple, select everything you want to turn into a compound, and press Upgrade. If no other more intelligent shape can be created, they will be turned into a compound.
Using compound geometry is specially useful to build a symbol library on your disk, so you can reuse them later. One cool use of this, coupled to the DXF import function, is that you can very easily use symbol libraries in DXF format (if your symbols are in dwg format, the free "Teigha file Converter" application can batch-convert all your library at once).
Once you have a library of DXF symbols, just drag one of them and drop it on top of your open FreeCAD window and it will be imported in the current document. It won't be imported as a compound, but all of the symbol geometry will be placed in a separate group, so it is easy to select it all and simply press "Upgrade". Beware that AutoCAD users have the bad habit of drawing things very far from the origin point (0,0,0), your inserted symbol can then lie very far from your drawing zone.
So, back to our drawing:
- Import a sanitary block if you have one, or pick one on the Cad Exchange site, and convert it to DXF with the "Teigha file Converter"
- Create the geometry for a door, upgrade it to a compound, copy it to the other door location, downgrade it, adjust the elements to the new size, and upgrade it again
- Do the same for the windows
Dimensions and annotations
Now that our plan is more or less ready, we can add dimensions and texts. This is usually pretty straightforward, so there is probably no need to explain much. Just try to dimension everything, and as a convention, always start the dimension lines from the main wall line, not the finishing layer. One thing is good to know, sometimes you draw a text or a dimension over a filled area, and the filled area will cover your dimension. There is a simple way to fix that, it is by downgrading and upgrading again the filled area. It will then be displayed under the other elements.
The dimension and text will by default have the same text height, which can be changed in the Draft Preferences page. You can then edit individually each text height.
Unfortunately certain non-geometry objects like texts and dimension are still not selectable in the FreeCAD 3D view, you must therefore select them in the tree, and you won't be able to snap to them, but this will probably be solved in a near future. It is also not possible at the moment to choose a font style. To align dimensions, at the moment, you need to draw a line first, then snap your dimensions to that line.
Finally, we can add a few things to finish our plan, like putting vegetation around the cabin. We can simply copy a few trees from our imported DXF drawing and scale them down with the scale tool, to for example (0.5,0.5). We can also change the line thickness of a couple of objects, for example make the walls thicker, and change the color of some things. And we can organize all our elements in groups.
The ability to organize your work in nested groups is surely one of the big advantages of groups over traditional work with layers. In this tutorial, I grouped my objects by type, inside the Plan group. For example, instead of having one big layer with all dimensions of your drawing, each part of the drawing will contain their own dimensions group, making it extremely easy to organize your drawing.
You might feel a loss at first if you come from a traditional drawing program like AutoCAD, but you'll quickly see the power that this method brings.
For example, all our construction geometry can go in a separate group, that we'll turn off. Maybe later we'll need to make some changes, and it will be handy to have that geometry available.
So, now we are ready to draw other parts...
Din moment ce în acest exercițiu vom rămâne în 2D pur, vom extrage direct elementele și secțiunile noastre. În medii mai avansate de arhitectură (ceea ce va deveni, în viitor, în viitor), nu ar trebui să desenăm elevațiile. Am modelat clădirea în 3D și apoi vom genera automat vizualizările diferite.Dar, de dragul acestui exercițiu (și, de asemenea, deoarece toate instrumentele necesare nu sunt încă implementate în FreeCAD), o vom face manual, ca pe vremuri.
We'll begin with the rear wall elevation, because the way our plan is oriented, it can be drawn directly below it, without the need to rotate the view. We will simply draw construction lines from the plan, set horizontal lines to the desired heights, I set the 0.00 level, the +0.15 level of the slab, then heights for the windows, and the roof slab at +2.50. We can then draw our geometry very quickly on top of it.
We can then place a couple of annotations, dimensions, and upgrade some of the objects so they appear filled with a color. Finally, we can make a bit of cleaning by creating a "South Elevation" group, then subgroups for our construction geometry and annotations, and place all of our new objects in them.
Rotația vederii și crearea macrocomenzii
Now, we need to draw other elevations of our little building. The simplest way would be to draw them directly under the plan view, as we did with the south elevation. For this, it would be handy to be able to rotate the view by 90°, so we can continue drawing our elevations "on foot". Unfortunately, FreeCAD has at the moment no "Rotate View" tool. But, fortunately, it has tools for us to easily create our own tools, called Macros. So, this is a good opportunity for us to try something easy.
Macrogramele, precum și toate scripting-urile din FreeCAD, se fac într-o limbă de programare foarte simplă python. Puteți scrie programe foarte complexe în FreeCAD în Python, dar o puteți utiliza și pentru a efectua operații foarte simple în cazul în care nu există încă o pictogramă a barei de instrumente FreeCAD, cum ar fi instrumentul Rotate The View. Deci, primul lucru de făcut, deschideți vizualizarea Report, dacă ați închis-o și selectați tabu-ul Python. Înăuntru, tastați (sau copy/paste) următorul cod:
import math from pivy import coin cam = Gui.ActiveDocument.ActiveView.getCameraNode() rot = coin.SbRotation() rot.setValue(coin.SbVec3f(0,0,1),math.pi/2) cam.orientation = rot
Acest script mic va roti pur și simplu vizualizarea cu 90 ° (stânga). Pentru rotirea cu -90 ° (dreapta), vă schimbați pur și simplu math.pi/2 by -math.pi/2. For rotating by -90° (right), you would simply changeScripting secțiune pe acest wiki.
Acum, trebuie să facem încă un pas, care ne salvează codul într-o macrocomandă, astfel încât să putem reutiliza ulterior. Deci, în loc să ne lipim codul în interpretul python, putem să deschidem managerul macro (Tools -> Macros), creați o macrocomandă nouă, apăsați butonul "Editați" și inserați codul în el. Închideți fila Editor macro și macro-ul va fi salvat.
Macro-urile se pot comporta ca orice alt instrument FreeCAD. Cu Tools -> Customize menu, putem adăuga o pictogramă la macrocomanda noastră, o comandă rapidă de la tastatură și o putem adăuga la o bară de instrumente.
Desenarea vederilor rotite
Acum, că putem roti vederea după voința noastră, putem atrage celelalte cote ale noastre. Cea mai ușoară modalitate este să vă desenați elevația la locul potrivit sub planul vizual și să utilizați o oglindă (o linie orizontală de 45 °) pentru a împinge liniile de înălțime de la altă elevație. În acest fel, desenul merge destul de repede.
În cele din urmă, desenați alte 2 elevații și, din moment ce al patrulea este același cu cel de-al doilea (dar în oglindă), îl vom ignora. Putem apoi trage o secțiune transversală, iar desenul nostru este complet: