FreeCAD-Doc/localwiki/Manual-sv.html
2018-07-19 18:47:02 -05:00

9924 lines
761 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><title>Manual/sv</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Manual/sv</h1></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><p>Detta är FreeCAD manualen. Den innehåller de viktiga delarna ur <a href="https://www.freecadweb.org/wiki/index.php?title=Main_Page/sv" title="Main Page/sv">FreeCADs dokumentationswiki</a>. Den är avsedd att skrivas ut som ett enda stort dokument, så om du läser detta online, så kanske du föredrar att hoppa direkt till<a href="Online_Help_Toc.html" title="Online Help Toc">Online hjälp</a> versionen, vilken är lättare att använda.
</p><p><br />
</p>
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Crystal_Clear_app_tutorials.png" class="image" title="150"><img alt="150" src="Crystal_Clear_app_tutorials.png" width="128" height="128" /></a></div>
<h2><span class="mw-headline" id="V.C3.A4lkommen_till_FreeCAD_on-line_hj.C3.A4lp">Välkommen till FreeCAD on-line hjälp</span></h2>
<p>Detta dokument har skapats automatiskt av innehållet i den officiella FreeCAD wiki dokumentationen, vilken kan läsas online på <a rel="nofollow" class="external free" href="https://www.freecadweb.org/wiki/index.php?title=Main_Page">http://www.freecadweb.org/wiki/index.php?title=Main_Page</a>. Eftersom wikin underhålls och utvecklas kontinuerligt av FreeCAD communityn av utvecklare och användare, så kan du finna att online-versionen innehåller mer eller nyare information än detta dokument. Men vi hoppas i alla fall att du kommer hitta all den information du behöver här. Om du har frågor som du inte kan hitta svaren på i detta dokument, ta en titt på <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/index.php">FreeCAD forumet</a>, där din fråga kanske finns besvarad, eller du finner någon som kan hjälpa dig.
</p>
<h3><span class="mw-headline" id="Hur_man_anv.C3.A4nder_detta_dokument">Hur man använder detta dokument</span></h3>
<p>Detta dokument är uppdelat i flera avsnitt: introduktion, användande, skriptning och utveckling, de sista tre är specifikt tillägnade de tre breda FreeCAD användarkategorierna: slutanvändare, som helt enkelt vill använda programmet, experter, som är intresserade av FreeCAD's skriptmöjligheter och vill förändra några av dess egenskaper, och utvecklare, som vill använda FreeCAD som en bas för att utveckla sina egna applikationer. Om du aldrig har använt FreeCAD innan, så föreslår vi att du startar med introduktionen.
</p>
<h3><span class="mw-headline" id="Bidra">Bidra</span></h3>
<p>Som du kanske märkt tidigare, så är programmerare riktigt dåliga manualskrivare! För dem är allting självklart, eftersom de skrev programmet på det sättet. Därför är det viktigt att användare med god erfarenhet hjälper oss att skriva och revidera dokumentationen. Ja, vi menar dig! Hur, frågar du dig? Gå bara till wikin <a rel="nofollow" class="external free" href="http://www.freecadweb.org/wiki/index.php">http://www.freecadweb.org/wiki/index.php</a> i användarsektionen. Du kommer att behöva ett <a rel="nofollow" class="external text" href="http://sourceforge.net/">sourceforge konto</a> för att logga in, sedan kan du börja att redigera!
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h1><span class="mw-headline" id="Introduktion">Introduktion</span></h1>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Freecad_default.jpg" class="image"><img alt="Freecad default.jpg" src="1024px-Freecad_default.jpg" width="1024" height="604" srcset="/wiki/images/thumb/2/2a/Freecad_default.jpg/1536px-Freecad_default.jpg 1.5x, /wiki/images/2/2a/Freecad_default.jpg 2x" /></a></div></div>
<div class="mw-translate-fuzzy">
<p><b>FreeCAD</b> är en allmän 3D <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Computer-aided_design"><b>CAD</b></a> modellerare. Utvecklingen är helt baserad på <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Öppen_Källkod">öppen källkod</a> (GPL &amp; LGPL Licens). FreeCAD riktar sig direkt till <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Maskinteknik">mekanisk konstruktion</a> och <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Product_design">produkt design</a> men passar även i ett bredare område inom konstruktion, som arkitektur eller andra konstruktions specialiteter.
</p><p><br />
</p><p>FreeCAD erbjuder verktyg liknande <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/CATIA">Catia</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Solidworks">SolidWorks</a> eller <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Solid_Edge">Solid Edge</a>, och hamnar därför i samma kategorier som <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Computer-aided_design"><b>MCAD</b></a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Product_Lifecycle_Management"><b>PLM</b></a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/CAx"><b>CAx</b></a> och <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Computer-aided_engineering"><b>CAE</b></a>. Det kommer att bli en <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Parametric_feature_based_modeler">parametrisk solidmodellerare</a> med en modulär mjukvaruarkitektur vilket gör det lätt att erbjuda extre funktionalitet utan att behöva ändra kärnsystemet.
</p><p><br />
</p><p>Som med många moderna 3D <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Computer-aided_design">CAD</a> modellerare så kommer den att ha en 2D komponent för att kunna skapa ritningar av 3D modellen, men direkt 2D ritare (som <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/AutoCAD">AutoCAD LT</a>) är inte avsikten, inte heller animeringar eller organiska former (som <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Maya_(datorprogram)">Maya</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/3ds_Max">3ds Max</a> eller <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Cinema_4D">Cinema 4D</a>), fast tack vare sin stora anpassningsbarhet, så kan FreeCAD bli användbart inom ett mycket större område än vad som avses för tillfället.
</p><p><br />
</p><p>En annan viktig sak för FreeCAD är ett flitigt användande av alla de fantastiska öppen-källkodsbibliotek som finns därute inom området <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Beräkningsvetenskap">Vetenskaplig databehandling</a>. Bland dem är <a rel="nofollow" class="external text" href="http://OpenCascade.org">OpenCascade</a>, en kraftfull CAD kärna, <a rel="nofollow" class="external text" href="http://Coin3D.org">Coin3D</a>, en inkarnation av <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">OpenInventor</a>, <a rel="nofollow" class="external text" href="http://www.qtsoftware.com/">Qt</a>, det världsberömda användargränssnittsverktyget, och <a rel="nofollow" class="external text" href="http://www.python.org">Python</a>, en av de bästa skriptspråken som finns. Själva FreeCAD kan även användas som ett bibliotek av andra program.
</p><p><br />
</p><p>FreeCAD är också helt <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Multiplattform">multiplattform</a>, och fungerar för närvarande perfekt på Windows och Linux/Unix och Mac OSX systems, med exakt samma utseende och funktionalitet på alla plattformarna.
</p><p><br />
</p><p>Blev du nyfiken? Ta en titt på <a href="https://www.freecadweb.org/wiki/index.php?title=Feature_list/sv" title="Feature list/sv">Egenskaper</a> eller <a href="https://www.freecadweb.org/wiki/index.php?title=Getting_started/sv" title="Getting started/sv">Introduktion</a> artiklarna, eller hoppa direkt till <a href="https://www.freecadweb.org/wiki/index.php?title=User_hub/sv" title="User hub/sv">Användarhubben</a>!
</p>
</div>
<p>FreeCAD features tools similar to <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Catia">Catia</a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Solidworks">SolidWorks</a> or <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Solid_Edge">Solid Edge</a>, and therefore also falls into the category of <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/CAD"><b>MCAD</b></a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Product_Lifecycle_Management"><b>PLM</b></a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/CAx"><b>CAx</b></a> and <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Computer-aided_engineering"><b>CAE</b></a>. It is a <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Parametric_feature_based_modeler">feature based parametric modeler</a> with a modular software architecture which makes it easy to provide additional functionality without modifying the core system.
</p><p>As with many modern 3D <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/CAD">CAD</a> modelers it has many 2D components in order to sketch 2D shapes or extract design details from the 3D model to create 2D production drawings, but direct 2D drawing (like <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/AutoCAD#AutoCAD_LT">AutoCAD LT</a>) is not the focus, neither are animation or organic shapes (like <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Maya_(software)">Maya</a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/3ds_Max">3ds Max</a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Blender_%28software%29">Blender</a> or <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/CINEMA_4D">Cinema 4D</a>), although, thanks to its wide adaptability, FreeCAD might become useful in a much broader area than its current focus.
</p><p>FreeCAD makes heavy use of all the great open-source libraries that exist out there in the field of <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Scientific_Computation">Scientific Computing</a>. Among them are <a rel="nofollow" class="external text" href="http://OpenCascade.org">OpenCascade</a>, a powerful CAD kernel, <a rel="nofollow" class="external text" href="http://www.Coin3D.org">Coin3D</a>, an incarnation of <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">Open Inventor</a>, <a rel="nofollow" class="external text" href="http://www.qtsoftware.com/">Qt</a>, the world-famous UI framework, and <a rel="nofollow" class="external text" href="http://www.python.org">Python</a>, one of the best scripting languages available. FreeCAD itself can also be used as a library by other programs.
</p><p>FreeCAD is also fully <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Cross-platform">multi-platform</a>, and currently runs flawlessly on Windows and Linux/Unix and Mac OSX systems, with the exact same look and functionality on all platforms.
</p><p>For more information about FreeCAD's capabilities, take a look at the <a href="Feature_list.html" title="Feature list">Feature list</a>, the <a href="/wiki/Getting_started#What.27s_new" title="Getting started"> latest release notes</a> or the <a href="Getting_started.html" title="Getting started">Getting started</a> articles, or see more <a href="Screenshots.html" title="Screenshots">screenshots</a>.
</p>
<h3><span class="mw-headline" id="About_the_FreeCAD_project">About the FreeCAD project</span></h3>
<p>The FreeCAD project was started as far as 2001, as described in its <a href="History.html" title="History">history</a> page.
</p><p>FreeCAD is maintained and developed by a community of enthusiastic developers and users (see the <a href="Contributors.html" title="Contributors">contributors</a> page). They work on FreeCAD voluntarily, in their free time. They cannot guarantee that FreeCAD contains or will contain everything you might wish, but they will usually do their best! The community gathers on the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org">FreeCAD forum</a>, where most of the ideas and decisions are discussed. Feel free to join us there!
</p>
<p><br />
</p><p>Detta är en extensiv, fast inte komplett, lista på de funktioner som FreeCAD har. Om du vill se in i framtiden, se <a href="https://www.freecadweb.org/wiki/index.php?title=Development_roadmap/sv" title="Development roadmap/sv">utvecklingskartan</a> för en snabb överblick så är <a href="https://www.freecadweb.org/wiki/index.php?title=Screenshots/sv" title="Screenshots/sv">Skärmdumpar</a> en bra plats att gå till.
</p>
<h2><span class="mw-headline" id="Release_notes">Release notes</span></h2>
<ul><li> <a href="Release_notes_011.html" title="Release notes 011">Release 0.11</a> - March 2011</li>
<li> <a href="Release_notes_012.html" title="Release notes 012">Release 0.12</a> - December 2011</li>
<li> <a href="Release_notes_013.html" title="Release notes 013">Release 0.13</a> - January 2013</li>
<li> <a href="Release_notes_0.14.html" title="Release notes 0.14">Release 0.14</a> - March 2014</li>
<li> <a href="Release_notes_015.html" title="Release notes 015">Release 0.15</a> - March 2015</li>
<li> <a href="Release_notes_0.16.html" title="Release notes 0.16">Release 0.16</a> - April 2016</li>
<li> <a href="Release_notes_0.17.html" title="Release notes 0.17">Release 0.17</a> - April 2018</li></ul>
<h2><span class="mw-headline" id="Allm.C3.A4na_funktioner">Allmäna funktioner</span></h2>
<div class="mw-translate-fuzzy">
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature1.jpg" class="image"><img alt="Feature1.jpg" src="Feature1.jpg" width="64" height="64" /></a></div> En komplett <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_CASCADE">OpenCasCade</a>-baserad <b>geometrikärna</b> som tillåter komplexa 3D operationer på komplexa formtyper, och stöder nativt koncept som brep, nurbs, booleska operationer eller fasningar <div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature3.jpg" class="image"><img alt="Feature3.jpg" src="Feature3.jpg" width="64" height="64" /></a></div> En full <b>parametrisk modell</b> som tillåter valfri typ av parameter-drivna anpassade objekt, som även <a href="https://www.freecadweb.org/wiki/index.php?title=Scripted_objects/sv" title="Scripted objects/sv">helt kan programmeras i python</a> <div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature4.jpg" class="image"><img alt="Feature4.jpg" src="Feature4.jpg" width="64" height="64" /></a></div> Komplett åtkomst från den inbyggda <b>python</b> tolken, makron eller externa skript till nästan alla delar i FreeCAD, so till exempel <a href="https://www.freecadweb.org/wiki/index.php?title=Topological_data_scripting/sv" title="Topological data scripting/sv">skapande och omvandling av geometri</a>, 2D eller 3D representationen av den geometrin (<a href="https://www.freecadweb.org/wiki/index.php?title=Scenegraph/sv" title="Scenegraph/sv">Scengrafen</a>) eller även <a href="https://www.freecadweb.org/wiki/index.php?title=PySide/sv" title="PySide/sv">FreeCAD gränssnittet</a> <div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature5.jpg" class="image"><img alt="Feature5.jpg" src="Feature5.jpg" width="64" height="64" /></a></div> Import/export till <b>standard format</b> som <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/ISO_10303">STEP</a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/IGES">IGES</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Obj">OBJ</a>, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Dxf">DXF</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Svg">SVG</a> <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Universal_3D">U3D</a> eller <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/STL_(file_format)">STL</a><div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature7.jpg" class="image"><img alt="Feature7.jpg" src="Feature7.jpg" width="64" height="64" /></a></div> En <a href="https://www.freecadweb.org/wiki/index.php?title=Sketcher_Workbench/sv" title="Sketcher Workbench/sv">Skissare</a> med begränsningslösare, som låter dig skissa geometri-begränsade 2D former. Skissare tillåter dig för tillfället att bygga flera typer av begränsad geometri, och sedan använda dem som en bas att bygga andra objekt i FreeCAD.<div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature9.jpg" class="image"><img alt="Feature9.jpg" src="Feature9.jpg" width="64" height="64" /></a></div> En <a href="https://www.freecadweb.org/wiki/index.php?title=Robot_Workbench/sv" title="Robot Workbench/sv">Robot simulerings</a> modul som tillåter dig att studera robotrörelser. Robotmodulen har redan ett utökat grafiskt gränssnitt, vilket kan användas för ett smidigt arbetsflöde. <div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature8.jpg" class="image"><img alt="Feature8.jpg" src="Feature8.jpg" width="64" height="64" /></a></div> En <a href="https://www.freecadweb.org/wiki/index.php?title=Drawing_Module/sv" title="Drawing Module/sv">Ritningsark</a> modul som låter dig skapa 2D vyer på dina 3D modeler på ett ritningsark. Denna modul producerar sedan färdiga SVG eller PDF dokument. Modulen är ännu funktionsfattig, men har redan en kraftfull python-funktionalitet.<div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature-raytracing.jpg" class="image"><img alt="Feature-raytracing.jpg" src="Feature-raytracing.jpg" width="64" height="64" /></a></div> En <a href="https://www.freecadweb.org/wiki/index.php?title=Raytracing_Module/sv" title="Raytracing Module/sv">Renderingsmodul</a> som kan exportera 3D objekt för rendering med externa rendererare. Stödjer för närvarande endast <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/POV-Ray">povray</a>, men förväntas stödja andra renderare i framtiden.<div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature-arch.jpg" class="image"><img alt="Feature-arch.jpg" src="Feature-arch.jpg" width="64" height="64" /></a></div> En <a href="https://www.freecadweb.org/wiki/index.php?title=Arch_Module/sv" title="Arch Module/sv">Arkitektur</a> modul som tillåter <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Building_Information_Modeling">BIM</a>-likt arbetsflöde, med <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Industry_Foundation_Classes">IFC</a> kompatibilitet. Skapandet av arkitekturmodulen diskuteras mycket av communityn <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=10&amp;t=821">här</a>.<div style="clear:both"></div></li></ul>
<a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Building_Information_Modeling">BIM</a>-like workflow, with <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Industry_Foundation_Classes">IFC</a> compatibility. The making of the Arch module is heavily discussed by the community <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=10&amp;t=821">here</a>.<div style="clear:both"></div>
</div>
<div class="mw-translate-fuzzy">
<h2><span class="mw-headline" id="Allm.C3.A4nna_funktioner">Allmänna funktioner</span></h2>
</div>
<div class="mw-translate-fuzzy">
<ul><li><b>FreeCAD är multi-plattform</b>. Det kan köras och beter sig på exakt samma sätt på Windows Linux och Mac OSX plattformarna.</li></ul>
</div>
<ul><li> <b>FreeCAD är en helgrafisk applikation</b>. FreeCAD har ett komplett grafiskt användargränssnitt baserat på det berömda <a rel="nofollow" class="external text" href="http://www.qtsoftware.com/">Qt</a> strukturen, med en 3D visare baserad på <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">Open Inventor</a>, vilket tillåter snabb rendering av 3D scener och en mycket lättåtkomlig scenrepresentation.</li></ul>
<ul><li> <b>FreeCAD kan också köras som en kommandolinje applikation</b>, med litet minnesbehov. I kommandolinje läge, så körs FreeCAD utan ett gränssnitt, men med alla geometriverktyg. Det kan till exempel användas som en server för att producera data för andra applikationer.</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> <b>FreeCAD kan importeras som en <a href="https://www.freecadweb.org/wiki/index.php?title=Embedding_FreeCAD/sv" title="Embedding FreeCAD/sv">Python modul</a></b>, inuti andra applikationer som kan köra python skript, eller i en python konsol. Som i konsol läge, så är FreeCAD's gränssnitt otillgängligt, men alla geometriverktyg finns tillgängliga.</li></ul>
</div>
<ul><li> <b>Arbetsbänk koncept</b>: I FreeCAD gränssnittet, så är verktygen grupperade i <a href="https://www.freecadweb.org/wiki/index.php?title=Workbenches/sv" title="Workbenches/sv">arbetsbänkar</a>. Detta innebär att endast de verktyg som behövs för att utföra en viss uppgift visas, vilket håller arbetsytan ren och responsiv, och snabb laddning av applikationen.</li></ul>
<ul><li> <b>Plugin/Modul struktur för sen laddnig av funktioner/data-typer</b>. FreeCAD är uppdelat i en kärnapplikation och moduler, som endast laddas när de behövs. Nästan alla verktyg och geometrityper är lagrade i moduler. Moduler beter sig som plugins, och kan adderas eller tas bort från en existerande installation av FreeCAD.</li></ul>
<ul><li> <b>Parametriska associativa dokumentobjekt</b>: Alla objekt i ett FreeCAD dokument kan definierass av parametrar. Dessa parametrar kan ändras direkt, och omberäknas när som helst. Förhållandet mellan objekt lagras också, så om ett objekt ändras, så ändras även de objekt som är beroende av det.</li></ul>
<ul><li> <b>Parametriska primitiver</b> som låda, sfär, cylinder, kon eller torus.</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> Grafiska <b>ändringsoperationer</b> som förflyttning, rotation, skalning, spegling, offset (trivial or after <a rel="nofollow" class="external text" href="http://www.ann.jussieu.fr/~frey/papers/meshing/Jung%20W.,%20Self-intersection%20removal%20in%20triangular%20mesh%20offsetting.pdf">Jung/Shin/Choi</a>) eller formförändring, i valfritt plan i 3D rymden</li></ul>
</div>
<ul><li> <b><a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Constructive_solid_geometry">Booleska operationer</a></b> som <b>förening</b>, <b>skillnad</b> och <b>skärning</b>.</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> Grafiskt skapande av<b>enkel plangeometri</b> som linjer, trådar, rektanglar, cirkelbågar eller cirklar i valfritt plan i 3D rymden</li></ul>
</div>
<ul><li> Modellering med raka eller rotering <b>extrusioner</b>, <b>sektioneringar</b> och <b>avrundningar</b>.</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> Topologiska komponenter som <b>hörn, kanter, trådar</b> och <b>plan</b> (via pythonskript).</li></ul>
</div>
<ul><li> <b>Testing and repairing</b> tools for meshes: solid test, non-two-manifolds test, self-intersection test, hole filling and uniform orientation.</li></ul>
<ul><li> <b>Anteckningar</b> som texter eller dimensioner</li></ul>
<ul><li> <b>Ångra/Gör om struktur</b>: Allt kan ångras eller göras om, med åtkomst till ångra minnet, så multipla steg kan ångras åt gången.</li></ul>
<ul><li> <b>Transaktionshantering</b>: Ångra/Gör om minnet lagrar dokumenttransaktioner och inte enstaka aktioner, vilket tillåter varje verktyg att exakt definiera vad som ska ångras eller göras om.</li></ul>
<ul><li> <b>Inbyggd <a href="https://www.freecadweb.org/wiki/index.php?title=Scripting/sv" class="mw-redirect" title="Scripting/sv">skript</a> struktur</b>: FreeCAD tillhandahåller en inbyggd <a rel="nofollow" class="external text" href="http://www.python.org/">Python</a> tolk, och ett API som täcker nästan alla delar av applikationen, gränssnittet, geometrin och representationen av denna geometri i 3D visaren. Tolken kan köra från enstaka kommandon upp till komplexa skript, faktum är att hela moduler kan programmeras helt och hållet i Python.</li></ul>
<ul><li> <b>Inbyggd Python konsol</b> med syntaxmarkering, autokomplettering och klassvisare: Python kommandon kan utföras direk i FreeCAD och ge resultat omedelbart, vilket tillåter skriptskrivare att testa funktionaliteten direkt, utforska modulernas innehåll och lätt lära sig FreeCAD's innanmäte.</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> <b>Användarinteraktion speglas i konsolen</b>: Allt som användaren gör i FreeCAD's gränssnitt, kör pythonkod, vilken kan skrivas ut i konsolen och spelas in i makron.</li></ul>
</div>
<div class="mw-translate-fuzzy">
<ul><li> <b>Full makro inspelning &amp; redigering</b>: De pythonkommandon som körs när användaren manipulerar gränssnittet kan spelas in, om nödvändigt redigeras, och sparas för att reproduceras senare.</li></ul>
</div>
<div class="mw-translate-fuzzy">
<ul><li> <b>Sammansatt (ZIP baserat) dokumentformat</b>: FreeCAD dokument som är sparade med filtypen .fcstd kan innehålla många olika informationstyper, som geometri, skript eller tumnagelikoner.</li></ul>
</div>
<div class="mw-translate-fuzzy">
<ul><li> <b>Fullt anpassningsbart/skriptbart grafiskt användargränssnitt</b>. Det <a rel="nofollow" class="external text" href="http://www.qtsoftware.com">Qt</a>-baserade gränssnittet i FreeCAD är helt åtkomligt via python tolken. Förutom de enkla funktioner som FreeCAD själv ger till arbetsbänkarna, så är hela Qt strukturen också tillgänglig, vilket tillåter vilken operation som helst på gränssnittet, som till exempel skapa, lägga till, docka, ändra eller ta bort widgets och verktygslådor.</li></ul>
</div>
<div class="mw-translate-fuzzy">
<ul><li> <b>Tumnaglare</b> (endast Linux system för närvarande): FreeCAD's dokumentikoner visar filens innehåll i de flesta filhanterarapplikationer som till exempel gnome's nautilus.</li></ul>
</div>
<ul><li> <b>en modulär MSI installerare</b> tillåter flexibel installation på Windowssystem. Paket för Ubuntusystem är också underhållna.</li></ul>
<h2><span class="mw-headline" id="I_utveckling">I utveckling</span></h2>
<div class="mw-translate-fuzzy">
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature-assembly.jpg" class="image"><img alt="Feature-assembly.jpg" src="Feature-assembly.jpg" width="64" height="64" /></a></div> An <a href="https://www.freecadweb.org/wiki/index.php?title=Assembly_project/sv" title="Assembly project/sv">Församling</a> modul som gör det möjligt för att arbeta med flera projekt, flera former, flera dokument, flera filer, flera relationer...<div style="clear:both"></div></li></ul>
<ul><li> <div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Feature-CAM.jpg" class="image"><img alt="Feature-CAM.jpg" src="Feature-CAM.jpg" width="64" height="64" /></a></div> <a href="https://www.freecadweb.org/wiki/index.php?title=Cam_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="Cam Module/sv (page does not exist)">CAM modulen</a> är tillägnad mekanisk bearbetning som till exempel fräsning. Denna modul har just påbörjats och är för tillfället mest tillägnad <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Incremental_sheet_forming">Inkrementell plåtformning</a>. Fastän det finns en del algoritmer för verktygsväg planering, så är de inte användbara för slutanvändaren för tillfället.</li></ul>
</div>
<h2><span class="mw-headline" id="Extra_Workbenches">Extra Workbenches</span></h2>
<p>Power users have created various custom <a href="External_workbenches.html" title="External workbenches">external workbenches</a>.
</p><p><br />
</p>
<p><br />
</p>
<h1><span class="mw-headline" id="Installation">Installation</span></h1>
<h2><span class="mw-headline" id="Installera_p.C3.A5_Windows">Installera på Windows</span></h2>
<p>The easiest way to install FreeCAD on Windows is to download the installer below.
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Windows.png" class="image"><img alt="Windows.png" src="Windows.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16/FreeCAD.0.16.6706.f86a4e4-WIN-x86-installer.exe">Windows</a> <small>32 bits </small>
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Windows.png" class="image"><img alt="Windows.png" src="Windows.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16.6712/FreeCAD-0.16.6712_x64_setup.exe">Windows</a> <small>64 bits</small>
</p><p>Det lättaste sättet att <b>installera FreeCAD på Windows</b> är genom att använda installeraren. Denna sida beskriver hur man använder den och egenskaperna av <i>Microsoft Installeraren</i> för mer installationsalternativ.
</p>
<h3><span class="mw-headline" id="Enkel_Installation">Enkel Installation</span></h3>
<p>FreeCAD installeraren levereras i .msi (Windows Installer) format.
</p><p>Du kan ladda ned den senaste .msi filen från <a rel="nofollow" class="external text" href="http://sourceforge.net/project/showfiles.php?group_id=49159&amp;package_id=206659">den officiella FreeCAD nedladdningssidan</a>.
</p><p>Efter att du har laddat ned filen, dubbelklicka på den för att starta installationsprocessen.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Windows.png" class="image"><img alt="Windows.png" src="Windows.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16/FreeCAD.0.16.6706.f86a4e4-WIN-x86-installer.exe">Windows</a> <small>32 bits </small>
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Windows.png" class="image"><img alt="Windows.png" src="Windows.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16.6712/FreeCAD-0.16.6712_x64_setup.exe">Windows</a> <small>64 bits</small>
</p><p><br />
After downloading the .msi (Microsoft Installer) file, just double-click on it to start the installation process.
</p><p>Below is more information about technical options. If it looks daunting, don't worry! Most Windows users will not need anything more than the .msi to install FreeCAD and <b><a href="Getting_started.html" title="Getting started"> Get started</a></b>!
</p><p><br />
</p>
<h3><span class="mw-headline" id="Simple_Microsoft_Installer_Installation">Simple Microsoft Installer Installation</span></h3>
<p>The easiest way to <b>install FreeCAD on Windows</b> is by using the installer above. This page describes the usage and the features of the <i>Microsoft Installer</i> for more installation options.
</p><p>If you would like to download either a 64 bit or unstable development version, see the <a href="Download.html" title="Download">Download</a> page. <a href="https://www.freecadweb.org/wiki/index.php?title=Download/sv" title="Download/sv">Download/sv</a>
</p><p><br />
</p>
<h3><span class="mw-headline" id="Kommandolinje_Installation">Kommandolinje Installation</span></h3>
<p>Med <i>msiexec.exe</i> kommandolinje programmet, så finns ytterligare funktioner tillgängliga, som o-interaktiv installation och administrativ installation.
</p>
<h4><span class="mw-headline" id="O-interaktiv_Installation">O-interaktiv Installation</span></h4>
<p>Med kommandoraden
</p>
<pre> msiexec /i FreeCAD&lt;version&gt;.msi
</pre>
<p>installation kan startas via ett program. Extra parametrar kan läggas till i slutet på denna kommandorad, som
</p>
<pre>msiexec /i FreeCAD-2.5.msi TARGETDIR=r:\FreeCAD25 </pre>
<h4><span class="mw-headline" id="Begr.C3.A4nsat_anv.C3.A4ndargr.C3.A4nssnitt">Begränsat användargränssnitt</span></h4>
<p>Det användargränssnitt som installeraren visar kan kontrolleras med /q alternativ, som:
</p>
<ul><li> /qn - Inget gränssnitt</li>
<li> /qb - Grundläggande gränssnitt - endast en liten förloppsdialog</li>
<li> /qb! - Som /qb, men göm Avbryt knappen</li>
<li> /qr - Reducerat gränssnitt - visar alla dialoger som inte kräver svar från användaren (skippa alla modala dialoger)</li>
<li> /qn+ - Like /qn, men visa "Färdig" dialogen vid slutet</li>
<li> /qb+ - Like /qb, men visa "Färdig" dialogen vid slutet </li></ul>
<h4><span class="mw-headline" id="M.C3.A5lkatalog">Målkatalog</span></h4>
<p>Egenskapen TARGETDIR avgör FreeCAD installationens rotkatalog. Till exempel, en annan installationsenhet kan specificeras med
</p>
<pre>TARGETDIR=R:\FreeCAD25 </pre>
<p>Standard TARGETDIR är [WindowsVolume\Program\]FreeCAD&lt;version&gt;.
</p>
<h4><span class="mw-headline" id="Installation_f.C3.B6r_Alla_anv.C3.A4ndare">Installation för Alla användare</span></h4>
<p>Genom att lägga till
</p>
<pre>ALLUSERS=1 </pre>
<p>så installeras programmet för alla användare. Som standard, så installerar den o-interaktiva installeraren paketet endast för den nuvarande användaren, och den interaktiva installeraren visar en dialog som har "alla användare" som standard, om användaren har tillräckliga rättigheter.
</p>
<h4><span class="mw-headline" id="Val_av_funktioner">Val av funktioner</span></h4>
<p>Ett antal egenskaper tillåter val av vilka funktioner som ska installeras, ominstalleras, eller tas bort. Funktionerna för FreeCAD installeraren är
</p>
<ul><li> DefaultFeature - installera mjukvaran korrekt, plus kärnbiblioteken</li>
<li> Documentation - installera dokumentationen</li>
<li> Source code - installera källkoden</li>
<li> ... ToDo</li></ul>
<p>I tillägg, så specificerar ALL alla funktioner. Alla funktioner beror på DefaultFeature, så när en funktion installeras, så installeras även standardfunktionen automatiskt. Följande egenskaper kontrollerar vilka funktioner som ska installeras eller tas bort
</p>
<ul><li> ADDLOCAL - lista på funktioner som ska installeras på den lokala maskinen</li>
<li> REMOVE - lista på funktioner som ska tas bort</li>
<li> ADDDEFAULT - lista på funktioner som ska läggas till i dess standardkonfiguration (vilket är lokal för alla FreeCAD funktioner)</li>
<li> REINSTALL - lista på funktioner som ska ominstalleras/repareras</li>
<li> ADVERTISE - lista på funktioner som ska annonsera en installation </li></ul>
<p>Det finns en del ytterligare alternativ tillgängliga; se MSDN dokumentationen för detaljer.
</p><p>Med dessa alternativ, genom att lägga till
</p>
<pre>ADDLOCAL=Extensions </pre>
<p>installerar själva tolken och registrerar extensionerna, men installerar inget annat.
</p>
<h3><span class="mw-headline" id="Avinstallering">Avinstallering</span></h3>
<p>Med
</p>
<pre>msiexec /x FreeCAD&lt;version&gt;.msi </pre>
<p>så kan FreeCAD avinstalleras. Det är inte nödvändigt att ha MSI filen tillgänglig för avinstalleringar; alternativt så kan även paketet eller produktkoden specificeras. Du kan hitta produktkoden genom att titta på avinstalleringsgenvägens egenskaper som FreeCAD installerar i startmenyn.
</p>
<h3><span class="mw-headline" id="Administrativ_installation">Administrativ installation</span></h3>
<p>Med
</p>
<pre>msiexec /a FreeCAD&lt;version&gt;.msi </pre>
<p>så kan en "administrativ" (nätverks) installation startas. Filerna packas upp till målkatalogen (vilken ska vara en nätverkskatalog), men inga andra ändringar görs på det lokala systemet. Dessutom genereras en annan (mindre) msi fil i målkatalogen, vilken klienter sedan kan använda för att utföra en lokal installation (framtida versioner kan också erbjuda att behålla vissa funktioner på nätverksenheten).
</p><p>För närvarande finns det inget användargränssnitt för administrativa installationer, så målkatalogen måste specificeras på kommandolinjen.
</p><p>Det finns ingen specifik avinstallationsprocedur för en administrativ installation - radera bara målkatalogen om inga klienter använder den längre.
</p>
<h3><span class="mw-headline" id="Annonsering">Annonsering</span></h3>
<p>Med
</p>
<pre>msiexec /jm FreeCAD&lt;version&gt;.msi </pre>
<p>så är det i princip möjligt att "annonsera" FreeCAD till en maskin (med /ju till en användare). Detta gör att ikonerna syns i startmenyn, och extensionerna registreras, utan att någon mjukvara installeras. Det första användandet av en funktion orsakar en installation av densamma.
</p><p>FreeCAD installeraren stödjer för närvarande endast annonsering till startmenyn, men inga annonseringar av genvägar.
</p>
<h3><span class="mw-headline" id="Automatisk_Installation_p.C3.A5_en_maskingrupp">Automatisk Installation på en maskingrupp</span></h3>
<p>Med Windows Group Policy, så är det möjlig att automatiskt installera FreeCAD på en grupp av maskiner. För att göra det, utför följande steg:
</p>
<ol><li>Logga in på domän controllern</li>
<li>Kopiera MSI filen till en delad mapp som alla målmaskiner har åtkomst till.</li>
<li>Öppna MMC snapin "Active Directory users and computers"</li>
<li>Navigera till den datorgrupp som behöver FreeCAD</li>
<li>Öppna egenskaper</li>
<li>Öppna Group Policy</li>
<li>Lägg till en ny policy, och redigera den</li>
<li>I datorkonfiguration/Mjukvaruinstallation, välj Ny/Paket</li>
<li>Välj MSI filen i nätverkssökvägen</li>
<li>Välj alternativt att du vill att FreeCAD ska avinstalleras om datorn lämnar policyns område. </li></ol>
<p>Grupp policy propagering brukar ta lite tid - för att distribuera paketet pålitligt, starta om samtliga maskiner.
</p>
<h3><span class="mw-headline" id="Installation_p.C3.A5_Linux_om_du_anv.C3.A4nder_Crossover_Office">Installation på Linux om du använder Crossover Office</span></h3>
<p>You can install the windows version of FreeCAD on a Linux system using <i>CXOffice 5.0.1</i>. Run <i>msiexec</i> from the CXOffice command line, assuming that the install package is placed in the "software" directory which is mapped to the drive letter "Y:":
</p>
<pre>msiexec /i Y:\\software\\FreeCAD&lt;version&gt;.msi </pre>
<p>FreeCAD is running, but it has been reported that the OpenGL display does not work, like with other programs running under <a href="http://en.wikipedia.org/wiki/Wine_(software)" class="extiw" title="wikipedia:Wine (software)">Wine</a> i.e. Google <a href="http://en.wikipedia.org/wiki/SketchUp" class="extiw" title="wikipedia:SketchUp">SketchUp</a>.
</p>
<p><br />
</p><p><br />
</p>
<h2><span class="mw-headline" id="Installera_p.C3.A5_Unix.2FLinux">Installera på Unix/Linux</span></h2>
<p>För tillfället, så erbjuder FreeCAD teamet endast installerare för 32bit Debian och Ubuntu system, men en del medlemmar av FreeCADs användargrupp erbjuder även anpassade installerare för andra Linuxvarianter. Ta en titt på <a href="https://www.freecadweb.org/wiki/index.php?title=Download/sv" title="Download/sv">Nedladdningssidan</a> sidan för att se vad som för tillfället finns tillgängligt.
</p><p>Once you've got FreeCAD installed, it's time to <a href="Getting_started.html" title="Getting started">get started</a>!
</p>
<h3><span class="mw-headline" id="Installation_p.C3.A5_Debian.2FUbuntu_system">Installation på Debian/Ubuntu system</span></h3>
<p>När du har laddat ned den .deb som motsvarar din systemversion, och om du har <a href="http://en.wikipedia.org/wiki/Gdebi" class="extiw" title="wikipedia:Gdebi">Gdebi</a> paketet installerat (det är det vanligtvis), så behöver du bara navigera till där du laddade ned filen, och dubbelklicka på den. Nödvändiga beroenden kommer att tas hand om automatiskt av din pakethanterare.
Alternativt, så kan du även installera den från terminalen, genom att navigera till där du laddade ned filen, och skriva:
</p>
<pre>sudo dpkg -i Name_of_your_FreeCAD_package.deb
</pre>
<p>byt Name_of_your_FreeCAD_package.deb till namnet på den fil som du laddade ned.
</p><p>Efter att du har installerat FreeCAD, så kommer en startikon läggas till i "Grafik" sektionen i din startmeny.
</p><p>Many Linux distributions are based on Ubuntu and share its repositories. Besides official variants (Kubuntu, Lubuntu and Xubuntu), there are non official distros such as Linux Mint, Voyager and others. The installation options below should be compatible to these systems.
</p>
<h3><span class="mw-headline" id="Official_Ubuntu_repository">Official Ubuntu repository</span></h3>
<p>FreeCAD is available from Ubuntu repositories and can be installed via the Software Center or with this command in a terminal:
</p>
<pre>sudo apt-get install freecad </pre>
<p>But chances are this stable version will be outdated, and not have the latest features. To get the last release version, please use the PPA.
</p>
<h3><span class="mw-headline" id="Stable_PPA_with_GUI">Stable PPA with GUI</span></h3>
<p>To install FreeCAD using the PPA, from the graphical interface, please follow those instructions. The FreeCAD community provides a <a rel="nofollow" class="external text" href="https://launchpad.net/~freecad-maintainers/+archive/freecad-stable">PPA repository on Launchpad</a> with the latest stable FreeCAD version.
</p><p>You need to add to your system's Software Sources the following PPA. To do that navigate to Ubuntu Software Centre &gt; Edit &gt; Software Sources &gt; Other Software. Click on add and copy and past the code below:
</p>
<pre>ppa:freecad-maintainers/freecad-stable </pre>
<p>Refresh your software sources, if asked. Now, you can find and install the last stable FreeCAD version on the Ubuntu Software Center.
</p><p>For more information on PPA, click here: <a rel="nofollow" class="external text" href="https://help.ubuntu.com/community/PPA">Definition of PPA (Personal Package Archive) on help.ubuntu.com</a>.
</p>
<h3><span class="mw-headline" id="Stable_PPA_with_console">Stable PPA with console</span></h3>
<p>Type, or copy-paste, these commands in a console to add the PPA:
</p><p>For the <b>"stable"</b> PPA
</p>
<pre>sudo add-apt-repository ppa:freecad-maintainers/freecad-stable </pre>
<p>Don't forget to retrieve the updated the package lists:
</p>
<pre>sudo apt-get update </pre>
<p>Update synchronizes your list of available packages with the servers.
</p><p>Then, install FreeCAD along with the documentation:
</p>
<pre>sudo apt-get install freecad freecad-doc &amp;&amp; sudo apt-get upgrade </pre>
<p>Upgrade downloads and installs the newest packages version of the installed programs. It will be applied to all the softwares installed on your computer.
</p><p>Execute this command to open the stable version of FreeCAD:
</p>
<pre>freecad </pre>
<h3><span class="mw-headline" id="Daily_PPA_with_console">Daily PPA with console</span></h3>
<p>If you want to install the last unstable version of FreeCAD, please use the PPA named <b>"freecad-daily"</b> <a rel="nofollow" class="external text" href="https://launchpad.net/~freecad-maintainers/+archive/freecad-daily">PPA repository on Launchpad</a>. This way you can access the bleeding edge of FreeCAD development. This PPA is automatically compiled daily from the official FreeCAD's master branch repository. It will usually contain numerous bug fixes and feature updates.
</p><p>For the daily PPA:
</p>
<pre>sudo add-apt-repository ppa:freecad-maintainers/freecad-daily
sudo apt-get update
sudo apt-get install freecad-daily &amp;&amp; sudo apt-get upgrade </pre>
<p>Execute this command to open the daily build of FreeCAD:
</p>
<pre>freecad-daily </pre>
<h2><span class="mw-headline" id="Debian_and_other_debian-based_systems">Debian and other debian-based systems</span></h2>
<p>Since Debian Lenny, FreeCAD is available directly from the Debian software repositories and can be installed via synaptic or simply with:
</p>
<pre>sudo apt-get install freecad </pre>
<h2><span class="mw-headline" id="OpenSUSE">OpenSUSE</span></h2>
<p>FreeCAD is typically installed with:
</p>
<pre>zypper install FreeCAD </pre>
<h2><span class="mw-headline" id="Gentoo">Gentoo</span></h2>
<p>FreeCAD can be built/installed simply by issuing:
</p>
<pre>emerge freecad </pre>
<h2><span class="mw-headline" id="Other">Other</span></h2>
<p>If you find out that your system features FreeCAD but is not documented in this page, please tell us on the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewforum.php?f=21">forum</a>!
</p><p>Many alternative, non-official FreeCAD packages are available on the net, for example for systems like slackware or fedora. A search on the net can quickly give you some results.
</p>
<h3><span class="mw-headline" id="Manual_install_on_.deb_based_systems">Manual install on .deb based systems</span></h3>
<p>If for some reason you cannot use one of the above methods, you can always download one of the .deb packages available on the <a href="Download.html" title="Download">Download</a> page. <br />
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Linux.png" class="image"><img alt="Linux.png" src="Linux.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://launchpad.net/~freecad-maintainers/+archive/freecad-stable">Ubuntu</a> <small>32/64bit</small>
<a href="https://www.freecadweb.org/wiki/index.php?title=File:AppImage-logo.png" class="image"><img alt="AppImage-logo.png" src="AppImage-logo.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16.6712/FreeCAD-0.16.6712.glibc2.17-x86_64.AppImage">AppImage</a> <small>64bit</small>
</p><p><br />
Once you downloaded the .deb corresponding to your system version, if you have the <a href="http://en.wikipedia.org/wiki/Debian#GDEBI" class="extiw" title="wikipedia:Debian">Gdebi</a> package installed (usually it is), you just need to navigate to where you downloaded the file, and double-click on it. The necessary dependencies will be taken care of automatically by your system package manager.
Alternatively you can also install it from the terminal, navigating to where you downloaded the file, and type:
</p>
<pre>sudo dpkg -i Name_of_your_FreeCAD_package.deb </pre>
<p>changing Name_of_your_FreeCAD_package.deb by the name of the file you downloaded.
</p><p>After you installed FreeCAD, a startup icon will be added in the "Graphic" section of your Start Menu.
</p>
<h3><span class="mw-headline" id="Installera_p.C3.A5_andra_Linux.2FUnix_system">Installera på andra Linux/Unix system</span></h3>
<p>Olyckligtvis finns det för tillfället inga förkompilerade paket för andra Linux/Unix system, så du får <a href="https://www.freecadweb.org/wiki/index.php?title=CompileOnUnix/sv" title="CompileOnUnix/sv">kompilera FreeCAD själv</a>.
</p><p>Unfortnately, at the moment, no precompiled package is available for other Linux/Unix systems,so you will need to <a href="CompileOnUnix.html" title="CompileOnUnix">compile FreeCAD yourself</a>.
</p>
<h3><span class="mw-headline" id="Installing_Windows_Version_on_Linux">Installing Windows Version on Linux</span></h3>
<p>See the <a href="Install_on_Windows.html" title="Install on Windows">Install on Windows</a> page.
</p>
<p><br />
</p><p><br />
</p>
<h2><span class="mw-headline" id="Installera_p.C3.A5_Mac">Installera på Mac</span></h2>
<p>FreeCAD can be installed on Mac OS X in one step using the Installer.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mac.png" class="image"><img alt="Mac.png" src="Mac.png" width="32" height="32" /></a> <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/releases/download/0.16.6712/FreeCAD_0.16-6712.da2d364-OSX-x86_64.dmg">Mac</a> <small>10.9 Mavericks 64-bit</small>
</p><p><br />
This page describes the usage and features of the FreeCAD installer. It also includes uninstallation instructions.
Once installed, you can <a href="Getting_started.html" title="Getting started">get started</a>!
</p>
<h3><span class="mw-headline" id="Enkel_Installation_2">Enkel Installation</span></h3>
<p>FreeCAD installeraren erbjuds som ett Installationspaket(.mpkg) bifogad i en diskavbildningsfil.
</p><p>You can download the latest installer from the <a href="Download.html" title="Download">Download</a> page. After downloading the file, just mount the disk image, then drag it to the Application folder or a folder of your choice.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mac_installer_1.png" class="image"><img alt="Mac installer 1.png" src="Mac_installer_1.png" width="700" height="438" /></a>
</p><p>That's it.Just click on the app to launch FreeCAD. If you have this message "FreeCAD can't be open as it is from unidentified developer. " Open the folder (Application) and right click on the app then click open and accept to open the application.
</p><p><br />
</p>
<h3><span class="mw-headline" id="Avinstallation">Avinstallation</span></h3>
<p>Det finns för närvarande ingen avinstallerare för FreeCAD. För att helt ta bort FreeCAD och alla installerade komponenter, dra följande filer och mappar till papperskorgen:
</p>
<ul><li>I /Applications:
<ul><li>FreeCAD</li></ul></li></ul>
<p>Det är allt. Eventuellt så kommer FreeCAD att finnas tillgängligt som ett applikationspaket så att allt detta trubbel kommer att försvinna.
</p>
<p><br />
</p><p><br />
</p>
<h1><span class="mw-headline" id="Uppt.C3.A4cka_FreeCAD">Upptäcka FreeCAD</span></h1>
<p><br />
</p>
<h2><span class="mw-headline" id="What.27s_new">What's new</span></h2>
<ul><li> <a href="Release_notes_0.17.html" title="Release notes 0.17">Version 0.17 Release notes</a>&#160;: Check what's new in the 0.17 release of FreeCAD</li>
<li> <a href="Release_notes_0.16.html" title="Release notes 0.16">Version 0.16 Release notes</a>&#160;: Check what's new in the 0.16 release of FreeCAD</li>
<li> <a href="Release_notes_015.html" title="Release notes 015">Version 0.15 Release notes</a>&#160;: Check what's new in the 0.15 release of FreeCAD</li>
<li> <a href="Release_notes_0.14.html" title="Release notes 0.14">Version 0.14 Release notes</a>&#160;: Check what's new in the 0.14 release of FreeCAD</li>
<li> <a href="Release_notes_013.html" title="Release notes 013">Version 0.13 Release notes</a>&#160;: Check what's new in the 0.13 release of FreeCAD</li>
<li> <a href="Release_notes_012.html" title="Release notes 012">Version 0.12 Release notes</a>&#160;: Check what's new in the 0.12 release of FreeCAD</li>
<li> <a href="Release_notes_011.html" title="Release notes 011">Version 0.11 Release notes</a>&#160;: Check what's new in the 0.11 release of FreeCAD</li></ul>
<h2><span class="mw-headline" id="F.C3.B6rord">Förord</span></h2>
<p>FreeCAD är en CAD/CAE parametrisk modelleringsapplikation. Den är fortfarande i ett tidigt utvecklingsstadium, så förvänta dig inte att du ska kunna använda den till professionellt arbete än.
</p><p>Men, om du är nyfiken på hur FreeCAD ser ut och vilka funktioner som håller på att utvecklas, så är du välkommen att ladda ned den och testa den. För tillfället finns det redan många funktioner, men gränssnittet för många av dem har ännu inte skapats. detta innebär att om du kan lite om python, så kommer du redan att kunna producera och förändra komplex geometri relativt enkelt. Om inte, så kommer du förmodligen att upptäcka att FreeCAD fortfarande har en del att erbjuda dig. Men, ha tålamod, detta kommer att förändras snart.
</p><p>Och om du efter att ha testat den har kommentarer, ideer eller åsikter, var vänlig att dela dem med oss på <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/index.php">FreeCAD diskussionsforum</a>!
</p>
<h2><span class="mw-headline" id="Installation_2">Installation</span></h2>
<p>Först av allt (om det inte redan är gjort), ladda ned och installera FreeCAD. Se <a href="https://www.freecadweb.org/wiki/index.php?title=Download/sv" title="Download/sv">Nedladdningssidan</a> för information om nuvarande versioner och updateringar. Det finns färdiga installationspaket för Windows (.msi), Ubuntu &amp; Debian (.deb) openSUSE (.rpm) och Mac OSX.
</p>
<h2><span class="mw-headline" id="Utforska_FreeCAD">Utforska FreeCAD</span></h2>
<div class="thumb tnone"><div class="thumbinner" style="width:802px;"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Freecad09-empty.jpg" class="image"><img alt="" src="Freecad09-empty.jpg" width="800" height="481" class="thumbimage" /></a> <div class="thumbcaption">FreeCAD gränssnittet när du startar den första gången. Se fler <a href="https://www.freecadweb.org/wiki/index.php?title=Screenshots/sv" title="Screenshots/sv">skärmdumpar</a> här.</div></div></div>
<p>FreeCAD är en allmän, allt-i-allo 3D modelleringsapplikation, fokuserad på mekanisk konstruktion och relaterade områden, som andra konstruktionsspecialiteter eller arkitektur. Den är utformad som en plattform för utveckling av vilken 3D applikation som helst, men även för att göra väldigt specifika uppgifter. För det ändamålet så är dess gränssnitt uppdelat i en serie med <a href="https://www.freecadweb.org/wiki/index.php?title=Workbenches/sv" title="Workbenches/sv">Arbetsbänkar</a>. Arbetsbänkar gör att du ändrar gränssnittsinnehållet till att endast visa de verktyg som är nödvändiga för en specifik uppgift, uppgiftsgrupper.
</p><p>FreeCAD gränssnittet kan därför beskrivas som en mycket enkel behållare, med en menyrad, en 3D visningsområde, och några sidopaneler för att visa sceninnehållet eller objektegenskaper. Allt innehåll i dessa paneler kan förändras beroende på arbetsbänken.
</p><p>När du startar FreeCAD för den första gången, så kommer en "generell" arbetsbänk att presenteras för dig, som vi kallar "komplett arbetsbänk". Denna arbetsbänk samlar de mognaste verktygen från andra arbetsbänkar. Eftersom FreeCAD är ganska ungt och inte har använts för något specialiserat arbete ännu, så är denna arbetsbänk väldigt smidig för att utforska FreeCAD lättare. Alla verktyg som är tillräckligt bra för att producera geometri finns här.
</p><p><br />
</p>
<ol><li> The 3D view, showing the contents of your document</li>
<li> The tree view, which shows the hierarchy and construction history of all the objects in your document</li>
<li> The <a href="Property.html" title="Property">properties editor</a>, which allows you to view and modify properties of the selected object(s)</li>
<li> The report view (or output window), which is where FreeCAD prints messages, warnings and errors</li>
<li> The python console, where all the commands executed by FreeCAD are printed, and where you can enter python code</li>
<li> The <a href="Workbenches.html" title="Workbenches">workbench selector</a>, where you select the active workbench</li></ol>
<p><br />
The main concept behind the FreeCAD interface is that it is separated into <a href="Workbenches.html" title="Workbenches">workbenches</a>. A workbench is a collection of tools suited for a specific task, such as working with <a href="Mesh_Module.html" class="mw-redirect" title="Mesh Module">meshes</a>, or drawing <a href="Draft_Module.html" title="Draft Module">2D objects</a>, or <a href="Sketcher_Module.html" class="mw-redirect" title="Sketcher Module">constrained sketches</a>. You can switch the current workbench with the workbench selector (6). You can <a href="Interface_Customization.html" title="Interface Customization">customize</a> the tools included in each workbench, add tools from other workbenches or even self-created tools, that we call <a href="Macros.html" title="Macros">macros</a>. Widely used starting points are the <a href="PartDesign_Workbench.html" title="PartDesign Workbench">PartDesign Workbench</a> and <a href="Part_Workbench.html" class="mw-redirect" title="Part Workbench">Part Workbench</a>
</p><p>When you start FreeCAD for the first time, you are presented with the start center:
</p><p><br />
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Startcenter.jpg" class="image"><img alt="Startcenter.jpg" src="1024px-Startcenter.jpg" width="1024" height="574" srcset="/wiki/images/6/66/Startcenter.jpg 1.5x" /></a></div></div>
<p><br />
The Start Center allows you to quickly jump to one of the most common workbenches, open one of the recent files, or see the latest news from the FreeCAD world. You can change the default workbench in the <a href="Preferences_Editor.html" title="Preferences Editor">preferences</a>.
</p>
<h3><span class="mw-headline" id="Navigera_i_3D_rymden">Navigera i 3D rymden</span></h3>
<p>FreeCAD har två olika <a href="https://www.freecadweb.org/wiki/index.php?title=Mouse_Model/sv" title="Mouse Model/sv">navigationslägen</a> tillgängliga, som kan ställas in i inställningsdialogen. I standardläget, så utförs <b>zoomning</b> med <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Mushjulet</span>, <b>panorering</b> med <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Mittre musknappen</span>, och <b>rotation</b> med <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">vänster musknapp</span> och <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Mittre musknappen</span> samtidigt. Val av ett objekt görs genom att klicka på det med <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">vänster musknapp</span>, med <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">CTRL</span> nedtryckt om du vill välja flera objekt.
</p><p>Du har också flera förinställda vyer (Toppvy, Frontvy, etc) tillgängliga i Visa menyn och på verktygslådan Visa, och via numeriska genvägar (<span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">1</span>, <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">2</span>, etc...)
</p>
<h2><span class="mw-headline" id="Skript"><a href="https://www.freecadweb.org/wiki/index.php?title=Scripting/sv" class="mw-redirect" title="Scripting/sv">Skript</a></span></h2>
<p>Och slutligen, en av de kraftfullaste funktionerna i FreeCAD är <a href="https://www.freecadweb.org/wiki/index.php?title=Scripting/sv" class="mw-redirect" title="Scripting/sv">skript</a> miljön. Från den integrerade pythonkonsolen (eller från något externt pythonskript), så får du åtkomst till nästan vilken del som helst av FreeCAD, skapa eller ändra geometri, ändra representationen av dessa objekt i 3D scenen eller förändra FreeCAD's gränssnitt. Python skript kan även användas i <a href="https://www.freecadweb.org/wiki/index.php?title=Macros/sv" title="Macros/sv">makron</a>, vilket erbjuder en lätt metod att skapa anpassade kommandon.
</p><p>FreeCAD has several different <a href="Mouse_Model.html" title="Mouse Model">navigation modes</a> available, that change the way you use your mouse to interact with the objects in the 3D view and the view itself. One of them is specifically made for <a href="/wiki/Mouse_Model#Touchpad_Navigation" title="Mouse Model">touchpads</a>, where the middle mouse button is not used. The following table describes the default mode, called <b>CAD Navigation</b> (You can quickly change the current navigation mode by right-clicking on an empty area of the 3D view):
</p><p><br />
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="20%">Select
</th>
<th align="center" width="20%">Pan
</th>
<th align="center" width="20%">Zoom
</th>
<th align="center" width="20%">Rotate View
</th>
<th align="center" width="20%">Rotate View
<p>Alternate Method
</p>
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse.svg" class="image" title="to Rotate view"><img alt="to Rotate view" src="Rotate-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse-MMB%2BRMB.svg" class="image" title="to Rotate view"><img alt="to Rotate view" src="Rotate-mouse-MMB%2BRMB.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select. Holding down ctrl allows the selection of multiple objects.
</td>
<td>Click the middle mouse button and move the object around to pan
</td>
<td>Use the mouse wheel to zoom in and out. Clicking the middle mouse button re-centers the view to the location of the cursor.
</td>
<td>Click first with the middle mouse button, hold it down, and then click the left mouse button and drag the mouse in the desired direction. The cursor location at the middle mouse button click determines the center of rotation. Rotation works like spinning a ball which rotates around its center. If the buttons are released before you stop the mouse motion, the object continues <a href="Spinning.html" title="Spinning">spinning</a>, if this is enabled. A double click with the middle mouse button sets a new center of rotation.
</td>
<td>Click first with the middle mouse button, hold it down, and then click the right mouse button and drag the mouse in the desired direction. This method works just like the previously described Rotate View that uses Middle Mouse Button + Left Mouse Button, except that the middle mouse button may be released after the right mouse button is pressed. Users who use the mouse with their right hand may find this Rotate View method easier than the previous method.
</td></tr>
<tr align="center">
<td>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse-CTRL.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse-CTRL.svg" width="75" height="107" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse-CTRL-SHIFT.svg" class="image" title="to Zoom"><img alt="to Zoom" src="Zoom-mouse-CTRL-SHIFT.svg" width="75" height="107" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse-SHIFT.svg" class="image" title="to rotate"><img alt="to rotate" src="Rotate-mouse-SHIFT.svg" width="75" height="107" /></a>
</td>
<td>
</td></tr>
<tr valign="top">
<td>
</td>
<td>For the Pan mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ctrl</span> key and press the right mouse button to pan (rev 0.17)
</td>
<td>For the Zoom mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ctrl</span> and <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Shift</span> key and press the right mouse button to Zoom (rev 0.17)
</td>
<td>For the Rotate mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Shift</span> key and press the right mouse button to rotate (rev 0.17)
</td>
<td>
</td></tr></table>
<p><br />
</p><p>You also have several view presets (top view, front view, etc) available in the View menu and on the View toolbar, and by numeric shortcuts (<span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">1</span>, <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">2</span>, etc...), and by right-clicking on an object or on an empty area of the 3D view, you have quick access to some common operations, such as setting a particular view, or locating an object in the Tree view.
</p>
<h2><span class="mw-headline" id="First_steps_with_FreeCAD">First steps with FreeCAD</span></h2>
<p>FreeCAD's focus is to allow you to make high-precision 3D models, to keep tight control over those models (being able to go back into modelling history and change parameters), and eventually to build those models (via 3D printing, CNC machining or even construction worksite). It is therefore very different from some other 3D applications made for other purposes, such as animation film or gaming. Its learning curve can be steep, specially if this is your first contact with 3D modeling. If you are struck at some point, don't forget that the friendly community of users on the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/index.php">FreeCAD forum</a> might be able to get you out in no time.
</p><p>The workbench you will start using in FreeCAD depends on the type of job you need to do: If you are going to work on mechanical models, or more generally any small-scale objects, you'll probably want to try the <a href="PartDesign_Workbench.html" title="PartDesign Workbench">PartDesign Workbench</a>. If you will work in 2D, then switch to the <a href="Draft_Workbench.html" class="mw-redirect" title="Draft Workbench">Draft Workbench</a>, or the <a href="Sketcher_Workbench.html" title="Sketcher Workbench">Sketcher Workbench</a> if you need constraints. If you want to do BIM, launch the <a href="Arch_Workbench.html" class="mw-redirect" title="Arch Workbench">Arch Workbench</a>. If you are working with ship design, there is a special <a href="Ship_Workbench.html" title="Ship Workbench">Ship Workbench</a> for you. And if you come from the OpenSCAD world, try the <a href="OpenSCAD_Workbench.html" class="mw-redirect" title="OpenSCAD Workbench">OpenSCAD Workbench</a>.
</p><p>You can switch workbenches at any time, and also <a href="Interface_Customization.html" title="Interface Customization">customize</a> your favorite workbench to add tools from other workbenches.
</p>
<h2><span class="mw-headline" id="Working_with_the_PartDesign_and_Sketcher_workbenches">Working with the PartDesign and Sketcher workbenches</span></h2>
<p>The <a href="PartDesign_Workbench.html" title="PartDesign Workbench">PartDesign Workbench</a> is specially made to build complex objects, starting from simple shapes, and adding or removing pieces (that we call "features"), until you get to your final object. All the features you applied during the modelling process are stored in a separate view called the <a href="Document_structure.html" title="Document structure">tree view</a>, which also contains the other objects in your document. You can think of a PartDesign object as a succession of operations, each one applied to the result of the preceding one, forming one big chain. In the tree view, you see your final object, but you can expand it and retrieve all preceding states, and change any of their parameter, which automatically updates the final object.
</p><p>The PartDesign workbench makes heavy use of another workbench, the <a href="Sketcher_Workbench.html" title="Sketcher Workbench">Sketcher Workbench</a>. The sketcher allows you to draw 2D shapes, which are defined by applying Constraints to the 2D shape. For example, you might draw a rectangle and set the size of a side by applying a length constraint to one of the sides. That side then cannot be resized anymore (unless the constraint is changed).
</p><p>Those 2D shapes made with the sketcher are used a lot in the PartDesign workbench, for example to create 3D volumes, or to draw areas on the faces of your object that will then be hollowed from its main volume. This is a typical PartDesign workflow:
</p>
<ol><li> Create a new sketch</li>
<li> Draw a closed shape (make sure all points are joined)</li>
<li> Close the sketch</li>
<li> Expand the sketch into a 3D solid by using the pad tool</li>
<li> Select one face of the solid</li>
<li> Create a second sketch (this time it will be drawn on the selected face)</li>
<li> Draw a closed shape</li>
<li> Close the sketch</li>
<li> Create a pocket from the second sketch, on the first object</li></ol>
<p>Which gives you an object like this:
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Partdesign_example.jpg" class="image"><img alt="Partdesign example.jpg" src="1024px-Partdesign_example.jpg" width="1024" height="524" srcset="/wiki/images/5/53/Partdesign_example.jpg 1.5x" /></a></div></div>
<p>At any moment, you can select the original sketches and modify them, or change the extrusion parameters of the pad or pocket operations, which will update the final object.
</p>
<h2><span class="mw-headline" id="Working_with_the_Draft_and_Arch_workbenches">Working with the Draft and Arch workbenches</span></h2>
<p>The <a href="Draft_Workbench.html" class="mw-redirect" title="Draft Workbench">Draft Workbench</a> and <a href="Arch_Module.html" title="Arch Module">Arch Workbench</a> behave a bit differently than the other workbenches above, although they follow the same rules, which are common to all of FreeCAD. In short, while the Sketcher and PartDesign are made primarily to design single pieces, Draft and Arch are made to ease your work when working with several, simpler objects.
</p><p>The <a href="Draft_Workbench.html" class="mw-redirect" title="Draft Workbench">Draft Workbench</a> offers you 2D tools a bit similar to what you can find in traditional 2D CAD applications such as <a rel="nofollow" class="external text" href="https://en.wikipedia.org/wiki/AutoCAD">AutoCAD</a>. However, 2D drafting being far away from the scope of FreeCAD, don't expect to find there the full array of tools that these dedicated applications offer. Most of the Draft tools work not only in a 2D plane but also in the full 3D space, and benefit from special helper systems such as <a href="Draft_SelectPlane.html" title="Draft SelectPlane">Work planes</a> and <a href="Draft_Snap.html" title="Draft Snap">object snapping</a>.
</p><p>The <a href="Arch_Module.html" title="Arch Module">Arch Workbench</a> adds <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Building_Information_Modeling">BIM</a> tools to FreeCAD, allowing you to build architectural models with parametric objects. The Arch workbench relies much on other modules such as Draft and Sketcher. All the Draft tools are also present in the Arch workbench, and most Arch tools make use of the Draft helper systems.
</p><p>A typical workflow with Arch and Draft workbenches might be:
</p>
<ol><li> Draw a couple of lines with the Draft Line tool</li>
<li> Select each line and press the Wall tool to build a wall on each of them</li>
<li> Join the walls by selecting them and pressing the Arch Add tool</li>
<li> Create a floor object, and move your walls in it from the Tree view</li>
<li> Create a building object, and move your floor in it from the Tree view</li>
<li> Create a window by clicking the Window tool, select a preset in its panel, then click on a face of a wall</li>
<li> Add dimensions by first setting the working plane if necessary, then using the Draft Dimension tool</li></ol>
<p>Which will give you this:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Arch_workflow_example.jpg" class="image"><img alt="Arch workflow example.jpg" src="1024px-Arch_workflow_example.jpg" width="1024" height="604" srcset="/wiki/images/d/df/Arch_workflow_example.jpg 1.5x" /></a>
</p><p>More on the <a href="Tutorials.html" title="Tutorials">Tutorials</a> page.
</p>
<h2><span class="mw-headline" id="Scripting">Scripting</span></h2>
<p>And finally, one of the most powerful features of FreeCAD is the <a href="Scripting.html" class="mw-redirect" title="Scripting">scripting</a> environment. From the integrated python console (or from any other external Python script), you can gain access to almost any part of FreeCAD, create or modify geometry, modify the representation of those objects in the 3D scene or access and modify the FreeCAD interface. Python scripting can also be used in <a href="Macros.html" title="Macros">macros</a>, which provide an easy method to create custom commands.
</p><p><br />
</p>
<p><br />
</p>
<h1><span class="mw-headline" id="Arbeta_med_FreeCAD">Arbeta med FreeCAD</span></h1>
<h2><span class="mw-headline" id="3D_navigering">3D navigering</span></h2>
<p>FreeCAD's <b>musmodell</b> är mycket flexibel och intuitiv och med några tips så kan du använda den redan efter någon minuts träning.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mouse-model.png" class="image"><img alt="Mouse-model.png" src="Mouse-model.png" width="800" height="371" /></a>
</p><p>FreeCAD's <b>musmodell</b> är mycket flexibel och intuitiv och med några tips så kan du använda den redan efter någon minuts träning.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mouse-model.png" class="image"><img alt="Mouse-model.png" src="Mouse-model.png" width="800" height="371" /></a>
</p>
<h2><span class="mw-headline" id="V.C3.A4lja_objekt">Välja objekt</span></h2>
<p>Objekt kan väljas med ett klick med den vänstra musknappen antingen genom att klicka på objektet i 3D-vyn eller genom att välja den i trädvyn. Det finns även en Förvals mekanism som markerar objekt och visar information om dem bara genom att hålla markören över den. Om du inte gillar det beteendet eller om du har en långsam maskin, så kan du stänga av förval i inställningarna.
</p>
<h2><span class="mw-headline" id="Hantera_Objekt">Hantera Objekt</span></h2>
<p>Objekthanteringen är gemensam för alla arbetsbänkar. Följande musgester kan användas till att kontrollera objektposition och vy.
</p>
<dl><dt>Välj</dt>
<dd> Klicka med den vänstra musknappen över det objekt som du vill välja.</dd></dl>
<dl><dt>Zoom</dt>
<dd> Använd <i>+</i> eller <i>-</i> tangenterna eller mushjulet för att zooma in och ut.</dd></dl>
<dl><dt>Panorera</dt>
<dd> Klicka med den mittre musknappen och flytta runt objektet .</dd></dl>
<dl><dt>Rotera</dt>
<dd> Klicka först med den mittre musknappen, håll den nedtryckt och klicka sedan med den vänstra musknappen på en synlig del av ett objekt och dra den i den önskade riktningen. Detta fungerar som en boll som snurrar runt dess centrum. Om du släpper knapparna innan du stoppar rörelsen, så kommer objektet fortsätta att <a href="https://www.freecadweb.org/wiki/index.php?title=Spinning/sv" title="Spinning/sv">rotera</a>, om detta är aktiverat.</dd></dl>
<dl><dt>Ställa in rotationscentrum</dt>
<dd> Ett dubbelklick med den mittre musknappen på valfri del av objektet ställer in ett nytt roationscentrum och zoomar in på denna punkt.</dd></dl>
<h2><span class="mw-headline" id="Manipulera_Objekt">Manipulera Objekt</span></h2>
<p>FreeCAD har <a href="https://www.freecadweb.org/wiki/index.php?title=Manipulator/sv" title="Manipulator/sv">manipulatorer</a> som kan användas till att ändra ett objekt eller dess visuella utseende. Ett enkelt exempel är <a href="https://www.freecadweb.org/wiki/index.php?title=Std_ClippingPlane/sv" title="Std ClippingPlane/sv">klippningsplan</a> som kan aktiveras med <i>Visa?Klippningsplan</i> menyn. Efter aktivering så kommer klippningsplan objektet fram och visar sju självklara manipulatorer som små lådor: En på varje ände på dess tre koordinataxlar och en på dentrum på den axel som är normal till planet. Det finns fyra till som inte är så självklara: Själva planet och den tunna delen på de tre axelobjekten.
</p>
<dl><dt>Skalning</dt>
<dd> För att skala objektet klicka med den vänstra musknappen på lådmanipulatorerna vid slutet på axlarna och dra dem bakåt och framåt. Beroende på objektet så arbetar manipulatorerna oberoende eller synkront.</dd>
<dt>Flytta ut ur planet</dt>
<dd> För att flytta objektet längs dess normalvektor, dra i den långa lådan vid axelns centrum med den vänstra musknappen. För klippningsplanet finns det endast en manipulator längs normalvektorn.</dd>
<dt>Flytta i planet</dt>
<dd> För att flytta klippningsplanets centrum, klicka på planobjektet och dra den till den önskade positionen.</dd>
<dt>Rotation</dt>
<dd> Klicka på den tunna delen av axlarna sätter manipulatorn i rotationsläge.</dd></dl>
<p>The FreeCAD <b>mouse model</b> consists of the commands used to visually navigate the 3D space and interact with the objects displayed. FreeCAD supports multiple mouse model navigation styles. The default navigation style is referred to as "CAD Navigation," and is very simple and practical, but FreeCAD also provides alternative navigation styles, that you can choose according to your preferences.
</p>
<h2><span class="mw-headline" id="Hantera_Objekt_2">Hantera Objekt</span></h2>
<p>Objekthanteringen är gemensam för alla arbetsbänkar. Följande musgester kan användas till att kontrollera objektposition och vy.
</p>
<dl><dt>Välj</dt>
<dd> Klicka med den vänstra musknappen över det objekt som du vill välja.</dd></dl>
<dl><dt>Zoom</dt>
<dd> Använd <i>+</i> eller <i>-</i> tangenterna eller mushjulet för att zooma in och ut.</dd></dl>
<dl><dt>Panorera</dt>
<dd> Klicka med den mittre musknappen och flytta runt objektet .</dd></dl>
<dl><dt>Rotera</dt>
<dd> Klicka först med den mittre musknappen, håll den nedtryckt och klicka sedan med den vänstra musknappen på en synlig del av ett objekt och dra den i den önskade riktningen. Detta fungerar som en boll som snurrar runt dess centrum. Om du släpper knapparna innan du stoppar rörelsen, så kommer objektet fortsätta att <a href="https://www.freecadweb.org/wiki/index.php?title=Spinning/sv" title="Spinning/sv">rotera</a>, om detta är aktiverat.</dd></dl>
<dl><dt>Ställa in rotationscentrum</dt>
<dd> Ett dubbelklick med den mittre musknappen på valfri del av objektet ställer in ett nytt roationscentrum och zoomar in på denna punkt.</dd></dl>
<h2><span class="mw-headline" id="Manipulera_Objekt_2">Manipulera Objekt</span></h2>
<p>FreeCAD har <a href="https://www.freecadweb.org/wiki/index.php?title=Manipulator/sv" title="Manipulator/sv">manipulatorer</a> som kan användas till att ändra ett objekt eller dess visuella utseende. Ett enkelt exempel är <a href="https://www.freecadweb.org/wiki/index.php?title=Std_ClippingPlane/sv" title="Std ClippingPlane/sv">klippningsplan</a> som kan aktiveras med <i>Visa?Klippningsplan</i> menyn. Efter aktivering så kommer klippningsplan objektet fram och visar sju självklara manipulatorer som små lådor: En på varje ände på dess tre koordinataxlar och en på dentrum på den axel som är normal till planet. Det finns fyra till som inte är så självklara: Själva planet och den tunna delen på de tre axelobjekten.
</p>
<dl><dt>Skalning</dt>
<dd> För att skala objektet klicka med den vänstra musknappen på lådmanipulatorerna vid slutet på axlarna och dra dem bakåt och framåt. Beroende på objektet så arbetar manipulatorerna oberoende eller synkront.</dd>
<dt>Flytta ut ur planet</dt>
<dd> För att flytta objektet längs dess normalvektor, dra i den långa lådan vid axelns centrum med den vänstra musknappen. För klippningsplanet finns det endast en manipulator längs normalvektorn.</dd>
<dt>Flytta i planet</dt>
<dd> För att flytta klippningsplanets centrum, klicka på planobjektet och dra den till den önskade positionen.</dd>
<dt>Rotation</dt>
<dd> Klicka på den tunna delen av axlarna sätter manipulatorn i rotationsläge.</dd></dl>
<p>The FreeCAD <b>mouse model</b> consists of the commands used to visually navigate the 3D space and interact with the objects displayed. FreeCAD supports multiple mouse model navigation styles. The default navigation style is referred to as "CAD Navigation," and is very simple and practical, but FreeCAD also provides alternative navigation styles, that you can choose according to your preferences.
</p>
<h2><span class="mw-headline" id="Navigation">Navigation</span></h2>
<p>The object handling is common to all workbenches. The following mouse gestures can be used to control the object position and view according to which Navigation style is selected.
</p><p>There are two ways to change the navigation style:
</p>
<ul><li> In the <a href="Preferences_Editor.html" title="Preferences Editor">Preferences Editor</a>, Display section, <i>3D View</i> tab;</li>
<li> By right-clicking in empty space in the 3D view area, then selecting <i>Navigation style</i> in the contextual menu.</li></ul>
<p><br />
</p>
<h3><span class="mw-headline" id="CAD_Navigation_.28default.29">CAD Navigation (default)</span></h3>
<p>This is the default navigation style and allows the user a simple control of the view, and does not require the use of keyboard keys except to make multi-selections.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="20%">Select
</th>
<th align="center" width="20%">Pan
</th>
<th align="center" width="20%">Zoom
</th>
<th align="center" width="20%">Rotate View
</th>
<th align="center" width="20%">Rotate View
<p>Alternate Method
</p>
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse.svg" class="image" title="to Rotate view"><img alt="to Rotate view" src="Rotate-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse-MMB%2BRMB.svg" class="image" title="to Rotate view"><img alt="to Rotate view" src="Rotate-mouse-MMB%2BRMB.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select. Holding down ctrl allows the selection of multiple objects.
</td>
<td>Click the middle mouse button and move the object around to pan
</td>
<td>Use the mouse wheel to zoom in and out. Clicking the middle mouse button re-centers the view to the location of the cursor.
</td>
<td>Click first with the middle mouse button, hold it down, and then click the left mouse button and drag the mouse in the desired direction. The cursor location at the middle mouse button click determines the center of rotation. Rotation works like spinning a ball which rotates around its center. If the buttons are released before you stop the mouse motion, the object continues <a href="Spinning.html" title="Spinning">spinning</a>, if this is enabled. A double click with the middle mouse button sets a new center of rotation.
</td>
<td>Click first with the middle mouse button, hold it down, and then click the right mouse button and drag the mouse in the desired direction. This method works just like the previously described Rotate View that uses Middle Mouse Button + Left Mouse Button, except that the middle mouse button may be released after the right mouse button is pressed. Users who use the mouse with their right hand may find this Rotate View method easier than the previous method.
</td></tr>
<tr align="center">
<td>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse-CTRL.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse-CTRL.svg" width="75" height="107" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse-CTRL-SHIFT.svg" class="image" title="to Zoom"><img alt="to Zoom" src="Zoom-mouse-CTRL-SHIFT.svg" width="75" height="107" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse-SHIFT.svg" class="image" title="to rotate"><img alt="to rotate" src="Rotate-mouse-SHIFT.svg" width="75" height="107" /></a>
</td>
<td>
</td></tr>
<tr valign="top">
<td>
</td>
<td>For the Pan mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ctrl</span> key and press the right mouse button to pan (rev 0.17)
</td>
<td>For the Zoom mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ctrl</span> and <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Shift</span> key and press the right mouse button to Zoom (rev 0.17)
</td>
<td>For the Rotate mode, press the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Shift</span> key and press the right mouse button to rotate (rev 0.17)
</td>
<td>
</td></tr></table>
<p><br />
</p>
<h3><span class="mw-headline" id="OpenInventor_Navigation">OpenInventor Navigation</span></h3>
<p>In OpenInventor (formerly Inventor) Navigation, modeled after <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">Open Inventor</a> (not to be confused with Autodesk Inventor), there is no mouse-only selection. In order to select objects, you must hold down the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">CTRL</span> key.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="25%">Select
</th>
<th align="center" width="25%">Pan
</th>
<th align="center" width="25%">Zoom
</th>
<th align="center" width="25%">Rotate View
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ctrl</span> +<a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a> or <a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Rotate-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Rotate"><img alt="to Rotate" src="Select-mouse.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Hold ctrl and press the left mouse button over an object you want to select.
</td>
<td>Click the middle mouse button and move the object around.
</td>
<td>Use the mouse wheel to zoom in and out, or click and hold the middle mouse button and click the left mouse button.
</td>
<td>Click and drag with the left mouse button to rotate
</td></tr></table>
<p><br />
</p>
<h3><span class="mw-headline" id="Blender_Navigation">Blender Navigation</span></h3>
<p>The Blender Navigation was modeled after <a rel="nofollow" class="external text" href="http://www.blender.org">Blender</a>. Previously there was no mouse-only panning, and it required use of the <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">SHIFT</span> key to pan the view. This changed in 2016 with a feature-addition. In order to pan the view, you can now press both left and right mouse buttons and drag in the view.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="25%">Select
</th>
<th align="center" width="25%">Pan
</th>
<th align="center" width="25%">Zoom
</th>
<th align="center" width="25%">Rotate View
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">shift</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse.svg" width="70" height="100" /></a> or <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mouse_LMB%2BRMB.svg" class="image"><img alt="Mouse LMB+RMB.svg" src="Mouse_LMB%2BRMB.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Rotate"><img alt="to Rotate" src="Pan-mouse.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select.
</td>
<td>Hold shift and click the middle mouse button and move the object around, or hold down the Left and Right buttons and move.
</td>
<td>Use the mouse wheel to zoom in and out.
</td>
<td>Click and drag with the middle mouse button.
</td></tr></table>
<p><br />
</p>
<h3><span class="mw-headline" id="Touchpad_Navigation">Touchpad Navigation</span></h3>
<p>In Touchpad Navigation, neither panning, nor zooming, nor rotating the view, are mouse-only (or touchpad-only) operations.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="25%">Select
</th>
<th align="center" width="25%">Pan
</th>
<th align="center" width="25%">Zoom
</th>
<th align="center" width="25%">Rotate View
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-touchpad.png" class="image" title="to Select"><img alt="to Select" src="70px-Select-touchpad.png" width="70" height="70" srcset="/wiki/images/b/bb/Select-touchpad.png 1.5x" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">shift</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Touchpad.png" class="image" title="to Pan"><img alt="to Pan" src="70px-Touchpad.png" width="70" height="70" srcset="/wiki/images/7/78/Touchpad.png 1.5x" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">PgUp</span> / <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">PgDn</span>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">alt</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Touchpad.png" class="image" title="to Rotate"><img alt="to Rotate" src="70px-Touchpad.png" width="70" height="70" srcset="/wiki/images/7/78/Touchpad.png 1.5x" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select.
</td>
<td>Hold shift and move the object around.
</td>
<td>Use PgUp and PgDn to zoom in and out.
</td>
<td>Hold alt and move the pointer.
</td></tr>
<tr align="center">
<td>
</td>
<td>
</td>
<td> <i>or</i>
</td>
<td> <i>or</i>
</td></tr>
<tr align="center">
<td>
</td>
<td>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">shift</span>+<span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ctrl</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-touchpad.png" class="image" title="to Zoom"><img alt="to Zoom" src="70px-Select-touchpad.png" width="70" height="70" srcset="/wiki/images/b/bb/Select-touchpad.png 1.5x" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">shift</span>+<span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ctrl</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Touchpad.png" class="image" title="to ROtate"><img alt="to ROtate" src="70px-Touchpad.png" width="70" height="70" srcset="/wiki/images/7/78/Touchpad.png 1.5x" /></a>
</td></tr>
<tr valign="top">
<td>
</td>
<td>
</td>
<td>Hold down both the shift and the ctrl keys, press the left mouse button, and move the pointer.
</td>
<td>Hold down both the shift and the ctrl keys and move the pointer.
</td></tr></table>
<p><br />
</p>
<h3><span class="mw-headline" id="Gesture_Navigation_.28v0.16.29">Gesture Navigation (v0.16)</span></h3>
<p>This navigation style was tailored for usability with touchscreen and pen, but is very usable with mouse too.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="20%">Select
</th>
<th align="center" width="20%">Pan
</th>
<th align="center" width="20%">Zoom
</th>
<th align="center" width="20%">Rotate View
</th>
<th align="center" width="20%">Tilt View
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse-Ctrl.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse-Ctrl.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Rotate view"><img alt="to Rotate view" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mouse_LMB%2BRMB.svg" class="image" title="to Tilt view"><img alt="to Tilt view" src="Mouse_LMB%2BRMB.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select. Holding down <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Ctrl</span> allows the selection of multiple objects.
</td>
<td>Hold right mouse button and drag to pan the view.
</td>
<td>Use the mouse wheel to zoom in and out. The zoom is centered at the cursor location.
</td>
<td>Hold Left mouse button and drag to rotate the view.
<p>In Sketcher and other edit modes, this behavior is disabled. Hold <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Alt</span> when pressing the mouse button to enter rotation mode.
</p><p>Rotation is always around camera's focus point. To set camera's focus point, click the new point with middle mouse button; the view will center on that point. Alternatively, aim the cursor at the new point and press <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">H</span> on keyboard.
</p>
</td>
<td>Press both left and right mouse buttons, and drag left or right to tilt the view (adjust horizon).
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_Tap.svg" class="image"><img alt="Touch Tap.svg" src="Touch_Tap.svg" width="100" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_Tap-Hold-Drag.svg" class="image"><img alt="Touch Tap-Hold-Drag.svg" src="Touch_Tap-Hold-Drag.svg" width="100" height="100" /></a>
<p>or
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_Two-Finger-Drag.svg" class="image"><img alt="Touch Two-Finger-Drag.svg" src="Touch_Two-Finger-Drag.svg" width="100" height="100" /></a>
</p>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_Pinch.svg" class="image"><img alt="Touch Pinch.svg" src="Touch_Pinch.svg" width="100" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_One-Finger-Drag.svg" class="image"><img alt="Touch One-Finger-Drag.svg" src="Touch_One-Finger-Drag.svg" width="100" height="100" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Touch_Rotate.svg" class="image"><img alt="Touch Rotate.svg" src="Touch_Rotate.svg" width="100" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Tap to select.
</td>
<td>Drag with two fingers to pan the view. Alternatively, tap and hold, then drag (simulates pan with right mouse button).
</td>
<td>Pinch to zoom (i.e., drag two fingers to each other/apart).
</td>
<td>Drag with one finger to rotate. Hold <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Alt</span> additionally when in Sketcher and some other edit modes.
</td>
<td>Rotate to tilt the view (i.e., put two fingers on surface and rotate the imaginary line formed by two touch points).
</td></tr></table>
<p>Notes on Gesture Navigation style:
</p>
<ul><li> on Windows, the actions of two-finger gestures are separated. The action depends on how one starts the gesture. For example, if one starts two-finger pan, the gesture will only pan. Changing the distance between fingers afterwards will not affect the scaling.</li></ul>
<p><br />
</p>
<h3><span class="mw-headline" id="Maya-Gesture_Navigation">Maya-Gesture Navigation</span></h3>
<p>In Maya-Gesture Navigation, all view movements are activated pressing <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ALT</span> and a mouse button, so that it will be needed to have a 3 button mouse in order to correctly use this navigation mode. Alternately it's possible to use gestures as this mode was been developed over the normal Gesture Navigation mode.
</p>
<table border="1" class="mousemodel">
<tr>
<th align="center" width="25%">Select
</th>
<th align="center" width="25%">Pan
</th>
<th align="center" width="25%">Zoom
</th>
<th align="center" width="25%">Rotate View
</th></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Hand_cursor.png" class="image"><img alt="Hand cursor.png" src="Hand_cursor.png" width="24" height="24" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan_cursor.png" class="image"><img alt="Pan cursor.png" src="Pan_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom_cursor.png" class="image"><img alt="Zoom cursor.png" src="Zoom_cursor.png" width="16" height="16" /></a>
</td>
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Rotate_cursor.png" class="image"><img alt="Rotate cursor.png" src="Rotate_cursor.png" width="16" height="16" /></a>
</td></tr>
<tr align="center">
<td><a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Select"><img alt="to Select" src="Select-mouse.svg" width="70" height="100" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">alt</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse.svg" class="image" title="to Pan"><img alt="to Pan" src="Pan-mouse.svg" width="70" height="100" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">alt</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Pan-mouse-Ctrl.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Pan-mouse-Ctrl.svg" width="70" height="100" /></a> or <a href="https://www.freecadweb.org/wiki/index.php?title=File:Zoom-mouse.svg" class="image" title="to Zoom in or out"><img alt="to Zoom in or out" src="Zoom-mouse.svg" width="70" height="100" /></a>
</td>
<td><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">alt</span>+<a href="https://www.freecadweb.org/wiki/index.php?title=File:Select-mouse.svg" class="image" title="to Rotate"><img alt="to Rotate" src="Select-mouse.svg" width="70" height="100" /></a>
</td></tr>
<tr valign="top">
<td>Press the left mouse button over an object you want to select.
</td>
<td>Hold <b>alt</b>, hold the middle mouse button and drag to pan the view.
</td>
<td>Hold <b>alt</b>, hold the right mouse button and drag to zoom in and out or use the mouse wheel to get the same effect.
</td>
<td>Hold <b>alt</b>, hold the left mouse button and drag to rotate the object around.
</td></tr></table>
<p><br />
</p>
<h2><span class="mw-headline" id="Selecting_objects">Selecting objects</span></h2>
<h3><span class="mw-headline" id="Simple_selection">Simple selection</span></h3>
<p>Objects can be selected by a click with the left mouse button either by clicking on the object in the 3D-view or by selecting it in the tree view.
</p>
<h3><span class="mw-headline" id="Preselection">Preselection</span></h3>
<p>There is also a <i>Preselection</i> mechanism that highlights objects and displays information before selection by just hovering the mouse over the objects. If you don't like this behaviour or you have a slow machine, you can switch preselection off in the preferences.
</p><p><br />
</p>
<h2><span class="mw-headline" id="Manipulating_Objects">Manipulating Objects</span></h2>
<p>FreeCAD offers <a href="Manipulator.html" title="Manipulator"><i>manipulators</i></a> that are handles that can be used to modify an object's appearance, shape, or other parameters.
</p><p>The <a href="Std_ClippingPlane.html" title="Std ClippingPlane">clipping plane</a> is an example of an object with manipulators. A <a href="Std_ClippingPlane.html" title="Std ClippingPlane">clipping plane</a> can be activated with the <i>View→Clipping Plane</i> menu
</p>
<h2><span class="mw-headline" id="Hardware_support">Hardware support</span></h2>
<p>FreeCAD also supports some <a href="3D_input_devices.html" title="3D input devices">3D input devices</a>.
</p>
<h2><span class="mw-headline" id="Mac_OS_X_Issues">Mac OS X Issues</span></h2>
<p>Recently we got reports <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=3&amp;t=3592&amp;start=0">on the forum</a> from Mac users that those mouse button and key combination do not work as expected. Unfortunately, none of the developers owns a Mac, neither do the other regular contributors. We need your help to determine which mouse buttons and key combination work so we can update this wiki.
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="FreeCAD_Dokumentet">FreeCAD Dokumentet</span></h2>
<p><br />
</p>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Screenshot_treeview.jpg" class="image"><img alt="Screenshot treeview.jpg" src="Screenshot_treeview.jpg" width="217" height="254" /></a></div>
<p>Ett FreeCAD document inehåller alla objekten i din scen. Det kan innehålla grupper, och objekt gjorda med valfri arbetsbänk. Du kan därför växla mellan arbetsbänkar, och ändå arbeta med samma dokument. Dokumentet är det som sparas till disk när du sparar ditt arbete. Du kan också äppna flera dokument samtidigt i FreeCAD, och öppna flera vyer av samma dokument.
</p><p>Inuti dokumentet, så kan objekten flyttas in i grupper, och ha unika namn. Hantering av grupper, objekt och objektnamn görs huvudsakligen från Trädvyn. Det kan förstås också göras, som allt annat i FreeCAD, från pythontolken. I trädvyn, så kan du skapa grupper, flytta objekt till grupper, radera objekt eller grupper, genom att högerklicka i trädvyn eller på ett objekt, döpa om objekt genom att dubbelklicka på dess namn, eller möjligtvis andra operationer, beroende på vilken arbetsbänk som används.
</p><p>Objekten inuti ett FreeCAD dokument kan vara av olika typer. Varje arbetsbänk kan skapa sina egna objekttyper, till exempel <a href="https://www.freecadweb.org/wiki/index.php?title=Mesh_Module/sv" class="mw-redirect" title="Mesh Module/sv">Nät arbetsbänken</a> skapar nätobjekt, <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del arbetsbänken</a> skapar Del objekt, <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Module/sv" title="Draft Module/sv">Rit arbetsbänken</a> skapar också Del objekt, etc.
</p><p>Om det finns åtminstone ett dokument öppet i FreeCAD, så finns det alltid ett och endast ett aktivt dokument. Det är det dokument som syns i den nuvarande 3D vyn, dokumentet som du för närvarande jobbar med.
</p>
<h2><span class="mw-headline" id="Applikations_och_Anv.C3.A4ndargr.C3.A4nssnitt">Applikations och Användargränssnitt</span></h2>
<p>Liksom nästan allt annat i FreeCAD, så är användargränssnittsdelen separerad från basapplikationsdelen. Detta gäller även för dokument. Dokumenten utgörs också av två delar: Applikationsdokumentet, vilket innehåller våra objekt, och Vydokumentet, vilket innehåller skärmrepresentationen av våra objekt.
</p><p>Tänk på det som två rymder, där objekten är definierade. Dess konstruktiva parametrar (är det en kub? en kon? vilken storlek?) lagras i Applikationsdokumentet, emedan dess grafiska representation (Är den ritad med svarta linjer? med blå ytor?) lagras i Vydokumentet. Varför är det så? därför att FreeCAD kan även användas UTAN grafiskt gränssnitt, till exempel inuti andra program, och vi måste fortfarande kunna manipulera våra objekt, även om inget ritas på skärmen.
</p><p>En annan sak som lagras i Vydokumentet är 3D vyer. Ett dokument kan ha flera vyer öppnade, så du kan inspektera ditt dokument från flera håll samtidigt. Du kanske vill se en toppvy och en frontvy av ditt arbete samtidigt? Då kommer du att ha två vyer av samma dokument, båda lagrade i Vydokumentet. Skapande av nya vyer eller stänga vyer kan göras från Visa menyn eller genom att högerklicka på en vytabb.
</p>
<h2><span class="mw-headline" id="Skript_2">Skript</span></h2>
<p>Dokument kan lätt skapas, kommas åt och ändras från tolken. Till exempel:
</p>
<pre>FreeCAD.ActiveDocument </pre>
<p>Kommer att returnera det nuvarande (aktiva) dokumentet
</p>
<pre>FreeCAD.ActiveDocument.Blob </pre>
<p>Kommer åt ett objekt kallat "Blob" inuti ditt dokument
</p>
<pre>FreeCADGui.ActiveDocument </pre>
<p>Kommer att returnera det vydokument som är associerat med det nuvarande dokumentet
</p>
<pre>FreeCADGui.ActiveDocument.Blob </pre>
<p>Kommer åt den grafiska representationen (vy) delen av vårt Blob objekt
</p>
<pre>FreeCADGui.ActiveDocument.ActiveView </pre>
<p>Kommer att returnera nuvarande vy
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="St.C3.A4lla_in_anv.C3.A4ndarpreferenser">Ställa in användarpreferenser</span></h2>
<p>FreeCAD inställningssystem finns i Redigera menyn → Alternativ.
</p><p>FreeCAD's funktionalitet är uppdelat i olika moduler, där varje modul är ansvarig för att en specifik <a href="https://www.freecadweb.org/wiki/index.php?title=Workbenches/sv" title="Workbenches/sv">arbetsbänk</a> ska fungera. FreeCAD använder sig också av ett koncept kallat sen laddning, vilket innebär att komponenter endast laddas när de behövs. du kanske har märkt att när du väljer en arbetsbänk i FreeCAD's verktygslåda, så laddas den arbetsbänken och alla dess komponenter just då. Detta inkluderar dess inställningar.
</p><p>Om inga moduler är laddade, så kommer du att ha två konfigurationssektioner, ansvariga för de allmäna applikationsinställningarna och för visningsinställningar.
</p>
<h2><span class="mw-headline" id="De_allm.C3.A4na_inst.C3.A4llningarna">De allmäna inställningarna</span></h2>
<p>När du startar FreeCAD utan någon arbetsbänk laddad, så kommer du ha ett minimalt inställningsfönster. Alltefter som du laddar fler moduler, så kommer nya avsnitt fram i inställningsfönstret, vilket tillåter dig att konfigurera detaljer för varje arbetsbänk.
</p>
<h3><span class="mw-headline" id="Allm.C3.A4n">Allmän</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_01.png" class="image"><img alt="Preference General Tab 01.png" src="Preference_General_Tab_01.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Dokument">Dokument</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_02.png" class="image"><img alt="Preference General Tab 02.png" src="Preference_General_Tab_02.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Redakt.C3.B6r">Redaktör</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_03.png" class="image"><img alt="Preference General Tab 03.png" src="Preference_General_Tab_03.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Utmatningsf.C3.B6nster">Utmatningsfönster</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_04.png" class="image"><img alt="Preference General Tab 04.png" src="Preference_General_Tab_04.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Makro">Makro</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_05.png" class="image"><img alt="Preference General Tab 05.png" src="Preference_General_Tab_05.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Enheter">Enheter</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_General_Tab_06.png" class="image"><img alt="Preference General Tab 06.png" src="Preference_General_Tab_06.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h2><span class="mw-headline" id="Sk.C3.A4rmens_inst.C3.A4llningar">Skärmens inställningar</span></h2>
<p>FreeCAD är alltid i konstant utveckling, så innehållet på dessa skärmar kan skilja sig från ovanstående skärmdumpar. Inställningarna är vanligtvis självförklarande, så du borde inte ha några problem att konfigurera FreeCAD efter dina behov.
</p>
<h3><span class="mw-headline" id="3D-vy">3D-vy</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_Display_Tab_01.png" class="image"><img alt="Preference Display Tab 01.png" src="Preference_Display_Tab_01.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="F.C3.A4rger">Färger</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_Display_Tab_02.png" class="image"><img alt="Preference Display Tab 02.png" src="Preference_Display_Tab_02.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<h3><span class="mw-headline" id="Delf.C3.A4rger">Delfärger</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Preference_Display_Tab_03.png" class="image"><img alt="Preference Display Tab 03.png" src="Preference_Display_Tab_03.png" width="657" height="712" /></a></div>
<div style="clear:both"></div>
<p>Draft-modulen har sin <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Preferences/sv" title="Draft Preferences/sv">Inställningar</a> -skärm
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="Anpassa_gr.C3.A4nssnittet">Anpassa gränssnittet</span></h2>
<p>Eftersom FreeCAD gränssnittet är baserat på det moderna <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Qt">Qt</a> verktygssetet, så har det en högklassig organisation. Widgetar, menyer, verktygslådor och andra verktyg kan ändras, flyttas, delas mellan arbetsbänkar, tangentbordsgenvägar kan ställas in, ändras, och makron kan spelas in och spelas upp. Anpassningsfönstret hittas i <b>Verktyg -&gt; Anpassa</b> menyn:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Screenshot-customize.jpg" class="image"><img alt="Screenshot-customize.jpg" src="Screenshot-customize.jpg" width="582" height="427" /></a>
</p><p><b>Kommandon</b> tabben visar alla tillgängliga FreeCAD kommandon, organiserade i kategorier.
</p><p>I <b>Tangentbord</b>, så kan du se de tangentbordsgenvägar som är associerade med varje FreeCAD kommando, och om du vill, ändra eller tilldela nya genvägar till valfritt kommando. Hit är var du vill komma om du använder en viss arbetsbänk ofta, och vill snabba upp dess användande genom att använda tangentbordet.
</p><p><b>Verktygslådor</b> tabben låter dig ändra existerande verktygslådor, eller skapa dina egna anpassade verktygslådor.
</p><p><b>Makron</b> tabben låter dig hantera dina sparade <a href="https://www.freecadweb.org/wiki/index.php?title=Macros/sv" title="Macros/sv">Makron</a>.
</p><p>Create your Toolbars for your macro <a href="Customize_Toolbars.html" title="Customize Toolbars">Customize Toolbars</a>
</p><p>In 0.16 version is available a new tool that lets you manage your workbenches
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:CustomizeWorkbenches.png" class="image"><img alt="CustomizeWorkbenches.png" src="CustomizeWorkbenches.png" width="692" height="434" /></a>
</p><p>For an example workflow lets suppose we want to have the "Measure Linear" tool also show up in a custom toolbar in draft workbench.
</p>
<ul><li> in FreeCAD choose "Tools -&gt; Customize" from the top menu</li>
<li> select the "Toolbars" tab</li>
<li> on the left side choose "Part" in the pull down menu</li>
<li> on the left side in the lower window scroll down to the "Measure Linear" entry and select it</li>
<li> on the right side choose "Draft" in the pull down menu</li>
<li> click on "New..." to create a new toolbar and choose a name for it</li>
<li> now select your destination toolbar in the right lower window (only needed if you have more than one toolbar)</li>
<li> by clicking on the blue "Arrow right" (top icon in the middle row) you will add your selected entry to the selected toolbar</li></ul>
<p><b>Remarks:</b>
</p>
<ul><li> when selecting "Global" in the pull down menu on the right side you will create a toolbar which will be visible in all workbenches</li>
<li> for adding an installed macro to a toolbar you must
<ul><li> select "Macros" in the pull down menu on the left side</li>
<li> have assigned menu text, icon (Pixmap) and so on using the "Tools -&gt; Customize -&gt; Macros" menu</li></ul></li></ul>
<p><br />
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="Objekt_egenskaper">Objekt egenskaper</span></h2>
<p>En <b>egenskap</b> är en informationsbit som till exempel ett nummer eller en textsträng som hör till ett FreeCAD dokument eller ett objekt i ett dokument. Egenskaper kan visas och - om det är tillåtet - ändras med <a href="https://www.freecadweb.org/wiki/index.php?title=Property_editor/sv" title="Property editor/sv">egenskapsredigeraren</a>.
</p><p><br />
</p><p>Egenskaper spelar en mycket viktig roll i FreeCAD, eftersom det från början är gjort för att arbeta med parametriska objekt, vilket är objekt som endast definieras av deras egenskaper.
</p><p><br />
</p><p>Anpassade <a href="https://www.freecadweb.org/wiki/index.php?title=Scripted_objects/sv" title="Scripted objects/sv">skript objekt</a> i FreeCAD kan ha egenskaper av följande typer:
</p><p><br />
</p>
<pre>Boolean
Float
FloatList
FloatConstraint
Angle
Distance
Integer
IntegerConstraint
Percent
Enumeration
IntegerList
String
StringList
Link
LinkList
Matrix
Vector
VectorList
Placement
PlacementLink
Color
ColorList
Material
Path
File
FileIncluded
PartShape
FilletContour
Circle
</pre>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h1><span class="mw-headline" id="Arbeta_med_arbetsb.C3.A4nkar">Arbeta med arbetsbänkar</span></h1>
<p>FreeCAD, som många moderna design applikationer som <a href="http://en.wikipedia.org/wiki/Revit" class="extiw" title="wikipedia:Revit">Revit</a>, är baserade på konceptet <a href="http://en.wikipedia.org/wiki/Workbench" class="extiw" title="wikipedia:Workbench">Arbetsbänk</a>. En arbetsbänk kan anses vara ett set verktyg, grupperade för en viss uppgift. I en traditionell möbelverkstad, så skulle du ha ett arbetsbord för den person som arbetar med trä, ett annat bord för den som arbetar med metalldelar, och kanske ett tredje för den som monterar ihop allting.
</p><p>I FreeCAD, så används samma koncept . Verktyg är grupperade i arbetsbänkar i enlighet med de uppgifter de är relaterade till.
</p>
<div class="mw-translate-fuzzy">
<p>När du byter från en arbetsbänk till en annan, så byts de tillgängliga verktygen i gränssnittet ut. Verktygslådor, kommandolådor och eventuellt andra delar av gränssnittet byts till den nya arbetsbänken, men innehållet i din scen förändras inte. Du kan till exempel börja att rita 2D former med Rit arbetsbänken, sedan fortsätta arbetet på dem med Del arbetsbänken.
</p>
</div>
<p>Note that sometimes a Workbench is referred to as a <i>Module</i>. However, Workbenches and Modules are different entities. A Module is any extension of FreeCAD, while a Workbench is a special GUI configuration that groups some toolbars and menus. Usually every Module contains its own Workbench, hence the cross-use of the name.
</p>
<h2><span class="mw-headline" id="Built-in_workbenches">Built-in workbenches</span></h2>
<div class="mw-translate-fuzzy">
<p>För närvarande har vi följande arbetsbänkar:
</p>
</div>
<h3><span class="mw-headline" id="Arbetsb.C3.A4nkar">Arbetsbänkar</span></h3>
<p>These are the base workbenches bundled with every installation of FreeCAD:
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Arch.svg" class="image"><img alt="Workbench Arch.svg" src="Workbench_Arch.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Arch_Module/sv" title="Arch Module/sv">Arch Workbench</a> for working with architectural elements.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Complete.svg" class="image"><img alt="Workbench Complete.svg" src="Workbench_Complete.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Complete_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Complete Workbench/sv (page does not exist)">Complete Workbench</a> hold all commands and features from all the modules and workbenches which met certain quality criteria.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Draft.svg" class="image"><img alt="Workbench Draft.svg" src="Workbench_Draft.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Module/sv" title="Draft Module/sv">2D skissning</a>: En enkel arbetsbänk för 2D skissning</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Drawing.svg" class="image"><img alt="Workbench Drawing.svg" src="Workbench_Drawing.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Drawing_Module/sv" title="Drawing Module/sv">Ritning</a>: Hjälper dig att lägga dina 3D vyer på ett 2D pappersark</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_FEM.svg" class="image"><img alt="Workbench FEM.svg" src="Workbench_FEM.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=FEM_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="FEM Module/sv (page does not exist)">FEM Workbench</a> provides Finite Element Analysis (FEA) workflow.</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Image.svg" class="image"><img alt="Workbench Image.svg" src="Workbench_Image.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Image_Workbench/sv" class="mw-redirect" title="Image Workbench/sv">Bild</a>: Hanterar Bitmappsbilder</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Inspection.svg" class="image"><img alt="Workbench Inspection.svg" src="Workbench_Inspection.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Inspection_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Inspection Workbench/sv (page does not exist)">Inspection Workbench</a> is made to give you specific tools for examination of shapes. It is still in development. </li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Mesh.svg" class="image"><img alt="Workbench Mesh.svg" src="Workbench_Mesh.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Mesh_Workbench/sv" title="Mesh Workbench/sv">Nät</a>: Hanterar triangulerade nät</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_OpenSCAD.svg" class="image"><img alt="Workbench OpenSCAD.svg" src="Workbench_OpenSCAD.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=OpenSCAD_Module/sv" title="OpenSCAD Module/sv">OpenSCAD Workbench</a> for interoperability with OpenSCAD and repairing Constructive Solid Geometry (CSG) model history.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Part.svg" class="image"><img alt="Workbench Part.svg" src="Workbench_Part.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Workbench/sv" class="mw-redirect" title="Part Workbench/sv">Del</a>: Hanterar BREP objekt</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_PartDesign.svg" class="image"><img alt="Workbench PartDesign.svg" src="Workbench_PartDesign.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=PartDesign_Workbench/sv" title="PartDesign Workbench/sv">Part Design Workbench</a> for building Part shapes from sketches.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Path.svg" class="image"><img alt="Workbench Path.svg" src="Workbench_Path.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Path_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Path Workbench/sv (page does not exist)">Path Workbench</a> is used to produce G-Code instructions. It is still in a stage of development. Only basic functions in 0.16</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Plot.svg" class="image"><img alt="Workbench Plot.svg" src="Workbench_Plot.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Plot_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="Plot Module/sv (page does not exist)">Plot Workbench</a> is used to edit and save output plots created from other modules and tools.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Points.svg" class="image"><img alt="Workbench Points.svg" src="Workbench_Points.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Points_Workbench/sv" class="mw-redirect" title="Points Workbench/sv">Punkter</a>: Låter dig arbeta med punktmoln</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Raytracing.svg" class="image"><img alt="Workbench Raytracing.svg" src="Workbench_Raytracing.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Raytracing_Workbench/sv" class="mw-redirect" title="Raytracing Workbench/sv">Rendering</a>: Tillåter att du använder extern renderingsmjukvara</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Reverse_Engineering.svg" class="image"><img alt="Workbench Reverse Engineering.svg" src="Workbench_Reverse_Engineering.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Reverse_Engineering_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Reverse Engineering Workbench/sv (page does not exist)">Reverse Engineering Workbench</a> is intended to give you specific tools to convert shapes/solids/meshes into parametric FreeCAD-compatible features. It is still in development.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Robot.svg" class="image"><img alt="Workbench Robot.svg" src="Workbench_Robot.svg" width="24" height="24" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Robot_Workbench/sv" title="Robot Workbench/sv">Robot simulering</a>: Simulera 6-Axliga industrirobotar som Kuka, ABB och andra.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Ship.svg" class="image"><img alt="Workbench Ship.svg" src="Workbench_Ship.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Ship_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Ship Workbench/sv (page does not exist)">Ship Workbench</a> FreeCAD-Ship works over Ship entities, that must be created on top of provided geometry.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Sketcher.svg" class="image"><img alt="Workbench Sketcher.svg" src="Workbench_Sketcher.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Sketcher_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="Sketcher Module/sv (page does not exist)">Sketcher Workbench</a> for working with geometry-constrained sketches.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Spreadsheet.svg" class="image"><img alt="Workbench Spreadsheet.svg" src="Workbench_Spreadsheet.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Spreadsheet_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="Spreadsheet Module/sv (page does not exist)">Spreadsheet Workbench</a> for creating and manipulating spreadsheet data.</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Start.svg" class="image"><img alt="Workbench Start.svg" src="Workbench_Start.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Start_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Start Workbench/sv (page does not exist)">Start Center Workbench</a> allows you to quickly jump to one of the most common workbenches.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_TechDraw.svg" class="image"><img alt="Workbench TechDraw.svg" src="Workbench_TechDraw.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=TechDraw_Module/sv&amp;action=edit&amp;redlink=1" class="new" title="TechDraw Module/sv (page does not exist)">TechDraw Workbench</a> is the more advanced and feature-rich successor of <a href="Drawing_Module.html" title="Drawing Module">Drawing</a> </li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Test.svg" class="image"><img alt="Workbench Test.svg" src="Workbench_Test.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Debugging/sv" title="Debugging/sv">Test Framework Workbench</a> is for debugging FreeCAD.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Workbench_Web.svg" class="image"><img alt="Workbench Web.svg" src="Workbench_Web.svg" width="24" height="24" /></a> The <a href="https://www.freecadweb.org/wiki/index.php?title=Web_Workbench/sv&amp;action=edit&amp;redlink=1" class="new" title="Web Workbench/sv (page does not exist)">Web Workbench</a> provides you with a browser window instead of the 3D-View within FreeCAD.</li></ul>
<h2><span class="mw-headline" id="External_workbenches">External workbenches</span></h2>
<p>FreeCAD workbenches are easy to program in <a rel="nofollow" class="external text" href="http://www.python.org">Python</a>, there are therefore many people developing additional workbenches outside of the FreeCAD codebase. The <a href="External_workbenches.html" title="External workbenches">External workbenches</a> page has some information and tutorials about some of them, and the <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD-addons">FreeCAD Addons</a> project aims at gathering them and making them easily installable from within FreeCAD.
</p><p>Nya arbetsbänkar är under utveckling, håll utkik!
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="N.C3.A4t_arbetsb.C3.A4nken">Nät arbetsbänken</span></h2>
<div class="mw-translate-fuzzy">
<p><b>Nät arbetsbänken</b> hanterar <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Triangle_mesh">triangelnät</a>. Nät är en speciell typ av 3D objekt, sammansatt av trianglar som är ihopkopplade via deras kanter och hörn.
</p>
</div>
<p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_example.jpg" class="image" title="An example of a mesh object"><img alt="An example of a mesh object" src="Mesh_example.jpg" width="640" height="400" /></a>
</p><p>Ett exempel på ett nätobjekt
</p><p>Många 3D applikationer använder nät som deras primära 3D objektstyp, som <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Sketchup">sketchup</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Blender">blender</a>, <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Maya_(datorprogram)">maya</a> eller <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/3ds_Max">3d studio max</a>. Eftersom nät är mycket simpla objekt, som endast innehåller hörn (punkter), kanter och (triangulära) ytor, så är de mycket lätta att skapa, förändra, dela upp, sträcka ut, och kan lätt flyttas från en applikation till en annan utan några förluster. Eftersom de dessutom innehåller mycket simpel data, så kan 3D applikationer vanligtvis hantera mycket stora kvantiteter av dem utan några problem. Av dessa anledningar, så är nät ofta den valda 3D objekttypen i applikationer för filmer, animeringar, och bildbehandling.
</p>
<div class="mw-translate-fuzzy">
<p>Emellertid har nät en stor begränsning inom konstruktionsfältet: De är mycket 'dumma' objekt, som endast består av punkter, linjer och ytor. De består endast av ytor, och har ingen informationom dess massa, så de beter sig inte som solider. I ett nät så finns det inget automatiskt sätt att avgöra om en punkt är inuti eller utanför objektet. Detta innebär att alla solidbaserade operationer, som addition eller subtraktion, alltid är svåra att utföra på nät, och ofta orsakar fel.
</p>
</div>
<div class="mw-translate-fuzzy">
<p>I FreeCAD, eftersom det är en konstruktionsapplikation, skulle vi givetvis föredra att arbeta med mer intelligenta 3D objekttyper, som kan innehålla mer information, som massa, solidbeteende, eller till och med anpassade parametrar. Nätmodulen skapades först bara för att tjäna som test, men att kunna läsa, manipulera och konvertera nät är också mycket viktigt för FreeCAD. I ditt arbetsflöde kommer du ofta ta emot 3D data i nätformat. Du kommer att behöva kunna hantera denna data, analysera den för att upptäcka fel eller andra problem som förhindrar dem från att konverteras till mer intelligenta objekt, och slutligen, konvertera dem till mer intelligenta objekt, som kan hanteras av <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a>.
</p>
</div>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id="Anv.C3.A4nda_n.C3.A4tmodulen">Använda nätmodulen</span></h3>
</div>
<div class="mw-translate-fuzzy">
<p>Nätmodulen har för närvarande ett mycket enkelt gränssnitt, alla dess funktioner är grupperade i <b>Nät</b> menyn. De viktigaste operationerna som du för närvarande kan göra med nät är:
</p>
<ul><li> Importera nät i flera filformat</li>
<li> Exportera nät i flera filformat</li>
<li> Konvertera <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del</a> objekt till nät</li>
<li> Analysera kurvatur, ytor, och kontrollera om ett nät kan konverteras till en solid på ett säkert sätt</li>
<li> Vända nät <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/normalvektor">normaler</a></li>
<li> Stänga hål i nät</li>
<li> Ta bort ytor i nät</li>
<li> Förena, subtrahera och skära nät</li>
<li> Skapa nätprimitiver, som kuber, sfärer, Koner eller cylindrar</li>
<li> Klippa nät längs en linje</li></ul>
</div>
<p><br />
</p>
<ul><li> <b>Analyze</b> curvature, faces, and check if a mesh can be safely converted into a solid
<ul><li> <a href="Mesh_EvaluateRepair.html" title="Mesh EvaluateRepair">Evaluate &amp; Repair mesh...</a>: Evaluates and repairs meshes</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_EvaluateFacet.png" class="image"><img alt="Mesh EvaluateFacet.png" src="32px-Mesh_EvaluateFacet.png" width="32" height="32" srcset="/wiki/images/thumb/9/96/Mesh_EvaluateFacet.png/48px-Mesh_EvaluateFacet.png 1.5x, /wiki/images/9/96/Mesh_EvaluateFacet.png 2x" /></a> <a href="Mesh_EvaluateFacet.html" title="Mesh EvaluateFacet">Face Info</a>: Gives info on faces</li>
<li> <a href="Mesh_EvaluateCurvature.html" title="Mesh EvaluateCurvature">Curvature Info</a>: Gives info on curvature</li>
<li> <a href="Mesh_EvaluateSolid.html" title="Mesh EvaluateSolid">Check solid mesh</a>: Checks the solid if it can be converted to a mesh</li>
<li> <a href="Mesh_BoundingBox.html" title="Mesh BoundingBox">Boundings info...</a>: Evaluates the bounding box of a mesh</li></ul></li></ul>
<p><br />
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Regular_Solid.png" class="image"><img alt="Mesh Regular Solid.png" src="32px-Mesh_Regular_Solid.png" width="32" height="32" srcset="/wiki/images/thumb/d/d9/Mesh_Regular_Solid.png/48px-Mesh_Regular_Solid.png 1.5x, /wiki/images/d/d9/Mesh_Regular_Solid.png 2x" /></a> <a href="Mesh_BuildRegularSolid.html" title="Mesh BuildRegularSolid">Regular solid...</a> Create mesh primitives, like cubes, cylinders, cones, or spheres:
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Cube.png" class="image"><img alt="Mesh Cube.png" src="32px-Mesh_Cube.png" width="32" height="32" srcset="/wiki/images/thumb/d/df/Mesh_Cube.png/48px-Mesh_Cube.png 1.5x, /wiki/images/d/df/Mesh_Cube.png 2x" /></a> Create a mesh cube</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Cylinder.png" class="image"><img alt="Mesh Cylinder.png" src="32px-Mesh_Cylinder.png" width="32" height="32" srcset="/wiki/images/thumb/2/26/Mesh_Cylinder.png/48px-Mesh_Cylinder.png 1.5x, /wiki/images/2/26/Mesh_Cylinder.png 2x" /></a> Create a mesh cylinder</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Cone.png" class="image"><img alt="Mesh Cone.png" src="32px-Mesh_Cone.png" width="32" height="32" srcset="/wiki/images/thumb/d/df/Mesh_Cone.png/48px-Mesh_Cone.png 1.5x, /wiki/images/d/df/Mesh_Cone.png 2x" /></a> Create a mesh cone</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Sphere.png" class="image"><img alt="Mesh Sphere.png" src="32px-Mesh_Sphere.png" width="32" height="32" srcset="/wiki/images/thumb/9/98/Mesh_Sphere.png/48px-Mesh_Sphere.png 1.5x, /wiki/images/9/98/Mesh_Sphere.png 2x" /></a> Create a mesh sphere</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Ellipsoid.png" class="image"><img alt="Mesh Ellipsoid.png" src="32px-Mesh_Ellipsoid.png" width="32" height="32" srcset="/wiki/images/thumb/9/9f/Mesh_Ellipsoid.png/48px-Mesh_Ellipsoid.png 1.5x, /wiki/images/9/9f/Mesh_Ellipsoid.png 2x" /></a> Create a mesh ellipsoid</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Torus.png" class="image"><img alt="Mesh Torus.png" src="32px-Mesh_Torus.png" width="32" height="32" srcset="/wiki/images/thumb/3/36/Mesh_Torus.png/48px-Mesh_Torus.png 1.5x, /wiki/images/3/36/Mesh_Torus.png 2x" /></a> Create a mesh torus</li></ul></li></ul>
<p><br />
</p>
<ul><li> Do <b>Boolean</b> operations with meshes
<ul><li> <a href="Mesh_Union.html" title="Mesh Union">Union</a>: Does a union (fusion) on meshes</li>
<li> <a href="Mesh_Intersection.html" title="Mesh Intersection">Intersection</a>: Does an intersection (common) on meshes</li>
<li> <a href="Mesh_Difference.html" title="Mesh Difference">Difference</a>: Does a difference (cut) on meshes</li></ul></li></ul>
<p><br />
</p>
<ul><li> <a href="Mesh_Merge.html" title="Mesh Merge">Merge</a>: Merges meshes</li>
<li> <a href="Mesh_SelectMesh.html" title="Mesh SelectMesh">Select Mesh</a>: Selects meshes</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_Cut.png" class="image"><img alt="Mesh Cut.png" src="32px-Mesh_Cut.png" width="32" height="32" srcset="/wiki/images/thumb/7/73/Mesh_Cut.png/48px-Mesh_Cut.png 1.5x, /wiki/images/7/73/Mesh_Cut.png 2x" /></a> <a href="Mesh_Cut.html" title="Mesh Cut">Cut mesh</a>: Cut meshes along a line</li>
<li> <a href="Mesh_SplitMesh.html" title="Mesh SplitMesh">Split Mesh</a>: Splits meshes</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_MakeSegment.png" class="image"><img alt="Mesh MakeSegment.png" src="32px-Mesh_MakeSegment.png" width="32" height="32" srcset="/wiki/images/thumb/0/0f/Mesh_MakeSegment.png/48px-Mesh_MakeSegment.png 1.5x, /wiki/images/0/0f/Mesh_MakeSegment.png 2x" /></a> <a href="Mesh_MakeSegment.html" title="Mesh MakeSegment">Make segment</a>: Makes a segment</li>
<li> <a href="Mesh_TrimMesh.html" title="Mesh TrimMesh">Trim mesh</a>: Trims meshes</li>
<li> <a href="Mesh_TrimMeshWithPlane.html" title="Mesh TrimMeshWithPlane">Trim mesh with a plane</a>: Trims meshes with a plane</li>
<li> <a href="Mesh_CreateMeshSegment.html" title="Mesh CreateMeshSegment">Create mesh segments...</a>: Creates mesh segments</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Mesh_CurvaturePlot.png" class="image"><img alt="Mesh CurvaturePlot.png" src="32px-Mesh_CurvaturePlot.png" width="32" height="32" srcset="/wiki/images/thumb/3/3b/Mesh_CurvaturePlot.png/48px-Mesh_CurvaturePlot.png 1.5x, /wiki/images/3/3b/Mesh_CurvaturePlot.png 2x" /></a> <a href="Mesh_CurvaturePlot.html" title="Mesh CurvaturePlot">Curvature Plot</a>: Creates a curvature plot</li></ul>
<p><br />
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Preferences-import-export.svg" class="image"><img alt="Preferences-import-export.svg" src="Preferences-import-export.svg" width="32" height="32" /></a> <a href="Import_Export_Preference.html" title="Import Export Preference">Preference ...</a> Import Export</li></ul>
<div class="mw-translate-fuzzy">
<p>Detta är bara några av de grundläggande operationerna som för närvarande finns i Nätmodulens gränssnitt. Men FreeCAD nät kan också hanteras på många fler sätt med <a href="https://www.freecadweb.org/wiki/index.php?title=Scripting/sv" title="Mesh Scripting/sv"> skript</a>.
</p>
</div>
<h2><span class="mw-headline" id="Links">Links</span></h2>
<ul><li> <a href="FreeCAD_and_Mesh_Import.html" title="FreeCAD and Mesh Import">FreeCAD and Mesh Import</a></li></ul>
<p><br />
</p>
<div class="mw-translate-fuzzy">
</div>
<p><br />
</p>
<h2><span class="mw-headline" id="Del_arbetsb.C3.A4nken">Del arbetsbänken</span></h2>
<p>FreeCAD's CAD kapabilitet är baserad på <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_CASCADE">OpenCasCade</a> kärnan. Del modulen tillåter FreeCAD att komma åt och använda OpenCasCade objekt och funktioner. OpenCascade är en professionell CAD kärna, som erbjuder avancerad 3D geometrimanipulation och objekt. Del objekten, till skillnad från <a href="https://www.freecadweb.org/wiki/index.php?title=Mesh_Module/sv" class="mw-redirect" title="Mesh Module/sv">Nätmodul</a> objekten, är mycket komplexare, och tillåter därför mycket mer avancerade operationer, som koherenta booleska operationer, ändringshistorik och parametriskt beteende.
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_example.jpg" class="image"><img alt="Part example.jpg" src="Part_example.jpg" width="634" height="406" /></a>
</p><p>Exempel på Del former i FreeCAD
</p>
<h3><span class="mw-headline" id="Verktygen">Verktygen</span></h3>
<p>Alla Del modul verktygen finns i <b>Del</b> menyn som kommer fram när du laddar Del modulen.
</p>
<h3><span class="mw-headline" id="Primitiver">Primitiver</span></h3>
<p>Detta är verktyg för att skapa primitivobjekt.
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Box.png" class="image"><img alt="Part Box.png" src="32px-Part_Box.png" width="32" height="32" srcset="/wiki/images/thumb/a/a5/Part_Box.png/48px-Part_Box.png 1.5x, /wiki/images/a/a5/Part_Box.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Box/sv" title="Part Box/sv">Låda</a>: Ritar en låda genom att ge dess dimensioner</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Cone.png" class="image"><img alt="Part Cone.png" src="32px-Part_Cone.png" width="32" height="32" srcset="/wiki/images/thumb/1/13/Part_Cone.png/48px-Part_Cone.png 1.5x, /wiki/images/1/13/Part_Cone.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Cone/sv" title="Part Cone/sv">Kon</a>: Ritar en kon genom att ge dess dimensioner</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Cylinder.png" class="image"><img alt="Part Cylinder.png" src="32px-Part_Cylinder.png" width="32" height="32" srcset="/wiki/images/thumb/d/d4/Part_Cylinder.png/48px-Part_Cylinder.png 1.5x, /wiki/images/d/d4/Part_Cylinder.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Cylinder/sv" title="Part Cylinder/sv">Cylinder</a>: Ritar en cylinder genom att ge dess dimensioner</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Sphere.png" class="image"><img alt="Part Sphere.png" src="32px-Part_Sphere.png" width="32" height="32" srcset="/wiki/images/thumb/4/4b/Part_Sphere.png/48px-Part_Sphere.png 1.5x, /wiki/images/4/4b/Part_Sphere.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Sphere/sv" title="Part Sphere/sv">Sfär</a>: Ritar en sfär genom att ge dess dimensioner</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Torus.png" class="image"><img alt="Part Torus.png" src="32px-Part_Torus.png" width="32" height="32" srcset="/wiki/images/thumb/8/8b/Part_Torus.png/48px-Part_Torus.png 1.5x, /wiki/images/8/8b/Part_Torus.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Torus/sv" title="Part Torus/sv">Torus</a>: Ritar en torus (ring) genom att ge dess dimensioner</li></ul>
<h3><span class="mw-headline" id="F.C3.B6r.C3.A4ndra_objekt">Förändra objekt</span></h3>
<p>Detta är verktyg för att förändra existerande objekt. De kommer att låta dig välja vilka objekt som du vill förändra.
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Booleans.png" class="image"><img alt="Part Booleans.png" src="32px-Part_Booleans.png" width="32" height="32" srcset="/wiki/images/thumb/8/89/Part_Booleans.png/48px-Part_Booleans.png 1.5x, /wiki/images/8/89/Part_Booleans.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Booleans/sv" title="Part Booleans/sv">Boolesk</a>: Utför booleska operationer på objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Union.png" class="image"><img alt="Part Union.png" src="32px-Part_Union.png" width="32" height="32" srcset="/wiki/images/thumb/4/45/Part_Union.png/48px-Part_Union.png 1.5x, /wiki/images/4/45/Part_Union.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Union/sv" title="Part Union/sv">Förena</a>: Förenar två objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Common.png" class="image"><img alt="Part Common.png" src="32px-Part_Common.png" width="32" height="32" srcset="/wiki/images/thumb/9/9a/Part_Common.png/48px-Part_Common.png 1.5x, /wiki/images/9/9a/Part_Common.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Common/sv" title="Part Common/sv">Gemensamt</a>: Tar bort den gemensamma (skärningen) delen mellan två objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Cut.png" class="image"><img alt="Part Cut.png" src="32px-Part_Cut.png" width="32" height="32" srcset="/wiki/images/thumb/4/4a/Part_Cut.png/48px-Part_Cut.png 1.5x, /wiki/images/4/4a/Part_Cut.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Cut/sv" title="Part Cut/sv">Klipp</a>: Klipper (tar bort) ett objekt från ett annat</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Extrude.png" class="image"><img alt="Part Extrude.png" src="32px-Part_Extrude.png" width="32" height="32" srcset="/wiki/images/thumb/d/df/Part_Extrude.png/48px-Part_Extrude.png 1.5x, /wiki/images/d/df/Part_Extrude.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Extrude/sv" title="Part Extrude/sv">Extrudera</a>: Extruderar plana ytor på ett objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Fillet.png" class="image"><img alt="Part Fillet.png" src="32px-Part_Fillet.png" width="32" height="32" srcset="/wiki/images/thumb/4/4a/Part_Fillet.png/48px-Part_Fillet.png 1.5x, /wiki/images/4/4a/Part_Fillet.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Fillet/sv" title="Part Fillet/sv">Fasning</a>: Fasar (rundar) kanterna på ett objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Revolve.png" class="image"><img alt="Part Revolve.png" src="32px-Part_Revolve.png" width="32" height="32" srcset="/wiki/images/thumb/1/12/Part_Revolve.png/48px-Part_Revolve.png 1.5x, /wiki/images/1/12/Part_Revolve.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Revolve/sv" title="Part Revolve/sv">Rotera</a>: Skapar ett objekt genom att rotera ett annat objekt runt en axel</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Section.png" class="image"><img alt="Part Section.png" src="32px-Part_Section.png" width="32" height="32" srcset="/wiki/images/thumb/a/ab/Part_Section.png/48px-Part_Section.png 1.5x, /wiki/images/a/ab/Part_Section.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Section/sv" title="Part Section/sv">Sektionera</a>: Skapar en sektion genom att skära ett objekt med ett sektioneringsplan</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Chamfer.png" class="image"><img alt="Part Chamfer.png" src="32px-Part_Chamfer.png" width="32" height="32" srcset="/wiki/images/thumb/8/87/Part_Chamfer.png/48px-Part_Chamfer.png 1.5x, /wiki/images/8/87/Part_Chamfer.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Chamfer/sv" title="Part Chamfer/sv">Fasning</a>: Fasar (klipper) kanter på ett objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Mirror.png" class="image"><img alt="Part Mirror.png" src="32px-Part_Mirror.png" width="32" height="32" srcset="/wiki/images/thumb/9/93/Part_Mirror.png/48px-Part_Mirror.png 1.5x, /wiki/images/9/93/Part_Mirror.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Mirror/sv" title="Part Mirror/sv">Spegling</a>: Speglar de valda objekten runt en given axel</li></ul>
<p><br />
</p>
<h3><span class="mw-headline" id="Booleska_Operationer">Booleska Operationer</span></h3>
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_BooleanOperations.png" class="image" title="An example of union (Fuse), intersection (Common) and difference (Cut)"><img alt="An example of union (Fuse), intersection (Common) and difference (Cut)" src="500px-Part_BooleanOperations.png" width="500" height="384" srcset="/wiki/images/thumb/d/df/Part_BooleanOperations.png/750px-Part_BooleanOperations.png 1.5x, /wiki/images/thumb/d/df/Part_BooleanOperations.png/1000px-Part_BooleanOperations.png 2x" /></a></div>
<div style="clear:both"></div>
<p><br />
Ett exempel på förening (ihopsmältning), skärning (Gemensam) och skillnad (Klipp)
</p>
<h3><span class="mw-headline" id="F.C3.B6rklaring_av_koncepten">Förklaring av koncepten</span></h3>
<p>I OpenCasCade terminologi, så skiljer vi mellan geometriska primitiver och (topologiska) former. En geometrisk primitiv kan vara en punkt, en linje, en cirkel, ett plan, etc. eller även mer komplexa typer som en B-Spline kurva eller yta. En form kan vara ett hörn, en kant, en tråd, en yta, en solid eller en sammansättning av andra former. De geometriska primitiverna är inte gjorda för att direkt visas i 3D scenen, utan snarare för att användas som bygggeometri för former. Till exempel så kan en kant skapas av en linje eller av en cirkeldel.
</p><p>Vi skulle kunna säga att geometriprimitiver är "formlösa" byggblock, och former är den riktiga spatiala geometrin som är byggd på dem.
</p><p>För att få en komplett lista på dem, se <a rel="nofollow" class="external text" href="http://www.opencascade.org/org/doc/">OCC documentation</a> och leta efter Geom_Geometry och TopoDS_Shape. Där kan du också läsa mer om skillnaderna mellan geometriska objekt och former. Notera att OCC dokumentationen inte är tillgänglig online (du måste ladda ned ett arkiv) och är mest riktad till programmerare, inte till slutanvändare. Men förhoppningsvis hittar du tillräckligt med information här för att kunna börja.
</p><p>De geometriska typeerna kan uppdelas i två huvudgrupper: kurvor och ytor. Från kurvor (linje, cirkel, ...) så kan du bygga en kant, från ytor (plan, cylinder, ...) så kan en yta byggas. Den geometriska primitiven linje är till exempel obegränsad, d.v.s. den är definierad av en basvektor och en riktningsvektor emedan dess formrepresentation måste vara något som begränsas av en start och en slutpunkt. Och en låda -- en solid -- kan skapas av sex begränsade plan.
</p>
<div class="mw-translate-fuzzy">
<p>Från en kant eller yta så kan du också gå tillbaka till dess motsvarande geometriska primitiv.
</p>
</div>
<p>Så, av former så kan du bygga mycket komplexa delar eller, åt andra hållet, plocka ut alla delformer som en mer komplex form är gjord av.
</p>
<h3><span class="mw-headline" id="Skript_3">Skript</span></h3>
<p>Den huvudsakliga data strukturen som används i Del modulen är <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Boundary_representation">BRep</a> datatypen från OpenCascade.
</p><p>Nästan alla Del modulens innehåll och objekttyper finns nu tillgängliga för python skript. Detta inkluderar geometriska primitiver, som Linje och Cirkel (eller Cirkelbåge), och alla topologiska former, som Hörn, Kanter, Trådar, Ytor, Solider och Sammansättningar. För vart och ett av dessa objekt, så finns flera metoder att skapa dem, och för en del av dem, speciellt de topologiska formerna, så finns avancerade operationer som booleska förening/skillnad/skärning . Utforska innehållet in Del modulen, som det är beskrivet i <a href="https://www.freecadweb.org/wiki/index.php?title=FreeCAD_Scripting_Basics/sv" title="FreeCAD Scripting Basics/sv">FreeCAD Skript Grunder</a> sidan, för att lära dig mer.
</p>
<h3><span class="mw-headline" id="Exempel">Exempel</span></h3>
<p>För att skapa en linje, växla till Python konsolen och skriv:
</p>
<pre>import Part,PartGui
doc=App.newDocument()
l=Part.LineSegment()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0)
doc.addObject("Part::Feature","Line").Shape=l.toShape()
doc.recompute() </pre>
<p>Låt oss gå igenom ovanstående python exempel steg för steg:
</p>
<pre>import Part,PartGui
doc=App.newDocument() </pre>
<p>laddar Del modulen och skapar ett nytt dokument
</p>
<pre>l=Part.LineSegment()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0) </pre>
<p>Linje är egentligen ett linjesegment, därför start och slutpunkten.
</p>
<pre>doc.addObject("Part::Feature","Line").Shape=l.toShape() </pre>
<div class="mw-translate-fuzzy">
<p>Detta lägger till en Del objekttyp till dokumentet och tilldelar linjesegmentets formrepresentation till 'Shape' egenskapen på det tillagda objektet. Det är viktigt att förstå att vi använde en geometrisk primitiv (Part.line) för att skapa en topologisk form av den ( toShape() metoden). Endast former kan adderass till dokumentet. I FreeCAD, så används geometriprimitiver som "byggstrukturer" för former.
</p>
</div>
<pre>doc.recompute() </pre>
<p>Uppdaterar dokumentet. Detta förbereder också den visuella representationen av det nya del objektet.
</p>
<div class="mw-translate-fuzzy">
<p>Notera att en Linje kan skapas genom att du specificerar dess start och slutpunkt direkt i konstruktorn, till exempel Part.Line(point1,point2) eller vi kan skapa en standardlinje och ändra dess egenskaper efteråt, som vi gjorde här.
</p>
</div>
<p>En cirkel kan skapas på ett liknanade sätt:
</p>
<pre>import Part
doc = App.activeDocument()
c = Part.Circle()
c.Radius=10.0
f = doc.addObject("Part::Feature", "Circle")
f.Shape = c.toShape()
doc.recompute() </pre>
<p>Notera igen, att vi använde cirkel (geometriprimitiv) för att konstruera en form av den. Vi kan förstår fortfarande komma åt vår konstruktionsgeometri efteråt, genom att göra:
</p>
<pre>s = f.Shape
e = s.Edges[0]
c = e.Curve </pre>
<p>Här tar vi formen av vårt objekt f, sedan tar vi dess lista av kanter, i detta fall kommer det endast att vara en, eftersom vi gjorde hela formen av en enda cirkel, så vi tar endast den första punkten i Kant listan, och vi tar dess kurva. Varje Kant har en Kurva, vilken är den geometriprimitiv den är baserad på.
</p><p>Gå till <a href="https://www.freecadweb.org/wiki/index.php?title=Topological_data_scripting/sv" title="Topological data scripting/sv">Topologiska data skript</a> sidan om du vill veta mer.
</p>
<h3><span class="mw-headline" id="Tutorials">Tutorials</span></h3>
<ul><li> <a href="Import_from_STL_or_OBJ.html" title="Import from STL or OBJ">Import from STL or OBJ</a>&#160;: How to import STL/OBJ files in FreeCAD</li>
<li> <a href="Export_to_STL_or_OBJ.html" title="Export to STL or OBJ">Export to STL or OBJ</a>&#160;: How to export STL/OBJ files from FreeCAD</li>
<li> <a href="Whiffle_Ball_tutorial.html" title="Whiffle Ball tutorial">Whiffle Ball tutorial</a>&#160;: How to use the Part Module</li></ul>
<div class="mw-translate-fuzzy">
</div>
<p><br />
</p>
<h2><span class="mw-headline" id="Ritnings_arbetsb.C3.A4nken">Ritnings arbetsbänken</span></h2>
<div class="mw-translate-fuzzy">
<p>Ritnings modulen tillåter dig att lägga ut ditt 3D arbete på papper. Det är, att lägga vyer av dina modeller i ett 2D fönster osh att sätta in det fönstret i en ritning, till exempel ett ark med en ram, en titel och din logotyp och slutligen skriva ut det arket. Ritningsmodulen är för närvarande under konstruktion och är mer eller mindre en teknologisk förhandstitt!
</p>
</div>
<div id="itsfree" style="text-align:center;color:black;background:#FDE0A8;margin:1em 7em;padding:0.5em 2em;border:2px solid #FF5706;">Development of the Drawing Module has stopped, and a new <a href="TechDraw_Module.html" title="TechDraw Module">TechDraw Module</a> aiming to replace it will be introduced in version 0.17. Both modules will be provided in v0.17, but the Drawing module may be removed in future releases.</div>
<p><br />
</p>
<h2><span class="mw-headline" id="Gr.C3.A4nssnittsverktyg">Gränssnittsverktyg</span></h2>
<p>Detta är verktyg för att skapa, konfigurera och exportera 2D ritningsark
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_New.png" class="image"><img alt="Drawing New.png" src="32px-Drawing_New.png" width="32" height="32" srcset="/wiki/images/thumb/d/dc/Drawing_New.png/48px-Drawing_New.png 1.5x, /wiki/images/d/dc/Drawing_New.png 2x" /></a> <a href="Drawing_Open_SVG.html" title="Drawing Open SVG">Open scalable vector graphic</a>: Opens a drawing sheet previously saved as an SVG file</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Landscape_A3.png" class="image"><img alt="Drawing Landscape A3.png" src="32px-Drawing_Landscape_A3.png" width="32" height="32" srcset="/wiki/images/thumb/2/27/Drawing_Landscape_A3.png/48px-Drawing_Landscape_A3.png 1.5x, /wiki/images/2/27/Drawing_Landscape_A3.png 2x" /></a> <a href="Drawing_Landscape_A3.html" title="Drawing Landscape A3">New A3 landscape drawing</a>: Creates a new drawing sheet from FreeCAD's default A3 template</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_View.png" class="image"><img alt="Drawing View.png" src="32px-Drawing_View.png" width="32" height="32" srcset="/wiki/images/thumb/0/03/Drawing_View.png/48px-Drawing_View.png 1.5x, /wiki/images/0/03/Drawing_View.png 2x" /></a> <a href="Drawing_View.html" title="Drawing View">Insert a view</a>: Inserts a view of the selected object in the active drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Annotation.png" class="image"><img alt="Drawing Annotation.png" src="32px-Drawing_Annotation.png" width="32" height="32" srcset="/wiki/images/thumb/7/74/Drawing_Annotation.png/48px-Drawing_Annotation.png 1.5x, /wiki/images/7/74/Drawing_Annotation.png 2x" /></a> <a href="Drawing_Annotation.html" title="Drawing Annotation">Annotation</a>: Adds an annotation to the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Clip.png" class="image"><img alt="Drawing Clip.png" src="32px-Drawing_Clip.png" width="32" height="32" srcset="/wiki/images/thumb/b/b9/Drawing_Clip.png/48px-Drawing_Clip.png 1.5x, /wiki/images/b/b9/Drawing_Clip.png 2x" /></a> <a href="Drawing_Clip.html" title="Drawing Clip">Clip</a>: Adds a clip group to the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Openbrowser.png" class="image"><img alt="Drawing Openbrowser.png" src="32px-Drawing_Openbrowser.png" width="32" height="32" srcset="/wiki/images/thumb/0/02/Drawing_Openbrowser.png/48px-Drawing_Openbrowser.png 1.5x, /wiki/images/0/02/Drawing_Openbrowser.png 2x" /></a> <a href="Drawing_Openbrowser.html" title="Drawing Openbrowser">Open Browser</a>: Opens a preview of the current sheet in the browser</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Orthoviews.png" class="image"><img alt="Drawing Orthoviews.png" src="32px-Drawing_Orthoviews.png" width="32" height="32" srcset="/wiki/images/thumb/7/7f/Drawing_Orthoviews.png/48px-Drawing_Orthoviews.png 1.5x, /wiki/images/7/7f/Drawing_Orthoviews.png 2x" /></a> <a href="Drawing_Orthoviews.html" title="Drawing Orthoviews">Ortho Views</a>: Automatically creates orthographic views of an object on the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Symbol.png" class="image"><img alt="Drawing Symbol.png" src="32px-Drawing_Symbol.png" width="32" height="32" srcset="/wiki/images/thumb/0/0a/Drawing_Symbol.png/48px-Drawing_Symbol.png 1.5x, /wiki/images/0/0a/Drawing_Symbol.png 2x" /></a> <a href="Drawing_Symbol.html" title="Drawing Symbol">Symbol</a>: Adds the contents of a SVG file as a symbol on the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_DraftView.png" class="image"><img alt="Drawing DraftView.png" src="32px-Drawing_DraftView.png" width="32" height="32" srcset="/wiki/images/thumb/f/ff/Drawing_DraftView.png/48px-Drawing_DraftView.png 1.5x, /wiki/images/f/ff/Drawing_DraftView.png 2x" /></a> <a href="Draft_Drawing.html" title="Draft Drawing">Draft View</a>: Inserts a special Draft view of the selected object in the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_SpreadsheetView.png" class="image"><img alt="Drawing SpreadsheetView.png" src="32px-Drawing_SpreadsheetView.png" width="32" height="32" srcset="/wiki/images/thumb/2/2f/Drawing_SpreadsheetView.png/48px-Drawing_SpreadsheetView.png 1.5x, /wiki/images/2/2f/Drawing_SpreadsheetView.png 2x" /></a> <a href="Drawing_SpreadsheetView.html" title="Drawing SpreadsheetView">Spreadsheet View</a>: Inserts a view of a selected spreadsheet in the current drawing sheet</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_Save.png" class="image"><img alt="Drawing Save.png" src="32px-Drawing_Save.png" width="32" height="32" srcset="/wiki/images/4/43/Drawing_Save.png 1.5x" /></a> <a href="Drawing_Save.html" title="Drawing Save">Save sheet</a>: Saves the current sheet as a SVG file</li></ul>
<ul><li> <a href="Drawing_ProjectShape.html" title="Drawing ProjectShape">Project Shape</a>: Creates a projection of the selected object (Source) in the 3D view.</li></ul>
<div class="mw-translate-fuzzy">
<p><b>Note</b>
The <a href="Draft_Module.html" title="Draft Module">Draft Module</a> has its own <a href="Draft_Drawing.html" title="Draft Drawing">Draft_Drawing</a> too to place Draft objects on paper. It has a couple of extra capabilities over the standard Drawing tools, and supports specific objects like <a href="Draft_Dimension.html" title="Draft Dimension">Draft dimensions</a>.
</p>
</div>
<p><br />
<a href="https://www.freecadweb.org/wiki/index.php?title=File:Drawing_extraction.png" class="image"><img alt="Drawing extraction.png" src="800px-Drawing_extraction.png" width="800" height="428" srcset="/wiki/images/thumb/f/f4/Drawing_extraction.png/1200px-Drawing_extraction.png 1.5x, /wiki/images/f/f4/Drawing_extraction.png 2x" /></a>
</p><p>I bilden så ser du huvudkoncepten av Ritningsmodulen. Dokumentet innehåller ett formobjekt (Schenkel) som vi vill göra en ritning av. Därför så är en "Sida" skapad. Sidan fås genom en mall, i detta fall "A3_Landskap" mallen. Mallen är ett SVG dokument som kan innehålla din vanliga sidram, din logotyp eller så den överensstämmer med dina presentationsstandarder.
</p><p>I denna sida så kan vi sätta in en eller fler vyer. Varje vy har en position på sidan (Egenskaper X,Y), en skalfaktor (Egenskap skala) och ytterligare egenskaper. Varje gång som sidan ,eller vyn, eller det refererade objektet ändras så regenereras sidan och visningen uppdateras.
</p>
<h2><span class="mw-headline" id="Skript_4">Skript</span></h2>
<p>För tillfället så är arbetsflödet för slutanvändaren väldigt begränsat, så skript API't är intressantare. Här följer exempel på hur man använder skript API't för ritningsmodulen.
</p><p>Here a script that can easily fill the <a href="Macro_CartoucheFC.html" title="Macro CartoucheFC">Macro_CartoucheFC</a> leaf FreeCAD A3_Landscape.
</p>
<h3><span class="mw-headline" id="Enkelt_exempel">Enkelt exempel</span></h3>
<p>Först av allt så behöver du Del och Ritningsmodulen:
</p>
<pre>import FreeCAD, Part, Drawing </pre>
<p>Skapa en liten exempeldel:
</p>
<pre>Part.show(Part.makeBox(100,100,100).cut(Part.makeCylinder(80,100)).cut(Part.makeBox(90,40,100)).cut(Part.makeBox(20,85,100))) </pre>
<p>Direkt projektion. G0 innebär hård kant, G1 är kontinuerlig tangent.
</p>
<pre>Shape = App.ActiveDocument.Shape.Shape
[visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(Shape)
print "visible edges:", len(visibleG0.Edges)
print "hidden edges:", len(hiddenG0.Edges) </pre>
<p>Allting projicerades på Z-planet:
</p>
<pre>print "Bnd Box shape: X=",Shape.BoundBox.XLength," Y=",Shape.BoundBox.YLength," Z=",Shape.BoundBox.ZLength
print "Bnd Box project: X=",visibleG0.BoundBox.XLength," Y=",visibleG0.BoundBox.YLength," Z=",visibleG0.BoundBox.ZLength </pre>
<p>Annan projectionsvektor
</p>
<pre>[visibleG0,visibleG1,hiddenG0,hiddenG1] = Drawing.project(Shape,App.Vector(1,1,1)) </pre>
<p>Projicera till SVG
</p>
<pre>resultSVG = Drawing.projectToSVG(Shape,App.Vector(1,1,1))
print resultSVG </pre>
<h3><span class="mw-headline" id="Det_parametriska_s.C3.A4ttet">Det parametriska sättet</span></h3>
<p>Skapa kroppen
</p>
<pre>import FreeCAD
import Part
import Drawing
# Create three boxes and a cylinder
App.ActiveDocument.addObject("Part::Box","Box")
App.ActiveDocument.Box.Length=100.00
App.ActiveDocument.Box.Width=100.00
App.ActiveDocument.Box.Height=100.00
App.ActiveDocument.addObject("Part::Box","Box1")
App.ActiveDocument.Box1.Length=90.00
App.ActiveDocument.Box1.Width=40.00
App.ActiveDocument.Box1.Height=100.00
App.ActiveDocument.addObject("Part::Box","Box2")
App.ActiveDocument.Box2.Length=20.00
App.ActiveDocument.Box2.Width=85.00
App.ActiveDocument.Box2.Height=100.00
App.ActiveDocument.addObject("Part::Cylinder","Cylinder")
App.ActiveDocument.Cylinder.Radius=80.00
App.ActiveDocument.Cylinder.Height=100.00
App.ActiveDocument.Cylinder.Angle=360.00
# Fuse two boxes and the cylinder
App.ActiveDocument.addObject("Part::Fuse","Fusion")
App.ActiveDocument.Fusion.Base = App.ActiveDocument.Cylinder
App.ActiveDocument.Fusion.Tool = App.ActiveDocument.Box1
App.ActiveDocument.addObject("Part::Fuse","Fusion1")
App.ActiveDocument.Fusion1.Base = App.ActiveDocument.Box2
App.ActiveDocument.Fusion1.Tool = App.ActiveDocument.Fusion
# Cut the fused shapes from the first box
App.ActiveDocument.addObject("Part::Cut","Shape")
App.ActiveDocument.Shape.Base = App.ActiveDocument.Box
App.ActiveDocument.Shape.Tool = App.ActiveDocument.Fusion1
# Hide all the intermediate shapes
Gui.ActiveDocument.Box.Visibility=False
Gui.ActiveDocument.Box1.Visibility=False
Gui.ActiveDocument.Box2.Visibility=False
Gui.ActiveDocument.Cylinder.Visibility=False
Gui.ActiveDocument.Fusion.Visibility=False
Gui.ActiveDocument.Fusion1.Visibility=False </pre>
<p>Sätt in ett sid objekt och välj en mall
</p>
<pre>App.ActiveDocument.addObject('Drawing::FeaturePage','Page')
App.ActiveDocument.Page.Template = App.getResourceDir()+'Mod/Drawing/Templates/A3_Landscape.svg' </pre>
<p>Skapa en vy på "Shape" objektet, definiera position och skala och sätt in den i en sida
</p>
<pre>App.ActiveDocument.addObject('Drawing::FeatureViewPart','View')
App.ActiveDocument.View.Source = App.ActiveDocument.Shape
App.ActiveDocument.View.Direction = (0.0,0.0,1.0)
App.ActiveDocument.View.X = 10.0
App.ActiveDocument.View.Y = 10.0
App.ActiveDocument.Page.addObject(App.ActiveDocument.View) </pre>
<p>Skapa en andra vy på samma objekt men denna gång kommer vyn att vara roterad 90 grader.
</p>
<pre>App.ActiveDocument.addObject('Drawing::FeatureViewPart','ViewRot')
App.ActiveDocument.ViewRot.Source = App.ActiveDocument.Shape
App.ActiveDocument.ViewRot.Direction = (0.0,0.0,1.0)
App.ActiveDocument.ViewRot.X = 290.0
App.ActiveDocument.ViewRot.Y = 30.0
App.ActiveDocument.ViewRot.Scale = 1.0
App.ActiveDocument.ViewRot.Rotation = 90.0
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewRot) </pre>
<p>Skapa en tredje vy av samma objekt men med en isometrisk vyriktning. Gömda linjer aktiveras också.
</p>
<pre>App.ActiveDocument.addObject('Drawing::FeatureViewPart','ViewIso')
App.ActiveDocument.ViewIso.Source = App.ActiveDocument.Shape
App.ActiveDocument.ViewIso.Direction = (1.0,1.0,1.0)
App.ActiveDocument.ViewIso.X = 335.0
App.ActiveDocument.ViewIso.Y = 140.0
App.ActiveDocument.ViewIso.ShowHiddenLines = True
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewIso) </pre>
<p>Ändra något och uppdatera. Uppdateringsprocessen ändrar vyn och sidan.
</p>
<pre>App.ActiveDocument.View.X = 30.0
App.ActiveDocument.View.Y = 30.0
App.ActiveDocument.View.Scale = 1.5
App.ActiveDocument.recompute() </pre>
<h3><span class="mw-headline" id="Komma_.C3.A5t_bitarna">Komma åt bitarna</span></h3>
<p>Hämte SVG fragment på en enkel vy
</p>
<pre>ViewSVG = App.ActiveDocument.View.ViewResult
print ViewSVG </pre>
<p>Hämta hela resultatsidan (det är en fil i dokumentets temporära katalog, endast läsrättigheter)
</p>
<pre>print "Resulting SVG document: ",App.ActiveDocument.Page.PageResult
file = open(App.ActiveDocument.Page.PageResult,"r")
print "Result page is ",len(file.readlines())," lines long" </pre>
<p>Viktigt: Frigör filen!
</p>
<pre>del file </pre>
<p>Sätt in en vy med ditt eget innehåll:
</p>
<pre>App.ActiveDocument.addObject('Drawing::FeatureView','ViewSelf')
App.ActiveDocument.ViewSelf.ViewResult = """&lt;g id="ViewSelf"
stroke="rgb(0, 0, 0)"
stroke-width="0.35"
stroke-linecap="butt"
stroke-linejoin="miter"
transform="translate(30,30)"
fill="#00cc00"
&gt;
&lt;ellipse cx="40" cy="40" rx="30" ry="15"/&gt;
&lt;/g&gt;"""
App.ActiveDocument.Page.addObject(App.ActiveDocument.ViewSelf)
App.ActiveDocument.recompute()
del ViewSVG </pre>
<p>Det leder till följande resultat:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:DrawingScriptResult.jpg" class="image"><img alt="DrawingScriptResult.jpg" src="800px-DrawingScriptResult.jpg" width="800" height="481" srcset="/wiki/images/thumb/2/2e/DrawingScriptResult.jpg/1200px-DrawingScriptResult.jpg 1.5x, /wiki/images/2/2e/DrawingScriptResult.jpg 2x" /></a>
</p>
<h3><span class="mw-headline" id="General_Dimensioning_and_Tolerancing">General Dimensioning and Tolerancing</span></h3>
<p>Drawing dimensions an tolerances are still under development but you can get some basic functionality with a bit of work.
</p><p>First you need to get the gdtsvg python module from here (WARNING: This could be broken at any time!):
</p><p><a rel="nofollow" class="external free" href="https://github.com/jcc242/FreeCAD">https://github.com/jcc242/FreeCAD</a>
</p><p>To get a feature control frame, try out the following:
</p>
<pre>import gdtsvg as g # Import the module, I like to give it an easy handle
ourFrame = g.ControlFrame("0","0", g.Perpendicularity(), ".5", g.Diameter(), g.ModifyingSymbols("M"), "A",
g.ModifyingSymbols("F"), "B", g.ModifyingSymbols("L"), "C", g.ModifyingSymbols("I")) </pre>
<p>Here is a good breakdown of the contents of a feature control frame: <a rel="nofollow" class="external free" href="http://www.cadblog.net/adding-geometric-tolerances.htm">http://www.cadblog.net/adding-geometric-tolerances.htm</a>
</p><p>The parameters to pass to control frame are:
</p>
<ol><li>X-coordinate in SVG-coordinate system (type string)</li>
<li>Y-coordinate in SVG-coordinate system (type string)</li>
<li>The desired geometric characteristic symbol (tuple, svg string as first, width of symbol as second, height of symbol as third)</li>
<li>The tolerance (type string)</li>
<li>(optional) The diameter symbol (tuple, svg string as first, width of symbol as second, height of symbol as third)</li>
<li>(optional) The condition modifying material (tuple, svg string as first, width of symbol as second, height of symbol as third)</li>
<li>(optional) The first datum (type string)</li>
<li>(optional) The first datum's modifying condition (tuple, svg string as first, width of symbol as second, height of symbol as third)</li>
<li>(optional) The second datum (type string)</li>
<li>(optional) The second datum's modifying condition (tuple, svg string as first, width of symbol as second, height of symbol as third)</li>
<li>(optional) The third datum (type string)</li>
<li>(optional) The third datum's material condition (tuple, svg string as first, width of symbol as second, height of symbol as third)</li></ol>
<p>The ControlFrame function returns a type containing (svg string, overall width of control frame, overall height of control frame)
</p><p>To get a dimension, try out the following:
</p>
<pre>import gdtsvg
ourDimension = linearDimension(point1, point2, textpoint, dimensiontext, linestyle=getStyle("visible"),
arrowstyle=getStyle("filled"), textstyle=getStyle("text") </pre>
<p>Inputs for linear dimension are:
</p>
<ol><li>point1, an (x,y) tuple with svg-coordinates, this is one of the points you would like to dimension between</li>
<li>point2, an (x,y) tuple with svg-coordinates, this is the second point you would like to dimension between</li>
<li>textpoint, an (x,y) tuple of svg-coordinates, this is where the text of your dimension will be</li>
<li>dimensiontext, a string containing the text you want the dimension to say</li>
<li>linestyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling the how the lines look</li>
<li>arrowstyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling how the arrows look</li>
<li>textstyle, a string containing svg (i.e. css) styles, using the getStyle function to retrieve a preset string, for styling how the text looks </li></ol>
<p>With those two, you can proceed as above for displaying them on the drawing page. This module is very buggy and can be broken at any given moment, bug reports are welcome on the github page for now, or contact jcc242 on the forums if you post a bug somewhere else.
</p>
<h2><span class="mw-headline" id="Exempel_2">Exempel</span></h2>
<p>FreeCAD kommer med ett standardset med mallar, men du kan hitta fler på <a href="https://www.freecadweb.org/wiki/index.php?title=Drawing_templates/sv" title="Drawing templates/sv">Ritningsmallar</a> sidan.
</p>
<h2><span class="mw-headline" id="Extending_the_Drawing_Module">Extending the Drawing Module</span></h2>
<p>Some notes on the programming side of the drawing module will be added to the <a href="Drawing_Documentation.html" title="Drawing Documentation">Drawing Documentation</a> page. This is to help quickly understand how the drawing module works, enabling programmers to rapidly start programming for it.
</p>
<h2><span class="mw-headline" id="Tutorials_2">Tutorials</span></h2>
<ul><li> <a href="Drawing_tutorial.html" title="Drawing tutorial">Drawing tutorial</a></li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id="External_links">External links</span></h2>
<ul><li> <a rel="nofollow" class="external text" href="https://www.youtube.com/watch?v=1Hm5Zyjmjac">Intro to mechanical drawing on Youtube - by Normal Universe</a></li></ul>
<p><br />
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="Raytracing_arbetsb.C3.A4nken">Raytracing arbetsbänken</span></h2>
<div class="mw-translate-fuzzy">
<p>Denna modul är tänkt att skicka innehållet i din scen till en extern <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Rendering">rendererare</a>, för att generera fotorealistiska bilder på ditt arbete. Renderingsmodulen är fortfarande i ett mycket tidigt skede, så du har inte så många tillgängliga alternativ för tillfället. För närvarande finns endast ett grundläggande verktygsset för att exportera Del objekt som <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/POV-Ray">POV-ray</a> filer. Dessa filer kan sedan laddas i POV-ray och renderas.
</p>
</div>
<p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Raytracing_example.jpg" class="image"><img alt="Raytracing example.jpg" src="1024px-Raytracing_example.jpg" width="1024" height="574" srcset="/wiki/images/thumb/a/a4/Raytracing_example.jpg/1536px-Raytracing_example.jpg 1.5x, /wiki/images/a/a4/Raytracing_example.jpg 2x" /></a>
</p><p>Currenly, two renderers are supported: <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/POV-Ray">povray</a> and <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/LuxRender">luxrender</a>. To be able to render directly from FreeCAD, at least one of those renderers must be installed on your system, and its path must be configured in the FreeCAD Raytracing preferences. Without any renderer installed, though, you are still able to export a scene file that can be used in any of those renderers later, or on another machine.
</p><p>The raytracing workbench works with <a href="/wiki/Raytracing_Module#Templates" title="Raytracing Module">templates</a>, which are complete scene files for the given external renderer, including lights and possibly additional geometry such as ground planes. These scene files contain placeholders, where FreeCAD will insert the position of the camera, and geometry and materials information of each of the objects you insert in the project. That modified scene file is what is then exported to the external renderer.
</p>
<h3><span class="mw-headline" id="Gr.C3.A4nssnittsverktyg_2">Gränssnittsverktyg</span></h3>
<p>Detta är verktyg för att exportera ditt 3D arbete till externa renderare
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Raytracing_Export.png" class="image"><img alt="Raytracing Export.png" src="32px-Raytracing_Export.png" width="32" height="32" srcset="/wiki/images/thumb/0/00/Raytracing_Export.png/48px-Raytracing_Export.png 1.5x, /wiki/images/0/00/Raytracing_Export.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Raytracing_Export/sv" title="Raytracing Export/sv">Skapa ett Povray projekt</a>: Skapar ett nytt POV-Ray projekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Raytracing_Camera.png" class="image"><img alt="Raytracing Camera.png" src="32px-Raytracing_Camera.png" width="32" height="32" srcset="/wiki/images/thumb/d/d0/Raytracing_Camera.png/48px-Raytracing_Camera.png 1.5x, /wiki/images/d/d0/Raytracing_Camera.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Raytracing_Camera/sv" title="Raytracing Camera/sv">Sätt in vyinfo</a>: Sätter in vyinfon (kameraposition, etc) till nuvarande POV-Ray projekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Raytracing_Part.png" class="image"><img alt="Raytracing Part.png" src="32px-Raytracing_Part.png" width="32" height="32" srcset="/wiki/images/thumb/c/c7/Raytracing_Part.png/48px-Raytracing_Part.png 1.5x, /wiki/images/c/c7/Raytracing_Part.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Raytracing_Part/sv" title="Raytracing Part/sv">Sätt in objekt info</a>:Sätter in det valda objektet till nuvarande POV-Ray projekt</li></ul>
<p><br />
</p>
<h2><span class="mw-headline" id="Typical_workflow">Typical workflow</span></h2>
<ol><li> Create or open a FreeCAD project, add some <a href="Part_Module.html" title="Part Module">Part-based</a> objects (meshes are currently not supported)</li>
<li> Create a Raytracing project (luxrender or povray)</li>
<li> Select the objects you wish to add to the raytracing project and add them to the project with the "Insert Part" tool</li>
<li> Export or render directly</li></ol>
<h2><span class="mw-headline" id="Creating_a_povray_file_manually">Creating a povray file manually</span></h2>
<p>The utility tools described above allow you to export the current 3D view and all of its content to a <a rel="nofollow" class="external text" href="http://www.povray.org/">Povray</a> file. First, you must load or create your CAD data and position the 3D View orientation as you wish. Then choose "Utilities-&gt;Export View..." from the raytracing menu.
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:FreeCAD_Raytracing.jpg" class="image"><img alt="FreeCAD Raytracing.jpg" src="FreeCAD_Raytracing.jpg" width="964" height="730" /></a></div></div>
<p>You will be asked for a location to save the resulting *.pov file. After that you can open it in <a rel="nofollow" class="external text" href="http://www.povray.org/">Povray</a> and render:
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Povray.jpg" class="image"><img alt="Povray.jpg" src="Povray.jpg" width="805" height="825" /></a></div></div>
<p>As usual in a renderer you can make big and nice pictures:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Scharniergreifer_render.jpg" class="image"><img alt="Scharniergreifer render.jpg" src="1024px-Scharniergreifer_render.jpg" width="1024" height="819" srcset="/wiki/images/2/2e/Scharniergreifer_render.jpg 1.5x" /></a>
</p>
<h3><span class="mw-headline" id="Skript_5">Skript</span></h3>
<h3><span class="mw-headline" id="Outputting_render_files">Outputting render files</span></h3>
<p>The Raytracing and RaytracingGui modules provide several methods to write scene contents as povray or luxrender data. The most useful are Raytracing.getPartAsPovray() and Raytracing.getPartAsLux() to render a FreeCAD Part object into a povray or luxrender definition, and RaytracingGui.povViewCamera() and RaytracinGui.luxViewCamera() to get the current point of view of the FreeCAD 3D window into povray or luxrender format.
</p><p>Här ser du hur du använder dessa funktioner i python:
</p>
<pre>import Raytracing,RaytracingGui
OutFile = open('C:/Documents and Settings/jriegel/Desktop/test.pov','w')
OutFile.write(open(App.getResourceDir()+'Mod/Raytracing/Templates/ProjectStd.pov').read())
OutFile.write(RaytracingGui.povViewCamera())
OutFile.write(Raytracing.getPartAsPovray('Box',App.activeDocument().Box.Shape,0.800000,0.800000,0.800000))
OutFile.close()
del OutFile </pre>
<p>And the same for luxrender:
</p>
<pre>import Raytracing,RaytracingGui
OutFile = open('C:/Documents and Settings/jriegel/Desktop/test.lxs','w')
OutFile.write(open(App.getResourceDir()+'Mod/Raytracing/Templates/LuxClassic.lxs').read())
OutFile.write(RaytracingGui.luxViewCamera())
OutFile.write(Raytracing.getPartAsLux('Box',App.activeDocument().Box.Shape,0.800000,0.800000,0.800000))
OutFile.close()
del OutFile </pre>
<h3><span class="mw-headline" id="Creating_a_custom_render_object">Creating a custom render object</span></h3>
<p>Apart from standard povray and luxrender view objects that provide a view of an existing Part object, and that can be inserted in povray and luxrender projects respectively, a third object exist, called RaySegment, that can be inserted either in povray or luxrender projects. That RaySegment object is not linked to any of the FreeCAD objects, and can contain custom povray or luxrender code, that you might wish to insert into your raytracing project. You can also use it, for example, to output your FreeCAD objects a certain way, if you are not happy with the standard way. You can create and use it like this from the python console:
</p>
<pre>myRaytracingProject = FreeCAD.ActiveDocument.PovProject
myCustomRenderObject = FreeCAD.ActiveDocument.addObject("Raytracing::RaySegment","myRenderObject")
myRaytracingProject.addObject(myCustomRenderObject)
myCustomRenderObject.Result = "// Hello from python!" </pre>
<h3><span class="mw-headline" id="L.C3.A4nkar">Länkar</span></h3>
<h3><span class="mw-headline" id="POVRay">POVRay</span></h3>
<ul><li> <a rel="nofollow" class="external free" href="http://www.spiritone.com/~english/cyclopedia/">http://www.spiritone.com/~english/cyclopedia/</a></li>
<li> <a rel="nofollow" class="external free" href="http://www.povray.org/">http://www.povray.org/</a></li>
<li> <a rel="nofollow" class="external free" href="http://en.wikipedia.org/wiki/POV-Ray">http://en.wikipedia.org/wiki/POV-Ray</a></li></ul>
<h3><span class="mw-headline" id="Luxrender">Luxrender</span></h3>
<ul><li> <a rel="nofollow" class="external free" href="http://www.luxrender.net/">http://www.luxrender.net/</a></li></ul>
<h3><span class="mw-headline" id="Future_possible_renderers_to_implement">Future possible renderers to implement</span></h3>
<ul><li> <a rel="nofollow" class="external free" href="http://www.yafaray.org/">http://www.yafaray.org/</a></li>
<li> <a rel="nofollow" class="external free" href="http://www.mitsuba-renderer.org/">http://www.mitsuba-renderer.org/</a></li>
<li> <a rel="nofollow" class="external free" href="http://www.kerkythea.net/">http://www.kerkythea.net/</a></li>
<li> <a rel="nofollow" class="external free" href="http://www.artofillusion.org/">http://www.artofillusion.org/</a></li></ul>
<hr />
<p>Currently there is a new Renderer Workbench in development to support multiple back-ends such as Lux Renderer and Yafaray. Information for using the development version can be viewed at <a href="Render_project.html" title="Render project">Render_project</a>
</p><p>For Development status of the Render Module look here <a href="Raytracing_project.html" title="Raytracing project">Raytracing_project</a>
</p>
<h2><span class="mw-headline" id="Templates">Templates</span></h2>
<p>FreeCAD comes with a couple of default templates for povray and luxrender, but you can easily create your own. All you need to do is to create a scene file for the given renderer, then edit it manually with a text editor to insert special tags that FreeCAD will recognize and where it will insert its contents (camera and objects data)
</p>
<h3><span class="mw-headline" id="Povray_2">Povray</span></h3>
<p>Povray scene files (with extension .pov) can be created manually with a text editor (povray is made primarily to be used as a scripting language), but also with a wide range of 3D applications, such as <a rel="nofollow" class="external text" href="http://www.blender.org">blender</a>. On the <a rel="nofollow" class="external text" href="http://www.povray.org/">povray website</a> you can find further information and a list of applications able to produce .pov files.
</p><p>When you have a .pov file ready, you need to open it with a text editor, and do two operations:
</p>
<ol><li> Strip out the camera information, because FreeCAD will place its own camera data. To do so, locate a text block like this: <tt>camera { ... }</tt>, which describes the camera parameters, and delete it (or put "//" in front of each line to comment them out).</li>
<li> Insert the following line somewhere: <tt>//RaytracingContent</tt>. This is where FreeCAD will insert its contents (camera and objects data). You can, for example, put this line at the very end of the file.</li></ol>
<p>Note that FreeCAD will also add some declarations, that you can use in your template, after the <tt>//RaytracingContent</tt> tag. These are:
</p>
<ul><li> cam_location: the location of the camera</li>
<li> cam_look_at: the location of the target point of the camera</li>
<li> cam_sky: the up vector of the camera.</li>
<li> cam_angle: the angle of the camera</li></ul>
<p>If you want, for example, to place a lamp above the camera, you can use this:
</p>
<pre>light_source {
cam_location + cam_angle * 100
color rgb &lt;10, 10, 10&gt;
} </pre>
<h3><span class="mw-headline" id="Luxrender_2">Luxrender</span></h3>
<p>Luxrender scene files (with extension.lxs) can either be single files, or a master .lxs file that includes world definition (.lxw), material definition (.lxm) and geometry definition (.lxo) files. You can work with both styles, but it is also easy to transform a group of 4 files in a single .lxs file, by copying the contents of each .lxw, .lxm and .lxo file and pasting it at the point where that file is inserted in the master .lxs file.
</p><p>Luxrender scene files are hard to produce by hand, but are easy to produce with many 3D applications such as <a rel="nofollow" class="external text" href="http://www.blender.org">blender</a>. On the <a rel="nofollow" class="external text" href="http://www.luxrender.net">luxrender website</a>, you'll find more information and plugins for the main 3D applications out there.
</p><p>If you will work with separated .lxw, .lxm and .lxo files, beware that the final .lxs exported by FreeCAD might be at a different location than the template file, and therefore these files might not be found by Luxrender at render time. In this case you should or copy these files to the location of your final file, or edit their paths in the exported .lxs file.
</p><p>If you are exporting a scene file from blender, and wish to merge everything into one single file, you will need to perform one step before exporting: By default, the luxrender exporter in blender exports all mesh geometry as separate .ply files, instead of placing the mesh geometry directly inside the .lxo file. To change that behaviour, you need to select each of your meshes in blender, go to the "mesh" tab and set the option "export as" to "luxrender mesh" for each one of them.
</p><p>After you have your scene file ready, to turn it into a FreeCAD template, you need to perform the following steps:
</p>
<ol><li> Locate the camera position, a single line that begins with <tt>LookAt</tt>, and delete it (or place a "#" at the beginning of the line to comment it out)</li>
<li> At that place, insert the following line: <tt>#RaytracingCamera</tt></li>
<li> At a desired point, for example just after the end of the materials definition, before the geometry information, or at the very end, just before the final <tt>WorldEnd</tt> line, insert the following line: <tt>#RaytracingContent</tt>. That is where FreeCAD will insert its own objects.</li></ol>
<p>Note that in luxrender, the objects stored in a scene file can define transformation matrixes, that perform location, rotation or scaling operations. These matrixes can stack and affect everything that come after them, so, by placing your <tt>#RaytracingContent</tt> tag at the end of the file, you might see your FreeCAD objects affected by a transformation matrix placed earlier in the template. To make sure that this doesn't happen, place your <tt>#RaytracingContent</tt> tag before any other geometry object present in the template. FreeCAD itself won't define any of those transformation matrixes.
</p>
<h2><span class="mw-headline" id="Exporting_to_Kerkythea">Exporting to Kerkythea</span></h2>
<p>Although direct export to the Kerkythea XML-File-Format is not supported yet, you can export your Objects as Mesh-Files (.obj) and then import them in Kerkythea.
</p>
<ul><li> if using Kerkythea for Linux, remember to install the WINE-Package (needed by Kerkythea for Linux to run)</li>
<li> you can convert your models with the help of the mesh workbench to meshes and then export these meshes as .obj-files</li>
<li> If your mesh-export resulted in errors (flip of normals, holes ...) you may try your luck with <a rel="nofollow" class="external text" href="http://www.netfabb.com/downloadcenter.php?basic=1">netfabb studio basic</a></li></ul>
<dl><dd>Free for personal use, available for Windows, Linux and Mac OSX.</dd>
<dd>It has standard repair tools which will repair you model in most cases.</dd></dl>
<ul><li> another good program for mesh analysing/repairing is <a rel="nofollow" class="external text" href="http://sourceforge.net/projects/meshlab/">Meshlab</a></li></ul>
<dl><dd>Open Source, available for Windows, Linux and Mac OSX.</dd>
<dd>It has standard repair tools which will repair you model in most cases (fill holes, re-orient normals, etc.)</dd></dl>
<ul><li> you can use "make compound" and then "make single copy" or you can fuse solids to group them before converting to meshes</li>
<li> remember to set in Kerkythea an import-factor of 0.001 for obj-modeler, since Kerkythea expects the obj-file to be in m (but standard units-scheme in FreeCAD is mm)</li></ul>
<dl><dd>Within WIndows 7 64-bit Kerkythea does not seem to be able to save these settings.</dd>
<dd>So remember to do that each time you start Kerkythea</dd></dl>
<ul><li> if importing multiple objects in Kerkythea you can use the "File &gt; Merge" command in Kerkythea</li></ul>
<h2><span class="mw-headline" id="Links_2">Links</span></h2>
<ul><li> <a href="Render_project.html" title="Render project">Render project</a></li>
<li> <a href="Raytracing_tutorial.html" title="Raytracing tutorial">Raytracing tutorial</a></li></ul>
<p><br />
</p>
<p><br />
</p>
<h2><span class="mw-headline" id="Bild_arbetsb.C3.A4nken">Bild arbetsbänken</span></h2>
<p>The image module manages different types of <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Raster_graphics">bitmap images</a>, and lets you open them in FreeCAD. <br />
<br />
Currently, the modules lets you open .bmp, .jpg, .png and .xpm file formats in a separate viewer window.
</p><p>The image workbenches also allows you to import an image on a plane in the 3D-space of FreeCAD. This function is available via the second button of the image workbench. <a href="https://www.freecadweb.org/wiki/index.php?title=File:Image_Import.png" class="image"><img alt="Image Import.png" src="32px-Image_Import.png" width="32" height="32" srcset="/wiki/images/thumb/b/b5/Image_Import.png/48px-Image_Import.png 1.5x, /wiki/images/b/b5/Image_Import.png 2x" /></a>.
<br />
The imported image can be attached like a sketch to one of the main three planes (XY/XZ/YZ) with positive or negativ offset.
<br />
This function is only available if you have opened a FreeCAD document.
</p><p>The image can be moved in 3D-space by editing the placement in the <a href="Property_editor.html" title="Property editor">Property editor</a>.
<br />
The major use is tracing over the image, in order to generate a new part at using the image as template.
</p><p>The image is imported with 1 pixel = 1mm.
Therefore it is recommended to have the imported image in a reasonable resolution.
The image can be scaled by editing the "XSize" and "YSize" values in the <a href="Property_editor.html" title="Property editor">Property editor</a>.
The image can be also moved by editing the X/Y/Z-values in the Placement-Tab.
The image can also be rotated around any axis by using the placement-dialogue.
</p><p><b>Tip:</b><br />
Tracing with sketcher elements over an image works best if the image has a small (negative) offset to the sketch plane.
<br />
You can set an offset of -0,1 mm at import or later by editing the placement of the image.
</p><p><b>Tools</b>
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Image_Import.png" class="image"><img alt="Image Import.png" src="32px-Image_Import.png" width="32" height="32" srcset="/wiki/images/thumb/b/b5/Image_Import.png/48px-Image_Import.png 1.5x, /wiki/images/b/b5/Image_Import.png 2x" /></a> <a href="Image_Import.html" title="Image Import">Image Import</a>
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h2><span class="mw-headline" id="Skiss_arbetsb.C3.A4nken">Skiss arbetsbänken</span></h2>
<p>Rit modulen är ett pågående arbete och är en ganska experimentell modul som har gjorts för att lägga till grundläggande 2d ritfunktionalitet till FreeCAD. Den är helt och hållet skriven i python, och är även tänkt att fungera som en presentation om hur mycket du kan utöka FreeCAD endast med hjälp av python, utan att ens röra källkoden.
</p>
<h3><span class="mw-headline" id="Rita_objekt">Rita objekt</span></h3>
<p>Detta är verktyg för att rita objekt.
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Line.png" class="image"><img alt="Draft Line.png" src="32px-Draft_Line.png" width="32" height="32" srcset="/wiki/images/thumb/a/a8/Draft_Line.png/48px-Draft_Line.png 1.5x, /wiki/images/a/a8/Draft_Line.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Line/sv" title="Draft Line/sv">2-punkt Linje</a>: Ritar ett linjesegment mellan 2 punkter</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Wire.png" class="image"><img alt="Draft Wire.png" src="32px-Draft_Wire.png" width="32" height="32" srcset="/wiki/images/thumb/0/00/Draft_Wire.png/48px-Draft_Wire.png 1.5x, /wiki/images/0/00/Draft_Wire.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Wire/sv" title="Draft Wire/sv">Tråd (multi-punkts linje)</a>: Ritar en linje som består av flera linjesegment</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Circle.png" class="image"><img alt="Draft Circle.png" src="32px-Draft_Circle.png" width="32" height="32" srcset="/wiki/images/thumb/1/10/Draft_Circle.png/48px-Draft_Circle.png 1.5x, /wiki/images/1/10/Draft_Circle.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Circle/sv" title="Draft Circle/sv">Cirkel</a>: Ritar en cirkel med hjälp av centrum och radie</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Arc.png" class="image"><img alt="Draft Arc.png" src="32px-Draft_Arc.png" width="32" height="32" srcset="/wiki/images/thumb/a/a8/Draft_Arc.png/48px-Draft_Arc.png 1.5x, /wiki/images/a/a8/Draft_Arc.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Arc/sv" title="Draft Arc/sv">Cirkelbåge</a>: Ritar en cirkelbåge med hjälp av centrum, radie, startvinkel och slutvinkel</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Ellipse.png" class="image"><img alt="Draft Ellipse.png" src="32px-Draft_Ellipse.png" width="32" height="32" srcset="/wiki/images/thumb/1/13/Draft_Ellipse.png/48px-Draft_Ellipse.png 1.5x, /wiki/images/1/13/Draft_Ellipse.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Ellipse/sv" title="Draft Ellipse/sv">Ellipse</a>: Draws an ellipse from two corner points</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Polygon.png" class="image"><img alt="Draft Polygon.png" src="32px-Draft_Polygon.png" width="32" height="32" srcset="/wiki/images/thumb/8/8e/Draft_Polygon.png/48px-Draft_Polygon.png 1.5x, /wiki/images/8/8e/Draft_Polygon.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Polygon/sv" title="Draft Polygon/sv">Polygon</a>: Ritar en regelbunden polygon med center och en radie</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Rectangle.png" class="image"><img alt="Draft Rectangle.png" src="32px-Draft_Rectangle.png" width="32" height="32" srcset="/wiki/images/thumb/1/14/Draft_Rectangle.png/48px-Draft_Rectangle.png 1.5x, /wiki/images/1/14/Draft_Rectangle.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Rectangle/sv" title="Draft Rectangle/sv">Rektangel</a>: Ritar en rektangel från 2 motsatta punkter (hörnen)</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Text.png" class="image"><img alt="Draft Text.png" src="32px-Draft_Text.png" width="32" height="32" srcset="/wiki/images/thumb/9/9f/Draft_Text.png/48px-Draft_Text.png 1.5x, /wiki/images/9/9f/Draft_Text.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Text/sv" title="Draft Text/sv">Text</a>: Ritar en text annotering med flera rader</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Dimension.png" class="image"><img alt="Draft Dimension.png" src="32px-Draft_Dimension.png" width="32" height="32" srcset="/wiki/images/thumb/b/b0/Draft_Dimension.png/48px-Draft_Dimension.png 1.5x, /wiki/images/b/b0/Draft_Dimension.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Dimension/sv" title="Draft Dimension/sv">Dimension</a>: Ritar en måttsättning</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_BSpline.png" class="image"><img alt="Draft BSpline.png" src="32px-Draft_BSpline.png" width="32" height="32" srcset="/wiki/images/thumb/a/af/Draft_BSpline.png/48px-Draft_BSpline.png 1.5x, /wiki/images/a/af/Draft_BSpline.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_BSpline/sv" title="Draft BSpline/sv">BSpline</a>: Ritar en B-Spline från en serie med punkter</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Point.png" class="image"><img alt="Draft Point.png" src="32px-Draft_Point.png" width="32" height="32" srcset="/wiki/images/thumb/c/c5/Draft_Point.png/48px-Draft_Point.png 1.5x, /wiki/images/c/c5/Draft_Point.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Point/sv" title="Draft Point/sv">Point</a>: Inserts a point object</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ShapeString.png" class="image"><img alt="Draft ShapeString.png" src="32px-Draft_ShapeString.png" width="32" height="32" srcset="/wiki/images/thumb/f/f7/Draft_ShapeString.png/48px-Draft_ShapeString.png 1.5x, /wiki/images/f/f7/Draft_ShapeString.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_ShapeString/sv" title="Draft ShapeString/sv">ShapeString</a>: The ShapeString tool inserts a compound shape representing a text string at a given point in the current document</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Facebinder.png" class="image"><img alt="Draft Facebinder.png" src="32px-Draft_Facebinder.png" width="32" height="32" srcset="/wiki/images/thumb/9/93/Draft_Facebinder.png/48px-Draft_Facebinder.png 1.5x, /wiki/images/9/93/Draft_Facebinder.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Facebinder/sv" title="Draft Facebinder/sv">Facebinder</a>: Creates a new object from selected faces on existing objects</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_BezCurve.png" class="image"><img alt="Draft BezCurve.png" src="32px-Draft_BezCurve.png" width="32" height="32" srcset="/wiki/images/thumb/3/34/Draft_BezCurve.png/48px-Draft_BezCurve.png 1.5x, /wiki/images/3/34/Draft_BezCurve.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_BezCurve/sv" title="Draft BezCurve/sv">Bezier Curve</a>: Draws a Bezier curve from a series of points</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Label.png" class="image"><img alt="Draft Label.png" src="32px-Draft_Label.png" width="32" height="32" srcset="/wiki/images/thumb/8/82/Draft_Label.png/48px-Draft_Label.png 1.5x, /wiki/images/8/82/Draft_Label.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Label/sv&amp;action=edit&amp;redlink=1" class="new" title="Draft Label/sv (page does not exist)">Label</a>: Places a label with an arrow pointing to a selected element <span style="font-size:8px;"><a href="https://www.freecadweb.org/wiki/index.php?title=Sl%C3%A4pp_anteckningar_0.17/sv&amp;action=edit&amp;redlink=1" class="new" title="Släpp anteckningar 0.17/sv (page does not exist)">Finns i version 0.17</a></span></li></ul>
<h3><span class="mw-headline" id="F.C3.B6r.C3.A4ndra_objekt_2">Förändra objekt</span></h3>
<p>Detta är verktyg för att förändra existerande objekt. De arbetar med valda objekt, men om inget objekt är valt, så ombes du att välja ett.
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Move.png" class="image"><img alt="Draft Move.png" src="32px-Draft_Move.png" width="32" height="32" srcset="/wiki/images/thumb/c/c5/Draft_Move.png/48px-Draft_Move.png 1.5x, /wiki/images/c/c5/Draft_Move.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Move/sv" title="Draft Move/sv">Flytta</a>: Flyttar objekt från en plats till en annan</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Rotate.png" class="image"><img alt="Draft Rotate.png" src="32px-Draft_Rotate.png" width="32" height="32" srcset="/wiki/images/thumb/5/5a/Draft_Rotate.png/48px-Draft_Rotate.png 1.5x, /wiki/images/5/5a/Draft_Rotate.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Rotate/sv" title="Draft Rotate/sv">Rotera</a>: Roterar objekt från en startvinkel till en slutvinkel</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Offset.png" class="image"><img alt="Draft Offset.png" src="32px-Draft_Offset.png" width="32" height="32" srcset="/wiki/images/thumb/e/eb/Draft_Offset.png/48px-Draft_Offset.png 1.5x, /wiki/images/e/eb/Draft_Offset.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Offset/sv" title="Draft Offset/sv">Offset</a>: Flyttar ett objekts segment ett visst avstånd</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Trimex.png" class="image"><img alt="Draft Trimex.png" src="32px-Draft_Trimex.png" width="32" height="32" srcset="/wiki/images/thumb/e/e7/Draft_Trimex.png/48px-Draft_Trimex.png 1.5x, /wiki/images/e/e7/Draft_Trimex.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Trimex/sv" title="Draft Trimex/sv">Trimma/förläng (Trimex)</a>: Trimmar eller förlänger ett objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Upgrade.png" class="image"><img alt="Draft Upgrade.png" src="32px-Draft_Upgrade.png" width="32" height="32" srcset="/wiki/images/thumb/b/be/Draft_Upgrade.png/48px-Draft_Upgrade.png 1.5x, /wiki/images/b/be/Draft_Upgrade.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Upgrade/sv" title="Draft Upgrade/sv">Uppgradera</a>: Förenar objekt till ett objekt med högre nivå</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Downgrade.png" class="image"><img alt="Draft Downgrade.png" src="32px-Draft_Downgrade.png" width="32" height="32" srcset="/wiki/images/thumb/8/86/Draft_Downgrade.png/48px-Draft_Downgrade.png 1.5x, /wiki/images/8/86/Draft_Downgrade.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Downgrade/sv" title="Draft Downgrade/sv">Nedgradera</a>: Splittrar objekt till enklare objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Scale.png" class="image"><img alt="Draft Scale.png" src="32px-Draft_Scale.png" width="32" height="32" srcset="/wiki/images/thumb/c/c9/Draft_Scale.png/48px-Draft_Scale.png 1.5x, /wiki/images/c/c9/Draft_Scale.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Scale/sv" title="Draft Scale/sv">Skala</a>: Skalar valda objekt runt en baspunkt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_PutOnSheet.png" class="image"><img alt="Draft PutOnSheet.png" src="32px-Draft_PutOnSheet.png" width="32" height="32" srcset="/wiki/images/thumb/9/91/Draft_PutOnSheet.png/48px-Draft_PutOnSheet.png 1.5x, /wiki/images/9/91/Draft_PutOnSheet.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Drawing/sv" title="Draft Drawing/sv">Ritning</a>: Skriver valda objekt till ett <a href="https://www.freecadweb.org/wiki/index.php?title=Drawing_Module/sv" title="Drawing Module/sv">Ritningsark</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Edit.png" class="image"><img alt="Draft Edit.png" src="32px-Draft_Edit.png" width="32" height="32" srcset="/wiki/images/thumb/5/51/Draft_Edit.png/48px-Draft_Edit.png 1.5x, /wiki/images/5/51/Draft_Edit.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Edit/sv" title="Draft Edit/sv">Redigera</a>: Redigerar ett valt objekt</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_WireToBSpline.png" class="image"><img alt="Draft WireToBSpline.png" src="32px-Draft_WireToBSpline.png" width="32" height="32" srcset="/wiki/images/thumb/a/a4/Draft_WireToBSpline.png/48px-Draft_WireToBSpline.png 1.5x, /wiki/images/a/a4/Draft_WireToBSpline.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_WireToBSpline/sv" title="Draft WireToBSpline/sv">Wire to BSpline</a>: Converts a wire to a BSpline and vice-versa</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_AddPoint.png" class="image"><img alt="Draft AddPoint.png" src="32px-Draft_AddPoint.png" width="32" height="32" srcset="/wiki/images/thumb/9/9e/Draft_AddPoint.png/48px-Draft_AddPoint.png 1.5x, /wiki/images/9/9e/Draft_AddPoint.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_AddPoint/sv" title="Draft AddPoint/sv">Add point</a>: Adds a point to a wire or BSpline</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_DelPoint.png" class="image"><img alt="Draft DelPoint.png" src="32px-Draft_DelPoint.png" width="32" height="32" srcset="/wiki/images/thumb/1/18/Draft_DelPoint.png/48px-Draft_DelPoint.png 1.5x, /wiki/images/1/18/Draft_DelPoint.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_DelPoint/sv" title="Draft DelPoint/sv">Delete point</a>: Delete a point from a wire or BSpline</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Shape2DView.png" class="image"><img alt="Draft Shape2DView.png" src="32px-Draft_Shape2DView.png" width="32" height="32" srcset="/wiki/images/thumb/9/9f/Draft_Shape2DView.png/48px-Draft_Shape2DView.png 1.5x, /wiki/images/9/9f/Draft_Shape2DView.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Shape2DView/sv" title="Draft Shape2DView/sv">Shape 2D View</a>: Creates a 2D object which is a flattened 2D view of another 3D object</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Draft2Sketch.png" class="image"><img alt="Draft Draft2Sketch.png" src="32px-Draft_Draft2Sketch.png" width="32" height="32" srcset="/wiki/images/thumb/b/b2/Draft_Draft2Sketch.png/48px-Draft_Draft2Sketch.png 1.5x, /wiki/images/b/b2/Draft_Draft2Sketch.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Draft2Sketch/sv" title="Draft Draft2Sketch/sv">Draft to Sketch</a>: Converts a Draft object to Sketch and vice-versa</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Array.png" class="image"><img alt="Draft Array.png" src="32px-Draft_Array.png" width="32" height="32" srcset="/wiki/images/thumb/c/c8/Draft_Array.png/48px-Draft_Array.png 1.5x, /wiki/images/c/c8/Draft_Array.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Array/sv" title="Draft Array/sv">Array</a>: Creates a polar or rectangular array from selected objects</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_PathArray.png" class="image"><img alt="Draft PathArray.png" src="32px-Draft_PathArray.png" width="32" height="32" srcset="/wiki/images/thumb/c/c1/Draft_PathArray.png/48px-Draft_PathArray.png 1.5x, /wiki/images/c/c1/Draft_PathArray.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_PathArray/sv" title="Draft PathArray/sv">Path Array</a>: Creates an array of objects by placing the copies along a path</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Clone.png" class="image"><img alt="Draft Clone.png" src="32px-Draft_Clone.png" width="32" height="32" srcset="/wiki/images/thumb/3/39/Draft_Clone.png/48px-Draft_Clone.png 1.5x, /wiki/images/3/39/Draft_Clone.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Clone/sv" title="Draft Clone/sv">Clone</a>: Clones the selected objects</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Mirror.png" class="image"><img alt="Draft Mirror.png" src="32px-Draft_Mirror.png" width="32" height="32" srcset="/wiki/images/thumb/3/3f/Draft_Mirror.png/48px-Draft_Mirror.png 1.5x, /wiki/images/3/3f/Draft_Mirror.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Mirror/sv&amp;action=edit&amp;redlink=1" class="new" title="Draft Mirror/sv (page does not exist)">Mirror</a>: Mirrors the selected objects</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Stretch.png" class="image"><img alt="Draft Stretch.png" src="32px-Draft_Stretch.png" width="32" height="32" srcset="/wiki/images/thumb/7/7b/Draft_Stretch.png/48px-Draft_Stretch.png 1.5x, /wiki/images/7/7b/Draft_Stretch.png 2x" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Stretch/sv&amp;action=edit&amp;redlink=1" class="new" title="Draft Stretch/sv (page does not exist)">Stretch</a>: Stretches the selected objects <span style="font-size:8px;"><a href="https://www.freecadweb.org/wiki/index.php?title=Sl%C3%A4pp_anteckningar_0.17/sv&amp;action=edit&amp;redlink=1" class="new" title="Släpp anteckningar 0.17/sv (page does not exist)">Finns i version 0.17</a></span></li></ul>
<h3><span class="mw-headline" id="Utility_tools">Utility tools</span></h3>
<p>Additional tools available via right-click context menu, depending on the selected objects.
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_SelectPlane.png" class="image"><img alt="Draft SelectPlane.png" src="32px-Draft_SelectPlane.png" width="32" height="32" srcset="/wiki/images/thumb/a/aa/Draft_SelectPlane.png/48px-Draft_SelectPlane.png 1.5x, /wiki/images/a/aa/Draft_SelectPlane.png 2x" /></a> <a href="Draft_SelectPlane.html" title="Draft SelectPlane">Set working plane</a>: Sets a working plane from a standard view or a selected face</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_FinishLine.png" class="image"><img alt="Draft FinishLine.png" src="32px-Draft_FinishLine.png" width="32" height="32" srcset="/wiki/images/thumb/c/c1/Draft_FinishLine.png/48px-Draft_FinishLine.png 1.5x, /wiki/images/c/c1/Draft_FinishLine.png 2x" /></a> <a href="Draft_FinishLine.html" title="Draft FinishLine">Finish line</a>: Ends the drawing of the current wire or bspline, without closing it</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_CloseLine.png" class="image"><img alt="Draft CloseLine.png" src="32px-Draft_CloseLine.png" width="32" height="32" srcset="/wiki/images/thumb/d/dc/Draft_CloseLine.png/48px-Draft_CloseLine.png 1.5x, /wiki/images/d/dc/Draft_CloseLine.png 2x" /></a> <a href="Draft_CloseLine.html" title="Draft CloseLine">Close line</a>: Ends the drawing of the current wire or bspline, and closes it</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_UndoLine.png" class="image"><img alt="Draft UndoLine.png" src="32px-Draft_UndoLine.png" width="32" height="32" srcset="/wiki/images/thumb/d/dd/Draft_UndoLine.png/48px-Draft_UndoLine.png 1.5x, /wiki/images/d/dd/Draft_UndoLine.png 2x" /></a> <a href="Draft_UndoLine.html" title="Draft UndoLine">Undo line</a>: Undoes the last segment of a line</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleConstructionMode.png" class="image"><img alt="Draft ToggleConstructionMode.png" src="32px-Draft_ToggleConstructionMode.png" width="32" height="32" srcset="/wiki/images/thumb/7/76/Draft_ToggleConstructionMode.png/48px-Draft_ToggleConstructionMode.png 1.5x, /wiki/images/7/76/Draft_ToggleConstructionMode.png 2x" /></a> <a href="Draft_ToggleConstructionMode.html" title="Draft ToggleConstructionMode">Toggle construction mode</a>: Toggles the Draft construction mode on/off</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleContinueMode.png" class="image"><img alt="Draft ToggleContinueMode.png" src="Draft_ToggleContinueMode.png" width="32" height="32" /></a> <a href="Draft_ToggleContinueMode.html" title="Draft ToggleContinueMode">Toggle continue mode</a>: Toggles the Draft continue mode on/off</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ApplyStyle.png" class="image"><img alt="Draft ApplyStyle.png" src="32px-Draft_ApplyStyle.png" width="32" height="32" srcset="/wiki/images/thumb/1/16/Draft_ApplyStyle.png/48px-Draft_ApplyStyle.png 1.5x, /wiki/images/1/16/Draft_ApplyStyle.png 2x" /></a> <a href="Draft_Apply.html" title="Draft Apply">Apply style</a>: Applies the current style and color to selected objects</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleDisplayMode.png" class="image"><img alt="Draft ToggleDisplayMode.png" src="32px-Draft_ToggleDisplayMode.png" width="32" height="32" srcset="/wiki/images/thumb/0/00/Draft_ToggleDisplayMode.png/48px-Draft_ToggleDisplayMode.png 1.5x, /wiki/images/0/00/Draft_ToggleDisplayMode.png 2x" /></a> <a href="Draft_ToggleDisplayMode.html" title="Draft ToggleDisplayMode">Toggle display mode</a>: Switches the display mode of selected objects between "flat lines" and "wireframe"</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_AddToGroup.png" class="image"><img alt="Draft AddToGroup.png" src="32px-Draft_AddToGroup.png" width="32" height="32" srcset="/wiki/images/thumb/5/56/Draft_AddToGroup.png/48px-Draft_AddToGroup.png 1.5x, /wiki/images/5/56/Draft_AddToGroup.png 2x" /></a> <a href="Draft_AddToGroup.html" title="Draft AddToGroup">Add to group</a>: Quickly adds selected objects to an existing group</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_SelectGroup.png" class="image"><img alt="Draft SelectGroup.png" src="32px-Draft_SelectGroup.png" width="32" height="32" srcset="/wiki/images/thumb/d/d9/Draft_SelectGroup.png/48px-Draft_SelectGroup.png 1.5x, /wiki/images/d/d9/Draft_SelectGroup.png 2x" /></a> <a href="Draft_SelectGroup.html" title="Draft SelectGroup">Select group contents</a>: Selects the contents of a selected group</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleSnap.png" class="image"><img alt="Draft ToggleSnap.png" src="32px-Draft_ToggleSnap.png" width="32" height="32" srcset="/wiki/images/thumb/2/25/Draft_ToggleSnap.png/48px-Draft_ToggleSnap.png 1.5x, /wiki/images/2/25/Draft_ToggleSnap.png 2x" /></a> <a href="Draft_ToggleSnap.html" title="Draft ToggleSnap">Toggle snap</a>: Toggles <a href="Draft_Snap.html" title="Draft Snap">object snapping</a> on/off</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleGrid.png" class="image"><img alt="Draft ToggleGrid.png" src="32px-Draft_ToggleGrid.png" width="32" height="32" srcset="/wiki/images/thumb/f/fc/Draft_ToggleGrid.png/48px-Draft_ToggleGrid.png 1.5x, /wiki/images/f/fc/Draft_ToggleGrid.png 2x" /></a> <a href="Draft_ToggleGrid.html" title="Draft ToggleGrid">Toggle grid</a>: Toggles the grid on/off</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ShowSnapBar.png" class="image"><img alt="Draft ShowSnapBar.png" src="32px-Draft_ShowSnapBar.png" width="32" height="32" srcset="/wiki/images/thumb/c/c3/Draft_ShowSnapBar.png/48px-Draft_ShowSnapBar.png 1.5x, /wiki/images/c/c3/Draft_ShowSnapBar.png 2x" /></a> <a href="Draft_ShowSnapBar.html" title="Draft ShowSnapBar">Show snap bar</a>: Shows/hides the <a href="Draft_Snap.html" title="Draft Snap">snapping</a> toolbar</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Heal.png" class="image"><img alt="Draft Heal.png" src="32px-Draft_Heal.png" width="32" height="32" srcset="/wiki/images/thumb/d/d9/Draft_Heal.png/48px-Draft_Heal.png 1.5x, /wiki/images/d/d9/Draft_Heal.png 2x" /></a> <a href="Draft_Heal.html" title="Draft Heal">Heal</a>: Heals problematic Draft objects found in very old files</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_FlipDimension.png" class="image"><img alt="Draft FlipDimension.png" src="32px-Draft_FlipDimension.png" width="32" height="32" srcset="/wiki/images/thumb/f/fe/Draft_FlipDimension.png/48px-Draft_FlipDimension.png 1.5x, /wiki/images/f/fe/Draft_FlipDimension.png 2x" /></a> <a href="Draft_FlipDimension.html" title="Draft FlipDimension">Flip Dimension</a>: Flips the orientation of the text of a <a href="Draft_Dimension.html" title="Draft Dimension">dimension</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_VisGroup.png" class="image"><img alt="Draft VisGroup.png" src="32px-Draft_VisGroup.png" width="32" height="32" srcset="/wiki/images/thumb/8/81/Draft_VisGroup.png/48px-Draft_VisGroup.png 1.5x, /wiki/images/8/81/Draft_VisGroup.png 2x" /></a> <a href="Draft_VisGroup.html" title="Draft VisGroup">VisGroup</a>: Creates a VisGroup in the current document</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_Slope.png" class="image"><img alt="Draft Slope.png" src="32px-Draft_Slope.png" width="32" height="32" srcset="/wiki/images/thumb/5/5c/Draft_Slope.png/48px-Draft_Slope.png 1.5x, /wiki/images/5/5c/Draft_Slope.png 2x" /></a> <a href="Draft_Slope.html" title="Draft Slope">Slope</a>: Changes the slope of selected Lines or Wires <span style="font-size:x-small;"><a href="Release_notes_0.17.html" title="Release notes 0.17">available in version 0.17</a></span></li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_AutoGroup.png" class="image"><img alt="Draft AutoGroup.png" src="32px-Draft_AutoGroup.png" width="32" height="32" srcset="/wiki/images/thumb/8/8c/Draft_AutoGroup.png/48px-Draft_AutoGroup.png 1.5x, /wiki/images/8/8c/Draft_AutoGroup.png 2x" /></a> <a href="Draft_AutoGroup.html" title="Draft AutoGroup">AutoGroup</a>: Automatically place new objects in a given group <span style="font-size:x-small;"><a href="Release_notes_0.17.html" title="Release notes 0.17">available in version 0.17</a></span></li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_SetWorkingPlaneProxy.png" class="image"><img alt="Draft SetWorkingPlaneProxy.png" src="32px-Draft_SetWorkingPlaneProxy.png" width="32" height="32" srcset="/wiki/images/thumb/0/03/Draft_SetWorkingPlaneProxy.png/48px-Draft_SetWorkingPlaneProxy.png 1.5x, /wiki/images/0/03/Draft_SetWorkingPlaneProxy.png 2x" /></a> <a href="Draft_SetWorkingPlaneProxy.html" title="Draft SetWorkingPlaneProxy">Set Working Plane Proxy</a>: Add a proxy object in the document to store a <a href="Draft_SelectPlane.html" title="Draft SelectPlane">Working Plane</a> position <span style="font-size:x-small;"><a href="Release_notes_0.17.html" title="Release notes 0.17">available in version 0.17</a></span></li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Draft_ToggleConstructionMode.png" class="image"><img alt="Draft ToggleConstructionMode.png" src="32px-Draft_ToggleConstructionMode.png" width="32" height="32" srcset="/wiki/images/thumb/7/76/Draft_ToggleConstructionMode.png/48px-Draft_ToggleConstructionMode.png 1.5x, /wiki/images/7/76/Draft_ToggleConstructionMode.png 2x" /></a> <a href="Draft_AddConstruction.html" title="Draft AddConstruction">Add to Construction group</a>: Add selected objects to the Construction group <span style="font-size:x-small;"><a href="Release_notes_0.17.html" title="Release notes 0.17">available in version 0.17</a></span></li></ul>
<h3><span class="mw-headline" id="Preferences">Preferences</span></h3>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Std_DlgParameter.png" class="image"><img alt="Std DlgParameter.png" src="32px-Std_DlgParameter.png" width="32" height="32" srcset="/wiki/images/thumb/6/6d/Std_DlgParameter.png/48px-Std_DlgParameter.png 1.5x, /wiki/images/6/6d/Std_DlgParameter.png 2x" /></a> <a href="Draft_Preferences.html" title="Draft Preferences">Preferences...</a>: Preferences disposable in Draft Tools.</li></ul>
<h3><span class="mw-headline" id="Import_.26_export">Import &amp; export</span></h3>
<p>Detta är funktioner för att öppna, importera eller exportera andra filformat. Öppna kommet att öppna ett nytt dokument med filens innehåll, medan importera kommer att lägga till filinnehållet till det nuvarande dokumentet. Exportera kommer att spara de valda objekten till en fil. Om inget är valt, så kommer alla objekt att exporteras. Var uppmärksam på att eftersom tanken med Ritmodulen är att arbeta med 2d objekt, så fokuserar dessa importerare endast på 2d objekt, och, fastän DXF och OCA formaten stödjer objektdefinitioner i 3D rymden (objekt är inte nödvändigtvis platta), så kommer de inte att importera volymetriska objekt som nät, 3D ytor, etc, utan snarare linjer, cirklar, text eller flata former. För närvarande så stöds följande filformat:
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Preferences-import-export.svg" class="image"><img alt="Preferences-import-export.svg" src="Preferences-import-export.svg" width="32" height="32" /></a> <a href="Import_Export_Preference.html" title="Import Export Preference">Preference ...</a> Import Export</li></ul>
<div class="mw-translate-fuzzy">
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_DXF/sv" title="Draft DXF/sv">Autodesk .DXF</a>: Importerar och exporterar DXF filer som har skapats med andra CAD applikationer</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_SVG/sv" title="Draft SVG/sv">SVG (som geometri)</a>: Importerar och exporterar SVG filer som har skapats med vektorbaserade ritapplikationer</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_OCA/sv" title="Draft OCA/sv">Open Cad format .OCA</a>: Importerar och exporterar OCA/GCAD files, ett potentiellt nytt <a rel="nofollow" class="external text" href="http://groups.google.com/group/open_cad_format">öppet CAD filformat</a></li></ul>
<ul><li> <a href="Draft_DAT.html" title="Draft DAT">Airfoil Data Format .DAT</a> Importerar DAT filer som beskriver <a rel="nofollow" class="external text" href="http://www.ae.illinois.edu/m-selig/ads/coord_database.html">Vingprofiler</a></li></ul>
</div>
<h3><span class="mw-headline" id="Gemensamt_beteende">Gemensamt beteende</span></h3>
<div class="mw-translate-fuzzy">
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Snap/sv" title="Draft Snap/sv">Snäpp</a>: tillåter dig att placera nya punkter på speciella platser på existerande objekt</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Constrain/sv" title="Draft Constrain/sv">Begränsning</a>: Tillåter att nya punkter placeras horisontellt eller vertikalt i relation till tidigare punkter</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Coordinates/sv" title="Draft Coordinates/sv">Arbeta med manuella koordinater</a>: tillåter att du matar in koordinaterna manuellt istället för att klicka på skärmen</li></ul>
<ul><li> Kopiering: Alla ändringsverktyg kan antingen ändra de valda objekten eller skapa en förändrad kopiaav dem. Genom att trycka på <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">ALT</span> tangenten medan verktyget används kommer att skapa en kopia</li></ul>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_ToggleConstructionMode/sv" title="Draft ToggleConstructionMode/sv">Konstruktionsläge</a>: Tillåter dig att skilja viss geometri åt från resten, för att lätt kunna stänga på/av</li></ul>
<ul><li><a href="https://www.freecadweb.org/wiki/index.php?title=Draft_SelectPlane/sv" title="Draft SelectPlane/sv">Arbetsplan</a>: Alla skisskommandon kan användas på valfritt plani i 3D rymden. Det gällande arbetsplanet kan konfigureras på ett lätt sätt</li></ul>
<ul><li> Alla nyligen skapade objekt kommer att anta gällande Rit <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_Linestyle/sv" title="Draft Linestyle/sv">färg och bredd</a></li></ul>
</div>
<h3><span class="mw-headline" id="API">API</span></h3>
<div class="mw-translate-fuzzy">
<p>Se <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_API/sv" title="Draft API/sv">Skiss API</a> sidan för en komplett beskrivning av Skissfunktionerna som du kan använda i skript och makron
</p>
</div>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id="Tutorials_3">Tutorials</span></h3>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_tutorial/sv" title="Draft tutorial/sv">Draft tutorial</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=Draft_tutorial_Outdated/sv" title="Draft tutorial Outdated/sv">Draft tutorial Outdated</a></li></ul>
</div>
<div class="mw-translate-fuzzy">
</div>
<p><br />
</p>
<h1><span class="mw-headline" id="Skript_och_Makron">Skript och Makron</span></h1>
<h2><span class="mw-headline" id="Macros">Macros</span></h2>
<p>Makron är ett smidigt sätt att skapa komplexa aktioner i FreeCAD. Du behöver bara spela in aktioner samtidigt som du gör dem, och sedan spara det under ett namn, och senare spela upp det när du vill. Eftersom makron i realiteten är en lista av python kommandon, så kan du även redigera det, och skapa mycket komplexa skript.
</p>
<h3><span class="mw-headline" id="Hur_det_fungerar">Hur det fungerar</span></h3>
<p>Om du aktiverar konsolutmatning(Meny Redigera -&gt; Alternativ -&gt; Allmänt -&gt; Makro -&gt; Visa skriptkommandon i python konsolen), så kommer du se att varje aktion du gör i FreeCAD, , som att klicka på en knapp, genererar ett python kommando. Dessa kommandon är vad som kan spelas in i ett makro. Huvudverktyget för att göra makron är makroverktygslådan: <a href="https://www.freecadweb.org/wiki/index.php?title=File:Macros_toolbar.jpg" class="image"><img alt="Macros toolbar.jpg" src="Macros_toolbar.jpg" width="144" height="43" /></a>. På den finns det 4 knappar: Spela in, stoppa inspelning, redigera och spela upp det nuvarande makrot.
</p><p>Det är mycket enkelt att använda: Klicka på inspelningsknappen, du kommer att efterfrågas om ett namn till ditt makro, utför sedan några aktioner. När du är klar, Klick på stoppa inspelning knappen, och dina aktioner kommer att spaaras. Du kan nu komma åt makrodialogen med redigeraknappen:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macros.jpg" class="image"><img alt="Macros.jpg" src="Macros.jpg" width="381" height="408" /></a>
</p><p>Där kan du hantera dina makron, radera, redigera eller skapa nya från scratch. Om du redigerar ett makro, så kommer det att öppnas i ett redigeringsfönster där du kan förändra dess kod.
</p>
<h3><span class="mw-headline" id="Exempel_3">Exempel</span></h3>
<p>Klicka på inspelningsknappen, ge den ett namn, låt oss säga "cylinder 10x10", skapa skapa sedan med <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del arbetsbänken</a> en cylinder med radien= 10 och höjden = 10. Klicka sedan på "stoppa inspelning" knappen. I redigera makro dialogen, så kan du se den python kod som har spelats in, och om du vill, göra ändringar på den. För att köra ditt makro, klicka på uppspelningsknappen i verktygslåden medan ditt makro är i redigeraren. Ditt makro sparas alltid till disk, så alla ändringar du gör, eller alla nya makron du skapar, kommer alltid att finnas tillgängliga nästa gång som du startar FreeCAD.
</p>
<h3><span class="mw-headline" id="Anpassning">Anpassning</span></h3>
<p>Det är förstås inte så praktiskt att behöva ladda ett makro i redigeraren för att kunna använda det. FreeCAD erbjuder många bättre sätt att använda ditt makro, som att tilldela en tangentbordsgenväg till den eller lägga till en punkt i menyn. När ditt makro är sparat, så kan allt detta göras via Verktyg -&gt; Anpassa menyn:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macros_config.jpg" class="image"><img alt="Macros config.jpg" src="Macros_config.jpg" width="400" height="276" /></a>
</p><p><a href="Customize_Toolbars.html" title="Customize Toolbars">Customize Toolbars</a> This way you can make your macro become a real tool, just like any standard FreeCAD tool. This, added to the power of python scripting within FreeCAD, makes it possible to easily add your own tools to the interface. Read on to the <a href="Scripting.html" class="mw-redirect" title="Scripting">Scripting</a> page if you want to know more about python scripting...
</p>
<h3><span class="mw-headline" id="Creating_macros_without_recording">Creating macros without recording</span></h3>
<p><a href="How_to_install_macros.html" title="How to install macros">How to install macros</a> You can also directly copy/paste python code into a macro, without recording GUI action. Simply create a new macro, edit it, and paste your code. You can then save your macro the same way as you save a FreeCAD document. Next time you start FreeCAD, the macro will appear under the "Installed Macros" item of the Macro menu.
</p>
<h3><span class="mw-headline" id="Makrof.C3.B6rr.C3.A5d">Makroförråd</span></h3>
<p>Besök <a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/sv" title="Macros recipes/sv">Makrorecept</a> sidan för att hämta några användbara makron att lägga till din FreeCAD installation.
</p>
<h3><span class="mw-headline" id="Links_3">Links</span></h3>
<p><a href="Installing_more_workbenches.html" title="Installing more workbenches">Installing more workbenches</a>
</p>
<h3><span class="mw-headline" id="Tutorials_4">Tutorials</span></h3>
<p><a href="How_to_install_additional_workbenches.html" title="How to install additional workbenches">How to install additional workbenches</a>
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h2><span class="mw-headline" id="Introduktion_till_Python">Introduktion till Python</span></h2>
<p>This is a short tutorial for those new to Python. <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Python_%28programming_language%29">Python</a> is an open-source, multiplatform <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Programming_language">programming language</a>. Python has several features that make it very different than other common programming languages, and very accessible to new users like yourself:
</p>
<ul><li>It has been designed specially to be easy to read by human beings, and so it is very easy to learn and understand.</li>
<li>It is interpreted, that is, unlike compiled languages like C, your program doesn't need to be compiled before it is executed. The code you write can be immediately executed, line by line if you wish. Because you can go slowly, step-by-step, it is extremely easy to learn and to find errors in your code.</li>
<li>It can be embedded in other programs to be used as scripting language. FreeCAD has an embedded Python interpreter; you can write Python code in FreeCAD, that will manipulate parts of FreeCAD, for example to create geometry. This is extremely powerful, instead of just clicking a button labeled "create sphere", that some programmer has coded; you have the freedom to easily build your own tool, creating exactly the geometry you want, in a manner or shape that the programmer may not foresee.</li>
<li>It is extensible, you can easily plug new modules in your Python installation and extend its functionality. For example, you have modules that allow Python to read and write jpg images, to communicate with twitter, to schedule tasks to be performed by your operating system, etc.</li></ul>
<p>We strongly encourage you to enter the code snippets below into a Python interpreter. For many of our discussions, the important point is the line after the snippet is run, the reveal. Not running the code would be all build up, without a punch line. So, hands on! The following is a very simple introduction, and by no means a complete tutorial. But our hope is that this will provide enough basics to explore deeper into the FreeCAD mechanisms.
</p>
<h2><span class="mw-headline" id="The_interpreter">The interpreter</span></h2>
<p>Usually, when writing computer programs, you simply open a text editor or your special programming environment, (which is usually a text editor with several additional tools) write your program, then compile and execute. Usually, one or more errors were made during entry, so your program won't work. You may even get an error message telling you what went wrong. Then you go back to your text editor, correct the mistakes, run again, repeating until your program works as intended.
</p><p>That whole process, in Python, can be done transparently inside the Python interpreter. The interpreter is a Python window with a command prompt, where you can simply type Python code. If you install Python on your computer (download it from the <a rel="nofollow" class="external text" href="http://www.python.org">Python website</a> if you are on Windows or Mac, install it from your package repository if you are on GNU/Linux), you will have a Python interpreter in your start menu. But FreeCAD also has a Python interpreter in its lower window:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Screenshot_pythoninterpreter.jpg" class="image"><img alt="Screenshot pythoninterpreter.jpg" src="Screenshot_pythoninterpreter.jpg" width="614" height="228" /></a>
</p><p>(If you don't have it, click on View --&gt; Panels --&gt; Python console.)
</p><p>The interpreter shows the Python version, then a &gt;&gt;&gt; symbol, which is the command prompt, that is, where you enter Python code. Writing code in the interpreter is simple: one line is one instruction. When you press Enter, your line of code will be executed (after being instantly and invisibly compiled). For example, try writing this:
</p>
<pre>print "hello" </pre>
<p><code>print</code> is a special Python keyword that means, obviously, to print something on the screen. When you press Enter, the operation is executed, and the message "hello" is printed. If you make an error, for example let's write:
</p>
<pre>print hello </pre>
<p>Python will tell us that it doesn't know what hello is. The " characters specify that the content is a string, which is simply, in programming jargon, a piece of text. Without the ", the print command believed hello was not a piece of text but a special Python keyword. The important thing is, you immediately get notified that you made an error. By pressing the up arrow (or, in the FreeCAD interpreter, CTRL+up arrow), you can go back to the last command you wrote and correct it.
</p><p>The Python interpreter also has a built-in help system. Try typing:
</p>
<pre>help </pre>
<p>or, for example, let's say we don't understand what went wrong with our print hello command above, we want specific information about the "print" command:
</p>
<pre>help("print") </pre>
<p>You'll get a long and complete description of everything the print command can do.
</p><p>Now that we totally dominate our interpreter, we can begin with the serious stuff.
</p>
<h2><span class="mw-headline" id="Variables">Variables</span></h2>
<p>Of course, printing "hello" is not very interesting. More interesting is printing stuff you didn't know before, or let Python find for you. That's where the concept of the variable comes in. A variable is simply a value that you store under a name. For example, type this:
</p>
<pre>a = "hello"
print a </pre>
<p>I guess you understood what happened, we "saved" the string "hello" under the name "a." Now, "a" is not an unknown name any more! We can use it anywhere, for example in the print command. We can use any name we want, just follow some simple rules, like not using spaces or punctuation. For example, we could write:
</p>
<pre>hello = "my own version of hello"
print hello </pre>
<p>See? now hello is not an undefined word any more. What if, by terrible bad luck, we choose a name that already exists in Python? Let's say we want to store our string under the name "print":
</p>
<pre>print = "hello" </pre>
<p>Python is very intelligent and will tell us that this is not possible. It has some "reserved" keywords that cannot be modified. But our variables can be modified any time, that's why they are called variables, the contents can vary. For example:
</p>
<pre>myVariable = "hello"
print myVariable
myVariable = "good bye"
print myVariable </pre>
<p>We changed the value of myVariable. We can also copy variables:
</p>
<pre>var1 = "hello"
var2 = var1
print var2 </pre>
<p>Note that it is important to give meaningful names to your variables. After a while you won't remember what your variable named "a" represents. But if you named it, for example myWelcomeMessage, you'll easily remember its purpose. Plus your code is a step closer to being self-documenting.
</p><p>Case is very important. myVariable is not the same as myvariable, the difference in the upper/lower case <b>v</b>. If you were to enter <i>print myvariable</i> it would come back with an error as not defined.
</p>
<h2><span class="mw-headline" id="Numbers">Numbers</span></h2>
<p>Of course you must know that programming is useful to treat all kinds of data, and especially numbers, not only text strings. One thing is important, Python must know what kind of data it is dealing with. We saw in our print hello example, that the print command recognized our "hello" string. That is because by using the ", we told specifically the print command what follows next is a text string.
</p><p>We can always check the data type of a variable with the special Python keyword type:
</p>
<pre>myVar = "hello"
type(myVar) </pre>
<p>It will tell us the contents of myVar is 'str', short for string in Python jargon. We have also other basic types of data, such as integer and float numbers:
</p>
<pre>firstNumber = 10
secondNumber = 20
print firstNumber + secondNumber
type(firstNumber) </pre>
<p>This is much more interesting, isn't it? Now we have a powerful calculator! Look at how well it worked, Python knows that 10 and 20 are integer numbers. So they are stored as "int", and Python can do with them everything it can do with integers. Look at the results of this:
</p>
<pre>firstNumber = "10"
secondNumber = "20"
print firstNumber + secondNumber </pre>
<p>See? We forced Python to consider that our two variables are not numbers but mere pieces of text. Python can add two pieces of text together, but it won't try to find out any sum. But we were talking about integer numbers. There are also float numbers. The difference is that integer numbers don't have decimal part, while float numbers can have a decimal part:
</p>
<pre>var1 = 13
var2 = 15.65
print "var1 is of type ", type(var1)
print "var2 is of type ", type(var2) </pre>
<p>Int and Floats can be mixed together without problem:
</p>
<pre>total = var1 + var2
print total
print type(total) </pre>
<p>Of course the total has decimals, right? Then Python automatically decided that the result is a float. In several cases such as this one, Python automatically decides what type to use. In other cases it doesn't. For example:
</p>
<pre>varA = "hello 123"
varB = 456
print varA + varB </pre>
<p>This will give us an error, varA is a string and varB is an int, and Python doesn't know what to do. However, we can force Python to convert between types:
</p>
<pre>varA = "hello"
varB = 123
print varA + str(varB) </pre>
<p>Now both are strings, the operation works! Note that we "stringified" varB at the time of printing, but we didn't change varB itself. If we wanted to turn varB permanently into a string, we would need to do this:
</p>
<pre>varB = str(varB) </pre>
<p>We can also use int() and float() to convert to int and float if we want:
</p>
<pre>varA = "123"
print int(varA)
print float(varA) </pre>
<p><b>Note on Python commands</b>
</p><p>You must have noticed that in this section we used the print command in several ways. We printed variables, sums, several things separated by commas, and even the result of other Python command such as type(). Maybe you also saw that doing those two commands,
</p>
<pre>type(varA)
print type(varA) </pre>
<p>have exactly the same result. That is because we are in the interpreter, and everything is automatically printed. When we write more complex programs that run outside the interpreter, they won't print automatically, so we'll need to use the print command. From now on, let's stop using it here, it'll go faster. So we can simply write:
</p>
<pre>myVar = "hello friends"
myVar </pre>
<p>You must have seen that most of the Python commands (or keywords) type(), int(), str(), etc. have parenthesis to limit the command contents. The only exception is the print command, which in fact is not really an exception, as it also works normally: print("hello"). However, since it is used often, the Python designers allowed a simpler version.
</p>
<h2><span class="mw-headline" id="Lists">Lists</span></h2>
<p>Another interesting data type is a list. A list is simply a collection of other data. The same way that we define a text string by using " ", we define a list by using [ ]:
</p>
<pre>myList = [1,2,3]
type(myList)
myOtherList = ["Bart", "Frank", "Bob"]
myMixedList = ["hello", 345, 34.567] </pre>
<p>You see that it can contain any type of data. Lists are very useful because you can group variables together. You can then do all kinds of things within that group, for example counting them:
</p>
<pre>len(myOtherList) </pre>
<p>or retrieving one item of a list:
</p>
<pre>myName = myOtherList[0]
myFriendsName = myOtherList[1] </pre>
<p>You see that while the len() command returns the total number of items in a list, their "position" in the list begins with 0. The first item in a list is always at position 0, so in our myOtherList, "Bob" will be at position 2. We can do much more with lists, you can read <a rel="nofollow" class="external text" href="http://www.diveintopython.net/native_data_types/lists.html">here</a>, such as sorting contents, removing or adding elements.
</p><p>A funny and interesting thing: a text string is very similar to a list of characters! Try doing this:
</p>
<pre>myvar = "hello"
len(myvar)
myvar[2] </pre>
<p>Usually, what you can do with lists can also be done with strings. In fact both lists and strings are sequences.
</p><p>Outside strings, ints, floats and lists, there are more built-in data types, such as <a rel="nofollow" class="external text" href="http://www.diveintopython.net/native_data_types/index.html#d0e5174">dictionaries</a>, or you can even create your own data types with <a rel="nofollow" class="external text" href="http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm">classes</a>.
</p>
<h2><span class="mw-headline" id="Indentation">Indentation</span></h2>
<p>One big cool use of lists is also browsing through them and do something with each item. For example look at this:
</p>
<pre>alldaltons = ["Joe", "William", "Jack", "Averell"]
for dalton in alldaltons:
print dalton + " Dalton" </pre>
<p>We iterated (programming jargon) through our list with the "for ... in ..." command and did something with each of the items. Note the special syntax: the <b>for</b> command terminates with <b>:</b> indicating the following will be a block of one of more commands. In the interpreter, immediately after you enter the command line ending with&#160;:, the command prompt will change to ... which means Python knows that a colon (:) ended line has happened and more is coming.
</p><p>How will Python know how many of the next lines will be to be executed inside the for...in operation? For that, Python uses indentation. That is, your next lines won't begin immediately. You will begin them with a blank space, or several blank spaces, or a tab, or several tabs. Other programming languages use other methods, like putting everything inside parenthesis, etc.
As long as you write your next lines with the <b>same</b> indentation, they will be considered part of the for-in block. If you begin one line with 2 spaces and the next one with 4, there will be an error.
When you finished, just write another line without indentation, or simply press Enter to come back from the for-in block
</p><p>Indentation is cool because it aids in program readability. If you use large indentations (for example use tabs instead of spaces because it's larger), when you write a big program you'll have a clear view of what is executed inside what. We'll see that commands other than for-in, can have indented blocks of code too.
</p><p>For-in commands can be used for many things that must be done more than once. It can, for example, be combined with the range() command:
</p>
<pre>serie = range(1,11)
total = 0
print "sum"
for number in serie:
print number
total = total + number
print "----"
print total </pre>
<p>(If you have been running the code examples in an interpreter by Copying and Pasting, you will find the previous block of text will throw an error. Instead, copy to the end of the indented block, i.e. the end of the line <i>total = total + number</i> and then paste to the interpreter. In the interpreter issue an &lt;enter&gt; until the three dot prompt disappears and the code runs. Then copy the final two lines into the interpreter followed by one or more &lt;enter&gt; The final answer should appear.)
</p><p>If you would type into the interpreter <b>help(range)</b> you would see:
</p>
<pre>range(...)
range(stop) -&gt; list of integers
range(start, stop[, step]) -&gt; list of integers </pre>
<p>Here the square brackets denote an optional parameter. However all are expected to be integers. Below we will force the range parameters to be an integer using int()
</p>
<pre>decimales = 1000 # for 3 decimales
#decimales = 10000 # for 4 decimales ...
for i in range(int(0 * decimales),int(180 * decimales),int(0.5 * decimales)):
print float(i) / decimales </pre>
<p>Or more complex things like this:
</p>
<pre>alldaltons = ["Joe", "William", "Jack", "Averell"]
for n in range(4):
print alldaltons[n], " is Dalton number ", n </pre>
<p>You see that the range() command also has that strange particularity that it begins with 0 (if you don't specify the starting number) and that its last number will be one less than the ending number you specify. That is, of course, so it works well with other Python commands. For example:
</p>
<pre>alldaltons = ["Joe", "William", "Jack", "Averell"]
total = len(alldaltons)
for n in range(total):
print alldaltons[n] </pre>
<p>Another interesting use of indented blocks is with the if command. If executes a code block only if a certain condition is met, for example:
</p>
<pre>alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Joe" in alldaltons:
print "We found that Dalton!!!" </pre>
<p>Of course this will always print the first sentence, but try replacing the second line by:
</p>
<pre>if "Lucky" in alldaltons: </pre>
<p>Then nothing is printed. We can also specify an else: statement:
</p>
<pre>alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Lucky" in alldaltons:
print "We found that Dalton!!!"
else:
print "Such Dalton doesn't exist!" </pre>
<h2><span class="mw-headline" id="Functions">Functions</span></h2>
<p>There are few <a rel="nofollow" class="external text" href="http://docs.python.org/reference/lexical_analysis.html#identifiers">standard Python commands</a>. In the current version of Python, there are about 30, and we already know several of them. But imagine if we could invent our own commands? Well, we can, and it's extremely easy. In fact, most the additional modules that you can plug into your Python installation do just that, they add commands that you can use. A custom command in Python is called a function and is made like this:
</p>
<pre>def printsqm(myValue):
print str(myValue)+" square meters"
printsqm(45) </pre>
<p>(Another copy and paste error, only copy through the end of the indented section i.e. <b>" square meters"</b> Paste to the interpreter, and issue &lt;enter&gt; until the three dot prompt goes a way, then copy and paste the final line.)
</p><p>Extremely simple: the def() command defines a new function. You give it a name, and inside the parenthesis you define arguments that we'll use in our function. Arguments are data that will be passed to the function. For example, look at the len() command. If you just write len() alone, Python will tell you it needs an argument. That is, you want len() of something, right? Then, for example, you'll write len(myList) and you'll get the length of myList. Well, myList is an argument that you pass to the len() function. The len() function is defined in such a way that it knows what to do with what is passed to it. Same as we did here.
</p><p>The "myValue" name can be anything, and it will be used only inside the function. It is just a name you give to the argument so you can do something with it, but it also serves to tell the function how many arguments to expect. For example, if you do this:
</p>
<pre>printsqm(45,34) </pre>
<p>There will be an error. Our function was programmed to receive just one argument, but it received two, 45 and 34. We could instead do something like this:
</p>
<pre>def sum(val1,val2):
total = val1 + val2
return total
sum(45,34)
myTotal = sum(45,34) </pre>
<p>We made a function that receives two arguments, sums them, and returns that value. Returning something is very useful, because we can do something with the result, such as store it in the myTotal variable. Of course, since we are in the interpreter and everything is printed, doing:
</p>
<pre>sum(45,34) </pre>
<p>will print the result on the screen, but outside the interpreter, since there is no print command inside the function, nothing would appear on the screen. You would need to:
</p>
<pre>print sum(45,34) </pre>
<p>to have something printed. Read more about functions <a rel="nofollow" class="external text" href="http://www.diveintopython.net/getting_to_know_python/declaring_functions.html">here</a>.
</p>
<h2><span class="mw-headline" id="Modules">Modules</span></h2>
<p>Now that we have a good idea of how Python works, we'll need one last thing: How to work with files and modules.
</p><p>Until now, we wrote Python instructions line by line in the interpreter, right? What if we could write several lines together, and have them executed all at once? It would certainly be handier for doing more complex things. And we could save our work too. Well, that too, is extremely easy. Simply open a text editor (such as the windows notepad, Linux gedit, emacs, or vi), and write all your Python lines, the same way as you write them in the interpreter, with indentations, etc. Then, save that file somewhere, preferably with a .py extension. That's it, you have a complete Python program. Of course, there are much better editors than notepad, but it is just to show you that a Python program is nothing else than a text file.
</p><p>To make Python execute that program, there are hundreds of ways. In windows, simply right-click your file, open it with Python, and execute it. But you can also execute it from the Python interpreter itself. For this, the interpreter must know where your .py program is. In FreeCAD, the easiest way is to place your program in a place that FreeCAD's Python interpreter knows by default, such as FreeCAD's bin folder, or any of the Mod folders. (In Linux, you probably have a directory /home/&lt;username&gt;/.FreeCAD/Mod, let's add a subdirectory to that called scripts where we will put the text file.) Suppose we write a file like this:
</p>
<pre>def sum(a,b):
return a + b
print "myTest.py succesfully loaded" </pre>
<p>and we save it as myTest.py in our FreeCAD/bin directory (or on Linux to /home/&lt;username&gt;/.FreeCAD/Mod/scripts.) Now, let's start FreeCAD, and in the interpreter window, write:
</p>
<pre>import myTest </pre>
<p>without the .py extension. This will simply execute the contents of the file, line by line, just as if we had written it in the interpreter. The sum function will be created, and the message will be printed. There is one big difference: the import command is made not only to execute programs written in files, like ours, but also to load the functions inside, so they become available in the interpreter. Files containing functions, like ours, are called modules.
</p><p>Normally when we write a sum() function in the interpreter, we execute it simply like that:
</p>
<pre>sum(14,45) </pre>
<p>Like we did earlier. When we import a module containing our sum() function, the syntax is a bit different. We do:
</p>
<pre>myTest.sum(14,45) </pre>
<p>That is, the module is imported as a "container", and all its functions are inside. This is extremely useful, because we can import a lot of modules, and keep everything well organized. So, basically, everywhere you see <b>something.somethingElse</b>, with a dot in between, that means <b>somethingElse</b> is inside <b>something</b>.
</p><p>We can also import our sum() function directly into the main interpreter space, like this:
</p>
<pre>from myTest import *
sum(12,54) </pre>
<p>Basically all modules behave like that. You import a module, then you can use its functions: module.function(argument). Almost all modules do that: they define functions, new data types and classes that you can use in the interpreter or in your own Python modules, because nothing prevents you from importing other modules inside your module!
</p><p>One last extremely useful thing. How do we know what modules we have, what functions are inside and how to use them (that is, what kind of arguments they need)? We saw already that Python has a help() function. Doing:
</p>
<pre>help()
modules </pre>
<p>Will give us a list of all available modules. We can now type q to get out of the interactive help, and import any of them. We can even browse their content with the dir() command
</p>
<pre>import math
dir(math) </pre>
<p>We'll see all the functions contained in the math module, as well as strange stuff named __doc__, __file__, __name__. The __doc__ is extremely useful, it is a documentation text. Every function of (well-made) modules has a __doc__ that explains how to use it. For example, we see that there is a sin function in side the math module. Want to know how to use it?
</p>
<pre>print math.sin.__doc__ </pre>
<p>(It may not be evident, but on either side of doc are two underscore characters.)
</p><p>And finally one last little goodie: When we work on a new or existing module, it's best to replace the file extension with py such as: myModule.FCMacro =&gt; myModule.py. We often want to test it so we will load it as above.
</p>
<pre>import myModule
myModule.myTestFunction() </pre>
<p>But what if we see that myTestFunction() doesn't work correctly? We go back to our editor and make changes. Then, instead of closing and reopening the python interpreter, we can simply update the module like this:
</p>
<pre>reload(myModule) </pre>
<p>This file renaming is because Python doesn't know about the extension FCMacro.
</p><p>However, there are two alternates: Inside the one macro use Python's exec or execfile functions.
</p>
<pre>f = open("myModule","r")
d = f.read()
exec d </pre>
<p>or
</p>
<pre>execfile "myModule" </pre>
<p>To share code across macros, you can access the FreeCAD or FreeCADGui module (or any other Python module) and set any attribute to it. This should survive the execution of the macro.
</p>
<pre>import FreeCAD
if hasattr(FreeCAD,"macro2_executed"):
...
else:
FreeCAD.macro2_executed = True # you can assign any value because we only check for the existence of the attribute
... execute macro2 </pre>
<h2><span class="mw-headline" id="Starting_with_FreeCAD">Starting with FreeCAD</span></h2>
<p>Well, I think you now have a good idea of how Python works, and you can start exploring what FreeCAD has to offer. FreeCAD's Python functions are all well organized in different modules. Some of them are already loaded (imported) when you start FreeCAD. So, just do
</p>
<pre>dir() </pre>
<p>and read on to <a href="FreeCAD_Scripting_Basics.html" title="FreeCAD Scripting Basics">FreeCAD Scripting Basics</a>...
</p><p>Of course, we saw here only a very small part of the Python world. There are many important concepts that we didn't mention. There are three very important Python reference documents on the net:
</p>
<ul><li> the <a rel="nofollow" class="external text" href="http://docs.python.org/3/tutorial/index.html">official Python tutorial with way more information than this one</a></li>
<li> the <a rel="nofollow" class="external text" href="http://docs.python.org/reference/">official Python reference</a></li>
<li> the <a rel="nofollow" class="external text" href="http://www.diveintopython.net">Dive into Python</a> wikibook/ book.</li></ul>
<p>Be sure to bookmark them!
</p><p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="Python_skript_i_FreeCAD">Python skript i FreeCAD</span></h2>
<p>FreeCAD är byggt från grunden att helt och hållet kunna kontrolleras av python skript. Nästan alla delar av FreeCAD som gränssnittet, sceninnehållet, och även representationen av detta innehåll i 3d vyerna kan kommas åt från den inbyggda pythontolken eller från dina egna skript. Resultatet av detta är att FreeCAD troligen är en av de mest anpassningsbara konstruktionsapplikationerna som finns idag.
</p><p>I dess nuvarande läge, så har FreeCAD emellertid mycket få "nativa" kommandon för att interagera på dina 3D objekt, huvudsakligen därför att den fortfarande är i ett tidigt utvecklingsstadium, men också för att filosofin bakom den är mer att erbjuda en plattform för CAD utveckling än en skräddarsydd användarapplikation. Men lättheten med python skript inuti FreeCAD kommer troligen att hjälpa mycket för att snabbt se ny funktionalitet utvecklas av "expertanvändare", eller, typiskt, användare som kan lite pythonprogrammering, som, hoppas vi, du själv.
</p><p>Om du inte kan något om python, så rekommenderar vi att du letar efter övningar på internet, och tar en snabbtitt på dess struktur. Python är ett mycket lättlärt språk, speciellt eftersom det kan köras inuti en tolk, där allt från enkla kommandon till kompletta program kan köras direkt, utan något bahov för kompilering. FreeCAD har en inbyggd tolk.
Om du inte ser fönstret "Rapportvy", som visas nedan, så kan du få fram den genom att klicka på Vy -&gt; Vyer -&gt; Rapportvy.
</p>
<h3><span class="mw-headline" id="Tolken">Tolken</span></h3>
<p>Från tolken så har du åtkomst till alla dina systeminstallerade pythonmoduler, såväl som FreeCAD's inbyggda moduler, och alla extra FreeCAD moduler som du installerat senare. Skärmdumpen nedan visar python tolken:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Screenshot_pythoninterpreter.jpg" class="image" title="FreeCAD python tolken"><img alt="FreeCAD python tolken" src="Screenshot_pythoninterpreter.jpg" width="614" height="228" /></a>
</p><p>Från tolken kan du köra pythonkod, lista igenom tillgängliga klasser och funktioner. FreeCAD erbjuder en väldigt smidig klasslistare för utforskning av din nya FreeCAD värld: När du skriver namnet på en känd klass följt av en punkt (vilket innebär att du vill addera något från den klassen), så öppnas en klasslistare, där du kan navigera mellan tillgängliga underklasser och metoder. När du väljer något, så visas en associerad hjälptext (om den finns):
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Screenshot_classbrowser.jpg" class="image" title="FreeCAD klasslistare"><img alt="FreeCAD klasslistare" src="Screenshot_classbrowser.jpg" width="614" height="228" /></a>
</p><p>Så, starta här genom att skriva <b>App.</b> eller <b>Gui.</b> och se vad som händer. Ett annat mer allmänt python-sätt att utforska modul- och klassinnehåll är att använda print dir() kommandot. Till exempel, genom att skriva <b>print dir()</b> så kommer alla moduler som för närvarande är laddade i FreeCAD att listas. <b>print dir(App)</b> kommer att visa dig allt inuti App modulen, etc.
</p><p>En annan användbar egenskap hos tolken är möjligheten att backa i kommandohistorian och hämta en kod-rad som du skrivit tidigare. För att navigera i kommandohistorian, använd CTRL+UPP-PIL eller CTRL+NED-PIL.
</p><p>Genom att högerklicka i tolkfönstret, så har du flera andra alternativ, som att kopiera hela historian (användbart för att göra en experimentskript, och sedan kunna spara det), eller att sätta in ett filnamn med full sökväg.
</p>
<h3><span class="mw-headline" id="Python_Hj.C3.A4lp">Python Hjälp</span></h3>
<p>I FreeCAD Hjälpmenyn, så hittar du en menypunkt som heter "Python hjälp", vilken kommer att öppna ett webbfönster som innehåller en komplett, realtidsgenererad dokumentation över alla python moduler som finns tillgänglig för FreeCAD tolken, inklusive python inbyggda FreeCAD moduler, system-installerade moduler, och extra FreeCAD moduler. Den dokumentation som fills tillgänglig där beror på hur mycket arbete varje modulutvecklare lägger på att dokumentera sin kod, men vanligtvis her pythonmoduler ett rykte om sig att vara ganska väldokumenterade. Ditt FreeCAD fönster måste vara öppet för att detta dokumentationssystem ska fungera.
</p>
<h2><span class="mw-headline" id="Inbyggda_moduler">Inbyggda moduler</span></h2>
<p>Eftersom FreeCAD är designat för att kunna köras utan ett grafiskt användargränssnitt, så är nästan all dess funktionalitet uppdelat i två grupper: Kärnfunktioner, benämnda App, och gränssnittsfunktioner, benämnda Gui. Så våra två inbyggda FreeCAD huvudmoduler kallas för App och Gui. Dessa två moduler kan även kommas åt av skript utanför tolken, genom de respektive namnen FreeCAD och FreeCADGui.
</p>
<ul><li> I <b>App modulen</b>, så hittar du allt som är relaterat till själva applikationen, som metoder för att öppna eller stänga filer, och till dokumenten, som att ställa in det aktiva dokumentet eller lista dess innehåll.</li></ul>
<ul><li> I <b>Gui modulen</b>, så hittar du verktyg för åtkomst och hantering av gränssnittselement, som arbetsbänkarna och dears verktygslådor, och mer intressant, den grafiska representationen av allt FreeCAD innehåll. </li></ul>
<p>Att lista allt innehåll av dessa moduler är en lite improduktiv uppgift, eftersom de växer ganska snabbt tillsammans med FreeCAD's utveckling. Men de två erbjudna listverktygen (klasslistaren och python hjälpen) ska alltid ge dig en komplett och uppdaterad dokumentation av dessa moduler.
</p>
<h3><span class="mw-headline" id="App_och_Gui_objekten">App och Gui objekten</span></h3>
<p>Som vi sade, så är allt i FreeCAD uppdelat mellan kärna och representation. Detta inkluderar även 3D objekten. Du kan komma åt objektens definierande egenskaper (kallade features i FreeCAD) via App modulen, och ändra det sätt som de representeras på skärmen via Gui modulen. Till exempel, en kub har egenskaper som definierar den, som bredd, längd, höjd som sparas i ett App objekt, och representationsegenskaper, som ytfärg, ritläge, som lagras i ett motsvarande Gui objekt.
</p><p>Detta sätt att göra det på tillåter ett mycket brett användningsområde, som att låta algoritmer endast arbeta på den definierande delen av objekten, utan att behöva bry sig om någon visuell del, eller även att skicka dokumentets innehåll till icke-grafiska applikationer, som listor, räkneark eller elementanalyser.
</p><p>För varje App objekt i ditt dokument, så existerar det ett motsvarande Gui objekt. Själva dokumentet har faktiskt också ett App och ett Gui objekt. Detta är förstås endast giltigt när du kör FreeCAD med dess fulla gränssnitt. I kommando-linje versionen, så existerar inget gränssnitt, så endast App objekt är tillgängliga. Notera att Gui delen av objekt genereras igen varje gång som ett App objekt är markerat som "att omberäknas" (till exempel när en av dess parametrar har ändrats), så ändringar som du har gjort direkt på Gui objektet kan förloras.
</p><p>För att komma åt App delen av något, så skriver du:
</p>
<pre>myObject = App.ActiveDocument.getObject("ObjectName") </pre>
<p>där "ObjektNamn är namnet på ditt objekt. Du kan också skriva:
</p>
<pre>myObject = App.ActiveDocument.ObjectName </pre>
<p>För att komma åt Gui delen av samma objekt, skriv:
</p>
<pre>myViewObject = Gui.ActiveDocument.getObject("ObjectName") </pre>
<p>där "ObjektNamn är namnet på ditt objekt. Du kan också skriva:
</p>
<pre>myViewObject = App.ActiveDocument.ObjectName.ViewObject </pre>
<p>Om vi inte har något gränssnitt (vi är till exempel i kommandoradsläge), så kommer den sista raden att returnera None.
</p>
<h3><span class="mw-headline" id="Dokument_objekten">Dokument objekten</span></h3>
<p>I FreeCAD så finns allt ditt arbete i Dokument. Ett dokument innehåller din geometri och kan sparas till en fil. Flera dokument kan öppnas samtidigt. Dokumentet, som geometrin som finns i den, har App och Gui objekt. App objekt innehåller dina geometridefinitioner, medan Gui objekt innehåller ditt dokuments olika vyer Du kan öppna flera fönster, där varje fönster visar ditt arbete med en annan zoomfaktor eller synvinkel. Dessa vyer är en del av Gui objektet i ditt dokument.
</p><p>För att komma åt App delen i det aktiva dokumentet, skriv:
</p>
<pre>myDocument = App.ActiveDocument </pre>
<p>För att skapa ett nytt dokument, skriv:
</p>
<pre>myDocument = App.newDocument("Document Name") </pre>
<p>För att komma åt Gui delen i det aktiva dokumentet, skriv:
</p>
<pre>myGuiDocument = Gui.ActiveDocument </pre>
<p>För att komma åt nuvarande vy, skriv:
</p>
<pre>myView = Gui.ActiveDocument.ActiveView </pre>
<h2><span class="mw-headline" id="Using_additional_modules">Using additional modules</span></h2>
<p>The FreeCAD and FreeCADGui modules are solely responsibles for creating and managing objects in the FreeCAD document. They don't actually do anything such as creating or modifying geometry. That is because that geometry can be of several types, and so it is managed by additional modules, each responsible for managing a certain geometry type. For example, the <a href="Part_Module.html" title="Part Module">Part Module</a> uses the OpenCascade kernel, and therefore is able to create and manipulate <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Boundary_representation">B-rep</a> type geometry, which is what OpenCascade is built for. The <a href="Mesh_Module.html" class="mw-redirect" title="Mesh Module">Mesh Module</a> is able to build and modify mesh objects. That way, FreeCAD is able to handle a wide variety of object types, that can all coexist in the same document, and new types could be added easily in the future.
</p>
<h3><span class="mw-headline" id="Creating_objects">Creating objects</span></h3>
<p>Each module has its own way to treat its geometry, but one thing they usually all can do is create objects in the document. But the FreeCAD document is also aware of the available object types provided by the modules:
</p>
<pre>FreeCAD.ActiveDocument.supportedTypes() </pre>
<p>will list you all the possible objects you can create. For example, let's create a mesh (treated by the mesh module) and a part (treated by the part module):
</p>
<pre>myMesh = FreeCAD.ActiveDocument.addObject("Mesh::Feature","myMeshName")
myPart = FreeCAD.ActiveDocument.addObject("Part::Feature","myPartName") </pre>
<p>The first argument is the object type, the second the name of the object. Our two objects look almost the same: They don't contain any geometry yet, and most of their properties are the same when you inspect them with dir(myMesh) and dir(myPart). Except for one, myMesh has a "Mesh" property and "Part" has a "Shape" property. That is where the Mesh and Part data are stored. For example, let's create a Part cube and store it in our myPart object:
</p>
<pre>import Part
cube = Part.makeBox(2,2,2)
myPart.Shape = cube </pre>
<p>You could try storing the cube inside the Mesh property of the myMesh object, it will return an error complaining of the wrong type. That is because those properties are made to store only a certain type. In the myMesh's Mesh property, you can only save stuff created with the Mesh module. Note that most modules also have a shortcut to add their geometry to the document:
</p>
<pre>import Part
cube = Part.makeBox(2,2,2)
Part.show(cube) </pre>
<h3><span class="mw-headline" id="Modifying_objects">Modifying objects</span></h3>
<p>Modifying an object is done the same way:
</p>
<pre>import Part
cube = Part.makeBox(2,2,2)
myPart.Shape = cube </pre>
<p>Now let's change the shape by a bigger one:
</p>
<pre>biggercube = Part.makeBox(5,5,5)
myPart.Shape = biggercube </pre>
<h3><span class="mw-headline" id="Querying_objects">Querying objects</span></h3>
<p>You can always look at the type of an object like this:
</p>
<pre>myObj = FreeCAD.ActiveDocument.getObject("myObjectName")
print myObj.TypeId </pre>
<p>or know if an object is derived from one of the basic ones (Part Feature, Mesh Feature, etc):
</p>
<pre>print myObj.isDerivedFrom("Part::Feature") </pre>
<p>Now you can really start playing with FreeCAD! To look at what you can do with the <a href="Part_Module.html" title="Part Module">Part Module</a>, read the <a href="Topological_data_scripting.html" title="Topological data scripting">Part scripting</a> page, or the <a href="Scripting.html" title="Mesh Scripting">Mesh Scripting</a> page for working with the <a href="Mesh_Module.html" class="mw-redirect" title="Mesh Module">Mesh Module</a>. Note that, although the Part and Mesh modules are the most complete and widely used, other modules such as the <a href="Draft_Module.html" title="Draft Module">Draft Module</a> also have <a href="Draft_API.html" title="Draft API">scripting</a> APIs that can be useful to you. For a complete list of each modules and their available tools, visit the <a href="https://www.freecadweb.org/wiki/index.php?title=Category:API" title="Category:API">Category:API</a> section.
</p>
<div style="clear:both"></div>
<p><br />
</p>
<h3><span class="mw-headline" id="Introduktion_2">Introduktion</span></h3>
<p>Först av allt så måste du importera Nätmodulen:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Mesh</pre></div>
<p>Efter det så har du åtkomst till Nätmodulen och Nätklassen Mesh class som ger åtkomst till funktionerna i FreeCAD's C++ Mesh-Kernel.
</p>
<h3><span class="mw-headline" id="Skapande_och_laddning">Skapande och laddning</span></h3>
<p>För att skapa ett tomt nätobjekt använd standardkonstruktören:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>mesh = Mesh.Mesh()</pre></div>
<p>Du kan också skapa ett objekt från en fil
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>mesh = Mesh.Mesh('D:/temp/Something.stl')</pre></div>
<p>Vilka filformat du kan använda för att bygga upp ett nät är <a href="/wiki/Feature_list/sv#IO" title="Feature list/sv">här</a>.
</p><p>Eller skapa det från ett set av trianglar, beskrivna av dess hörnpunkter:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>planarMesh = [
# triangle 1
[-0.5000,-0.5000,0.0000],[0.5000,0.5000,0.0000],[-0.5000,0.5000,0.0000],
#triangle 2
[-0.5000,-0.5000,0.0000],[0.5000,-0.5000,0.0000],[0.5000,0.5000,0.0000],
]
planarMeshObject = Mesh.Mesh(planarMesh)
Mesh.show(planarMeshObject)</pre></div>
<p>Mesh-Kernel tar hand om skapandet av en topologiskt korrekt datastruktur genom att sortera sammanfallande punkter och kanter tillsammans.
</p><p>Senare kommer du att se hur du kan testa och undersöka nät data.
</p>
<h3><span class="mw-headline" id="Modellering">Modellering</span></h3>
<p>För att skapa reguljärageometrier så kan du används Python skriptet BuildRegularGeoms.py.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import BuildRegularGeoms</pre></div>
<p>Detta skript ger metoder att definiera enkla rotationskroppar som sfärer, ellipsoider, cylindrar, toroider och koner. Och det har även en metod för att skapa en enkel kub.
</p><p>För att till exempel skapa en toroid, så kan du göra enligt följande:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>t = BuildRegularGeoms.Toroid(8.0, 2.0, 50) # list with several thousands triangles
m = Mesh.Mesh(t)</pre></div>
<p>De första två parametrarna definierar toroidens radier och den tredje parametern är en sub-sampling faktor för hur många trianglar som skapas. Ju högre värde på denna faktorn, desto jämnare blir kroppen.
</p><p>Nät klassen har ett set med booleska funktioner som kan användas för modelleringsändamål. Den erbjuder förening, skärning och skillnad mellan två nätobjekt.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>m1, m2 # are the input mesh objects
m3 = Mesh.Mesh(m1) # create a copy of m1
m3.unite(m2) # union of m1 and m2, the result is stored in m3
m4 = Mesh.Mesh(m1)
m4.intersect(m2) # intersection of m1 and m2
m5 = Mesh.Mesh(m1)
m5.difference(m2) # the difference of m1 and m2
m6 = Mesh.Mesh(m2)
m6.difference(m1) # the difference of m2 and m1, usually the result is different to m5</pre></div>
<p>Slutligen, ett komplett exempel som beräknar skärningen mellan en sfär och en cylinder som skär sfären.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Mesh, BuildRegularGeoms
sphere = Mesh.Mesh( BuildRegularGeoms.Sphere(5.0, 50) )
cylinder = Mesh.Mesh( BuildRegularGeoms.Cylinder(2.0, 10.0, True, 1.0, 50) )
diff = sphere
diff = diff.difference(cylinder)
d = FreeCAD.newDocument()
d.addObject("Mesh::Feature","Diff_Sphere_Cylinder").Mesh=diff
d.recompute()</pre></div>
<h3><span class="mw-headline" id="Unders.C3.B6kning_och_testning">Undersökning och testning</span></h3>
<h3><span class="mw-headline" id="Skriv_dina_egna_algoritmer">Skriv dina egna algoritmer</span></h3>
<h3><span class="mw-headline" id="Exportera">Exportera</span></h3>
<p>Du kan även skriva nätet till en python modul:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>m.write("D:/Develop/Projekte/FreeCAD/FreeCAD_0.7/Mod/Mesh/SavedMesh.py")
import SavedMesh
m2 = Mesh.Mesh(SavedMesh.faces)</pre></div>
<h3><span class="mw-headline" id="Gr.C3.A4nssnittsrelaterade_saker">Gränssnittsrelaterade saker</span></h3>
<h3><span class="mw-headline" id="Special">Special</span></h3>
<p>En extensiv, fast svåranvänd, källa för Nätrelaterade skript är Nätmodulens enhetstestskript.
I detta enhetstest så kallas samtliga metoder och samtliga egenskaper/attribut ändras.
Så om du är tillräckligt modig, ta en titt på <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Mesh/App/MeshTestsApp.py?view=markup">Unit Test module</a>.
</p><p>See also <a href="Mesh_API.html" title="Mesh API">Mesh API</a>
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<table class="fcinfobox wikitable ct" >
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="Tutorial"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Base_ExampleCommandModel.png" class="image"><img alt="Base ExampleCommandModel.png" src="32px-Base_ExampleCommandModel.png" width="32" height="30" srcset="/wiki/images/thumb/9/93/Base_ExampleCommandModel.png/48px-Base_ExampleCommandModel.png 1.5x, /wiki/images/9/93/Base_ExampleCommandModel.png 2x" /></a> Tutorial</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Topic
</th></tr>
<tr>
<td class="ctEven">Programming
</td></tr>
<tr>
<th class="ctOdd">Level
</th></tr>
<tr>
<td class="ctEven">Intermediate
</td></tr>
<tr>
<th class="ctOdd">Time to complete
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">Author
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">FreeCAD version
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">Example File(s)
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#V.C3.A4lkommen_till_FreeCAD_on-line_hj.C3.A4lp"><span class="tocnumber">1</span> <span class="toctext">Välkommen till FreeCAD on-line hjälp</span></a>
<ul>
<li class="toclevel-2"><a href="#Hur_man_anv.C3.A4nder_detta_dokument"><span class="tocnumber">1.1</span> <span class="toctext">Hur man använder detta dokument</span></a></li>
<li class="toclevel-2"><a href="#Bidra"><span class="tocnumber">1.2</span> <span class="toctext">Bidra</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-1"><a href="#Introduktion"><span class="tocnumber">2</span> <span class="toctext">Introduktion</span></a>
<ul>
<li class="toclevel-2"><a href="#About_the_FreeCAD_project"><span class="tocnumber">2.1</span> <span class="toctext">About the FreeCAD project</span></a></li>
<li class="toclevel-2"><a href="#Release_notes"><span class="tocnumber">2.2</span> <span class="toctext">Release notes</span></a></li>
<li class="toclevel-2"><a href="#Allm.C3.A4na_funktioner"><span class="tocnumber">2.3</span> <span class="toctext">Allmäna funktioner</span></a></li>
<li class="toclevel-2"><a href="#Allm.C3.A4nna_funktioner"><span class="tocnumber">2.4</span> <span class="toctext">Allmänna funktioner</span></a></li>
<li class="toclevel-2"><a href="#I_utveckling"><span class="tocnumber">2.5</span> <span class="toctext">I utveckling</span></a></li>
<li class="toclevel-2"><a href="Workbenches.html"><span class="tocnumber">2.6</span> <span class="toctext">Extra Workbenches</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-2"><a href="#Installation"><span class="tocnumber">3</span> <span class="toctext">Installation</span></a>
<ul>
<li class="toclevel-2 tocsection-3"><a href="#Installera_p.C3.A5_Windows"><span class="tocnumber">3.1</span> <span class="toctext">Installera på Windows</span></a>
<ul>
<li class="toclevel-3"><a href="#Enkel_Installation"><span class="tocnumber">3.1.1</span> <span class="toctext">Enkel Installation</span></a></li>
<li class="toclevel-3"><a href="#Simple_Microsoft_Installer_Installation"><span class="tocnumber">3.1.2</span> <span class="toctext">Simple Microsoft Installer Installation</span></a></li>
<li class="toclevel-3"><a href="#Kommandolinje_Installation"><span class="tocnumber">3.1.3</span> <span class="toctext">Kommandolinje Installation</span></a>
<ul>
<li class="toclevel-4"><a href="#O-interaktiv_Installation"><span class="tocnumber">3.1.3.1</span> <span class="toctext">O-interaktiv Installation</span></a></li>
<li class="toclevel-4"><a href="#Begr.C3.A4nsat_anv.C3.A4ndargr.C3.A4nssnitt"><span class="tocnumber">3.1.3.2</span> <span class="toctext">Begränsat användargränssnitt</span></a></li>
<li class="toclevel-4"><a href="#M.C3.A5lkatalog"><span class="tocnumber">3.1.3.3</span> <span class="toctext">Målkatalog</span></a></li>
<li class="toclevel-4"><a href="#Installation_f.C3.B6r_Alla_anv.C3.A4ndare"><span class="tocnumber">3.1.3.4</span> <span class="toctext">Installation för Alla användare</span></a></li>
<li class="toclevel-4"><a href="#Val_av_funktioner"><span class="tocnumber">3.1.3.5</span> <span class="toctext">Val av funktioner</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Avinstallering"><span class="tocnumber">3.1.4</span> <span class="toctext">Avinstallering</span></a></li>
<li class="toclevel-3"><a href="#Administrativ_installation"><span class="tocnumber">3.1.5</span> <span class="toctext">Administrativ installation</span></a></li>
<li class="toclevel-3"><a href="#Annonsering"><span class="tocnumber">3.1.6</span> <span class="toctext">Annonsering</span></a></li>
<li class="toclevel-3"><a href="#Automatisk_Installation_p.C3.A5_en_maskingrupp"><span class="tocnumber">3.1.7</span> <span class="toctext">Automatisk Installation på en maskingrupp</span></a></li>
<li class="toclevel-3"><a href="#Installation_p.C3.A5_Linux_om_du_anv.C3.A4nder_Crossover_Office"><span class="tocnumber">3.1.8</span> <span class="toctext">Installation på Linux om du använder Crossover Office</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-4"><a href="#Installera_p.C3.A5_Unix.2FLinux"><span class="tocnumber">3.2</span> <span class="toctext">Installera på Unix/Linux</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_p.C3.A5_Debian.2FUbuntu_system"><span class="tocnumber">3.2.1</span> <span class="toctext">Installation på Debian/Ubuntu system</span></a></li>
<li class="toclevel-3"><a href="#Official_Ubuntu_repository"><span class="tocnumber">3.2.2</span> <span class="toctext">Official Ubuntu repository</span></a></li>
<li class="toclevel-3"><a href="#Stable_PPA_with_GUI"><span class="tocnumber">3.2.3</span> <span class="toctext">Stable PPA with GUI</span></a></li>
<li class="toclevel-3"><a href="#Stable_PPA_with_console"><span class="tocnumber">3.2.4</span> <span class="toctext">Stable PPA with console</span></a></li>
<li class="toclevel-3"><a href="#Daily_PPA_with_console"><span class="tocnumber">3.2.5</span> <span class="toctext">Daily PPA with console</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Debian_and_other_debian-based_systems"><span class="tocnumber">3.3</span> <span class="toctext">Debian and other debian-based systems</span></a></li>
<li class="toclevel-2"><a href="#OpenSUSE"><span class="tocnumber">3.4</span> <span class="toctext">OpenSUSE</span></a></li>
<li class="toclevel-2"><a href="#Gentoo"><span class="tocnumber">3.5</span> <span class="toctext">Gentoo</span></a></li>
<li class="toclevel-2"><a href="#Other"><span class="tocnumber">3.6</span> <span class="toctext">Other</span></a>
<ul>
<li class="toclevel-3"><a href="#Manual_install_on_.deb_based_systems"><span class="tocnumber">3.6.1</span> <span class="toctext">Manual install on .deb based systems</span></a></li>
<li class="toclevel-3"><a href="#Installera_p.C3.A5_andra_Linux.2FUnix_system"><span class="tocnumber">3.6.2</span> <span class="toctext">Installera på andra Linux/Unix system</span></a></li>
<li class="toclevel-3"><a href="#Installing_Windows_Version_on_Linux"><span class="tocnumber">3.6.3</span> <span class="toctext">Installing Windows Version on Linux</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-5"><a href="#Installera_p.C3.A5_Mac"><span class="tocnumber">3.7</span> <span class="toctext">Installera på Mac</span></a>
<ul>
<li class="toclevel-3"><a href="#Enkel_Installation_2"><span class="tocnumber">3.7.1</span> <span class="toctext">Enkel Installation</span></a></li>
<li class="toclevel-3"><a href="#Avinstallation"><span class="tocnumber">3.7.2</span> <span class="toctext">Avinstallation</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-6"><a href="#Uppt.C3.A4cka_FreeCAD"><span class="tocnumber">4</span> <span class="toctext">Upptäcka FreeCAD</span></a>
<ul>
<li class="toclevel-2"><a href="#What.27s_new"><span class="tocnumber">4.1</span> <span class="toctext">What's new</span></a></li>
<li class="toclevel-2"><a href="#F.C3.B6rord"><span class="tocnumber">4.2</span> <span class="toctext">Förord</span></a></li>
<li class="toclevel-2"><a href="#Installation_2"><span class="tocnumber">4.3</span> <span class="toctext">Installation</span></a></li>
<li class="toclevel-2"><a href="#Utforska_FreeCAD"><span class="tocnumber">4.4</span> <span class="toctext">Utforska FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#Navigera_i_3D_rymden"><span class="tocnumber">4.4.1</span> <span class="toctext">Navigera i 3D rymden</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Skript"><span class="tocnumber">4.5</span> <span class="toctext">Skript</span></a></li>
<li class="toclevel-2"><a href="#First_steps_with_FreeCAD"><span class="tocnumber">4.6</span> <span class="toctext">First steps with FreeCAD</span></a></li>
<li class="toclevel-2"><a href="#Working_with_the_PartDesign_and_Sketcher_workbenches"><span class="tocnumber">4.7</span> <span class="toctext">Working with the PartDesign and Sketcher workbenches</span></a></li>
<li class="toclevel-2"><a href="#Working_with_the_Draft_and_Arch_workbenches"><span class="tocnumber">4.8</span> <span class="toctext">Working with the Draft and Arch workbenches</span></a></li>
<li class="toclevel-2"><a href="Scripting.html"><span class="tocnumber">4.9</span> <span class="toctext">Scripting</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-7"><a href="#Arbeta_med_FreeCAD"><span class="tocnumber">5</span> <span class="toctext">Arbeta med FreeCAD</span></a>
<ul>
<li class="toclevel-2 tocsection-8"><a href="#3D_navigering"><span class="tocnumber">5.1</span> <span class="toctext">3D navigering</span></a></li>
<li class="toclevel-2"><a href="#V.C3.A4lja_objekt"><span class="tocnumber">5.2</span> <span class="toctext">Välja objekt</span></a></li>
<li class="toclevel-2"><a href="#Hantera_Objekt"><span class="tocnumber">5.3</span> <span class="toctext">Hantera Objekt</span></a></li>
<li class="toclevel-2"><a href="#Manipulera_Objekt"><span class="tocnumber">5.4</span> <span class="toctext">Manipulera Objekt</span></a></li>
<li class="toclevel-2"><a href="#Hantera_Objekt_2"><span class="tocnumber">5.5</span> <span class="toctext">Hantera Objekt</span></a></li>
<li class="toclevel-2"><a href="#Manipulera_Objekt_2"><span class="tocnumber">5.6</span> <span class="toctext">Manipulera Objekt</span></a></li>
<li class="toclevel-2"><a href="#Navigation"><span class="tocnumber">5.7</span> <span class="toctext">Navigation</span></a>
<ul>
<li class="toclevel-3"><a href="#CAD_Navigation_.28default.29"><span class="tocnumber">5.7.1</span> <span class="toctext">CAD Navigation (default)</span></a></li>
<li class="toclevel-3"><a href="#OpenInventor_Navigation"><span class="tocnumber">5.7.2</span> <span class="toctext">OpenInventor Navigation</span></a></li>
<li class="toclevel-3"><a href="#Blender_Navigation"><span class="tocnumber">5.7.3</span> <span class="toctext">Blender Navigation</span></a></li>
<li class="toclevel-3"><a href="#Touchpad_Navigation"><span class="tocnumber">5.7.4</span> <span class="toctext">Touchpad Navigation</span></a></li>
<li class="toclevel-3"><a href="#Gesture_Navigation_.28v0.16.29"><span class="tocnumber">5.7.5</span> <span class="toctext">Gesture Navigation (v0.16)</span></a></li>
<li class="toclevel-3"><a href="#Maya-Gesture_Navigation"><span class="tocnumber">5.7.6</span> <span class="toctext">Maya-Gesture Navigation</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Selecting_objects"><span class="tocnumber">5.8</span> <span class="toctext">Selecting objects</span></a>
<ul>
<li class="toclevel-3"><a href="#Simple_selection"><span class="tocnumber">5.8.1</span> <span class="toctext">Simple selection</span></a></li>
<li class="toclevel-3"><a href="#Preselection"><span class="tocnumber">5.8.2</span> <span class="toctext">Preselection</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Manipulating_Objects"><span class="tocnumber">5.9</span> <span class="toctext">Manipulating Objects</span></a></li>
<li class="toclevel-2"><a href="#Hardware_support"><span class="tocnumber">5.10</span> <span class="toctext">Hardware support</span></a></li>
<li class="toclevel-2"><a href="#Mac_OS_X_Issues"><span class="tocnumber">5.11</span> <span class="toctext">Mac OS X Issues</span></a></li>
<li class="toclevel-2 tocsection-9"><a href="#FreeCAD_Dokumentet"><span class="tocnumber">5.12</span> <span class="toctext">FreeCAD Dokumentet</span></a></li>
<li class="toclevel-2"><a href="#Applikations_och_Anv.C3.A4ndargr.C3.A4nssnitt"><span class="tocnumber">5.13</span> <span class="toctext">Applikations och Användargränssnitt</span></a></li>
<li class="toclevel-2"><a href="#Skript_2"><span class="tocnumber">5.14</span> <span class="toctext">Skript</span></a></li>
<li class="toclevel-2 tocsection-10"><a href="#St.C3.A4lla_in_anv.C3.A4ndarpreferenser"><span class="tocnumber">5.15</span> <span class="toctext">Ställa in användarpreferenser</span></a></li>
<li class="toclevel-2"><a href="#De_allm.C3.A4na_inst.C3.A4llningarna"><span class="tocnumber">5.16</span> <span class="toctext">De allmäna inställningarna</span></a>
<ul>
<li class="toclevel-3"><a href="#Allm.C3.A4n"><span class="tocnumber">5.16.1</span> <span class="toctext">Allmän</span></a></li>
<li class="toclevel-3"><a href="#Dokument"><span class="tocnumber">5.16.2</span> <span class="toctext">Dokument</span></a></li>
<li class="toclevel-3"><a href="#Redakt.C3.B6r"><span class="tocnumber">5.16.3</span> <span class="toctext">Redaktör</span></a></li>
<li class="toclevel-3"><a href="#Utmatningsf.C3.B6nster"><span class="tocnumber">5.16.4</span> <span class="toctext">Utmatningsfönster</span></a></li>
<li class="toclevel-3"><a href="#Makro"><span class="tocnumber">5.16.5</span> <span class="toctext">Makro</span></a></li>
<li class="toclevel-3"><a href="#Enheter"><span class="tocnumber">5.16.6</span> <span class="toctext">Enheter</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Sk.C3.A4rmens_inst.C3.A4llningar"><span class="tocnumber">5.17</span> <span class="toctext">Skärmens inställningar</span></a>
<ul>
<li class="toclevel-3"><a href="#3D-vy"><span class="tocnumber">5.17.1</span> <span class="toctext">3D-vy</span></a></li>
<li class="toclevel-3"><a href="#F.C3.A4rger"><span class="tocnumber">5.17.2</span> <span class="toctext">Färger</span></a></li>
<li class="toclevel-3"><a href="#Delf.C3.A4rger"><span class="tocnumber">5.17.3</span> <span class="toctext">Delfärger</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-11"><a href="#Anpassa_gr.C3.A4nssnittet"><span class="tocnumber">5.18</span> <span class="toctext">Anpassa gränssnittet</span></a></li>
<li class="toclevel-2 tocsection-12"><a href="#Objekt_egenskaper"><span class="tocnumber">5.19</span> <span class="toctext">Objekt egenskaper</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-13"><a href="#Arbeta_med_arbetsb.C3.A4nkar"><span class="tocnumber">6</span> <span class="toctext">Arbeta med arbetsbänkar</span></a>
<ul>
<li class="toclevel-2"><a href="#Built-in_workbenches"><span class="tocnumber">6.1</span> <span class="toctext">Built-in workbenches</span></a>
<ul>
<li class="toclevel-3"><a href="#Arbetsb.C3.A4nkar"><span class="tocnumber">6.1.1</span> <span class="toctext">Arbetsbänkar</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="External_workbenches.html"><span class="tocnumber">6.2</span> <span class="toctext">External workbenches</span></a></li>
<li class="toclevel-2 tocsection-14"><a href="#N.C3.A4t_arbetsb.C3.A4nken"><span class="tocnumber">6.3</span> <span class="toctext">Nät arbetsbänken</span></a>
<ul>
<li class="toclevel-3"><a href="#Anv.C3.A4nda_n.C3.A4tmodulen"><span class="tocnumber">6.3.1</span> <span class="toctext">Använda nätmodulen</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Links"><span class="tocnumber">6.4</span> <span class="toctext">Links</span></a></li>
<li class="toclevel-2 tocsection-15"><a href="#Del_arbetsb.C3.A4nken"><span class="tocnumber">6.5</span> <span class="toctext">Del arbetsbänken</span></a>
<ul>
<li class="toclevel-3"><a href="#Verktygen"><span class="tocnumber">6.5.1</span> <span class="toctext">Verktygen</span></a></li>
<li class="toclevel-3"><a href="#Primitiver"><span class="tocnumber">6.5.2</span> <span class="toctext">Primitiver</span></a></li>
<li class="toclevel-3"><a href="#F.C3.B6r.C3.A4ndra_objekt"><span class="tocnumber">6.5.3</span> <span class="toctext">Förändra objekt</span></a></li>
<li class="toclevel-3"><a href="#Booleska_Operationer"><span class="tocnumber">6.5.4</span> <span class="toctext">Booleska Operationer</span></a></li>
<li class="toclevel-3"><a href="#F.C3.B6rklaring_av_koncepten"><span class="tocnumber">6.5.5</span> <span class="toctext">Förklaring av koncepten</span></a></li>
<li class="toclevel-3"><a href="#Skript_3"><span class="tocnumber">6.5.6</span> <span class="toctext">Skript</span></a></li>
<li class="toclevel-3"><a href="#Exempel"><span class="tocnumber">6.5.7</span> <span class="toctext">Exempel</span></a></li>
<li class="toclevel-3"><a href="Tutorials.html"><span class="tocnumber">6.5.8</span> <span class="toctext">Tutorials</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-16"><a href="#Ritnings_arbetsb.C3.A4nken"><span class="tocnumber">6.6</span> <span class="toctext">Ritnings arbetsbänken</span></a></li>
<li class="toclevel-2"><a href="#Gr.C3.A4nssnittsverktyg"><span class="tocnumber">6.7</span> <span class="toctext">Gränssnittsverktyg</span></a></li>
<li class="toclevel-2"><a href="#Skript_4"><span class="tocnumber">6.8</span> <span class="toctext">Skript</span></a>
<ul>
<li class="toclevel-3"><a href="#Enkelt_exempel"><span class="tocnumber">6.8.1</span> <span class="toctext">Enkelt exempel</span></a></li>
<li class="toclevel-3"><a href="#Det_parametriska_s.C3.A4ttet"><span class="tocnumber">6.8.2</span> <span class="toctext">Det parametriska sättet</span></a></li>
<li class="toclevel-3"><a href="#Komma_.C3.A5t_bitarna"><span class="tocnumber">6.8.3</span> <span class="toctext">Komma åt bitarna</span></a></li>
<li class="toclevel-3"><a href="#General_Dimensioning_and_Tolerancing"><span class="tocnumber">6.8.4</span> <span class="toctext">General Dimensioning and Tolerancing</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Exempel_2"><span class="tocnumber">6.9</span> <span class="toctext">Exempel</span></a></li>
<li class="toclevel-2"><a href="Drawing_Module.html"><span class="tocnumber">6.10</span> <span class="toctext">Extending the Drawing Module</span></a></li>
<li class="toclevel-2"><a href="#Tutorials_2"><span class="tocnumber">6.11</span> <span class="toctext">Tutorials</span></a></li>
<li class="toclevel-2"><a href="#External_links"><span class="tocnumber">6.12</span> <span class="toctext">External links</span></a></li>
<li class="toclevel-2 tocsection-17"><a href="#Raytracing_arbetsb.C3.A4nken"><span class="tocnumber">6.13</span> <span class="toctext">Raytracing arbetsbänken</span></a>
<ul>
<li class="toclevel-3"><a href="#Gr.C3.A4nssnittsverktyg_2"><span class="tocnumber">6.13.1</span> <span class="toctext">Gränssnittsverktyg</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Typical_workflow"><span class="tocnumber">6.14</span> <span class="toctext">Typical workflow</span></a></li>
<li class="toclevel-2"><a href="#Creating_a_povray_file_manually"><span class="tocnumber">6.15</span> <span class="toctext">Creating a povray file manually</span></a>
<ul>
<li class="toclevel-3"><a href="#Skript_5"><span class="tocnumber">6.15.1</span> <span class="toctext">Skript</span></a></li>
<li class="toclevel-3"><a href="#Outputting_render_files"><span class="tocnumber">6.15.2</span> <span class="toctext">Outputting render files</span></a></li>
<li class="toclevel-3"><a href="#Creating_a_custom_render_object"><span class="tocnumber">6.15.3</span> <span class="toctext">Creating a custom render object</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4nkar"><span class="tocnumber">6.15.4</span> <span class="toctext">Länkar</span></a></li>
<li class="toclevel-3"><a href="#POVRay"><span class="tocnumber">6.15.5</span> <span class="toctext">POVRay</span></a></li>
<li class="toclevel-3"><a href="#Luxrender"><span class="tocnumber">6.15.6</span> <span class="toctext">Luxrender</span></a></li>
<li class="toclevel-3"><a href="#Future_possible_renderers_to_implement"><span class="tocnumber">6.15.7</span> <span class="toctext">Future possible renderers to implement</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Templates"><span class="tocnumber">6.16</span> <span class="toctext">Templates</span></a>
<ul>
<li class="toclevel-3"><a href="#Povray_2"><span class="tocnumber">6.16.1</span> <span class="toctext">Povray</span></a></li>
<li class="toclevel-3"><a href="#Luxrender_2"><span class="tocnumber">6.16.2</span> <span class="toctext">Luxrender</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Exporting_to_Kerkythea"><span class="tocnumber">6.17</span> <span class="toctext">Exporting to Kerkythea</span></a></li>
<li class="toclevel-2"><a href="#Links_2"><span class="tocnumber">6.18</span> <span class="toctext">Links</span></a></li>
<li class="toclevel-2 tocsection-18"><a href="#Bild_arbetsb.C3.A4nken"><span class="tocnumber">6.19</span> <span class="toctext">Bild arbetsbänken</span></a></li>
<li class="toclevel-2 tocsection-19"><a href="#Skiss_arbetsb.C3.A4nken"><span class="tocnumber">6.20</span> <span class="toctext">Skiss arbetsbänken</span></a>
<ul>
<li class="toclevel-3"><a href="#Rita_objekt"><span class="tocnumber">6.20.1</span> <span class="toctext">Rita objekt</span></a></li>
<li class="toclevel-3"><a href="#F.C3.B6r.C3.A4ndra_objekt_2"><span class="tocnumber">6.20.2</span> <span class="toctext">Förändra objekt</span></a></li>
<li class="toclevel-3"><a href="#Utility_tools"><span class="tocnumber">6.20.3</span> <span class="toctext">Utility tools</span></a></li>
<li class="toclevel-3"><a href="#Preferences"><span class="tocnumber">6.20.4</span> <span class="toctext">Preferences</span></a></li>
<li class="toclevel-3"><a href="#Import_.26_export"><span class="tocnumber">6.20.5</span> <span class="toctext">Import &amp; export</span></a></li>
<li class="toclevel-3"><a href="#Gemensamt_beteende"><span class="tocnumber">6.20.6</span> <span class="toctext">Gemensamt beteende</span></a></li>
<li class="toclevel-3"><a href="#API"><span class="tocnumber">6.20.7</span> <span class="toctext">API</span></a></li>
<li class="toclevel-3"><a href="#Tutorials_3"><span class="tocnumber">6.20.8</span> <span class="toctext">Tutorials</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-20"><a href="#Skript_och_Makron"><span class="tocnumber">7</span> <span class="toctext">Skript och Makron</span></a>
<ul>
<li class="toclevel-2 tocsection-21"><a href="Macros.html"><span class="tocnumber">7.1</span> <span class="toctext">Macros</span></a>
<ul>
<li class="toclevel-3"><a href="#Hur_det_fungerar"><span class="tocnumber">7.1.1</span> <span class="toctext">Hur det fungerar</span></a></li>
<li class="toclevel-3"><a href="#Exempel_3"><span class="tocnumber">7.1.2</span> <span class="toctext">Exempel</span></a></li>
<li class="toclevel-3"><a href="#Anpassning"><span class="tocnumber">7.1.3</span> <span class="toctext">Anpassning</span></a></li>
<li class="toclevel-3"><a href="#Creating_macros_without_recording"><span class="tocnumber">7.1.4</span> <span class="toctext">Creating macros without recording</span></a></li>
<li class="toclevel-3"><a href="#Makrof.C3.B6rr.C3.A5d"><span class="tocnumber">7.1.5</span> <span class="toctext">Makroförråd</span></a></li>
<li class="toclevel-3"><a href="#Links_3"><span class="tocnumber">7.1.6</span> <span class="toctext">Links</span></a></li>
<li class="toclevel-3"><a href="#Tutorials_4"><span class="tocnumber">7.1.7</span> <span class="toctext">Tutorials</span></a></li>
</ul>
</li>
<li class="toclevel-2 tocsection-22"><a href="#Introduktion_till_Python"><span class="tocnumber">7.2</span> <span class="toctext">Introduktion till Python</span></a></li>
<li class="toclevel-2"><a href="#The_interpreter"><span class="tocnumber">7.3</span> <span class="toctext">The interpreter</span></a></li>
<li class="toclevel-2"><a href="#Variables"><span class="tocnumber">7.4</span> <span class="toctext">Variables</span></a></li>
<li class="toclevel-2"><a href="#Numbers"><span class="tocnumber">7.5</span> <span class="toctext">Numbers</span></a></li>
<li class="toclevel-2"><a href="#Lists"><span class="tocnumber">7.6</span> <span class="toctext">Lists</span></a></li>
<li class="toclevel-2"><a href="#Indentation"><span class="tocnumber">7.7</span> <span class="toctext">Indentation</span></a></li>
<li class="toclevel-2"><a href="#Functions"><span class="tocnumber">7.8</span> <span class="toctext">Functions</span></a></li>
<li class="toclevel-2"><a href="#Modules"><span class="tocnumber">7.9</span> <span class="toctext">Modules</span></a></li>
<li class="toclevel-2"><a href="#Starting_with_FreeCAD"><span class="tocnumber">7.10</span> <span class="toctext">Starting with FreeCAD</span></a></li>
<li class="toclevel-2"><a href="#Python_skript_i_FreeCAD"><span class="tocnumber">7.11</span> <span class="toctext">Python skript i FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#Tolken"><span class="tocnumber">7.11.1</span> <span class="toctext">Tolken</span></a></li>
<li class="toclevel-3"><a href="#Python_Hj.C3.A4lp"><span class="tocnumber">7.11.2</span> <span class="toctext">Python Hjälp</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Inbyggda_moduler"><span class="tocnumber">7.12</span> <span class="toctext">Inbyggda moduler</span></a>
<ul>
<li class="toclevel-3"><a href="#App_och_Gui_objekten"><span class="tocnumber">7.12.1</span> <span class="toctext">App och Gui objekten</span></a></li>
<li class="toclevel-3"><a href="#Dokument_objekten"><span class="tocnumber">7.12.2</span> <span class="toctext">Dokument objekten</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Using_additional_modules"><span class="tocnumber">7.13</span> <span class="toctext">Using additional modules</span></a>
<ul>
<li class="toclevel-3"><a href="#Creating_objects"><span class="tocnumber">7.13.1</span> <span class="toctext">Creating objects</span></a></li>
<li class="toclevel-3"><a href="#Modifying_objects"><span class="tocnumber">7.13.2</span> <span class="toctext">Modifying objects</span></a></li>
<li class="toclevel-3"><a href="#Querying_objects"><span class="tocnumber">7.13.3</span> <span class="toctext">Querying objects</span></a></li>
<li class="toclevel-3"><a href="#Introduktion_2"><span class="tocnumber">7.13.4</span> <span class="toctext">Introduktion</span></a></li>
<li class="toclevel-3"><a href="#Skapande_och_laddning"><span class="tocnumber">7.13.5</span> <span class="toctext">Skapande och laddning</span></a></li>
<li class="toclevel-3"><a href="#Modellering"><span class="tocnumber">7.13.6</span> <span class="toctext">Modellering</span></a></li>
<li class="toclevel-3"><a href="#Unders.C3.B6kning_och_testning"><span class="tocnumber">7.13.7</span> <span class="toctext">Undersökning och testning</span></a></li>
<li class="toclevel-3"><a href="#Skriv_dina_egna_algoritmer"><span class="tocnumber">7.13.8</span> <span class="toctext">Skriv dina egna algoritmer</span></a></li>
<li class="toclevel-3"><a href="#Exportera"><span class="tocnumber">7.13.9</span> <span class="toctext">Exportera</span></a></li>
<li class="toclevel-3"><a href="#Gr.C3.A4nssnittsrelaterade_saker"><span class="tocnumber">7.13.10</span> <span class="toctext">Gränssnittsrelaterade saker</span></a></li>
<li class="toclevel-3"><a href="#Special"><span class="tocnumber">7.13.11</span> <span class="toctext">Special</span></a></li>
<li class="toclevel-3"><a href="#Tutorial"><span class="tocnumber">7.13.12</span> <span class="toctext">Tutorial</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Introduktion_3"><span class="tocnumber">7.14</span> <span class="toctext">Introduktion</span></a>
<ul>
<li class="toclevel-3"><a href="#Klass_Diagram"><span class="tocnumber">7.14.1</span> <span class="toctext">Klass Diagram</span></a></li>
<li class="toclevel-3"><a href="#Geometri"><span class="tocnumber">7.14.2</span> <span class="toctext">Geometri</span></a></li>
<li class="toclevel-3"><a href="#Topologi"><span class="tocnumber">7.14.3</span> <span class="toctext">Topologi</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Exempel_4"><span class="tocnumber">7.15</span> <span class="toctext">Exempel</span></a>
<ul>
<li class="toclevel-3"><a href="#Skapa_simpel_topologi"><span class="tocnumber">7.15.1</span> <span class="toctext">Skapa simpel topologi</span></a>
<ul>
<li class="toclevel-4"><a href="#Skapa_Geometri"><span class="tocnumber">7.15.1.1</span> <span class="toctext">Skapa Geometri</span></a></li>
<li class="toclevel-4"><a href="#Cirkelb.C3.A5ge"><span class="tocnumber">7.15.1.2</span> <span class="toctext">Cirkelbåge</span></a></li>
<li class="toclevel-4"><a href="#Linje"><span class="tocnumber">7.15.1.3</span> <span class="toctext">Linje</span></a></li>
<li class="toclevel-4"><a href="#S.C3.A4tta_ihop_allt"><span class="tocnumber">7.15.1.4</span> <span class="toctext">Sätta ihop allt</span></a></li>
<li class="toclevel-4"><a href="#Skapa_ett_prisma"><span class="tocnumber">7.15.1.5</span> <span class="toctext">Skapa ett prisma</span></a></li>
<li class="toclevel-4"><a href="#Show_it_all"><span class="tocnumber">7.15.1.6</span> <span class="toctext">Show it all</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Skapa_grundtyper"><span class="tocnumber">7.16</span> <span class="toctext">Skapa grundtyper</span></a>
<ul>
<li class="toclevel-3"><a href="#Kort_beskrivning"><span class="tocnumber">7.16.1</span> <span class="toctext">Kort beskrivning</span></a></li>
<li class="toclevel-3"><a href="#Detaljerade_f.C3.B6rklaringar"><span class="tocnumber">7.16.2</span> <span class="toctext">Detaljerade förklaringar</span></a>
<ul>
<li class="toclevel-4"><a href="#Creating_a_Vector"><span class="tocnumber">7.16.2.1</span> <span class="toctext">Creating a Vector</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_kant.3F"><span class="tocnumber">7.16.2.2</span> <span class="toctext">Hur skapar man en kant?</span></a></li>
<li class="toclevel-4"><a href="#Putting_the_shape_on_screen"><span class="tocnumber">7.16.2.3</span> <span class="toctext">Putting the shape on screen</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_tr.C3.A5d.3F"><span class="tocnumber">7.16.2.4</span> <span class="toctext">Hur skapar man en tråd?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_yta.3F"><span class="tocnumber">7.16.2.5</span> <span class="toctext">Hur skapar man en yta?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_cirkel.3F"><span class="tocnumber">7.16.2.6</span> <span class="toctext">Hur skapar man en cirkel?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_cirkelb.C3.A5ge_l.C3.A4ngs_punkter.3F"><span class="tocnumber">7.16.2.7</span> <span class="toctext">Hur skapar man en cirkelbåge längs punkter?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_polygon_eller_linje_l.C3.A4ngs_punkter.3F"><span class="tocnumber">7.16.2.8</span> <span class="toctext">Hur skapar man en polygon eller linje längs punkter?</span></a></li>
<li class="toclevel-4"><a href="#Creating_a_Bezier_curve"><span class="tocnumber">7.16.2.9</span> <span class="toctext">Creating a Bezier curve</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_ett_plan.3F"><span class="tocnumber">7.16.2.10</span> <span class="toctext">Hur skapar man ett plan?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_ellips.3F"><span class="tocnumber">7.16.2.11</span> <span class="toctext">Hur skapar man en ellips?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_Torus.3F"><span class="tocnumber">7.16.2.12</span> <span class="toctext">Hur skapar man en Torus?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_l.C3.A5da_eller_en_kub.3F"><span class="tocnumber">7.16.2.13</span> <span class="toctext">Hur skapar man en låda eller en kub?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_sf.C3.A4r.3F"><span class="tocnumber">7.16.2.14</span> <span class="toctext">Hur skapar man en sfär?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_men_en_Cylinder.3F"><span class="tocnumber">7.16.2.15</span> <span class="toctext">Hur skapar men en Cylinder?</span></a></li>
<li class="toclevel-4"><a href="#Hur_skapar_man_en_Kon.3F"><span class="tocnumber">7.16.2.16</span> <span class="toctext">Hur skapar man en Kon?</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Modifying_shapes"><span class="tocnumber">7.17</span> <span class="toctext">Modifying shapes</span></a>
<ul>
<li class="toclevel-3"><a href="#Transform_operations"><span class="tocnumber">7.17.1</span> <span class="toctext">Transform operations</span></a>
<ul>
<li class="toclevel-4"><a href="#Translating_a_shape"><span class="tocnumber">7.17.1.1</span> <span class="toctext">Translating a shape</span></a></li>
<li class="toclevel-4"><a href="#Rotating_a_shape"><span class="tocnumber">7.17.1.2</span> <span class="toctext">Rotating a shape</span></a></li>
<li class="toclevel-4"><a href="#Generic_transformations_with_matrixes"><span class="tocnumber">7.17.1.3</span> <span class="toctext">Generic transformations with matrixes</span></a></li>
<li class="toclevel-4"><a href="#Scaling_a_shape"><span class="tocnumber">7.17.1.4</span> <span class="toctext">Scaling a shape</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Booleska_Operationer_2"><span class="tocnumber">7.17.2</span> <span class="toctext">Booleska Operationer</span></a>
<ul>
<li class="toclevel-4"><a href="#Hur_klipper_man_ut_en_form_fr.C3.A5n_en_annan.3F"><span class="tocnumber">7.17.2.1</span> <span class="toctext">Hur klipper man ut en form från en annan?</span></a></li>
<li class="toclevel-4"><a href="#Hur_f.C3.A5r_man_det_gemensamma_mellan_tv.C3.A5_former.3F"><span class="tocnumber">7.17.2.2</span> <span class="toctext">Hur får man det gemensamma mellan två former?</span></a></li>
<li class="toclevel-4"><a href="#Hur_f.C3.B6renar_man_tv.C3.A5_former.3F"><span class="tocnumber">7.17.2.3</span> <span class="toctext">Hur förenar man två former?</span></a></li>
<li class="toclevel-4"><a href="#Hur_man_sektionerar_en_solid_med_given_form.3F"><span class="tocnumber">7.17.2.4</span> <span class="toctext">Hur man sektionerar en solid med given form?</span></a></li>
<li class="toclevel-4"><a href="#Extrusion"><span class="tocnumber">7.17.2.5</span> <span class="toctext">Extrusion</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Utforska_former"><span class="tocnumber">7.18</span> <span class="toctext">Utforska former</span></a>
<ul>
<li class="toclevel-3"><a href="#Utforska_Kanter"><span class="tocnumber">7.18.1</span> <span class="toctext">Utforska Kanter</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Anv.C3.A4nda_valet"><span class="tocnumber">7.19</span> <span class="toctext">Använda valet</span></a>
<ul>
<li class="toclevel-3"><a href="#OCC_flaskan"><span class="tocnumber">7.19.1</span> <span class="toctext">OCC flaskan</span></a>
<ul>
<li class="toclevel-4"><a href="#Det_kompletta_skriptet"><span class="tocnumber">7.19.1.1</span> <span class="toctext">Det kompletta skriptet</span></a></li>
<li class="toclevel-4"><a href="#Detaljerad_f.C3.B6rklaring"><span class="tocnumber">7.19.1.2</span> <span class="toctext">Detaljerad förklaring</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Box_pierced"><span class="tocnumber">7.20</span> <span class="toctext">Box pierced</span></a></li>
<li class="toclevel-2"><a href="#Ladda_och_spara"><span class="tocnumber">7.21</span> <span class="toctext">Ladda och spara</span></a></li>
<li class="toclevel-2"><a href="#Konvertera_Del_objekt_till_N.C3.A4t"><span class="tocnumber">7.22</span> <span class="toctext">Konvertera Del objekt till Nät</span></a></li>
<li class="toclevel-2"><a href="#Konvertera_N.C3.A4t_till_Del_objekt"><span class="tocnumber">7.23</span> <span class="toctext">Konvertera Nät till Del objekt</span></a></li>
<li class="toclevel-2"><a href="#Komma_.C3.A5t_och_.C3.A4ndra_scengrafen"><span class="tocnumber">7.24</span> <span class="toctext">Komma åt och ändra scengrafen</span></a></li>
<li class="toclevel-2"><a href="#Anv.C3.A4nda_.C3.A5teranropsmekanismer"><span class="tocnumber">7.25</span> <span class="toctext">Använda återanropsmekanismer</span></a></li>
<li class="toclevel-2"><a href="#Dokumentation"><span class="tocnumber">7.26</span> <span class="toctext">Dokumentation</span></a></li>
<li class="toclevel-2"><a href="#PySide"><span class="tocnumber">7.27</span> <span class="toctext">PySide</span></a></li>
<li class="toclevel-2"><a href="#Basic_example"><span class="tocnumber">7.28</span> <span class="toctext">Basic example</span></a></li>
<li class="toclevel-2"><a href="#Tillg.C3.A4ngliga_egenskaper"><span class="tocnumber">7.29</span> <span class="toctext">Tillgängliga egenskaper</span></a></li>
<li class="toclevel-2"><a href="#Property_Type"><span class="tocnumber">7.30</span> <span class="toctext">Property Type</span></a></li>
<li class="toclevel-2"><a href="#Andra_mer_komplexa_exempel"><span class="tocnumber">7.31</span> <span class="toctext">Andra mer komplexa exempel</span></a></li>
<li class="toclevel-2"><a href="#G.C3.B6ra_objekt_valbara"><span class="tocnumber">7.32</span> <span class="toctext">Göra objekt valbara</span></a></li>
<li class="toclevel-2"><a href="#Arbeta_med_enkla_former"><span class="tocnumber">7.33</span> <span class="toctext">Arbeta med enkla former</span></a></li>
<li class="toclevel-2"><a href="#Further_informations"><span class="tocnumber">7.34</span> <span class="toctext">Further informations</span></a>
<ul>
<li class="toclevel-3"><a href="#Anv.C3.A4nda_FreeCAD_utan_gr.C3.A4nssnitt"><span class="tocnumber">7.34.1</span> <span class="toctext">Använda FreeCAD utan gränssnitt</span></a></li>
<li class="toclevel-3"><a href="#Anv.C3.A4nda_FreeCAD_med_gr.C3.A4nssnitt"><span class="tocnumber">7.34.2</span> <span class="toctext">Använda FreeCAD med gränssnitt</span></a></li>
<li class="toclevel-3"><a href="#Caveats"><span class="tocnumber">7.34.3</span> <span class="toctext">Caveats</span></a></li>
<li class="toclevel-3"><a href="#Tutorial_2"><span class="tocnumber">7.34.4</span> <span class="toctext">Tutorial</span></a></li>
<li class="toclevel-3"><a href="#En_typisk_InitGui.py_fil"><span class="tocnumber">7.34.5</span> <span class="toctext">En typisk InitGui.py fil</span></a></li>
<li class="toclevel-3"><a href="#En_typisk_modulfil"><span class="tocnumber">7.34.6</span> <span class="toctext">En typisk modulfil</span></a></li>
<li class="toclevel-3"><a href="#Importera_en_ny_filtyp"><span class="tocnumber">7.34.7</span> <span class="toctext">Importera en ny filtyp</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_en_linje"><span class="tocnumber">7.34.8</span> <span class="toctext">Lägga till en linje</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_en_polygon"><span class="tocnumber">7.34.9</span> <span class="toctext">Lägga till en polygon</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_och_ta_bort_ett_objekt_till.2Ffr.C3.A5n_en_grupp"><span class="tocnumber">7.34.10</span> <span class="toctext">Lägga till och ta bort ett objekt till/från en grupp</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_ett_n.C3.A4t"><span class="tocnumber">7.34.11</span> <span class="toctext">Lägga till ett nät</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_en_cirkelb.C3.A5ge_eller_en_cirkel"><span class="tocnumber">7.34.12</span> <span class="toctext">Lägga till en cirkelbåge eller en cirkel</span></a></li>
<li class="toclevel-3"><a href="#Komma_.C3.A5t_och_.C3.A4ndra_representationen_av_ett_objekt"><span class="tocnumber">7.34.13</span> <span class="toctext">Komma åt och ändra representationen av ett objekt</span></a></li>
<li class="toclevel-3"><a href="#Observation_av_mush.C3.A4ndelser_i_3D_visaren_via_Python"><span class="tocnumber">7.34.14</span> <span class="toctext">Observation av mushändelser i 3D visaren via Python</span></a></li>
<li class="toclevel-3"><a href="#Display_keys_pressed_and_Events_command"><span class="tocnumber">7.34.15</span> <span class="toctext">Display keys pressed and Events command</span></a></li>
<li class="toclevel-3"><a href="#Manipulera_scengrafen_i_Python"><span class="tocnumber">7.34.16</span> <span class="toctext">Manipulera scengrafen i Python</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_och_ta_bort_objekt_till.2Ffr.C3.A5n_scengrafen"><span class="tocnumber">7.34.17</span> <span class="toctext">Lägga till och ta bort objekt till/från scengrafen</span></a></li>
<li class="toclevel-3"><a href="#Saves_the_sceneGraph_with_a_rotation_in_a_series_of_36_files_in_the_X_Y_Z_axis"><span class="tocnumber">7.34.18</span> <span class="toctext">Saves the sceneGraph with a rotation in a series of 36 files in the X Y Z axis</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4gga_till_anpassade_widgetar_till_gr.C3.A4nssnittet"><span class="tocnumber">7.34.19</span> <span class="toctext">Lägga till anpassade widgetar till gränssnittet</span></a></li>
<li class="toclevel-3"><a href="#Adding_a_Tab_to_the_Combo_View"><span class="tocnumber">7.34.20</span> <span class="toctext">Adding a Tab to the Combo View</span></a></li>
<li class="toclevel-3"><a href="#Enable_or_disable_a_window"><span class="tocnumber">7.34.21</span> <span class="toctext">Enable or disable a window</span></a></li>
<li class="toclevel-3"><a href="#Opening_a_custom_webpage"><span class="tocnumber">7.34.22</span> <span class="toctext">Opening a custom webpage</span></a></li>
<li class="toclevel-3"><a href="#Getting_the_HTML_contents_of_an_opened_webpage"><span class="tocnumber">7.34.23</span> <span class="toctext">Getting the HTML contents of an opened webpage</span></a></li>
<li class="toclevel-3"><a href="#Retrieve_and_use_the_coordinates_of_3_selected_points_or_objects"><span class="tocnumber">7.34.24</span> <span class="toctext">Retrieve and use the coordinates of 3 selected points or objects</span></a></li>
<li class="toclevel-3"><a href="#List_all_objects"><span class="tocnumber">7.34.25</span> <span class="toctext">List all objects</span></a></li>
<li class="toclevel-3"><a href="#List_the_dimensions_of_an_object.2C_given_its_name"><span class="tocnumber">7.34.26</span> <span class="toctext">List the dimensions of an object, given its name</span></a></li>
<li class="toclevel-3"><a href="#Function_resident_with_the_mouse_click_action"><span class="tocnumber">7.34.27</span> <span class="toctext">Function resident with the mouse click action</span></a></li>
<li class="toclevel-3"><a href="#Finding-selecting_all_elements_below_cursor"><span class="tocnumber">7.34.28</span> <span class="toctext">Finding-selecting all elements below cursor</span></a></li>
<li class="toclevel-3"><a href="#List_the_components_of_an_object"><span class="tocnumber">7.34.29</span> <span class="toctext">List the components of an object</span></a></li>
<li class="toclevel-3"><a href="#List_the_PropertiesList"><span class="tocnumber">7.34.30</span> <span class="toctext">List the PropertiesList</span></a></li>
<li class="toclevel-3"><a href="#Adding_one_Property_.22Comment.22"><span class="tocnumber">7.34.31</span> <span class="toctext">Adding one Property "Comment"</span></a></li>
<li class="toclevel-3"><a href="#Search_and_data_extraction"><span class="tocnumber">7.34.32</span> <span class="toctext">Search and data extraction</span></a></li>
<li class="toclevel-3"><a href="#Manual_search_of_an_element_with_label"><span class="tocnumber">7.34.33</span> <span class="toctext">Manual search of an element with label</span></a></li>
<li class="toclevel-3"><a href="#Cartesian_coordinates"><span class="tocnumber">7.34.34</span> <span class="toctext">Cartesian coordinates</span></a></li>
<li class="toclevel-3"><a href="#Select_all_objects_in_the_document"><span class="tocnumber">7.34.35</span> <span class="toctext">Select all objects in the document</span></a></li>
<li class="toclevel-3"><a href="#Selecting_a_face_of_an_object"><span class="tocnumber">7.34.36</span> <span class="toctext">Selecting a face of an object</span></a></li>
<li class="toclevel-3"><a href="#Create_one_object_to_the_position_of_the_Camera"><span class="tocnumber">7.34.37</span> <span class="toctext">Create one object to the position of the Camera</span></a></li>
<li class="toclevel-3"><a href="#Find_normal_vector_on_the_surface"><span class="tocnumber">7.34.38</span> <span class="toctext">Find normal vector on the surface</span></a></li>
<li class="toclevel-3"><a href="#Read_And_write_one_Expression"><span class="tocnumber">7.34.39</span> <span class="toctext">Read And write one Expression</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Huvudskriptet"><span class="tocnumber">7.35</span> <span class="toctext">Huvudskriptet</span></a></li>
<li class="toclevel-2"><a href="#Detaljerad_f.C3.B6rklaring_2"><span class="tocnumber">7.36</span> <span class="toctext">Detaljerad förklaring</span></a></li>
<li class="toclevel-2"><a href="#Testa_.26_anv.C3.A4nda_skriptet"><span class="tocnumber">7.37</span> <span class="toctext">Testa &amp; använda skriptet</span></a></li>
<li class="toclevel-2"><a href="#Registrera_skriptet_i_FreeCAD.27s_gr.C3.A4nssnitt"><span class="tocnumber">7.38</span> <span class="toctext">Registrera skriptet i FreeCAD's gränssnitt</span></a></li>
<li class="toclevel-2"><a href="#S.C3.A5_du_vill_ha_mer.3F"><span class="tocnumber">7.39</span> <span class="toctext">Så du vill ha mer?</span></a></li>
<li class="toclevel-2"><a href="#Designa_dialogen"><span class="tocnumber">7.40</span> <span class="toctext">Designa dialogen</span></a></li>
<li class="toclevel-2"><a href="#Konvertera_v.C3.A5r_dialog_till_python"><span class="tocnumber">7.41</span> <span class="toctext">Konvertera vår dialog till python</span></a></li>
<li class="toclevel-2"><a href="#Ordna_s.C3.A5_att_v.C3.A5r_dialog_g.C3.B6r_n.C3.A5got"><span class="tocnumber">7.42</span> <span class="toctext">Ordna så att vår dialog gör något</span></a></li>
<li class="toclevel-2"><a href="#Det_kompletta_skriptet_2"><span class="tocnumber">7.43</span> <span class="toctext">Det kompletta skriptet</span></a></li>
<li class="toclevel-2"><a href="#Creation_of_a_dialog_with_buttons"><span class="tocnumber">7.44</span> <span class="toctext">Creation of a dialog with buttons</span></a>
<ul>
<li class="toclevel-3"><a href="#Method_1"><span class="tocnumber">7.44.1</span> <span class="toctext">Method 1</span></a></li>
<li class="toclevel-3"><a href="#Method_2"><span class="tocnumber">7.44.2</span> <span class="toctext">Method 2</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Icon_personalized_in_ComboView"><span class="tocnumber">7.45</span> <span class="toctext">Icon personalized in ComboView</span></a></li>
<li class="toclevel-2"><a href="#Use_QFileDialog_for_write_the_file"><span class="tocnumber">7.46</span> <span class="toctext">Use QFileDialog for write the file</span></a></li>
<li class="toclevel-2"><a href="#Use_QFileDialog_for_read_the_file"><span class="tocnumber">7.47</span> <span class="toctext">Use QFileDialog for read the file</span></a></li>
<li class="toclevel-2"><a href="#Use_QColorDialog_for_get_the_color"><span class="tocnumber">7.48</span> <span class="toctext">Use QColorDialog for get the color</span></a></li>
<li class="toclevel-2"><a href="#Some_useful_commands"><span class="tocnumber">7.49</span> <span class="toctext">Some useful commands</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-23"><a href="#Utveckla_applikationer_f.C3.B6r_FreeCAD"><span class="tocnumber">8</span> <span class="toctext">Utveckla applikationer för FreeCAD</span></a>
<ul>
<li class="toclevel-2"><a href="#Uttalande_fr.C3.A5n_underh.C3.A5llaren"><span class="tocnumber">8.1</span> <span class="toctext">Uttalande från underhållaren</span></a></li>
<li class="toclevel-2"><a href="#Anv.C3.A4nda_licenser"><span class="tocnumber">8.2</span> <span class="toctext">Använda licenser</span></a></li>
<li class="toclevel-2"><a href="#Licensernas_inverkan"><span class="tocnumber">8.3</span> <span class="toctext">Licensernas inverkan</span></a>
<ul>
<li class="toclevel-3"><a href="#Privata_anv.C3.A4ndare"><span class="tocnumber">8.3.1</span> <span class="toctext">Privata användare</span></a></li>
<li class="toclevel-3"><a href="#Professionella_anv.C3.A4ndare"><span class="tocnumber">8.3.2</span> <span class="toctext">Professionella användare</span></a></li>
<li class="toclevel-3"><a href="#.C3.96ppen_k.C3.A4llkodsutvecklare"><span class="tocnumber">8.3.3</span> <span class="toctext">Öppen källkodsutvecklare</span></a></li>
<li class="toclevel-3"><a href="#Professionella_utvecklare"><span class="tocnumber">8.3.4</span> <span class="toctext">Professionella utvecklare</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#OpenCasCade_License_side_effects_.28for_FreeCAD_version_0.13_and_older.29"><span class="tocnumber">8.4</span> <span class="toctext">OpenCasCade License side effects (for FreeCAD version 0.13 and older)</span></a>
<ul>
<li class="toclevel-3"><a href="#GPL2.2FGPL3.2FOCTLP_incompatibility"><span class="tocnumber">8.4.1</span> <span class="toctext">GPL2/GPL3/OCTLP incompatibility</span></a></li>
<li class="toclevel-3"><a href="#Debian"><span class="tocnumber">8.4.2</span> <span class="toctext">Debian</span></a></li>
<li class="toclevel-3"><a href="#Fedora.2FRedHat_non-free"><span class="tocnumber">8.4.3</span> <span class="toctext">Fedora/RedHat non-free</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Rapportera_buggar"><span class="tocnumber">8.5</span> <span class="toctext">Rapportera buggar</span></a></li>
<li class="toclevel-2"><a href="#Beg.C3.A4ra_funktioner"><span class="tocnumber">8.6</span> <span class="toctext">Begära funktioner</span></a></li>
<li class="toclevel-2"><a href="#Skicka_patchar"><span class="tocnumber">8.7</span> <span class="toctext">Skicka patchar</span></a></li>
<li class="toclevel-2"><a href="#Requesting_merge"><span class="tocnumber">8.8</span> <span class="toctext">Requesting merge</span></a></li>
<li class="toclevel-2"><a href="#MantisBT_Tips_and_Tricks"><span class="tocnumber">8.9</span> <span class="toctext">MantisBT Tips and Tricks</span></a>
<ul>
<li class="toclevel-3"><a href="#MantisBT_.3C.3D.3E_GitHub_Markup"><span class="tocnumber">8.9.1</span> <span class="toctext">MantisBT &lt;=&gt; GitHub Markup</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#GitHub_and_MantisBT"><span class="tocnumber">8.10</span> <span class="toctext">GitHub and MantisBT</span></a>
<ul>
<li class="toclevel-3"><a href="#Attaching_a_git_commit_to_a_ticket"><span class="tocnumber">8.10.1</span> <span class="toctext">Attaching a git commit to a ticket</span></a></li>
<li class="toclevel-3"><a href="#Remotely_resolving_a_ticket"><span class="tocnumber">8.10.2</span> <span class="toctext">Remotely resolving a ticket</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Prerequisites"><span class="tocnumber">8.11</span> <span class="toctext">Prerequisites</span></a>
<ul>
<li class="toclevel-3"><a href="#Required_programs"><span class="tocnumber">8.11.1</span> <span class="toctext">Required programs</span></a></li>
<li class="toclevel-3"><a href="#Source_Code"><span class="tocnumber">8.11.2</span> <span class="toctext">Source Code</span></a>
<ul>
<li class="toclevel-4"><a href="#Using_Git_.28Preferred.29"><span class="tocnumber">8.11.2.1</span> <span class="toctext">Using Git (Preferred)</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Compiler"><span class="tocnumber">8.11.3</span> <span class="toctext">Compiler</span></a></li>
<li class="toclevel-3"><a href="Third_Party_Libraries.html"><span class="tocnumber">8.11.4</span> <span class="toctext">Third Party Libraries</span></a></li>
<li class="toclevel-3"><a href="#Optional_programs"><span class="tocnumber">8.11.5</span> <span class="toctext">Optional programs</span></a></li>
<li class="toclevel-3"><a href="#System_Path_Configuration"><span class="tocnumber">8.11.6</span> <span class="toctext">System Path Configuration</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Configuration_with_CMake"><span class="tocnumber">8.12</span> <span class="toctext">Configuration with CMake</span></a>
<ul>
<li class="toclevel-3"><a href="#The_switch_to_CMake"><span class="tocnumber">8.12.1</span> <span class="toctext">The switch to CMake</span></a></li>
<li class="toclevel-3"><a href="#CMake"><span class="tocnumber">8.12.2</span> <span class="toctext">CMake</span></a></li>
<li class="toclevel-3"><a href="#Configure_CMake_using_GUI"><span class="tocnumber">8.12.3</span> <span class="toctext">Configure CMake using GUI</span></a></li>
<li class="toclevel-3"><a href="#Options_for_the_Build_Process"><span class="tocnumber">8.12.4</span> <span class="toctext">Options for the Build Process</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Building_FreeCAD"><span class="tocnumber">8.13</span> <span class="toctext">Building FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#Building_with_Visual_Studio_12_2013"><span class="tocnumber">8.13.1</span> <span class="toctext">Building with Visual Studio 12 2013</span></a></li>
<li class="toclevel-3"><a href="#Building_with_Visual_Studio_9_2008"><span class="tocnumber">8.13.2</span> <span class="toctext">Building with Visual Studio 9 2008</span></a></li>
<li class="toclevel-3"><a href="#Building_with_Qt_Creator"><span class="tocnumber">8.13.3</span> <span class="toctext">Building with Qt Creator</span></a>
<ul>
<li class="toclevel-4"><a href="#Installation_and_configuration_of_Qt_Creator"><span class="tocnumber">8.13.3.1</span> <span class="toctext">Installation and configuration of Qt Creator</span></a></li>
<li class="toclevel-4"><a href="#Import_project_and_Build"><span class="tocnumber">8.13.3.2</span> <span class="toctext">Import project and Build</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Command_line_build"><span class="tocnumber">8.13.4</span> <span class="toctext">Command line build</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Building_older_versions"><span class="tocnumber">8.14</span> <span class="toctext">Building older versions</span></a>
<ul>
<li class="toclevel-3"><a href="#Using_LibPack"><span class="tocnumber">8.14.1</span> <span class="toctext">Using LibPack</span></a>
<ul>
<li class="toclevel-4"><a href="#Directory_setup_in_Visual_Studio"><span class="tocnumber">8.14.1.1</span> <span class="toctext">Directory setup in Visual Studio</span></a>
<ul>
<li class="toclevel-5"><a href="#Includes"><span class="tocnumber">8.14.1.1.1</span> <span class="toctext">Includes</span></a></li>
<li class="toclevel-5"><a href="#Libs"><span class="tocnumber">8.14.1.1.2</span> <span class="toctext">Libs</span></a></li>
<li class="toclevel-5"><a href="#Executables"><span class="tocnumber">8.14.1.1.3</span> <span class="toctext">Executables</span></a></li>
</ul>
</li>
<li class="toclevel-4"><a href="#Python_needed"><span class="tocnumber">8.14.1.2</span> <span class="toctext">Python needed</span></a></li>
<li class="toclevel-4"><a href="#Special_for_VC8"><span class="tocnumber">8.14.1.3</span> <span class="toctext">Special for VC8</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Compile"><span class="tocnumber">8.14.2</span> <span class="toctext">Compile</span></a></li>
<li class="toclevel-3"><a href="#After_Compiling"><span class="tocnumber">8.14.3</span> <span class="toctext">After Compiling</span></a></li>
<li class="toclevel-3"><a href="#Additional_stuff"><span class="tocnumber">8.14.4</span> <span class="toctext">Additional stuff</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#References"><span class="tocnumber">8.15</span> <span class="toctext">References</span></a></li>
<li class="toclevel-2"><a href="#Getting_the_source"><span class="tocnumber">8.16</span> <span class="toctext">Getting the source</span></a>
<ul>
<li class="toclevel-3"><a href="#Git"><span class="tocnumber">8.16.1</span> <span class="toctext">Git</span></a></li>
<li class="toclevel-3"><a href="#Github"><span class="tocnumber">8.16.2</span> <span class="toctext">Github</span></a></li>
<li class="toclevel-3"><a href="#Source_package"><span class="tocnumber">8.16.3</span> <span class="toctext">Source package</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Getting_the_dependencies"><span class="tocnumber">8.17</span> <span class="toctext">Getting the dependencies</span></a>
<ul>
<li class="toclevel-3"><a href="#Debian_and_Ubuntu"><span class="tocnumber">8.17.1</span> <span class="toctext">Debian and Ubuntu</span></a></li>
<li class="toclevel-3"><a href="#Fedora"><span class="tocnumber">8.17.2</span> <span class="toctext">Fedora</span></a></li>
<li class="toclevel-3"><a href="#Gentoo_2"><span class="tocnumber">8.17.3</span> <span class="toctext">Gentoo</span></a></li>
<li class="toclevel-3"><a href="#OpenSUSE_2"><span class="tocnumber">8.17.4</span> <span class="toctext">OpenSUSE</span></a></li>
<li class="toclevel-3"><a href="#Arch_Linux"><span class="tocnumber">8.17.5</span> <span class="toctext">Arch Linux</span></a></li>
<li class="toclevel-3"><a href="#Older_and_non-conventional_distributions"><span class="tocnumber">8.17.6</span> <span class="toctext">Older and non-conventional distributions</span></a>
<ul>
<li class="toclevel-4"><a href="#Pivy"><span class="tocnumber">8.17.6.1</span> <span class="toctext">Pivy</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Compile_FreeCAD"><span class="tocnumber">8.18</span> <span class="toctext">Compile FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#Using_cMake"><span class="tocnumber">8.18.1</span> <span class="toctext">Using cMake</span></a>
<ul>
<li class="toclevel-4"><a href="#In-source_building"><span class="tocnumber">8.18.1.1</span> <span class="toctext">In-source building</span></a>
<ul>
<li class="toclevel-5"><a href="#For_a_Debug_build"><span class="tocnumber">8.18.1.1.1</span> <span class="toctext">For a Debug build</span></a></li>
<li class="toclevel-5"><a href="#Or_for_a_Release_build"><span class="tocnumber">8.18.1.1.2</span> <span class="toctext">Or for a Release build</span></a></li>
</ul>
</li>
<li class="toclevel-4"><a href="#How_to_repair_your_source_code_directory_after_accidentally_running_an_in-source_build."><span class="tocnumber">8.18.1.2</span> <span class="toctext">How to repair your source code directory after accidentally running an in-source build.</span></a></li>
<li class="toclevel-4"><a href="#Out-of-source_build"><span class="tocnumber">8.18.1.3</span> <span class="toctext">Out-of-source build</span></a></li>
<li class="toclevel-4"><a href="#Configuration_options"><span class="tocnumber">8.18.1.4</span> <span class="toctext">Configuration options</span></a></li>
<li class="toclevel-4"><a href="#Qt_designer_plugin"><span class="tocnumber">8.18.1.5</span> <span class="toctext">Qt designer plugin</span></a></li>
<li class="toclevel-4"><a href="#Doxygen"><span class="tocnumber">8.18.1.6</span> <span class="toctext">Doxygen</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Making_a_debian_package"><span class="tocnumber">8.18.2</span> <span class="toctext">Making a debian package</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Troubleshooting"><span class="tocnumber">8.19</span> <span class="toctext">Troubleshooting</span></a>
<ul>
<li class="toclevel-3"><a href="#Note_for_64bit_systems"><span class="tocnumber">8.19.1</span> <span class="toctext">Note for 64bit systems</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Automatic_build_scripts"><span class="tocnumber">8.20</span> <span class="toctext">Automatic build scripts</span></a>
<ul>
<li class="toclevel-3"><a href="#Ubuntu"><span class="tocnumber">8.20.1</span> <span class="toctext">Ubuntu</span></a></li>
<li class="toclevel-3"><a href="#OpenSUSE_12.2"><span class="tocnumber">8.20.2</span> <span class="toctext">OpenSUSE 12.2</span></a></li>
<li class="toclevel-3"><a href="#Debian_Squeeze"><span class="tocnumber">8.20.3</span> <span class="toctext">Debian Squeeze</span></a></li>
<li class="toclevel-3"><a href="#Fedora_22.2F23.2F24"><span class="tocnumber">8.20.4</span> <span class="toctext">Fedora 22/23/24</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Updating_the_source_code"><span class="tocnumber">8.21</span> <span class="toctext">Updating the source code</span></a></li>
<li class="toclevel-2"><a href="#Links_4"><span class="tocnumber">8.22</span> <span class="toctext">Links</span></a></li>
<li class="toclevel-2"><a href="#Prerequisites_2"><span class="tocnumber">8.23</span> <span class="toctext">Prerequisites</span></a>
<ul>
<li class="toclevel-3"><a href="#Package_Manager"><span class="tocnumber">8.23.1</span> <span class="toctext">Package Manager</span></a></li>
<li class="toclevel-3"><a href="#CMake_2"><span class="tocnumber">8.23.2</span> <span class="toctext">CMake</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Installing_the_Dependencies"><span class="tocnumber">8.24</span> <span class="toctext">Installing the Dependencies</span></a></li>
<li class="toclevel-2"><a href="#Getting_the_source_2"><span class="tocnumber">8.25</span> <span class="toctext">Getting the source</span></a></li>
<li class="toclevel-2"><a href="#Building_FreeCAD_2"><span class="tocnumber">8.26</span> <span class="toctext">Building FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#CMake_Options"><span class="tocnumber">8.26.1</span> <span class="toctext">CMake Options</span></a></li>
<li class="toclevel-3"><a href="#CMake_GUI"><span class="tocnumber">8.26.2</span> <span class="toctext">CMake GUI</span></a></li>
<li class="toclevel-3"><a href="#CMake_command_line"><span class="tocnumber">8.26.3</span> <span class="toctext">CMake command line</span></a></li>
<li class="toclevel-3"><a href="#Make"><span class="tocnumber">8.26.4</span> <span class="toctext">Make</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Updating"><span class="tocnumber">8.27</span> <span class="toctext">Updating</span></a></li>
<li class="toclevel-2"><a href="#Troubleshooting_2"><span class="tocnumber">8.28</span> <span class="toctext">Troubleshooting</span></a>
<ul>
<li class="toclevel-3"><a href="#Fortran"><span class="tocnumber">8.28.1</span> <span class="toctext">Fortran</span></a></li>
<li class="toclevel-3"><a href="#OpenGL"><span class="tocnumber">8.28.2</span> <span class="toctext">OpenGL</span></a></li>
<li class="toclevel-3"><a href="#FreeType"><span class="tocnumber">8.28.3</span> <span class="toctext">FreeType</span></a></li>
<li class="toclevel-3"><a href="#.C3.96versikt"><span class="tocnumber">8.28.4</span> <span class="toctext">Översikt</span></a></li>
<li class="toclevel-3"><a href="#L.C3.A4nkar_2"><span class="tocnumber">8.28.5</span> <span class="toctext">Länkar</span></a></li>
<li class="toclevel-3"><a href="#Detaljer"><span class="tocnumber">8.28.6</span> <span class="toctext">Detaljer</span></a>
<ul>
<li class="toclevel-4"><a href="#Python"><span class="tocnumber">8.28.6.1</span> <span class="toctext">Python</span></a>
<ul>
<li class="toclevel-5"><a href="#Beskrivning"><span class="tocnumber">8.28.6.1.1</span> <span class="toctext">Beskrivning</span></a></li>
<li class="toclevel-5"><a href="#Krediter"><span class="tocnumber">8.28.6.1.2</span> <span class="toctext">Krediter</span></a></li>
</ul>
</li>
<li class="toclevel-4"><a href="#OpenCasCade"><span class="tocnumber">8.28.6.2</span> <span class="toctext">OpenCasCade</span></a></li>
<li class="toclevel-4"><a href="#Qt"><span class="tocnumber">8.28.6.3</span> <span class="toctext">Qt</span></a></li>
<li class="toclevel-4"><a href="#Coin3D"><span class="tocnumber">8.28.6.4</span> <span class="toctext">Coin3D</span></a></li>
<li class="toclevel-4"><a href="#SoQt"><span class="tocnumber">8.28.6.5</span> <span class="toctext">SoQt</span></a></li>
<li class="toclevel-4"><a href="#Xerces-C.2B.2B"><span class="tocnumber">8.28.6.6</span> <span class="toctext">Xerces-C++</span></a></li>
<li class="toclevel-4"><a href="#Zlib"><span class="tocnumber">8.28.6.7</span> <span class="toctext">Zlib</span></a></li>
<li class="toclevel-4"><a href="#Boost"><span class="tocnumber">8.28.6.8</span> <span class="toctext">Boost</span></a></li>
<li class="toclevel-4"><a href="#libarea"><span class="tocnumber">8.28.6.9</span> <span class="toctext">libarea</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#LibPack"><span class="tocnumber">8.28.7</span> <span class="toctext">LibPack</span></a>
<ul>
<li class="toclevel-4"><a href="#FreeCADLibs7.x_.C3.84ndringslogg"><span class="tocnumber">8.28.7.1</span> <span class="toctext">FreeCADLibs7.x Ändringslogg</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Verktygssida"><span class="tocnumber">8.29</span> <span class="toctext">Verktygssida</span></a>
<ul>
<li class="toclevel-3"><a href="#Plattformsoberoende_verktyg"><span class="tocnumber">8.29.1</span> <span class="toctext">Plattformsoberoende verktyg</span></a>
<ul>
<li class="toclevel-4"><a href="#Qt-Toolkit"><span class="tocnumber">8.29.1.1</span> <span class="toctext">Qt-Toolkit</span></a></li>
<li class="toclevel-4"><a href="#InkScape"><span class="tocnumber">8.29.1.2</span> <span class="toctext">InkScape</span></a></li>
<li class="toclevel-4"><a href="#Doxygen_2"><span class="tocnumber">8.29.1.3</span> <span class="toctext">Doxygen</span></a></li>
<li class="toclevel-4"><a href="#The_Gimp"><span class="tocnumber">8.29.1.4</span> <span class="toctext">The Gimp</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Verktyg_p.C3.A5_Windows"><span class="tocnumber">8.29.2</span> <span class="toctext">Verktyg på Windows</span></a>
<ul>
<li class="toclevel-4"><a href="#Visual_Studio_8_Express"><span class="tocnumber">8.29.2.1</span> <span class="toctext">Visual Studio 8 Express</span></a></li>
<li class="toclevel-4"><a href="#CamStudio"><span class="tocnumber">8.29.2.2</span> <span class="toctext">CamStudio</span></a></li>
<li class="toclevel-4"><a href="#Tortoise_SVN"><span class="tocnumber">8.29.2.3</span> <span class="toctext">Tortoise SVN</span></a></li>
<li class="toclevel-4"><a href="#StarUML"><span class="tocnumber">8.29.2.4</span> <span class="toctext">StarUML</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Verktyg_p.C3.A5_Linux"><span class="tocnumber">8.29.3</span> <span class="toctext">Verktyg på Linux</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Starta_FreeCAD_fr.C3.A5n_Kommandoraden"><span class="tocnumber">8.30</span> <span class="toctext">Starta FreeCAD från Kommandoraden</span></a>
<ul>
<li class="toclevel-3"><a href="#Kommandoradsalternativ"><span class="tocnumber">8.30.1</span> <span class="toctext">Kommandoradsalternativ</span></a></li>
<li class="toclevel-3"><a href="#Respons_och_konfigurationsfiler"><span class="tocnumber">8.30.2</span> <span class="toctext">Respons och konfigurationsfiler</span></a></li>
<li class="toclevel-3"><a href="#G.C3.B6mda_alternativ"><span class="tocnumber">8.30.3</span> <span class="toctext">Gömda alternativ</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#K.C3.B6ra_FreeCAD_utan_anv.C3.A4ndargr.C3.A4nssnitt"><span class="tocnumber">8.31</span> <span class="toctext">Köra FreeCAD utan användargränssnitt</span></a></li>
<li class="toclevel-2"><a href="#Konfigurationssetet"><span class="tocnumber">8.32</span> <span class="toctext">Konfigurationssetet</span></a>
<ul>
<li class="toclevel-3"><a href="#Anv.C3.A4ndarrelaterad_information"><span class="tocnumber">8.32.1</span> <span class="toctext">Användarrelaterad information</span></a></li>
<li class="toclevel-3"><a href="#Kommandoradsargument"><span class="tocnumber">8.32.2</span> <span class="toctext">Kommandoradsargument</span></a></li>
<li class="toclevel-3"><a href="#Systemrelaterat"><span class="tocnumber">8.32.3</span> <span class="toctext">Systemrelaterat</span></a></li>
<li class="toclevel-3"><a href="#Bygga_relaterad_information"><span class="tocnumber">8.32.4</span> <span class="toctext">Bygga relaterad information</span></a></li>
<li class="toclevel-3"><a href="#M.C3.A4rkningsrelaterat"><span class="tocnumber">8.32.5</span> <span class="toctext">Märkningsrelaterat</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Bruk"><span class="tocnumber">8.33</span> <span class="toctext">Bruk</span></a>
<ul>
<li class="toclevel-3"><a href="#DistSrc"><span class="tocnumber">8.33.1</span> <span class="toctext">DistSrc</span></a></li>
<li class="toclevel-3"><a href="#DistBin"><span class="tocnumber">8.33.2</span> <span class="toctext">DistBin</span></a></li>
<li class="toclevel-3"><a href="#DistSetup"><span class="tocnumber">8.33.3</span> <span class="toctext">DistSetup</span></a></li>
<li class="toclevel-3"><a href="#DistSetup_2"><span class="tocnumber">8.33.4</span> <span class="toctext">DistSetup</span></a></li>
<li class="toclevel-3"><a href="#DistAll"><span class="tocnumber">8.33.5</span> <span class="toctext">DistAll</span></a></li>
<li class="toclevel-3"><a href="#NextBuildNumber"><span class="tocnumber">8.33.6</span> <span class="toctext">NextBuildNumber</span></a></li>
<li class="toclevel-3"><a href="#CreateModule"><span class="tocnumber">8.33.7</span> <span class="toctext">CreateModule</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Using_the_FreeCAD_Build_tool"><span class="tocnumber">8.34</span> <span class="toctext">Using the FreeCAD Build tool</span></a></li>
<li class="toclevel-2"><a href="#Setting_up_a_new_module_manually"><span class="tocnumber">8.35</span> <span class="toctext">Setting up a new module manually</span></a></li>
<li class="toclevel-2"><a href="#Creating_a_new_workbench"><span class="tocnumber">8.36</span> <span class="toctext">Creating a new workbench</span></a></li>
<li class="toclevel-2"><a href="#Creating_FreeCAD_commands_in_Python"><span class="tocnumber">8.37</span> <span class="toctext">Creating FreeCAD commands in Python</span></a></li>
<li class="toclevel-2"><a href="#Creating_FreeCAD_Commands_in_C.2B.2B"><span class="tocnumber">8.38</span> <span class="toctext">Creating FreeCAD Commands in C++</span></a></li>
<li class="toclevel-2"><a href="#Links_5"><span class="tocnumber">8.39</span> <span class="toctext">Links</span></a></li>
<li class="toclevel-2"><a href="#Test_First"><span class="tocnumber">8.40</span> <span class="toctext">Test First</span></a></li>
<li class="toclevel-2"><a href="#Command_Line"><span class="tocnumber">8.41</span> <span class="toctext">Command Line</span></a></li>
<li class="toclevel-2"><a href="#Generating_a_Backtrace"><span class="tocnumber">8.42</span> <span class="toctext">Generating a Backtrace</span></a>
<ul>
<li class="toclevel-3"><a href="#For_Linux"><span class="tocnumber">8.42.1</span> <span class="toctext">For Linux</span></a></li>
<li class="toclevel-3"><a href="#For_MacOSX"><span class="tocnumber">8.42.2</span> <span class="toctext">For MacOSX</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Python_Debugging"><span class="tocnumber">8.43</span> <span class="toctext">Python Debugging</span></a></li>
<li class="toclevel-2"><a href="#Introduction"><span class="tocnumber">8.44</span> <span class="toctext">Introduction</span></a>
<ul>
<li class="toclevel-3"><a href="#TestAPP.All"><span class="tocnumber">8.44.1</span> <span class="toctext">TestAPP.All</span></a></li>
<li class="toclevel-3"><a href="#BaseTests"><span class="tocnumber">8.44.2</span> <span class="toctext">BaseTests</span></a></li>
<li class="toclevel-3"><a href="#UnitTests"><span class="tocnumber">8.44.3</span> <span class="toctext">UnitTests</span></a></li>
<li class="toclevel-3"><a href="#Document"><span class="tocnumber">8.44.4</span> <span class="toctext">Document</span></a></li>
<li class="toclevel-3"><a href="#UnicodeTests"><span class="tocnumber">8.44.5</span> <span class="toctext">UnicodeTests</span></a></li>
<li class="toclevel-3"><a href="#MeshTestsApp"><span class="tocnumber">8.44.6</span> <span class="toctext">MeshTestsApp</span></a></li>
<li class="toclevel-3"><a href="#TestSketcherApp"><span class="tocnumber">8.44.7</span> <span class="toctext">TestSketcherApp</span></a></li>
<li class="toclevel-3"><a href="#TestPartApp"><span class="tocnumber">8.44.8</span> <span class="toctext">TestPartApp</span></a></li>
<li class="toclevel-3"><a href="#TestPartDesignApp"><span class="tocnumber">8.44.9</span> <span class="toctext">TestPartDesignApp</span></a></li>
<li class="toclevel-3"><a href="#Workbench"><span class="tocnumber">8.44.10</span> <span class="toctext">Workbench</span></a></li>
<li class="toclevel-3"><a href="#Menu"><span class="tocnumber">8.44.11</span> <span class="toctext">Menu</span></a></li>
<li class="toclevel-3"><a href="#Menu.MenuDeleteCases"><span class="tocnumber">8.44.12</span> <span class="toctext">Menu.MenuDeleteCases</span></a></li>
<li class="toclevel-3"><a href="#Menu.MenuCreateCases"><span class="tocnumber">8.44.13</span> <span class="toctext">Menu.MenuCreateCases</span></a></li>
<li class="toclevel-3"><a href="#Allm.C3.A4nt"><span class="tocnumber">8.44.14</span> <span class="toctext">Allmänt</span></a></li>
<li class="toclevel-3"><a href="#Images"><span class="tocnumber">8.44.15</span> <span class="toctext">Images</span></a></li>
<li class="toclevel-3"><a href="#Branding_XML"><span class="tocnumber">8.44.16</span> <span class="toctext">Branding XML</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Hj.C3.A4lpa_till_med_att_.C3.B6vers.C3.A4tta_FreeCAD"><span class="tocnumber">8.45</span> <span class="toctext">Hjälpa till med att översätta FreeCAD</span></a>
<ul>
<li class="toclevel-3"><a href="#Hur_man_.C3.B6vers.C3.A4tter"><span class="tocnumber">8.45.1</span> <span class="toctext">Hur man översätter</span></a></li>
<li class="toclevel-3"><a href="#.C3.96vers.C3.A4tta_med_Qt-Linguist_.28det_gamla_s.C3.A4ttet.29"><span class="tocnumber">8.45.2</span> <span class="toctext">Översätta med Qt-Linguist (det gamla sättet)</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#F.C3.B6rbereda_dina_egna_moduler.2Fapplikationer_f.C3.B6r_.C3.B6vers.C3.A4ttning"><span class="tocnumber">8.46</span> <span class="toctext">Förbereda dina egna moduler/applikationer för översättning</span></a>
<ul>
<li class="toclevel-3"><a href="#F.C3.B6rkrav"><span class="tocnumber">8.46.1</span> <span class="toctext">Förkrav</span></a></li>
<li class="toclevel-3"><a href="#Inst.C3.A4llning_av_Projekt"><span class="tocnumber">8.46.2</span> <span class="toctext">Inställning av Projekt</span></a></li>
<li class="toclevel-3"><a href="#St.C3.A4lla_in_pythonfiler_f.C3.B6r_.C3.B6vers.C3.A4ttning"><span class="tocnumber">8.46.3</span> <span class="toctext">Ställa in pythonfiler för översättning</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#.C3.96vers.C3.A4tta_wikin"><span class="tocnumber">8.47</span> <span class="toctext">Översätta wikin</span></a>
<ul>
<li class="toclevel-3"><a href="#Translation_plugin"><span class="tocnumber">8.47.1</span> <span class="toctext">Translation plugin</span></a></li>
<li class="toclevel-3"><a href="#Old_translation_instructions"><span class="tocnumber">8.47.2</span> <span class="toctext">Old translation instructions</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#PySide_.28previously_PyQt4.29"><span class="tocnumber">8.48</span> <span class="toctext">PySide (previously PyQt4)</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_3"><span class="tocnumber">8.48.1</span> <span class="toctext">Installation</span></a>
<ul>
<li class="toclevel-4"><a href="#Linux"><span class="tocnumber">8.48.1.1</span> <span class="toctext">Linux</span></a></li>
<li class="toclevel-4"><a href="#Windows"><span class="tocnumber">8.48.1.2</span> <span class="toctext">Windows</span></a></li>
<li class="toclevel-4"><a href="#MacOSX"><span class="tocnumber">8.48.1.3</span> <span class="toctext">MacOSX</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Usage"><span class="tocnumber">8.48.2</span> <span class="toctext">Usage</span></a></li>
<li class="toclevel-3"><a href="#Example_of_transition_from_PyQt4_and_PySide"><span class="tocnumber">8.48.3</span> <span class="toctext">Example of transition from PyQt4 and PySide</span></a></li>
<li class="toclevel-3"><a href="#Additional_documentation"><span class="tocnumber">8.48.4</span> <span class="toctext">Additional documentation</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Pivy_2"><span class="tocnumber">8.49</span> <span class="toctext">Pivy</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_4"><span class="tocnumber">8.49.1</span> <span class="toctext">Installation</span></a>
<ul>
<li class="toclevel-4"><a href="#Prerequisites_3"><span class="tocnumber">8.49.1.1</span> <span class="toctext">Prerequisites</span></a></li>
<li class="toclevel-4"><a href="#Debian_.26_Ubuntu"><span class="tocnumber">8.49.1.2</span> <span class="toctext">Debian &amp; Ubuntu</span></a></li>
<li class="toclevel-4"><a href="#Other_linux_distributions"><span class="tocnumber">8.49.1.3</span> <span class="toctext">Other linux distributions</span></a></li>
<li class="toclevel-4"><a href="#Mac_OS"><span class="tocnumber">8.49.1.4</span> <span class="toctext">Mac OS</span></a></li>
<li class="toclevel-4"><a href="#Windows_2"><span class="tocnumber">8.49.1.5</span> <span class="toctext">Windows</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Usage_2"><span class="tocnumber">8.49.2</span> <span class="toctext">Usage</span></a></li>
<li class="toclevel-3"><a href="#Dokumentation_2"><span class="tocnumber">8.49.3</span> <span class="toctext">Dokumentation</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#pyCollada"><span class="tocnumber">8.50</span> <span class="toctext">pyCollada</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_5"><span class="tocnumber">8.50.1</span> <span class="toctext">Installation</span></a>
<ul>
<li class="toclevel-4"><a href="#Linux_2"><span class="tocnumber">8.50.1.1</span> <span class="toctext">Linux</span></a>
<ul>
<li class="toclevel-5"><a href="#From_the_git_repository"><span class="tocnumber">8.50.1.1.1</span> <span class="toctext">From the git repository</span></a></li>
<li class="toclevel-5"><a href="#With_easy_install"><span class="tocnumber">8.50.1.1.2</span> <span class="toctext">With easy_install</span></a></li>
</ul>
</li>
<li class="toclevel-4"><a href="#Windows_3"><span class="tocnumber">8.50.1.2</span> <span class="toctext">Windows</span></a></li>
<li class="toclevel-4"><a href="#Mac_OS_2"><span class="tocnumber">8.50.1.3</span> <span class="toctext">Mac OS</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#IfcOpenShell"><span class="tocnumber">8.51</span> <span class="toctext">IfcOpenShell</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_6"><span class="tocnumber">8.51.1</span> <span class="toctext">Installation</span></a>
<ul>
<li class="toclevel-4"><a href="#Linux_3"><span class="tocnumber">8.51.1.1</span> <span class="toctext">Linux</span></a></li>
<li class="toclevel-4"><a href="#Windows_4"><span class="tocnumber">8.51.1.2</span> <span class="toctext">Windows</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Links_6"><span class="tocnumber">8.51.2</span> <span class="toctext">Links</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Teigha_Converter"><span class="tocnumber">8.52</span> <span class="toctext">Teigha Converter</span></a>
<ul>
<li class="toclevel-3"><a href="#Installation_7"><span class="tocnumber">8.52.1</span> <span class="toctext">Installation</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1 tocsection-24"><a href="#Krediter_2"><span class="tocnumber">9</span> <span class="toctext">Krediter</span></a>
<ul>
<li class="toclevel-2"><a href="#Development"><span class="tocnumber">9.1</span> <span class="toctext">Development</span></a>
<ul>
<li class="toclevel-3"><a href="#Project_managers"><span class="tocnumber">9.1.1</span> <span class="toctext">Project managers</span></a></li>
<li class="toclevel-3"><a href="#Main_developers"><span class="tocnumber">9.1.2</span> <span class="toctext">Main developers</span></a></li>
<li class="toclevel-3"><a href="#Other_coders"><span class="tocnumber">9.1.3</span> <span class="toctext">Other coders</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Companies"><span class="tocnumber">9.2</span> <span class="toctext">Companies</span></a></li>
<li class="toclevel-2"><a href="#Forum_moderators"><span class="tocnumber">9.3</span> <span class="toctext">Forum moderators</span></a></li>
<li class="toclevel-2"><a href="#Community"><span class="tocnumber">9.4</span> <span class="toctext">Community</span></a></li>
<li class="toclevel-2"><a href="#Documentation_writers"><span class="tocnumber">9.5</span> <span class="toctext">Documentation writers</span></a></li>
<li class="toclevel-2"><a href="#Translators"><span class="tocnumber">9.6</span> <span class="toctext">Translators</span></a></li>
<li class="toclevel-2"><a href="#Addons_developers"><span class="tocnumber">9.7</span> <span class="toctext">Addons developers</span></a></li>
</ul>
</li>
</ul>
</div>
</td></tr></table>
<p><br />
</p><p><br />
This page describes several methods for creating and modifying <a href="Part_Module.html" title="Part Module">Part shapes</a> from python. Before reading this page, if you are new to python, it is a good idea to read about <a href="Introduction_to_Python.html" title="Introduction to Python">python scripting</a> and <a href="FreeCAD_Scripting_Basics.html" title="FreeCAD Scripting Basics">how python scripting works in FreeCAD</a>.
</p>
<div class="mw-translate-fuzzy">
<h2><span class="mw-headline" id="Introduktion_3">Introduktion</span></h2>
<p>Här kommer vi att förklara hur du kontrollerar <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a> direkt från FreeCADs python tolk, eller från ett externt skript. Titta igenom <a href="https://www.freecadweb.org/wiki/index.php?title=Scripting/sv" class="mw-redirect" title="Scripting/sv">Skript</a> avsnittet och <a href="https://www.freecadweb.org/wiki/index.php?title=FreeCAD_Scripting_Basics/sv" title="FreeCAD Scripting Basics/sv">FreeCAD Skript grunder</a> sidorna om du behöver mer information om hur python skript fungerar i FreeCAD.
</p><p><br />
För att kunna använda Delmodulens funktioner så måste du ladda Del modulen i tolken:
</p><p><code>
import Part
</code>
</p>
</div>
<h3><span class="mw-headline" id="Klass_Diagram">Klass Diagram</span></h3>
<p>Detta är en UML översikt över de viktigaste klasserna i Del modulen:
</p>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Part_Classes.jpg" class="image" title="Python klasser i Del modulen"><img alt="Python klasser i Del modulen" src="Part_Classes.jpg" width="744" height="520" /></a></div></div>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id="Geometri">Geometri</span></h3>
<p>De geomtriska objekten är byggblocken för alla topologiska objekt:
</p>
<ul><li> <b>GEOM</b> Basklass för geometriska objekt</li></ul>
<ul><li> <b>LINE</b> En rak linje i 3D, definierad av en start- och en slutpunkt</li></ul>
<ul><li> <b>CIRCLE</b> Cirkel eller cirkelsegment som definieras av en centrumpunkt, start- och en slutpunkt</li></ul>
<ul><li> <b>......</b> Och snart lite mer</li></ul>
</div>
<h3><span class="mw-headline" id="Topologi">Topologi</span></h3>
<p>Följande topologiska datatyper finns tillgängliga:
</p>
<ul><li> <b>COMPOUND</b> En grupp av valfri typ av topologiska objekt.</li>
<li> <b>COMPSOLID</b> En kompositsolid är ett set av solider ihopkopplade genom dess ytor. Det expanderar begreppen WIRE och SHELL till solider.</li>
<li> <b>SOLID</b> En rymd som är begränsad av skal. Den är tredimensionell.</li>
<li> <b>SHELL</b> Ett set av ytor ihopkopplade genom dess kanter. Ett skal kan vara öppet eller slutet.</li>
<li> <b>FACE</b> I 2D så är det en del av ett plan; i 3D är det en del av en yta. Dess geometri är begränsad (trimmad) av konturer. Den är tvådimensionell.</li>
<li> <b>WIRE</b> Ett set av kanter som är ihopkopplade genom dess hörn. Det kan vara en öppen eller sluten kontur beroende på om kanterna är ihoplänkade eller inte.</li>
<li> <b>EDGE</b> Ett topologiskt element som motsvarar en begränsad kurva. En kant är vanligtvis begränsad av hörn. Det har en dimension.</li>
<li> <b>VERTEX</b> Ett topologiskt element som motsvarar en punkt. Dess dimension är noll.</li>
<li> <b>SHAPE</b> En allmän term som täcker allt ovan.</li></ul>
<h2><span class="mw-headline" id="Exempel_4">Exempel</span></h2>
<h3><span class="mw-headline" id="Skapa_simpel_topologi">Skapa simpel topologi</span></h3>
<div class="mw-translate-fuzzy">
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Wire.png" class="image" title="Wire"><img alt="Wire" src="Wire.png" width="260" height="137" /></a></div>
</div>
<p><br />
Vi ska nu skapa en topologi genom att konstruera den utifrån enklare geometri.
Som ett studiefall så använder vi en del som syns i bilden vilken består av
fyra hörn, två cirklar och två linjer.
</p>
<h4><span class="mw-headline" id="Skapa_Geometri">Skapa Geometri</span></h4>
<p>Först så måste vi skapa de distinkt geometriska delarna av denna tråd.
Och vi måste ta hänsyn till att hörnen på de geometriska delarna
är på <b>samma</b> position. Annars kanske vi inte kan koppla ihop
de geometriska delarna till en topologi!
</p><p>Så vi skapar punkterna först:
</p>
<pre>from FreeCAD import Base
V1 = Base.Vector(0,10,0)
V2 = Base.Vector(30,10,0)
V3 = Base.Vector(30,-10,0)
V4 = Base.Vector(0,-10,0) </pre>
<h4><span class="mw-headline" id="Cirkelb.C3.A5ge">Cirkelbåge</span></h4>
<div class="mw-translate-fuzzy">
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Circel.png" class="image" title="Circle"><img alt="Circle" src="Circel.png" width="111" height="135" /></a></div>
</div>
<p><br />
För att skapa en cirkelbåge så skapar vi en hjälppunkt och skapar cirkelbågen
genom tre punkter:
</p>
<pre>VC1 = Base.Vector(-10,0,0)
C1 = Part.Arc(V1,VC1,V4)
# and the second one
VC2 = Base.Vector(40,0,0)
C2 = Part.Arc(V2,VC2,V3) </pre>
<h4><span class="mw-headline" id="Linje">Linje</span></h4>
<div class="mw-translate-fuzzy">
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Line.png" class="image" title="Line"><img alt="Line" src="Line.png" width="175" height="76" /></a></div>
</div>
<p><br />
</p>
<div class="mw-translate-fuzzy">
<p>Linjen kan skapas mycket lätt ur punkterna:
</p>
</div>
<pre>L1 = Part.LineSegment(V1,V2)
# and the second one
L2 = Part.LineSegment(V3,V4) </pre>
<p><i>Note: in FreeCAD 0.16 Part.Line was used, for FreeCAD 0.17 Part.LineSegment has to be used</i>
</p>
<h4><span class="mw-headline" id="S.C3.A4tta_ihop_allt">Sätta ihop allt</span></h4>
<p>Det sista steget är att sätta ihop den geometriska grundelementen
och baka en topologisk form:
</p>
<pre>S1 = Part.Shape([C1,L1,C2,L2]) </pre>
<h4><span class="mw-headline" id="Skapa_ett_prisma">Skapa ett prisma</span></h4>
<p>Extrudera nu tråden i en riktning och skapa en äkta 3D form:
</p>
<pre>W = Part.Wire(S1.Edges)
P = W.extrude(Base.Vector(0,0,10)) </pre>
<h4><span class="mw-headline" id="Show_it_all">Show it all</span></h4>
<pre>Part.show(P) </pre>
<h2><span class="mw-headline" id="Skapa_grundtyper">Skapa grundtyper</span></h2>
<h3><span class="mw-headline" id="Kort_beskrivning">Kort beskrivning</span></h3>
<p>Du kan lätt skapa enkla topologiska objekt med "make...()" metoden från Del Modulen:
</p>
<pre>b = Part.makeBox(100,100,100)
Part.show(b) </pre>
<p>Några andra make...() metoder fom finns:
</p>
<ul><li> makeBox(l,w,h,[p,d]) -- Skapa en låda placerad i p och pekar i riktningen d med dimensionerna (l,w,h). Som standard är p Vektor(0,0,0) och d är Vektor(0,0,1)</li>
<li> makeCircle(radius,[p,d,angle1,angle2]) -- Skapa en cirkel med en given radie. Som standard är p Vektor(0,0,0), d är Vektor(0,0,1) angle1=0 och angle2=360</li>
<li> makeCompound(list) -- Skapar en compound från en lista med former (shapes)</li>
<li> makeCone(radius1,radius2,height,[p,d,angle]) -- Skapa en kon med given radie och höjd. Som standard är p Vektor(0,0,0), d är Vektor(0,0,1) och angle=360</li>
<li> makeCylinder(radius,height,[p,d,angle]) -- Skapa en cylinder med given radie och höjd. Som standard är p Vektor(0,0,0), d är Vektor(0,0,1) och angle=360</li>
<li> makeLine((x1,y1,z1),(x2,y2,z2)) -- Skapa en linje mellan två punkter</li>
<li> makePlane(length,width,[p,d]) -- Skapa ett plan med längd och bredd. med given radie och höjd. Som standard är p Vektor(0,0,0), och d är Vektor(0,0,1)</li>
<li> makePolygon(list) -- Skapa en polygon från en lista med punkter</li>
<li> makeSphere(radius,[p,d,angle1,angle2,angle3]) -- Skapa en sfär med given radie. Som standard är p Vektor(0,0,0), d Vektor(0,0,1), angle1=0, angle2=90 och angle3=360</li>
<li> makeTorus(radius1,radius2,[p,d,angle1,angle2,angle3]) -- Skapa en torus med given radie. Som standard är p Vektor(0,0,0), d Vektor(0,0,1), angle1=0, angle2=360 och angle3=360</li></ul>
<p>See the <a href="Part_API.html" title="Part API">Part API</a> page for a complete list of available methods of the Part module.
</p>
<h3><span class="mw-headline" id="Detaljerade_f.C3.B6rklaringar">Detaljerade förklaringar</span></h3>
<p>Importera först följande:
</p>
<pre>import Part
from FreeCAD import Base </pre>
<h4><span class="mw-headline" id="Creating_a_Vector">Creating a Vector</span></h4>
<p><a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Euclidean_vector">Vectors</a> are one of the most
important pieces of information when building shapes. They contain a 3 numbers
usually (but not necessarily always) the x, y and z cartesian coordinates. You
create a vector like this:
</p>
<pre>myVector = Base.Vector(3,2,0) </pre>
<p>We just created a vector at coordinates x=3, y=2, z=0. In the Part module,
vectors are used everywhere. Part shapes also use another kind of point
representation, called Vertex, which is acually nothing else than a container
for a vector. You access the vector of a vertex like this:
</p>
<pre>myVertex = myShape.Vertexes[0]
print myVertex.Point
&gt; Vector (3, 2, 0) </pre>
<h4><span class="mw-headline" id="Hur_skapar_man_en_kant.3F">Hur skapar man en kant?</span></h4>
<p>En kant är inget annat än en linje med två hörn:
</p>
<pre>edge = Part.makeLine((0,0,0), (10,0,0))
edge.Vertexes
&gt; [&lt;Vertex object at 01877430&gt;, &lt;Vertex object at 014888E0&gt;] </pre>
<p>Notera: Du kan inte skapa en kant som passerar två hörn.
</p>
<pre>vec1 = Base.Vector(0,0,0)
vec2 = Base.Vector(10,0,0)
line = Part.LineSegment(vec1,vec2)
edge = line.toShape() </pre>
<p>Du kan hitta en kants längd och centrum så här:
</p>
<pre>edge.Length
&gt; 10.0
edge.CenterOfMass
&gt; Vector (5, 0, 0) </pre>
<h4><span class="mw-headline" id="Putting_the_shape_on_screen">Putting the shape on screen</span></h4>
<p>So far we created an edge object, but it doesn't appear anywhere on screen.
This is because we just manipulated python objects here. The FreeCAD 3D scene
only displays what you tell it to display. To do that, we use this simple
method:
</p>
<pre>Part.show(edge) </pre>
<p>An object will be created in our FreeCAD document, and our "edge" shape
will be attributed to it. Use this whenever it's time to display your
creation on screen.
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_tr.C3.A5d.3F">Hur skapar man en tråd?</span></h4>
<p>en tråd kan skapas från en lista med kanter eller en lista med trådar:
</p>
<pre>edge1 = Part.makeLine((0,0,0), (10,0,0))
edge2 = Part.makeLine((10,0,0), (10,10,0))
wire1 = Part.Wire([edge1,edge2])
edge3 = Part.makeLine((10,10,0), (0,10,0))
edge4 = Part.makeLine((0,10,0), (0,0,0))
wire2 = Part.Wire([edge3,edge4])
wire3 = Part.Wire([wire1,wire2])
wire3.Edges
&gt; [&lt;Edge object at 016695F8&gt;, &lt;Edge object at 0197AED8&gt;, &lt;Edge object at 01828B20&gt;, &lt;Edge object at 0190A788&gt;]
Part.show(wire3) </pre>
<p>Part.show(wire3) kommer att visa fyra linjer som bildar en kvadrat:
</p>
<pre>wire3.Length
&gt; 40.0
wire3.CenterOfMass
&gt; Vector (5, 5, 0)
wire3.isClosed()
&gt; True
wire2.isClosed()
&gt; False </pre>
<h4><span class="mw-headline" id="Hur_skapar_man_en_yta.3F">Hur skapar man en yta?</span></h4>
<p>Endast ytor som skapats av stängda trådar är giltiga.
</p><p>I detta exempel, så är wire3 en stängd tråd men wire2 är inte det (se ovan)
</p>
<pre>face = Part.Face(wire3)
face.Area
&gt; 99.999999999999972
face.CenterOfMass
&gt; Vector (5, 5, 0)
face.Length
&gt; 40.0
face.isValid()
&gt; True
sface = Part.Face(wire2)
face.isValid()
&gt; False </pre>
<p>Endast ytor har en area, inte trådar eller kanter.
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_cirkel.3F">Hur skapar man en cirkel?</span></h4>
<p>circle = Part.makeCircle(radius,[center,dir_normal,angle1,angle2]) -- Skapa en cirkel med en given radie
</p><p>Som standard är, center=Vektor(0,0,0), dir_normal=Vektor(0,0,1), angle1=0 och angle2=360.
</p><p>En cirkel kan skapas så här:
</p>
<pre>circle = Part.makeCircle(10)
circle.Curve
&gt; Circle (Radius&#160;: 10, Position&#160;: (0, 0, 0), Direction&#160;: (0, 0, 1)) </pre>
<p>Om du vill skapa den vid en viss position och med en viss riktning
</p>
<pre>ccircle = Part.makeCircle(10, Base.Vector(10,0,0), Base.Vector(1,0,0))
ccircle.Curve
&gt; Circle (Radius&#160;: 10, Position&#160;: (10, 0, 0), Direction&#160;: (1, 0, 0)) </pre>
<p>cirkeln kommer att skapas med en distans 10 från nollpunkten i x och kommer att vara vänd mot x axeln.
</p><p>Notera: makeCircle accepterar endast Base.Vector() men inte tupler.
</p><p>Du kan också skapa en cirkelbåge genom att ge start- och slutvinkel:
</p>
<pre>from math import pi
arc1 = Part.makeCircle(10, Base.Vector(0,0,0), Base.Vector(0,0,1), 0, 180)
arc2 = Part.makeCircle(10, Base.Vector(0,0,0), Base.Vector(0,0,1), 180, 360) </pre>
<p>Både arc1 och arc2 kommer tillsammans skapa en cirkel.
</p><p>Vinklar ska anges i grader, om du har radianer, konvertera det genom att använda formeln:
</p><p>Grader = radianer * 180/PI
</p><p>eller genom att använda python's math modul (efter att du importerat math, förstås):
</p><p>grader = math.degrees(radianer)
</p>
<pre>degrees = math.degrees(radians) </pre>
<div class="mw-translate-fuzzy">
<h4><span class="mw-headline" id="Hur_skapar_man_en_cirkelb.C3.A5ge_l.C3.A4ngs_punkter.3F">Hur skapar man en cirkelbåge längs punkter?</span></h4>
<p>Olyckligtvis så finns det ingen makeArc funktion men vi har Part.Arc funktionen för att skapa en cirkelbåge längs tre punkter.
</p><p>Det kan antas vara en cirkelbåge som förenar start- och slutpunkt genom mittenpunkten.
</p><p>Part.Arc skapar ett arc objekt på vilken .toShape() måste kallas för att få kant objektet,
</p><p>vilket i allmänhet skapas av makeLine eller makeCircle
</p>
</div>
<pre>arc = Part.Arc(Base.Vector(0,0,0),Base.Vector(0,5,0),Base.Vector(5,5,0))
arc
&gt; &lt;Arc object&gt;
arc_edge = arc.toShape() </pre>
<p>Notera: Arc accepterar endast Base.Vector() för punkter men inte tupler.
</p><p>arc_edge är vad vi vill ha, vilken vi kan visa med Part.show(arc_edge).
</p><p>Om du vill ha en liten del av en cirkel som en cirkelbåge, så är det också möjligt:
</p>
<pre>from math import pi
circle = Part.Circle(Base.Vector(0,0,0),Base.Vector(0,0,1),10)
arc = Part.Arc(c,0,pi) </pre>
<p>Arcs are valid edges, like lines. So they can be used in wires too.
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_polygon_eller_linje_l.C3.A4ngs_punkter.3F">Hur skapar man en polygon eller linje längs punkter?</span></h4>
<p>En linje längs multipla punkter är inget annat än att skapa en tråd med multipla kanter.
</p><p>makePolygon funktionen tar en lista med punkter och skapar en tråd längs dessa punkter:
</p>
<pre>lshape_wire = Part.makePolygon([Base.Vector(0,5,0),Base.Vector(0,0,0),Base.Vector(5,0,0)]) </pre>
<h4><span class="mw-headline" id="Creating_a_Bezier_curve">Creating a Bezier curve</span></h4>
<p>Bézier curves are used to model smooth curves using a series of poles (points) and optional weights. The function below makes a Part.BezierCurve from a series of FreeCAD.Vector points. (Note: when "getting" and "setting" a single pole or weight indices start at 1, not 0.)
</p>
<pre>def makeBCurveEdge(Points):
geomCurve = Part.BezierCurve()
geomCurve.setPoles(Points)
edge = Part.Edge(geomCurve)
return(edge) </pre>
<h4><span class="mw-headline" id="Hur_skapar_man_ett_plan.3F">Hur skapar man ett plan?</span></h4>
<p>Ett plan är en platt yta, alltså en yta i 2D
</p><p>makePlane(length,width,[start_pnt,dir_normal]) -- Skapa ett plan
</p><p>Som standard start_pnt=Vector(0,0,0) och dir_normal=Vector(0,0,1).
</p><p>dir_normal=Vector(0,0,1) kommer att skapa ett plan vinkelrätt mot z axeln.
</p><p>dir_normal=Vector(1,0,0) kommer att skapa ett plan vinkelrätt mot x axeln:
</p>
<pre>plane = Part.makePlane(2,2)
plane
&gt;&lt;Face object at 028AF990&gt;
plane = Part.makePlane(2,2, Base.Vector(3,0,0), Base.Vector(0,1,0))
plane.BoundBox
&gt; BoundBox (3, 0, 0, 5, 0, 2) </pre>
<p>BoundBox är en kub som omsluter planet med en diagonal som startar vid (3,0,0) och slutar vid (5,0,2).
</p><p>Här ar BoundBox tjockleken i y axeln noll.
</p><p>Notera: makePlane accepterar endast Base.Vector() för start_pnt och dir_normal men inte tupler
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_ellips.3F">Hur skapar man en ellips?</span></h4>
<p>För att skapa en ellips så finns det flera sätt:
</p>
<pre>Part.Ellipse() </pre>
<p>Skapar en ellips med majorradie 2 och minorradie 1 med
</p><p>centrum i (0,0,0)
</p>
<pre>Part.Ellipse(Ellipse) </pre>
<p>skapa en kopia på den givna ellipsen
</p>
<pre>Part.Ellipse(S1,S2,Center) </pre>
<p>Skapar en ellips centrerad på punkten Center, där
ellipsens plan är definierad av Center, S1 och S2,
dess majoraxel är definierad av Center och S1,
dess majorradie är avståndet mellan Center och S1, och
dess minorradie är avståndet mellan S2 och majoraxeln.
</p>
<pre>Part.Ellipse(Center,MajorRadius,MinorRadius) </pre>
<p>Skapar en ellips med major och minor radierna MajorRadius och
MinorRadius, och är placerad i det plan som definieras av Center och
normalen (0,0,1)
</p>
<pre>eli = Part.Ellipse(Base.Vector(10,0,0),Base.Vector(0,5,0),Base.Vector(0,0,0))
Part.show(eli.toShape()) </pre>
<p>I koden ovan så har vi gett S1, S2 och centrum.
I likhet med Arc, så skapar Ellipse också ett ellipsobjekt men inte kant,
så vi behöver konvertera den till en kant genom att använda toShape() för att visa den
</p><p>Note: Arc accepterar endast Base.Vector() för punkter men inte tupler
</p>
<pre>eli = Part.Ellipse(Base.Vector(0,0,0),10,5)
Part.show(eli.toShape()) </pre>
<p>För Ellipse konstruktören ovan så har vi gett center, MajorRadius och MinorRadius
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_Torus.3F">Hur skapar man en Torus?</span></h4>
<p>makeTorus(radius1,radius2,[pnt,dir,angle1,angle2,angle]) -- Skapa en torus med given radie och vinklar.
</p><p>Som standard är pnt=Vector(0,0,0),dir=Vector(0,0,1),angle1=0,angle1=360 och angle=360
</p><p>anse torus som en liten cirkel som sveper längs en stor cirkel:
</p><p>radius1 den stora cirkelns radie, radius2 är den lilla cirkelns radie,
pnt torusens centrum och dir är normalriktningen.
angle1 och angle2 är vinklar i radianer för den lilla cirkeln, för att skapa en cirkelbåge
den sista parametervinkeln är för att sektionera torusen:
</p>
<pre>torus = Part.makeTorus(10, 2) </pre>
<p>Ovanstående kod kommer att skapa en torus med diametern 20(radie 10) och tjocklek 4(lilla cirkelradien 2)
</p>
<pre>tor=Part.makeTorus(10,5,Base.Vector(0,0,0),Base.Vector(0,0,1),0,180) </pre>
<p>Ovanstående kod kommer att skapa en bit av en torus
</p>
<pre>tor=Part.makeTorus(10,5,Base.Vector(0,0,0),Base.Vector(0,0,1),0,360,180) </pre>
<p>Ovanstående kod kommer att skapa en semi torus, endast den sista parametern är ändrad d.v.s. vinkeln och de kvarvarande vinklarna är standardvärden.
</p><p><br />
Genom att ge vinkeln 180 så kommer en halvtorus att skapas
</p>
<h4><span class="mw-headline" id="Hur_skapar_man_en_l.C3.A5da_eller_en_kub.3F">Hur skapar man en låda eller en kub?</span></h4>
<p>makeBox(length,width,height,[pnt,dir]) -- Skapar en låda placerad i pnt med dimensionerna (längd,bredd,höjd)
</p><p>Som standard är pnt=Vektor(0,0,0) och dir=Vektor(0,0,1)
</p>
<pre>box = Part.makeBox(10,10,10)
len(box.Vertexes)
&gt; 8 </pre>
<h4><span class="mw-headline" id="Hur_skapar_man_en_sf.C3.A4r.3F">Hur skapar man en sfär?</span></h4>
<p>makeSphere(radius,[pnt, dir, angle1,angle2,angle3]) -- Skapa en sför med given radie.
</p><p>Som standard är pnt=Vektor(0,0,0), dir=Vektor(0,0,1), angle1=-90, angle2=90 och angle3=360.
</p><p>angle1 och angle2 är sfärens vertikala minimum och maximum ,
</p><p>angle3 sfärdiametern
</p>
<pre>sphere = Part.makeSphere(10)
hemisphere = Part.makeSphere(10,Base.Vector(0,0,0),Base.Vector(0,0,1),-90,90,180) </pre>
<h4><span class="mw-headline" id="Hur_skapar_men_en_Cylinder.3F">Hur skapar men en Cylinder?</span></h4>
<p>makeCylinder(radius,height,[pnt,dir,angle]) -- skapa en cylinder med given radie och höjd
</p><p>Som standard är pnt=Vektor(0,0,0),dir=Vektor(0,0,1) och angle=360
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cylinder = Part.makeCylinder(5,20)
partCylinder = Part.makeCylinder(5,20,Base.Vector(20,0,0),Base.Vector(0,0,1),180)</pre></div>
<h4><span class="mw-headline" id="Hur_skapar_man_en_Kon.3F">Hur skapar man en Kon?</span></h4>
<p>makeCone(radius1,radius2,height,[pnt,dir,angle]) -- skapa en kon med given radie och höjd
</p><p>Som standard är pnt=Vector(0,0,0), dir=Vector(0,0,1) och angle=360
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cone = Part.makeCone(10,0,20)
semicone = Part.makeCone(10,0,20,Base.Vector(20,0,0),Base.Vector(0,0,1),180)</pre></div>
<h2><span class="mw-headline" id="Modifying_shapes">Modifying shapes</span></h2>
<p>There are several ways to modify shapes. Some are simple transformation operations
such as moving or rotating shapes, other are more complex, such as unioning and
subtracting one shape from another. Be aware that
</p>
<h3><span class="mw-headline" id="Transform_operations">Transform operations</span></h3>
<h4><span class="mw-headline" id="Translating_a_shape">Translating a shape</span></h4>
<p>Translating is the act of moving a shape from one place to another.
Any shape (edge, face, cube, etc...) can be translated the same way:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myShape = Part.makeBox(2,2,2)
myShape.translate(Base.Vector(2,0,0))</pre></div>
<p>This will move our shape "myShape" 2 units in the x direction.
</p>
<h4><span class="mw-headline" id="Rotating_a_shape">Rotating a shape</span></h4>
<p>To rotate a shape, you need to specify the rotation center, the axis,
and the rotation angle:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myShape.rotate(Vector(0,0,0),Vector(0,0,1),180)</pre></div>
<p>The above code will rotate the shape 180 degrees around the Z Axis.
</p>
<h4><span class="mw-headline" id="Generic_transformations_with_matrixes">Generic transformations with matrixes</span></h4>
<p>A matrix is a very convenient way to store transformations in the 3D
world. In a single matrix, you can set translation, rotation and scaling
values to be applied to an object. For example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myMat = Base.Matrix()
myMat.move(Base.Vector(2,0,0))
myMat.rotateZ(math.pi/2)</pre></div>
<p>Note: FreeCAD matrixes work in radians. Also, almost all matrix operations
that take a vector can also take 3 numbers, so those 2 lines do the same thing:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myMat.move(2,0,0)
myMat.move(Base.Vector(2,0,0))</pre></div>
<p>When our matrix is set, we can apply it to our shape. FreeCAD provides 2
methods to do that: transformShape() and transformGeometry(). The difference
is that with the first one, you are sure that no deformations will occur (see
"scaling a shape" below). So we can apply our transformation like this:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> myShape.trasformShape(myMat)</pre></div>
<p>or
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myShape.transformGeometry(myMat)</pre></div>
<h4><span class="mw-headline" id="Scaling_a_shape">Scaling a shape</span></h4>
<p>Scaling a shape is a more dangerous operation because, unlike translation
or rotation, scaling non-uniformly (with different values for x, y and z)
can modify the structure of the shape. For example, scaling a circle with
a higher value horizontally than vertically will transform it into an
ellipse, which behaves mathematically very differently. For scaling, we
can't use the transformShape, we must use transformGeometry():
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>myMat = Base.Matrix()
myMat.scale(2,1,1)
myShape=myShape.transformGeometry(myMat)</pre></div>
<h3><span class="mw-headline" id="Booleska_Operationer_2">Booleska Operationer</span></h3>
<h4><span class="mw-headline" id="Hur_klipper_man_ut_en_form_fr.C3.A5n_en_annan.3F">Hur klipper man ut en form från en annan?</span></h4>
<p>cut(...)
</p><p>Skillnaden mellan denna och en given topografisk form.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cylinder = Part.makeCylinder(3,10,Base.Vector(0,0,0),Base.Vector(1,0,0))
sphere = Part.makeSphere(5,Base.Vector(5,0,0))
diff = cylinder.cut(sphere)</pre></div>
<h4><span class="mw-headline" id="Hur_f.C3.A5r_man_det_gemensamma_mellan_tv.C3.A5_former.3F">Hur får man det gemensamma mellan två former?</span></h4>
<p>common(...)
</p><p>Skärning mellan denna och en given topografisk form.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cylinder1 = Part.makeCylinder(3,10,Base.Vector(0,0,0),Base.Vector(1,0,0))
cylinder2 = Part.makeCylinder(3,10,Base.Vector(5,0,-5),Base.Vector(0,0,1))
common = cylinder1.common(cylinder2)</pre></div>
<h4><span class="mw-headline" id="Hur_f.C3.B6renar_man_tv.C3.A5_former.3F">Hur förenar man två former?</span></h4>
<p>fuse(...)
</p><p>Förening av denna och en given topografisk form.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cylinder1 = Part.makeCylinder(3,10,Base.Vector(0,0,0),Base.Vector(1,0,0))
cylinder2 = Part.makeCylinder(3,10,Base.Vector(5,0,-5),Base.Vector(0,0,1))
fuse = cylinder1.fuse(cylinder2)</pre></div>
<h4><span class="mw-headline" id="Hur_man_sektionerar_en_solid_med_given_form.3F">Hur man sektionerar en solid med given form?</span></h4>
<p>section(...)
</p><p>Sektionering av denna med en given topografisk form.
</p><p><br />
Kommer att returnera en skärningskurva, en compound med kanter
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>cylinder1 = Part.makeCylinder(3,10,Base.Vector(0,0,0),Base.Vector(1,0,0))
cylinder2 = Part.makeCylinder(3,10,Base.Vector(5,0,-5),Base.Vector(0,0,1))
section = cylinder1.section(cylinder2)
section.Wires
> []
section.Edges
> [&lt;Edge object at 0D87CFE8>, &lt;Edge object at 019564F8>, &lt;Edge object at 0D998458>,
&lt;Edge object at 0D86DE18>, &lt;Edge object at 0D9B8E80>, &lt;Edge object at 012A3640>,
&lt;Edge object at 0D8F4BB0>]</pre></div>
<h4><span class="mw-headline" id="Extrusion">Extrusion</span></h4>
<p>Extrusion is the act of "pushing" a flat shape in a certain direction resulting in
a solid body. Think of a circle becoming a tube by "pushing it out":
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>circle = Part.makeCircle(10)
tube = circle.extrude(Base.Vector(0,0,2))</pre></div>
<p>If your circle is hollow, you will obtain a hollow tube. If your circle is actually
a disc, with a filled face, you will obtain a solid cylinder:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>wire = Part.Wire(circle)
disc = Part.Face(wire)
cylinder = disc.extrude(Base.Vector(0,0,2))</pre></div>
<h2><span class="mw-headline" id="Utforska_former">Utforska former</span></h2>
<p>du kan lätt utforska den topologiska datastrukturen:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
b = Part.makeBox(100,100,100)
b.Wires
w = b.Wires[0]
w
w.Wires
w.Vertexes
Part.show(w)
w.Edges
e = w.Edges[0]
e.Vertexes
v = e.Vertexes[0]
v.Point</pre></div>
<p>Genom att skriva in ovanstående rader i python tolken, kommer du att få en god förståelse av Del objektens struktur . Här skapade vårt makeBox() kommando en solid form. Denna solid, liksom alla Del solider, innehåller ytor. Ytor innehåller alltid trådar, vilka är listor på kanter som gränsar till ytan. Varje yta har exakt en stängd tråd. I tråden, så kan vi titta på varje kant separat, och inuti varje kant, så kan vi se hörnen. Raka kanter har förstås endast två hörn. Del Hörn är OCC former, men de har ett punktattribut vilket returnerar en snygg FreeCAD Vektor.
</p>
<h3><span class="mw-headline" id="Utforska_Kanter">Utforska Kanter</span></h3>
<p>I fallet Kanter, vilken är en godtycklig kurva, så är det mycket troligt att du vill göra en diskretisering. I FreeCAD så är kanterna parametriserade av dess längder. Det innebär att du kan gå en kant/kurva genom dess längd:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
box = Part.makeBox(100,100,100)
anEdge = box.Edges[0]
print anEdge.Length</pre></div>
<p>Nu kan du komma åt många av kantens egenskaper genom att använda längden som en position. Det betyder att om
</p><p>kanten är 100mm lång så är startpositionen 0 och slutpositionen 100.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>anEdge.tangentAt(0.0) # tangent direction at the beginning
anEdge.valueAt(0.0) # Point at the beginning
anEdge.valueAt(100.0) # Point at the end of the edge
anEdge.derivative1At(50.0) # first derivative of the curve in the middle
anEdge.derivative2At(50.0) # second derivative of the curve in the middle
anEdge.derivative3At(50.0) # third derivative of the curve in the middle
anEdge.centerOfCurvatureAt(50) # center of the curvature for that position
anEdge.curvatureAt(50.0) # the curvature
anEdge.normalAt(50) # normal vector at that position (if defined)</pre></div>
<h2><span class="mw-headline" id="Anv.C3.A4nda_valet">Använda valet</span></h2>
<p>Här ser vi nu hur vi kan använda det val som användaren gjorde i visaren.
</p><p>Först av allt så skapar vi en låda och visar den i visaren
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
Part.show(Part.makeBox(100,100,100))
Gui.SendMsgToActiveView("ViewFit")</pre></div>
<p>Välj nu några ytor eller kanter. Med detta skript kan du
</p><p>iterera alla valda objekt och deras delelement:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>for o in Gui.Selection.getSelectionEx():
print o.ObjectName
for s in o.SubElementNames:
print "name: ",s
for s in o.SubObjects:
print "object: ",s</pre></div>
<p>Välj några kanter och detta skript kommer att beräkna längden:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>length = 0.0
for o in Gui.Selection.getSelectionEx():
for s in o.SubObjects:
length += s.Length
print "Length of the selected edges:" ,length</pre></div>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id="OCC_flaskan">OCC flaskan</span></h3>
<p>Ett typiskt exempel som finns på <a rel="nofollow" class="external text" href="http://www.opencascade.org/org/gettingstarted/appli/">OpenCasCade Startsida</a> är hur man bygger en flaska.
</p><p>Detta är en god övning även för FreeCAD. Du kan faktiskt följa vårt exempel nedan och OCC sidan samtidigt , du kommer att få en god förståelse om hur OCC strukturer är implementerade i FreeCAD.
</p><p><br />
</p><p>Hela skriptet nedan är även inkluderat i FreeCAD installationen (i Mod/Part mappen) och kan anropas från python tolken genom att skriva:
</p>
</div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
import MakeBottle
bottle = MakeBottle.makeBottle()
Part.show(bottle)</pre></div>
<h4><span class="mw-headline" id="Det_kompletta_skriptet">Det kompletta skriptet</span></h4>
<p>Här är det kompletta MakeBottle skriptet:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part, FreeCAD, math
from FreeCAD import Base
def makeBottle(myWidth=50.0, myHeight=70.0, myThickness=30.0):
aPnt1=Base.Vector(-myWidth/2.,0,0)
aPnt2=Base.Vector(-myWidth/2.,-myThickness/4.,0)
aPnt3=Base.Vector(0,-myThickness/2.,0)
aPnt4=Base.Vector(myWidth/2.,-myThickness/4.,0)
aPnt5=Base.Vector(myWidth/2.,0,0)
aArcOfCircle = Part.Arc(aPnt2,aPnt3,aPnt4)
aSegment1=Part.LineSegment(aPnt1,aPnt2)
aSegment2=Part.LineSegment(aPnt4,aPnt5)
aEdge1=aSegment1.toShape()
aEdge2=aArcOfCircle.toShape()
aEdge3=aSegment2.toShape()
aWire=Part.Wire([aEdge1,aEdge2,aEdge3])
aTrsf=Base.Matrix()
aTrsf.rotateZ(math.pi) # rotate around the z-axis
aMirroredWire=aWire.transformGeometry(aTrsf)
myWireProfile=Part.Wire([aWire,aMirroredWire])
myFaceProfile=Part.Face(myWireProfile)
aPrismVec=Base.Vector(0,0,myHeight)
myBody=myFaceProfile.extrude(aPrismVec)
myBody=myBody.makeFillet(myThickness/12.0,myBody.Edges)
neckLocation=Base.Vector(0,0,myHeight)
neckNormal=Base.Vector(0,0,1)
myNeckRadius = myThickness / 4.
myNeckHeight = myHeight / 10
myNeck = Part.makeCylinder(myNeckRadius,myNeckHeight,neckLocation,neckNormal)
myBody = myBody.fuse(myNeck)
faceToRemove = 0
zMax = -1.0
for xp in myBody.Faces:
try:
surf = xp.Surface
if type(surf) == Part.Plane:
z = surf.Position.z
if z > zMax:
zMax = z
faceToRemove = xp
except:
continue
myBody = myBody.makeFillet(myThickness/12.0,myBody.Edges)
return myBody
el = makeBottle()
Part.show(el)</pre></div>
<h4><span class="mw-headline" id="Detaljerad_f.C3.B6rklaring">Detaljerad förklaring</span></h4>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part, FreeCAD, math
from FreeCAD import Base</pre></div>
<p>Vi kommer förstås behöva Del modulen, men också FreeCAD.Base modulen, vilken innehåller grundläggande FreeCAD strukturer som vektorer och matriser.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>def makeBottle(myWidth=50.0, myHeight=70.0, myThickness=30.0):
aPnt1=Base.Vector(-myWidth/2.,0,0)
aPnt2=Base.Vector(-myWidth/2.,-myThickness/4.,0)
aPnt3=Base.Vector(0,-myThickness/2.,0)
aPnt4=Base.Vector(myWidth/2.,-myThickness/4.,0)
aPnt5=Base.Vector(myWidth/2.,0,0)</pre></div>
<p>Här definierar vi vår makeBottle funktion. Denna funktion kan anropas utan argument, som vi gjorde ovan, i vilket fall standardvärden för bredd, höjd, och tjocklek kommer att användas. Sedan så definierar vi ett par punkter som kommer att användas för att bygga vår grundprofil.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> aArcOfCircle = Part.Arc(aPnt2,aPnt3,aPnt4)
aSegment1=Part.LineSegment(aPnt1,aPnt2)
aSegment2=Part.LineSegment(aPnt4,aPnt5)</pre></div>
<p>Här definierar vi själva geometrin: en cirkelbåge, gjord av 3 punkter, och två linjesegment, gjorda av 2 punkter.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> aEdge1=aSegment1.toShape()
aEdge2=aArcOfCircle.toShape()
aEdge3=aSegment2.toShape()
aWire=Part.Wire([aEdge1,aEdge2,aEdge3])</pre></div>
<p>Kommer du ihåg skillnaden mellan geometri och former? Här bygger vi former utifrån vår konstruktionsgeometri. 3 kanter (kanter kan vara raka eller krökta), sedan en tråd av dessa tre kanter.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> aTrsf=Base.Matrix()
aTrsf.rotateZ(math.pi) # rotate around the z-axis
aMirroredWire=aWire.transformGeometry(aTrsf)
myWireProfile=Part.Wire([aWire,aMirroredWire])</pre></div>
<p>Tills nu så har vi bara byggt en halv profil. Lättare än att bygga hela profilen på samma sätt, så behöver vi bara spegla det vi har gjort, och limma ihop båda halvorna. Så vi skapar först en matris. En matris är ett mycket vanligt sätt att tillämpa omvandlingar på objekt i 3D världen, eftersom den i en struktur kan innehålla alla grundläggande omvandlingar som 3D objekt kan påtvingas (flytta, rotera och skala). Här, efter att vi skapat matrisen, så speglar vi den, och vi skapar en kopia av vår tråd med tillämpning av vår omvandlingsmatris. Vi har nu två trådar, och vi kan göra en tredje tråd från dem, eftersom trådar egentligen är listor med kanter.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> myFaceProfile=Part.Face(myWireProfile)
aPrismVec=Base.Vector(0,0,myHeight)
myBody=myFaceProfile.extrude(aPrismVec)
myBody=myBody.makeFillet(myThickness/12.0,myBody.Edges)</pre></div>
<p>Nu när vi har en stängd tråd, så kan den omvandlas till en yta. När vi väl har en yta, så kan vi extrudera den. Genom att göra så, så skapar vi en solid. Sedan tillämpar vi en snygg liten fasning på vårt objekt för vi vill ha en bra design, eller hur?
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> neckLocation=Base.Vector(0,0,myHeight)
neckNormal=Base.Vector(0,0,1)
myNeckRadius = myThickness / 4.
myNeckHeight = myHeight / 10
myNeck = Part.makeCylinder(myNeckRadius,myNeckHeight,neckLocation,neckNormal)</pre></div>
<p>När vår flaskas kropp är skapad, så behöver vi fortfarande skapa en hals. Så vi gör en ny solid, med en cylinder.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> myBody = myBody.fuse(myNeck)</pre></div>
<p>Ihopsmältningsoperationen, vilket i andra applikationer ibland kallas för förening, är mycket kraftfull. Den kommer att limma ihop det som behövs, och ta bort de delar som inte behövs.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> return myBody</pre></div>
<div class="mw-translate-fuzzy">
<p>Sedan så får vi tillbaka vår Del solid som ett resultat av vår funktion. Denna Del solid, liksom andra Del former, kan tillskrivas ett objekt i ett FreeCAD dokument, med:
</p>
</div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>el = makeBottle()
Part.show(el)</pre></div>
<div class="mw-translate-fuzzy">
<p>eller, mer enkelt:
</p>
</div>
<h2><span class="mw-headline" id="Box_pierced">Box pierced</span></h2>
<p>Here a complete example of building a box pierced.
</p><p>The construction is done side by side and when the cube is finished, it is hollowed out of a cylinder through.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Draft, Part, FreeCAD, math, PartGui, FreeCADGui, PyQt4
from math import sqrt, pi, sin, cos, asin
from FreeCAD import Base
size = 10
poly = Part.makePolygon( [ (0,0,0), (size, 0, 0), (size, 0, size), (0, 0, size), (0, 0, 0)])
face1 = Part.Face(poly)
face2 = Part.Face(poly)
face3 = Part.Face(poly)
face4 = Part.Face(poly)
face5 = Part.Face(poly)
face6 = Part.Face(poly)
myMat = FreeCAD.Matrix()
myMat.rotateZ(math.pi/2)
face2.transformShape(myMat)
face2.translate(FreeCAD.Vector(size, 0, 0))
myMat.rotateZ(math.pi/2)
face3.transformShape(myMat)
face3.translate(FreeCAD.Vector(size, size, 0))
myMat.rotateZ(math.pi/2)
face4.transformShape(myMat)
face4.translate(FreeCAD.Vector(0, size, 0))
myMat = FreeCAD.Matrix()
myMat.rotateX(-math.pi/2)
face5.transformShape(myMat)
face6.transformShape(myMat)
face6.translate(FreeCAD.Vector(0,0,size))
myShell = Part.makeShell([face1,face2,face3,face4,face5,face6])
mySolid = Part.makeSolid(myShell)
mySolidRev = mySolid.copy()
mySolidRev.reverse()
myCyl = Part.makeCylinder(2,20)
myCyl.translate(FreeCAD.Vector(size/2, size/2, 0))
cut_part = mySolidRev.cut(myCyl)
Part.show(cut_part)</pre></div>
<h2><span class="mw-headline" id="Ladda_och_spara">Ladda och spara</span></h2>
<p>Det finns flera sätt att spara ditt arbetet i Del modulen. Du kan förstås spara ditt FreeCAD dokument, men du kan också spara Del objekt direkt till vanliga CAD format, som BREP, IGS, STEP och STL.
</p><p>Att spara en form till en fil är lätt. det finns exportBrep(), exportIges(), exportStl() och exportStep() metoder tillgängliga för alla form objekt. Så genom att göra:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
s = Part.makeBox(0,0,0,10,10,10)
s.exportStep("test.stp")</pre></div>
<p>detta kommer att spara vår låda i en STEP fil. För att ladda en BREP, IGES eller STEP fil, gör bara motsatsen:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import Part
s = Part.Shape()
s.read("test.stp")</pre></div>
<p>To convert an <b>.stp</b> in <b>.igs</b> file simply&#160;:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> import Part
s = Part.Shape()
s.read("file.stp") # incoming file igs, stp, stl, brep
s.exportIges("file.igs") # outbound file igs</pre></div>
<p>Notera att import eller öppning av BREP, IGES eller STEP filer även kan göras direkt via Fil -&gt; Öppna eller Fil -&gt; Importera menyn. För närvarande är export fortfarande inte möjligt den vägen, men ska vara det snart.
</p>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="Konvertera_Del_objekt_till_N.C3.A4t">Konvertera Del objekt till Nät</span></h2>
<p>Att konvertera högnivåobjekt som <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del former</a> till enklare objekt som <a href="https://www.freecadweb.org/wiki/index.php?title=Mesh_Module/sv" class="mw-redirect" title="Mesh Module/sv">nät</a> är en ganska enkel operation, där alla ytor på ett Del objekt blir triangulerade. Resultatet av denna triangulering (tessellering) används sedan till att konstruera ett nät: (Låt oss anta att vårt dokument innehåller ett Del objekt)
</p>
<pre>#let's assume our document contains one part object
import Mesh
faces = []
shape = FreeCAD.ActiveDocument.ActiveObject.Shape
triangles = shape.tessellate(1) # the number represents the precision of the tessellation)
for tri in triangles[1]:
face = []
for i in range(3):
vindex = tri[i]
face.append(triangles[0][vindex])
faces.append(face)
m = Mesh.Mesh(faces)
Mesh.show(m) </pre>
<p>Ibland så är den triangulering av vissa ytor som erbjuds av OpenCascade ganska ful. Om ytan har en rektangulär parameterrymd och inte innehåller några hål eller andra trimkurvor så kan du också skapa ett eget Nät:
</p>
<pre>import Mesh
def makeMeshFromFace(u,v,face):
(a,b,c,d)=face.ParameterRange
pts=[]
for j in range(v):
for i in range(u):
s=1.0/(u-1)*(i*b+(u-1-i)*a)
t=1.0/(v-1)*(j*d+(v-1-j)*c)
pts.append(face.valueAt(s,t))
mesh=Mesh.Mesh()
for j in range(v-1):
for i in range(u-1):
mesh.addFacet(pts[u*j+i],pts[u*j+i+1],pts[u*(j+1)+i])
mesh.addFacet(pts[u*(j+1)+i],pts[u*j+i+1],pts[u*(j+1)+i+1])
return mesh </pre>
<h2><span class="mw-headline" id="Konvertera_N.C3.A4t_till_Del_objekt">Konvertera Nät till Del objekt</span></h2>
<p>Konvertering av Nät till Del objekt är en mycket viktig operation i CAD arbete, eftersom du mycket ofta tar emot 3D data i nätformat från andra människor eller utmatade från andra applikationer. Nät är mycket praktiskt för att representera friformsgeometri och stora visuella scener, eftersom den är mycket kompakt, men för CAD föredrar vi i allmänhet mer högnivåobjekt som bär mycket mer information, som solider, eller ytor som är skapade av kurvor istället för trianglar.
</p><p>Konvertering av nät till dessa högnivåobjekt (hanterat av <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a> i FreeCAD) är inte en lätt operation. Nät kan vara gjord av tusentals trianglar (till exempel när de är genererade av en 3D skanner), och att ha solider gjorda med samma antal ytor skulle bli väldigt tungrott att manipulera. Så generellt sett så vill du optimera objektet när du konverterar.
</p><p>FreeCAD erbjuder för närvarande två metoder för att konvertera Nät till Del objekt. Den första metoden är en enkel, direkt konvertering, utan någon optimering:
</p>
<pre>import Mesh,Part
mesh = Mesh.createTorus()
shape = Part.Shape()
shape.makeShapeFromMesh(mesh.Topology,0.05) # the second arg is the tolerance for sewing
solid = Part.makeSolid(shape)
Part.show(solid) </pre>
<p>Den andra metoden erbjuder möjligheten att anse nätfasetter koplanära när vinkeln mellan dem är under ett visst värde. Detta tillåter uppbyggnad av mycket enklare former: (Låt oss anta att vårt dokument innehåller ett Nät objekt)
</p>
<pre># let's assume our document contains one Mesh object
import Mesh,Part,MeshPart
faces = []
mesh = App.ActiveDocument.ActiveObject.Mesh
segments = mesh.getPlanes(0.00001) # use rather strict tolerance here
for i in segments:
if len(i) &gt; 0:
# a segment can have inner holes
wires = MeshPart.wireFromSegment(mesh, i)
# we assume that the exterior boundary is that one with the biggest bounding box
if len(wires) &gt; 0:
ext=None
max_length=0
for i in wires:
if i.BoundBox.DiagonalLength &gt; max_length:
max_length = i.BoundBox.DiagonalLength
ext = i
wires.remove(ext)
# all interior wires mark a hole and must reverse their orientation, otherwise Part.Face fails
for i in wires:
i.reverse()
# make sure that the exterior wires comes as first in the lsit
wires.insert(0, ext)
faces.append(Part.Face(wires))
shell=Part.Compound(faces)
Part.show(shell)
#solid = Part.Solid(Part.Shell(faces))
#Part.show(solid) </pre>
<div style="clear:both"></div>
<p><br />
</p><p>I grunden är FreeCAD ett kollage av olika kraftfulla bibliotek, vilket de viktigaste är <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_CASCADE">openCascade</a>, för hantering och konstruktion av geometri, <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Coin3D">Coin3d</a> för att visa denna geometri, och <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Qt_(toolkit)">Qt</a> för att sätta ihop allt detta i ett snyggt grafiskt användargränssnitt.
</p><p>Den geometri som syns i FreeCAD's #D vyer är renderade av Coin3D biblioteket. Coin3D är en implementering av <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">OpenInventor</a> standarden. openCascade mjukvaran erbjuder också samma funktionalitet, men det beslöts när FreeCAD påbörjades att inte använda openCascade's inbyggda visare utan istället använda sig av den snabbare coin3D mjukvaran.
</p><p><a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Open_Inventor">OpenInventor</a> är egentligen ett 3D scen beskrivningsspråk. Den scen som beskrivs i renderas sedan av OpenGL på din skärm. Coin3D gör arbetet med detta, så programmeraren inte behöver bry sig om komplexa openGL anrop, programmeraren behöver bara förse den med giltig OpenInventor kod. Den stora fördelen är att openInventor är en mycket välkänd och väldokumenterad standard.
</p><p>Ett av de stora jobben som FreeCAD gör för dig är att översätta openCascade geometriinformation till openInventor språket.
</p><p>OpenInventor beskriver en 3D scen i formen av en <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Scene_graph">scenegraph</a>, som den nedan:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Scenegraph.gif" class="image"><img alt="Scenegraph.gif" src="Scenegraph.gif" width="422" height="496" /></a>
image from <a rel="nofollow" class="external text" href="http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/index.html">Inventor mentor</a>
</p><p>En openInventor scengraf beskriver allt som utgör en 3D scen, som geometri, färger, material, ljus, etc, och organiserar all den data i smidig och klar struktur. Allting kan grupperas till sub-strukturer, vilket tillåter dig att organisera ditt sceninnehåll så som du vill. Här är ett exempel på en openInventor fil:
</p>
<pre>#Inventor V2.0 ascii
Separator {
RotationXYZ {
axis Z
angle 0
}
Transform {
translation 0 0 0.5
}
Separator {
Material {
diffuseColor 0.05 0.05 0.05
}
Transform {
rotation 1 0 0 1.5708
scaleFactor 0.2 0.5 0.2
}
Cylinder {
}
}
} </pre>
<p>Som du kan se, så är strukturen mycket simpel. Du använder separatorer för att organisera din data till block, lite som du skulle organisera dina filer i mappar. Varje uttryck påverkar vad som kommer härnäst, till exempel de första två punkterna i vår rot separator är en rotation och en förflyttning, båda kommer att påverka nästa punkt, vilken är en separator. I den separatorn, så är ett material definierat, och en annan förflyttning. Vår cylinder kommer därför att påverkas av båda förändringarna, den som vi lade direkt på den och den som vi lade på dess förälderseparator.
</p><p>Vi har också många andra elementtyper för att organisera vår scen, som grupper, växlar eller annoteringar. Vi kan definiera mycket komplexa material för våra objekt, med färg, texturer, skugglägen och transparens. Vi kan också definiera ljus, kameror, och även rörelser. Det är även möjligt att bädda in skriptbitar i openInventor filer, för att definiera mer komplext beteende.
</p><p>Om du är intresserad av att lära dig mer om openInventor, hoppa direkt till dess berömdaste referens, <a rel="nofollow" class="external text" href="http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/index.html">Inventor mentor</a>.
</p><p>I FreeCAD behöver vi normalt inte interagera direkt med scengrafen openInventor. Varje objekt i ett FreeCAD dokument, ett nät, en delform eller något annat, blir automatiskt konverterat till openInventor kod och insatt i huvudscengrafen som du ser i en 3D vy. Den scengrafen uppdateras kontinuerligt när du gör förändringar, lägger till eller tar bort objekt i dokumentet. Alla objekt (i App rymden) har en visare(ett motsvarande objekt i Gui rymden), som anvarar för att ge openInventor kod.
</p><p>Men det finns många fördelar med att kunna komma åt scengrafen direkt. Vi kan till exempel temporärt ändra utseendet på ett objekt, eller vi kan lägga till objekt som inte har en reell existens i FreeCAD dokumentet, som till exempel konstruktionsgeometri, hjälpare, grafiska tips eller verktyg som manipulatorer eller information på skärmen.
</p><p>Själva FreeCAD har flera verktyg för att se eller ändra openInventor kod. Till exempel, följande pythonkod kommer att visa openInventor representationen av ett valt objekt:
</p>
<pre>obj = FreeCAD.ActiveDocument.ActiveObject
viewprovider = obj.ViewObject
print viewprovider.toString() </pre>
<p>Men vi har också en python modul som tillåter komplett åtkomst till allt som hanterar av Coin3D, som vår FreeCAD scengraf. Så, läs vidare på <a href="https://www.freecadweb.org/wiki/index.php?title=Pivy/sv" title="Pivy/sv">Pivy</a>.
</p>
<div style="clear:both"></div>
<p><br />
</p><p><a rel="nofollow" class="external text" href="http://pivy.coin3d.org/">Pivy</a> is a python binding library for <a rel="nofollow" class="external text" href="http://www.coin3d.org">Coin3d</a>, the 3D-rendering library used in FreeCAD. When imported in a running python interpreter, it allows to dialog directly with any running Coin3d <a href="Scenegraph.html" title="Scenegraph">scenegraphs</a>, such as the FreeCAD 3D views, or even to create new ones. Pivy is bundled in standard FreeCAD installation.
</p><p>Coin biblioteket är uppdelat i flera delar, själva coin, för manipulation av scengrafer och bindningar för flera GUI system, som windows, eller som i vårt fall, qt. Dessa moduler är även tillgängliga för pivy, beroende på om de finns i systemet. Coin modulen finns alltid, och det är vad vi kommer att använda i alla fall, eftersom vi inte behöver bry oss om att förankra vårt 3D fönster i något gränssnitt, det görs redan av FreeCAD själv. Allt vi behöver göra är detta:
</p>
<pre>from pivy import coin </pre>
<h2><span class="mw-headline" id="Komma_.C3.A5t_och_.C3.A4ndra_scengrafen">Komma åt och ändra scengrafen</span></h2>
<p>Vi såg i <a href="https://www.freecadweb.org/wiki/index.php?title=Scenegraph/sv" title="Scenegraph/sv">Scengraf</a> sidan hur en typisk Coin scen är organiserad. Allt som syns i en FreeCAD 3D vy är en coin scengraf, organiserad på samma sätt. Vi har en rotnod, och alla objekt på skärmen är dess barn.
</p><p>FreeCAD har ett lätt sätt att komma åt 3D vy scengrafens rotnod:
</p>
<pre>sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
print sg </pre>
<p>Detta kommer att returnera rotnoden:
</p>
<pre>&lt;pivy.coin.SoSelection; proxy of &lt;Swig Object of type 'SoSelection *' at 0x360cb60&gt; &gt; </pre>
<p>Vi kan inspektera vår scen's närmaste barn:
</p>
<pre>for node in sg.getChildren():
print node </pre>
<p>En del av dessa noder, som SoSeparators eller SoGroups, kan själva ha barn. Den kompletta listan på de tillgängliga coin objekten kan återfinnas på <a rel="nofollow" class="external text" href="http://coin3d.bitbucket.org/Coin/classes.html">official coin documentation</a>.
</p><p>Låt oss försöka lägga till något till vår scengraf nu. Vi lägger till en snygg röd kub:
</p>
<pre>col = coin.SoBaseColor()
col.rgb=(1,0,0)
cub = coin.SoCube()
myCustomNode = coin.SoSeparator()
myCustomNode.addChild(col)
myCustomNode.addChild(cub)
sg.addChild(myCustomNode) </pre>
<p>och här är vår (snygga) röda kub. Låt os nu försöka detta:
</p>
<pre>col.rgb=(1,1,0) </pre>
<p>Se? Allt är fortfarande åtkomligt och förändringsbart direkt. Inget behov av omberäkningar eller omritningar, coin tar hand om allt. Du kan lägga till saker till din scengraf, ändra egenskaper, gömma saker, visa temporära objekt, allting. Detta gäller förstås endast visningen i 3D vyn. Den visningen beräknas om av FreeCAD när filen öppnas, och när ett objekt behöver omberäknas. Så om du ändrar en aspekt på ett existerande FreeCAD objekt, så kommer dessa ändringar att förloras om objektet beräknas om eller när du öppnar filen igen.
</p><p>En nyckel till arbete med scengrafer i dina skript är att kunna komma åt vissa egenskaper på de noder som du vid behov lägger till. Till exempel, om vi skulle vilja flytta vår kub, så skulle vil ha lagt till en SoTranslation nod till vår anpassade nod, och det skulle ha sett ut så här:
</p>
<pre>col = coin.SoBaseColor()
col.rgb=(1,0,0)
trans = coin.SoTranslation()
trans.translation.setValue([0,0,0])
cub = coin.SoCube()
myCustomNode = coin.SoSeparator()
myCustomNode.addChild(col)
mtCustomNode.addChild(trans)
myCustomNode.addChild(cub)
sg.addChild(myCustomNode) </pre>
<p>Kom ihåg att i en openInventor scengraf, så är ordningen viktig. en nod påverkar efterkommande saker, så du kan säga något som&#160;: färg röd, kub, färg gul, sfär, och du kommer att få en röd kub och en gul sfär. Om vi lade till förflyttning till vår existerande anpassade nod, så skulle den komma efter kuben, och inte påverka den. Om vi hade satt in den när vi skapade den, som här ovan, så skulle vi nu kunna göra:
</p>
<pre>trans.translation.setValue([2,0,0]) </pre>
<p>Och vår kub skulle hoppa 2 enheter åt höger.
Slutligen, att ta bort något görs med:
</p>
<pre>sg.removeChild(myCustomNode) </pre>
<h2><span class="mw-headline" id="Anv.C3.A4nda_.C3.A5teranropsmekanismer">Använda återanropsmekanismer</span></h2>
<p>En <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Callback_%28computer_science%29">återanropsmekanism</a> är ett system som tillåter ett bibliotek som du använder, som vårt coin bibliotek, att anropa tillbaka, vilket innebär att anropa en viss funktion från ditt för närvarande körande python objekt. Detta är väldigt användbart, därför att på det sättet så kan coin meddela python objektet om någon specifik händelse uppstår i scenen. Coin kan övervaka väldigt olika saker, som musposition, musklick, tangentbordsnedtryckningar, och många andra saker.
</p><p>FreeCAD erbjuder ett lätt sätt att använda sådana återanrop:
</p>
<pre>class ButtonTest:
def __init__(self):
self.view = FreeCADGui.ActiveDocument.ActiveView
self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getMouseClick)
def getMouseClick(self,event_cb):
event = event_cb.getEvent()
if event.getState() == SoMouseButtonEvent.DOWN:
print "Alert!!! A mouse button has been improperly clicked!!!"
self.view.removeEventCallbackSWIG(SoMouseButtonEvent.getClassTypeId(),self.callback)
ButtonTest() </pre>
<p>Återanropet måste initieras från ett objekt, därför så måste det objektet fortfarande köras när återanropet uppstår.
</p><p>Se även <a href="/wiki/Code_snippets#Observing_mouse_events_in_the_3D_viewer_via_Python.2Fsv" title="Code snippets">den kompletta listan</a> för möjliga händelser och dess parametrar, eller <a rel="nofollow" class="external text" href="http://doc.coin3d.org/Coin/classes.html">i den officiella coin dokumentationen</a>.
</p>
<h2><span class="mw-headline" id="Dokumentation">Dokumentation</span></h2>
<p>Olyckligtvis har pivy själv ingen ordentlig dokumentation, men eftersom det är en riktig översättning av coin, så kan du med säkerhet använda coin dokumentationen som referens, och använda python stil istället för c++ stil (till exempel SoFile::getClassTypeId() skulle i pivy bli SoFile.getClassId())
</p>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="PySide">PySide</span></h2>
<p><a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/PySide">PySide</a> is a Python binding of the cross-platform GUI toolkit Qt. FreeCAD uses PySide for all GUI (Graphic User Interface) purposes inside of Python. PySide is an alternative to the PyQt package which was previously used by FreeCAD for its GUI. PySide has a more permissible licence. See <a rel="nofollow" class="external text" href="http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt">Differences Between PySide and PyQt</a> for more information on the differences.
</p><p>Users of FreeCAD often achieve everything using the built-in interface. But for users who want to customise their operations then the Python interface exists which is documented in the <a href="Python_scripting_tutorial.html" title="Python scripting tutorial">Python Scripting Tutorial</a>. The Python interface for FreeCAD had great flexibility and power. For its user interaction Python with FreeCAD uses PySide, which is what is documented on this page.
</p><p>Python offers the 'print' statement which gives the code:
</p>
<pre>print 'Hello World' </pre>
<p>With Python's print statement you have only limited control of the appearance and behaviour. PySide supplies the missing control and also handles environments (such as the FreeCAD macro file environment) where the built-in facilities of Python are not enough.
</p><p>PySide's abilities range from:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:PySideScreenSnapshot1.jpg" class="image"><img alt="PySideScreenSnapshot1.jpg" src="PySideScreenSnapshot1.jpg" width="279" height="163" /></a>
</p><p>to:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:PySideScreenSnapshot2.jpg" class="image"><img alt="PySideScreenSnapshot2.jpg" src="PySideScreenSnapshot2.jpg" width="400" height="311" /></a>
</p><p>PySide is described in the following 3 pages which should follow on one from each other:
</p>
<ul><li> <a href="PySide_Beginner_Examples.html" title="PySide Beginner Examples">Beginner PySide Examples</a> (Hello World, announcements, enter text, enter number)</li>
<li> <a href="PySide_Medium_Examples.html" title="PySide Medium Examples">Medium PySide Examples</a> (window sizing, hiding widgets, popup menus, mouse position, mouse events)</li>
<li> <a href="PySide_Advanced_Examples.html" title="PySide Advanced Examples">Advanced PySide Examples</a> (widgets etc.)</li></ul>
<p>They divide the subject matter into 3 parts, differentiated by level of exposure to PySide, Python and the FreeCAD internals. The first page has overview and background material giving a description of PySide and how it is put together while the second and third pages are mostly code examples at different levels.
</p><p>The intention is that the associated pages will provide simple Python code to run PySide so that the user working on a problem can easily copy the code, paste it into their own work, adapt it as necessary and return to their problem solving with FreeCAD. Hopefully they don't have to go chasing off across the internet looking for answers to PySide questions. At the same time this page is not intended to replace the various comprehensive PySide tutorials and reference sites available on the web.
</p>
<div style="clear:both"></div>
<p><br />
</p><p>Förutom standard objekttyper som annoteringar, nät och delobjekt, så erbjuder FreeCAD också den fantastiska möjligheten att bygga 100% python-skriptade objekt, som kallas för Python Funktioner. dessa objekt kommer att bete sig exakt som alla andra FreeCAD objekt, de kan sparas i ett dokument och öppnas av en annan FreeCAD installation, eftersom den python kod som definierar objektet även sparas i dokumentet.
</p><p>One particularity must be understood, those objects are saved in FreeCAD FcStd files with python's <a rel="nofollow" class="external text" href="http://docs.python.org/2/library/json.html">json</a> module. That module turns a python object as a string, allowing it to be added to the saved file. On load, the json module uses that string to recreate the original object, provided it has access to the source code that created the object. This means that if you save such a custom object and open it on a machine where the python code that generated the object is not present, the object won't be recreated. If you distribute such objects to others, you will need to distribute the python script that created it together.
</p><p>Python Funktioner följer samma regler som alla FreeCAD funktioner: de är separerade i App och GUI delar. App delen, Dokumentobjektet, definierar vårt objekts geometri , medan dess gränssnittsdel, Visaobjektet, definierar hur objektet kommer att ritas på skärmen. VisaObjektet, är som alla andra FreeCAD funktioner, endast tillgängligt när du kör FreeCAD i dess eget gränssnitt. Det finns flera egenskaper och metoder tillgängliga för att bygga ditt objekt. Egenskaperna måste vara en av de fördefinierade egenskapstyperna som FreeCAD erbjuder, och kommer att visas i egenskapsfönstret, så de kan redigeras av användaren. på detta sätt så är Python Funktionsobjekt totalt parametrisk. Du kan definiera egenskaper för objektet och dess Visaobjekt separat.
</p><p><b>Hint:</b> In former versions we used Python's <a rel="nofollow" class="external text" href="http://docs.python.org/release/2.5/lib/module-cPickle.html">cPickle</a> module. However, this module executes arbitrary code and thus causes a security problem. Thus, we moved to Python's json module.
</p>
<h2><span class="mw-headline" id="Basic_example">Basic example</span></h2>
<p>The following sample can be found in the <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/TemplatePyMod/FeaturePython.py">src/Mod/TemplatePyMod/FeaturePython.py</a> file, together with several other examples:
</p>
<pre>'''Examples for a feature class and its view provider.'''
import FreeCAD, FreeCADGui
from pivy import coin
class Box:
def __init__(self, obj):
'''Add some custom properties to our box feature'''
obj.addProperty("App::PropertyLength","Length","Box","Length of the box").Length=1.0
obj.addProperty("App::PropertyLength","Width","Box","Width of the box").Width=1.0
obj.addProperty("App::PropertyLength","Height","Box", "Height of the box").Height=1.0
obj.Proxy = self
def onChanged(self, fp, prop):
'''Do something when a property has changed'''
FreeCAD.Console.PrintMessage("Change property: " + str(prop) + "\n")
def execute(self, fp):
'''Do something when doing a recomputation, this method is mandatory'''
FreeCAD.Console.PrintMessage("Recompute Python Box feature\n")
class ViewProviderBox:
def __init__(self, obj):
'''Set this object to the proxy object of the actual view provider'''
obj.addProperty("App::PropertyColor","Color","Box","Color of the box").Color=(1.0,0.0,0.0)
obj.Proxy = self
def attach(self, obj):
'''Setup the scene sub-graph of the view provider, this method is mandatory'''
self.shaded = coin.SoGroup()
self.wireframe = coin.SoGroup()
self.scale = coin.SoScale()
self.color = coin.SoBaseColor()
data=coin.SoCube()
self.shaded.addChild(self.scale)
self.shaded.addChild(self.color)
self.shaded.addChild(data)
obj.addDisplayMode(self.shaded,"Shaded");
style=coin.SoDrawStyle()
style.style = coin.SoDrawStyle.LINES
self.wireframe.addChild(style)
self.wireframe.addChild(self.scale)
self.wireframe.addChild(self.color)
self.wireframe.addChild(data)
obj.addDisplayMode(self.wireframe,"Wireframe");
self.onChanged(obj,"Color")
def updateData(self, fp, prop):
'''If a property of the handled feature has changed we have the chance to handle this here'''
# fp is the handled feature, prop is the name of the property that has changed
l = fp.getPropertyByName("Length")
w = fp.getPropertyByName("Width")
h = fp.getPropertyByName("Height")
self.scale.scaleFactor.setValue(float(l),float(w),float(h))
pass
def getDisplayModes(self,obj):
'''Return a list of display modes.'''
modes=[]
modes.append("Shaded")
modes.append("Wireframe")
return modes
def getDefaultDisplayMode(self):
'''Return the name of the default display mode. It must be defined in getDisplayModes.'''
return "Shaded"
def setDisplayMode(self,mode):
'''Map the display mode defined in attach with those defined in getDisplayModes.\
Since they have the same names nothing needs to be done. This method is optional'''
return mode
def onChanged(self, vp, prop):
'''Here we can do something when a single property got changed'''
FreeCAD.Console.PrintMessage("Change property: " + str(prop) + "\n")
if prop == "Color":
c = vp.getPropertyByName("Color")
self.color.rgb.setValue(c[0],c[1],c[2])
def getIcon(self):
'''Return the icon in XPM format which will appear in the tree view. This method is\
optional and if not defined a default icon is shown.'''
return """
/* XPM */
static const char * ViewProviderBox_xpm[] = {
"16 16 6 1",
" c None",
". c #141010",
"+ c #615BD2",
"@ c #C39D55",
"# c #000000",
"$ c #57C355",
" ........",
" ......++..+..",
" .@@@@.++..++.",
" .@@@@.++..++.",
" .@@ .++++++.",
" ..@@ .++..++.",
"###@@@@ .++..++.",
"##$.@@$#.++++++.",
"#$#$.$$$........",
"#$$####### ",
"#$$#$$$$$# ",
"#$$#$$$$$# ",
"#$$#$$$$$# ",
" #$#$$$$$# ",
" ##$$$$$# ",
" ####### "};
"""
def __getstate__(self):
'''When saving the document this object gets stored using Python's json module.\
Since we have some un-serializable parts here -- the Coin stuff -- we must define this method\
to return a tuple of all serializable objects or None.'''
return None
def __setstate__(self,state):
'''When restoring the serialized object from document we have the chance to set some internals here.\
Since no data were serialized nothing needs to be done here.'''
return None
def makeBox():
FreeCAD.newDocument()
a=FreeCAD.ActiveDocument.addObject("App::FeaturePython","Box")
Box(a)
ViewProviderBox(a.ViewObject)
makeBox() </pre>
<h2><span class="mw-headline" id="Tillg.C3.A4ngliga_egenskaper">Tillgängliga egenskaper</span></h2>
<p>Egenskaper är PythonFunktion objektens sanna byggstenar. Genom dem, så kan användaren interagera och ändra objektet. Efter att ett nytt PythonFunktion objekt har skapats i ditt dokument ( a=FreeCAD.ActiveDocument.addObject("App::FeaturePython","Box") ), så kan du få en lista på de tillgängliga egenskaperna genom att skriva:
</p>
<pre>obj.supportedProperties() </pre>
<p>Du kommer att få en lista på tillgängliga egenskaper:
</p>
<pre>App::PropertyBool
App::PropertyBoolList
App::PropertyFloat
App::PropertyFloatList
App::PropertyFloatConstraint
App::PropertyQuantity
App::PropertyQuantityConstraint
App::PropertyAngle
App::PropertyDistance
App::PropertyLength
App::PropertySpeed
App::PropertyAcceleration
App::PropertyForce
App::PropertyPressure
App::PropertyInteger
App::PropertyIntegerConstraint
App::PropertyPercent
App::PropertyEnumeration
App::PropertyIntegerList
App::PropertyIntegerSet
App::PropertyMap
App::PropertyString
App::PropertyUUID
App::PropertyFont
App::PropertyStringList
App::PropertyLink
App::PropertyLinkSub
App::PropertyLinkList
App::PropertyLinkSubList
App::PropertyMatrix
App::PropertyVector
App::PropertyVectorList
App::PropertyPlacement
App::PropertyPlacementLink
App::PropertyColor
App::PropertyColorList
App::PropertyMaterial
App::PropertyPath
App::PropertyFile
App::PropertyFileIncluded
App::PropertyPythonObject
Part::PropertyPartShape
Part::PropertyGeometryList
Part::PropertyShapeHistory
Part::PropertyFilletEdges
Sketcher::PropertyConstraintList </pre>
<p>När du adderar egenskaper till dina anpassade objekt, var uppmärksam på detta:
</p>
<ul><li> Använd inte tecknen "&lt;" eller "&gt;" i egenskapsbeskrivningen (det förstör xml delarna i .fcstd filen)</li>
<li> Egenskaper lagras i alfabetisk ordning i en .fcstd fil. Om du har en form i dina egenskaper, så kommer alla egenskaper vars namn kommer efter "Form" i alfabetisk ordning att laddas EFTER formen, vilket kan orsaka ett märkligt beteende.</li></ul>
<h2><span class="mw-headline" id="Property_Type">Property Type</span></h2>
<p>By default the properties can be updated. It is possible to make the properties read-only, for instance in the case one wants to show the result of a method. It is also possible to hide the property.
The property type can be set using
</p>
<pre>obj.setEditorMode("MyPropertyName", mode) </pre>
<p>where mode is a short int that can be set to:
</p>
<pre> 0 -- default mode, read and write
1 -- read-only
2 -- hidden
</pre>
<p>The EditorModes are not set at FreeCAD file reload. This could to be done by the __setstate__ function. See <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=10#p108072">http://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=10#p108072</a>. By using the setEditorMode the properties are only read only in PropertyEditor. They could still be changed from python. To really make them read only the setting has to be passed directly inside the addProperty function. See <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=20#p109709">http://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=20#p109709</a> for an example.
</p>
<h2><span class="mw-headline" id="Andra_mer_komplexa_exempel">Andra mer komplexa exempel</span></h2>
<p>Detta exempel använder sig av <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a> för att skapa en oktahedron, sedan skapas dess coin representation med pivy.
</p><p>Det första är själva Dokument objektet:
</p>
<pre>import FreeCAD, FreeCADGui, Part
import pivy
from pivy import coin
class Octahedron:
def __init__(self, obj):
"Add some custom properties to our box feature"
obj.addProperty("App::PropertyLength","Length","Octahedron","Length of the octahedron").Length=1.0
obj.addProperty("App::PropertyLength","Width","Octahedron","Width of the octahedron").Width=1.0
obj.addProperty("App::PropertyLength","Height","Octahedron", "Height of the octahedron").Height=1.0
obj.addProperty("Part::PropertyPartShape","Shape","Octahedron", "Shape of the octahedron")
obj.Proxy = self
def execute(self, fp):
# Define six vetices for the shape
v1 = FreeCAD.Vector(0,0,0)
v2 = FreeCAD.Vector(fp.Length,0,0)
v3 = FreeCAD.Vector(0,fp.Width,0)
v4 = FreeCAD.Vector(fp.Length,fp.Width,0)
v5 = FreeCAD.Vector(fp.Length/2,fp.Width/2,fp.Height/2)
v6 = FreeCAD.Vector(fp.Length/2,fp.Width/2,-fp.Height/2)
# Make the wires/faces
f1 = self.make_face(v1,v2,v5)
f2 = self.make_face(v2,v4,v5)
f3 = self.make_face(v4,v3,v5)
f4 = self.make_face(v3,v1,v5)
f5 = self.make_face(v2,v1,v6)
f6 = self.make_face(v4,v2,v6)
f7 = self.make_face(v3,v4,v6)
f8 = self.make_face(v1,v3,v6)
shell=Part.makeShell([f1,f2,f3,f4,f5,f6,f7,f8])
solid=Part.makeSolid(shell)
fp.Shape = solid
# helper mehod to create the faces
def make_face(self,v1,v2,v3):
wire = Part.makePolygon([v1,v2,v3,v1])
face = Part.Face(wire)
return face </pre>
<p>Sedan så har vi visarobjektet, ansvarigt för att visa objektet i 3D scenen:
</p>
<pre>class ViewProviderOctahedron:
def __init__(self, obj):
"Set this object to the proxy object of the actual view provider"
obj.addProperty("App::PropertyColor","Color","Octahedron","Color of the octahedron").Color=(1.0,0.0,0.0)
obj.Proxy = self
def attach(self, obj):
"Setup the scene sub-graph of the view provider, this method is mandatory"
self.shaded = coin.SoGroup()
self.wireframe = coin.SoGroup()
self.scale = coin.SoScale()
self.color = coin.SoBaseColor()
self.data=coin.SoCoordinate3()
self.face=coin.SoIndexedLineSet()
self.shaded.addChild(self.scale)
self.shaded.addChild(self.color)
self.shaded.addChild(self.data)
self.shaded.addChild(self.face)
obj.addDisplayMode(self.shaded,"Shaded");
style=coin.SoDrawStyle()
style.style = coin.SoDrawStyle.LINES
self.wireframe.addChild(style)
self.wireframe.addChild(self.scale)
self.wireframe.addChild(self.color)
self.wireframe.addChild(self.data)
self.wireframe.addChild(self.face)
obj.addDisplayMode(self.wireframe,"Wireframe");
self.onChanged(obj,"Color")
def updateData(self, fp, prop):
"If a property of the handled feature has changed we have the chance to handle this here"
# fp is the handled feature, prop is the name of the property that has changed
if prop == "Shape":
s = fp.getPropertyByName("Shape")
self.data.point.setNum(6)
cnt=0
for i in s.Vertexes:
self.data.point.set1Value(cnt,i.X,i.Y,i.Z)
cnt=cnt+1
self.face.coordIndex.set1Value(0,0)
self.face.coordIndex.set1Value(1,1)
self.face.coordIndex.set1Value(2,2)
self.face.coordIndex.set1Value(3,-1)
self.face.coordIndex.set1Value(4,1)
self.face.coordIndex.set1Value(5,3)
self.face.coordIndex.set1Value(6,2)
self.face.coordIndex.set1Value(7,-1)
self.face.coordIndex.set1Value(8,3)
self.face.coordIndex.set1Value(9,4)
self.face.coordIndex.set1Value(10,2)
self.face.coordIndex.set1Value(11,-1)
self.face.coordIndex.set1Value(12,4)
self.face.coordIndex.set1Value(13,0)
self.face.coordIndex.set1Value(14,2)
self.face.coordIndex.set1Value(15,-1)
self.face.coordIndex.set1Value(16,1)
self.face.coordIndex.set1Value(17,0)
self.face.coordIndex.set1Value(18,5)
self.face.coordIndex.set1Value(19,-1)
self.face.coordIndex.set1Value(20,3)
self.face.coordIndex.set1Value(21,1)
self.face.coordIndex.set1Value(22,5)
self.face.coordIndex.set1Value(23,-1)
self.face.coordIndex.set1Value(24,4)
self.face.coordIndex.set1Value(25,3)
self.face.coordIndex.set1Value(26,5)
self.face.coordIndex.set1Value(27,-1)
self.face.coordIndex.set1Value(28,0)
self.face.coordIndex.set1Value(29,4)
self.face.coordIndex.set1Value(30,5)
self.face.coordIndex.set1Value(31,-1)
def getDisplayModes(self,obj):
"Return a list of display modes."
modes=[]
modes.append("Shaded")
modes.append("Wireframe")
return modes
def getDefaultDisplayMode(self):
"Return the name of the default display mode. It must be defined in getDisplayModes."
return "Shaded"
def setDisplayMode(self,mode):
return mode
def onChanged(self, vp, prop):
"Here we can do something when a single property got changed"
FreeCAD.Console.PrintMessage("Change property: " + str(prop) + "\n")
if prop == "Color":
c = vp.getPropertyByName("Color")
self.color.rgb.setValue(c[0],c[1],c[2])
def getIcon(self):
return """
/* XPM */
static const char * ViewProviderBox_xpm[] = {
"16 16 6 1",
" c None",
". c #141010",
"+ c #615BD2",
"@ c #C39D55",
"# c #000000",
"$ c #57C355",
" ........",
" ......++..+..",
" .@@@@.++..++.",
" .@@@@.++..++.",
" .@@ .++++++.",
" ..@@ .++..++.",
"###@@@@ .++..++.",
"##$.@@$#.++++++.",
"#$#$.$$$........",
"#$$####### ",
"#$$#$$$$$# ",
"#$$#$$$$$# ",
"#$$#$$$$$# ",
" #$#$$$$$# ",
" ##$$$$$# ",
" ####### "};
"""
def __getstate__(self):
return None
def __setstate__(self,state):
return None </pre>
<p>Slutligen, när vårt objekt och dess visningsobjekt är definierade, så behöver vi bara anropa dem:
</p>
<pre>FreeCAD.newDocument()
a=FreeCAD.ActiveDocument.addObject("App::FeaturePython","Octahedron")
Octahedron(a)
ViewProviderOctahedron(a.ViewObject) </pre>
<h2><span class="mw-headline" id="G.C3.B6ra_objekt_valbara">Göra objekt valbara</span></h2>
<p>Om du vill göra ditt objekt valbart, eller åtminstone en del av den, genom att klicka på den i vyn, så måste du inkludera dess geometri inuti en SoFCSelection nod. Om ditt objekt har en komplex representation, med widgetar, annoteringar, etc, så kanske du bara vill inkludera en del av den i en SoFCSelection. Allt som är en SoFCSelection skannas konstant av FreeCAD för att detektera val/förval, så det är vettigt att inte försöka överbelasta den med onödig skanning. Detta är vad du skulle göra för att inkludera en self.face från det ovan visade exemplet:
</p>
<pre>selectionNode = coin.SoType.fromName("SoFCSelection").createInstance()
selectionNode.documentName.setValue(FreeCAD.ActiveDocument.Name)
selectionNode.objectName.setValue(obj.Object.Name) # here obj is the ViewObject, we need its associated App Object
selectionNode.subElementName.setValue("Face")
selectNode.addChild(self.face)
...
self.shaded.addChild(selectionNode)
self.wireframe.addChild(selectionNode) </pre>
<p>Du skapar en SoFCSelection nod, sedan lägger du till dina geometrinoder till den, sedan lägger du till den till din huvudnod, istället för att lägga till dina geometrinoder direkt.
</p>
<h2><span class="mw-headline" id="Arbeta_med_enkla_former">Arbeta med enkla former</span></h2>
<p>Om ditt parametriska objektbara resulterar i en form, så behöver du inte använda ett visarobjekt. Formen kommer att visas med hjälp av FreeCAD's standard form representation:
</p>
<pre>import FreeCAD as App
import FreeCADGui
import FreeCAD
import Part
class Line:
def __init__(self, obj):
'''"App two point properties" '''
obj.addProperty("App::PropertyVector","p1","Line","Start point")
obj.addProperty("App::PropertyVector","p2","Line","End point").p2=FreeCAD.Vector(1,0,0)
obj.Proxy = self
def execute(self, fp):
'''"Print a short message when doing a recomputation, this method is mandatory" '''
fp.Shape = Part.makeLine(fp.p1,fp.p2)
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Line")
Line(a)
a.ViewObject.Proxy=0 # just set it to something different from None (this assignment is needed to run an internal notification)
FreeCAD.ActiveDocument.recompute() </pre>
<p>Same code with use <b>ViewProviderLine</b>
</p>
<pre>import FreeCAD as App
import FreeCADGui
import FreeCAD
import Part
class Line:
def __init__(self, obj):
'''"App two point properties" '''
obj.addProperty("App::PropertyVector","p1","Line","Start point")
obj.addProperty("App::PropertyVector","p2","Line","End point").p2=FreeCAD.Vector(100,0,0)
obj.Proxy = self
def execute(self, fp):
'''"Print a short message when doing a recomputation, this method is mandatory" '''
fp.Shape = Part.makeLine(fp.p1,fp.p2)
class ViewProviderLine:
def __init__(self, obj):
''' Set this object to the proxy object of the actual view provider '''
obj.Proxy = self
def getDefaultDisplayMode(self):
''' Return the name of the default display mode. It must be defined in getDisplayModes. '''
return "Flat Lines"
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Line")
Line(a)
ViewProviderLine(a.ViewObject)
App.ActiveDocument.recompute() </pre>
<p><br />
</p>
<h2><span class="mw-headline" id="Further_informations">Further informations</span></h2>
<p>There are a few very interesting forum threads about scripted objects:
</p><p>- <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/viewtopic.php?f=22&amp;t=13740">http://forum.freecadweb.org/viewtopic.php?f=22&amp;t=13740</a>
</p><p>- <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/viewtopic.php?t=12139">http://forum.freecadweb.org/viewtopic.php?t=12139</a>
</p><p>- <a rel="nofollow" class="external free" href="https://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=20#p109709">https://forum.freecadweb.org/viewtopic.php?f=18&amp;t=13460&amp;start=20#p109709</a>
</p><p>- <a rel="nofollow" class="external free" href="https://forum.freecadweb.org/viewtopic.php?f=22&amp;t=21330">https://forum.freecadweb.org/viewtopic.php?f=22&amp;t=21330</a>
</p><p><br />
In addition to the examples presented here have a look at FreeCAD source code <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/TemplatePyMod/FeaturePython.py">src/Mod/TemplatePyMod/FeaturePython.py</a> for more examples.
</p>
<div style="clear:both"></div>
<p><br />
</p>
<div class="mw-translate-fuzzy">
<p>FreeCAD har den fantastiska förmågan att kunna importeras som en python modul i andra program eller i en python konsol, tilsammans med alla dess moduler och komponenter. Det är även möjligt att importera FreeCAD's gränssnitt som en python modul -- emellertid med några begränsningar.
</p>
</div>
<h3><span class="mw-headline" id="Anv.C3.A4nda_FreeCAD_utan_gr.C3.A4nssnitt">Använda FreeCAD utan gränssnitt</span></h3>
En första, direkt, lätt och användbar sak du kan göra med detta är att importera FreeCAD dokument in till ditt program. I det följande exemplet, så kommer vi att importera Del geometrin i ett FreeCAD dokument till <a rel="nofollow" class="external text" href="http://www.blender.org">blender</a>. Här är det kompletta skriptet. Jag hoppas att du kommer att bli imponerad av dess enkelhet:<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>FREECADPATH = '/opt/FreeCAD/lib' # path to your FreeCAD.so or FreeCAD.dll file
import Blender, sys
sys.path.append(FREECADPATH)
def import_fcstd(filename):
try:
import FreeCAD
except ValueError:
Blender.Draw.PupMenu('Error%t|FreeCAD library not found. Please check the FREECADPATH variable in the import script is correct')
else:
scene = Blender.Scene.GetCurrent()
import Part
doc = FreeCAD.open(filename)
objects = doc.Objects
for ob in objects:
if ob.Type[:4] == 'Part':
shape = ob.Shape
if shape.Faces:
mesh = Blender.Mesh.New()
rawdata = shape.tessellate(1)
for v in rawdata[0]:
mesh.verts.append((v.x,v.y,v.z))
for f in rawdata[1]:
mesh.faces.append.append(f)
scene.objects.new(mesh,ob.Name)
Blender.Redraw()
def main():
Blender.Window.FileSelector(import_fcstd, 'IMPORT FCSTD',
Blender.sys.makename(ext='.fcstd'))
# This lets you import the script without running it
if __name__=='__main__':
main()</pre></div>Den första, viktiga delen är att försäkra sig om att python kan hitta vårt FreeCAD bibliotek. När den väl har hittats, så kommer alla FreeCAD moduler som Del, som vi kommer använda, automatiskat att vara tillgängliga. Så vi tar bara sys.path variabeln, vilket är var python söker efter moduler, och lägger till sökvägen till FreeCAD's bibliotek. Denna ändring är endast temporär, och kommer att förloras när vi stänger vår python tolk. Ett annat sätt kan vara att göra en länk till ditt FreeCAD bibliotek i en av python's sökvägar. Jag behöll sökvägen i en konstant (FREECADPATH) så att det blir lättare för en annan användare av skriptet att konfigurera den till sitt eget system.
<div class="mw-translate-fuzzy">
<p>När vi är säkra på att biblioteket är laddat(try/except sekvensen), så kan vi nu arbeta med FreeCAD, på samma sätt som vi skulle inuti FreeCAD's egen python tolk. Vi öppnar FreeCAD dokumentet som skickats till oss genom main() funktionen, och vi gör en lista på dess objekt. Sedan då vi valde att endast bry oss om Del geometri, så kontrollerar vi om varje objekts Typegenskap innehåller "Part", sedan tesselerar vi den.
</p>
</div>
<p>Tesseleringen producerar en lista på hörn och en lista på ytor som definierats av hörnindexen. Detta är perfekt, eftersom det är på exakt samma sätt som blender definierar nät. Så vår uppgift är löjligt enkel, vi adderar bara båda listinnehållen till verts och faces av ett blender nät. När allting är gjort, så ritar vi bara om skärmen, och det är klart!
</p><p>Detta skript är förstås mycket enkelt (det finns ett mer avancerat <a rel="nofollow" class="external text" href="http://yorik.orgfree.com/scripts/import_freecad.py">här</a>), du kanske vill bygga ut det, för att till exempel importera nätobjekt också, eller importera Del geometri som inte har några ytor, eller importera andra filformat som FreeCAD kan läsa. Du kanske också vill exportera geometri till ett FreeCAD dokument, vilket kan göras på samma sätt. Du kanske också vill bygga en dialog, så att användaren kan välja vad som ska importeras, etc... Skönheten i allt detta ligger i det faktum att du låter FreeCAD göra grundarbetet medan du presenterar dess resultat i ett program som du väljer.
</p>
<h3><span class="mw-headline" id="Anv.C3.A4nda_FreeCAD_med_gr.C3.A4nssnitt">Använda FreeCAD med gränssnitt</span></h3>
<p>Från och med version 4.2 så har Qt den fängslande förmågan att inbädda Qt-gränssnitt-beroende plugins till icke-Qt värdapplikationer och dela värdens händelseslinga.
</p><p>Speciellt för FreeCAD så betyder detta att den kan importeras från en annan applikation med hela gränssnittet där värdapplikationen har full kontroll över FreeCAD.
</p><p>Hela python koden för att uppnå detta har bara två rader
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>
import FreeCADGui
FreeCADGui.showMainWindow()</pre></div>
<p>Om värdapplikationen är baserad på Qt så ska denna lösningen fungera på alla plattformar som Qt stöder. emellertid så ska värden länka samma Qt version som FreeCAD, annars såkan du få oväntade fel.
</p><p>Men för icke-Qt applikationer så finns det en del begränsningar som du måste vara uppmärksam på. Denna lösning fungerar troligen inte tillsammans med alla andra verktygskiten.
</p><p>I Windows så fungerar det så länge som värdapplikationen är direkt baserad på Win32 eller något annat verktygskit som internt använder Win32 API som wxWidgets, MFC eller WinForms. för att få det att fungera under X11 så måste värdapplikationen länka till "glib" biblioteket.
</p><p>Notera att för konsolapplikationer fungerar inte denna lösning eftersom det inte finns någon händelseslinga som körs.
</p>
<h3><span class="mw-headline" id="Caveats">Caveats</span></h3>
<p>Although it is possible to import FreeCAD to an external Python interpreter, this is not a common usage scenario and requires some care. Generally, it is better to use the Python included with FreeCAD, run FreeCAD via command line, or as a subprocess. See <a href="Start_up_and_Configuration.html" title="Start up and Configuration">Start up and Configuration</a> for more on the last two options.
</p><p>Since the FreeCAD Python module is compiled from C++ (rather than being a pure Python module), it can only be imported from a compatible Python interpreter. Generally this means that the Python interpreter must be compiled with the same C compiler as was used to build FreeCAD. Information about the compiler used to build a Python interpreter (including the one built with FreeCAD) can be found as follows:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>>>> import sys
>>> sys.version
'2.7.13 (default, Dec 17 2016, 23:03:43) \n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]'</pre></div>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<table class="fcinfobox wikitable ct" >
<tr>
<td class="ctTitle">
<h3><span class="mw-headline" id="Tutorial_2"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Base_ExampleCommandModel.png" class="image"><img alt="Base ExampleCommandModel.png" src="32px-Base_ExampleCommandModel.png" width="32" height="30" srcset="/wiki/images/thumb/9/93/Base_ExampleCommandModel.png/48px-Base_ExampleCommandModel.png 1.5x, /wiki/images/9/93/Base_ExampleCommandModel.png 2x" /></a> Tutorial</span></h3>
</td></tr>
<tr>
<th class="ctOdd">Topic
</th></tr>
<tr>
<td class="ctEven">Python
</td></tr>
<tr>
<th class="ctOdd">Level
</th></tr>
<tr>
<td class="ctEven">Beginner
</td></tr>
<tr>
<th class="ctOdd">Time to complete
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">Author
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">FreeCAD version
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<th class="ctOdd">Example File(s)
</th></tr>
<tr>
<td class="ctEven">
</td></tr>
<tr>
<td class="ctToc"><br />
</td></tr></table>
<p><br />
</p><p>Denna sida innehåller exempel, delar, bitar av FreeCAD pythonkod som samlats ihop från användare och diskussioner på forumen. Läs och använd dem som en början för dina egna skript...
</p><p><br />
</p>
<h3><span class="mw-headline" id="En_typisk_InitGui.py_fil">En typisk InitGui.py fil</span></h3>
<p>Varje modul måste innehålla, förutom din huvudmodul fil, en InitGui.py fil, som ansvarar för insättningen av modulen i huvudgränssnittet. Detta är ett exempel på en enkel sådan.
</p>
<pre>class ScriptWorkbench (Workbench):
MenuText = "Scripts"
def Initialize(self):
import Scripts # assuming Scripts.py is your module
list = ["Script_Cmd"] # That list must contain command names, that can be defined in Scripts.py
self.appendToolbar("My Scripts",list)
Gui.addWorkbench(ScriptWorkbench()) </pre>
<h3><span class="mw-headline" id="En_typisk_modulfil">En typisk modulfil</span></h3>
<p>Detta är ett exempel på en huvudmodulfil, som innehåller allt som din modul gör. Det är Scripts.py filen startad i föregående exempel. Du kan ha alla dina anpassade kommandon här.
</p>
<pre>import FreeCAD, FreeCADGui
class ScriptCmd:
def Activated(self):
# Here your write what your ScriptCmd does...
FreeCAD.Console.PrintMessage('Hello, World!')
def GetResources(self):
return {'Pixmap'&#160;: 'path_to_an_icon/myicon.png', 'MenuText': 'Short text', 'ToolTip': 'More detailed text'}
FreeCADGui.addCommand('Script_Cmd', ScriptCmd()) </pre>
<h3><span class="mw-headline" id="Importera_en_ny_filtyp">Importera en ny filtyp</span></h3>
<p>Att skapa en importerare för en ny filtyp i FreeCAD är lätt. FreeCAD anser inte att du importerar data i ett öppnat dokument, utan snarare att du direkt kan öppna den nya filtypen. Så vad du behöver göra är att lägga till den nya filtypen till FreeCAD's lista på kända filtyper, och skriva koden som kommer att läsa filen och skapa de FreeCAD objekt som du vill:
</p><p>Denna rad måste läggas till i InitGui.py filen för att lägga till den nya filtypen till listan:
</p>
<pre># Assumes Import_Ext.py is the file that has the code for opening and reading .ext files
FreeCAD.addImportType("Your new File Type (*.ext)","Import_Ext") </pre>
<p>Sedan i filen Import_Ext.py&#160;:
</p>
<pre>def open(filename):
doc=App.newDocument()
# here you do all what is needed with filename, read, classify data, create corresponding FreeCAD objects
doc.recompute() </pre>
<p>För att exportera ditt dokument till någon ny filtyp fungerar på samma sätt, förutom att du använder:
</p>
<pre>FreeCAD.addExportType("Din nya FilTyp (*.ext)","Export_Ext")
</pre>
<h3><span class="mw-headline" id="L.C3.A4gga_till_en_linje">Lägga till en linje</span></h3>
<p>En linje har 2 punkter.
</p>
<pre>import Part,PartGui
doc=App.activeDocument()
# add a line element to the document and set its points
l=Part.LineSegment()
l.StartPoint=(0.0,0.0,0.0)
l.EndPoint=(1.0,1.0,1.0)
doc.addObject("Part::Feature","Line").Shape=l.toShape()
doc.recompute() </pre>
<h3><span class="mw-headline" id="L.C3.A4gga_till_en_polygon">Lägga till en polygon</span></h3>
<p>En polygon ett set av ihopkopplade linjesegment (en polyline i AutoCAD). Den behöver inte vara stängd.
</p>
<pre>import Part,PartGui
doc=App.activeDocument()
n=list()
# create a 3D vector, set its coordinates and add it to the list
v=App.Vector(0,0,0)
n.append(v)
v=App.Vector(10,0,0)
n.append(v)
#... repeat for all nodes
# Create a polygon object and set its nodes
p=doc.addObject("Part::Polygon","Polygon")
p.Nodes=n
doc.recompute() </pre>
<h3><span class="mw-headline" id="L.C3.A4gga_till_och_ta_bort_ett_objekt_till.2Ffr.C3.A5n_en_grupp">Lägga till och ta bort ett objekt till/från en grupp</span></h3>
<pre>doc=App.activeDocument()
grp=doc.addObject("App::DocumentObjectGroup", "Group")
lin=doc.addObject("Part::Feature", "Line")
grp.addObject(lin) # adds the lin object to the group grp
grp.removeObject(lin) # removes the lin object from the group grp </pre>
<p>Notera: Du kan även lägga till andra grupper till en grupp...
</p>
<h3><span class="mw-headline" id="L.C3.A4gga_till_ett_n.C3.A4t">Lägga till ett nät</span></h3>
<pre>import Mesh
doc=App.activeDocument()
# create a new empty mesh
m = Mesh.Mesh()
# build up box out of 12 facets
m.addFacet(0.0,0.0,0.0, 0.0,0.0,1.0, 0.0,1.0,1.0)
m.addFacet(0.0,0.0,0.0, 0.0,1.0,1.0, 0.0,1.0,0.0)
m.addFacet(0.0,0.0,0.0, 1.0,0.0,0.0, 1.0,0.0,1.0)
m.addFacet(0.0,0.0,0.0, 1.0,0.0,1.0, 0.0,0.0,1.0)
m.addFacet(0.0,0.0,0.0, 0.0,1.0,0.0, 1.0,1.0,0.0)
m.addFacet(0.0,0.0,0.0, 1.0,1.0,0.0, 1.0,0.0,0.0)
m.addFacet(0.0,1.0,0.0, 0.0,1.0,1.0, 1.0,1.0,1.0)
m.addFacet(0.0,1.0,0.0, 1.0,1.0,1.0, 1.0,1.0,0.0)
m.addFacet(0.0,1.0,1.0, 0.0,0.0,1.0, 1.0,0.0,1.0)
m.addFacet(0.0,1.0,1.0, 1.0,0.0,1.0, 1.0,1.0,1.0)
m.addFacet(1.0,1.0,0.0, 1.0,1.0,1.0, 1.0,0.0,1.0)
m.addFacet(1.0,1.0,0.0, 1.0,0.0,1.0, 1.0,0.0,0.0)
# scale to a edge langth of 100
m.scale(100.0)
# add the mesh to the active document
me=doc.addObject("Mesh::Feature","Cube")
me.Mesh=m </pre>
<h3><span class="mw-headline" id="L.C3.A4gga_till_en_cirkelb.C3.A5ge_eller_en_cirkel">Lägga till en cirkelbåge eller en cirkel</span></h3>
<pre>import Part
doc = App.activeDocument()
c = Part.Circle()
c.Radius=10.0
f = doc.addObject("Part::Feature", "Circle") # create a document with a circle feature
f.Shape = c.toShape() # Assign the circle shape to the shape property
doc.recompute() </pre>
<h3><span class="mw-headline" id="Komma_.C3.A5t_och_.C3.A4ndra_representationen_av_ett_objekt">Komma åt och ändra representationen av ett objekt</span></h3>
<p>Varje objekt i ett FreeCAD dokument har ett associerat vy representationsobjekt som sparar alla parametrar som definierar hur objekten syns, som färg, linjebredd, etc...
</p>
<pre>gad=Gui.activeDocument() # access the active document containing all
# view representations of the features in the
# corresponding App document
v=gad.getObject("Cube") # access the view representation to the Mesh feature 'Cube'
v.ShapeColor # prints the color to the console
v.ShapeColor=(1.0,1.0,1.0) # sets the shape color to white </pre>
<h3><span class="mw-headline" id="Observation_av_mush.C3.A4ndelser_i_3D_visaren_via_Python">Observation av mushändelser i 3D visaren via Python</span></h3>
<p>Inventor ramverket tillåter att du lägger till en eller flera återanropsnoder vill visarens scengraf. som standard i FreeCAD är en återanropsnod installerad per visare vilket tillåter att du kan lägga till globala eller statiska C++ funktioner. I en lämplig Python bindning så erbjuds några metoder för att använda denna teknik inuti Python kod.
</p>
<pre>App.newDocument()
v=Gui.activeDocument().activeView()
#This class logs any mouse button events. As the registered callback function fires twice for 'down' and
#'up' events we need a boolean flag to handle this.
class ViewObserver:
def logPosition(self, info):
down = (info["State"] == "DOWN")
pos = info["Position"]
if (down):
FreeCAD.Console.PrintMessage("Clicked on position: ("+str(pos[0])+", "+str(pos[1])+")\n")
o = ViewObserver()
c = v.addEventCallback("SoMouseButtonEvent",o.logPosition) </pre>
<p>Klicka nu någonstans i 3D visaren och observera meddelandena i utmatningsfönstret. För att avsluta observationen, anropa bara
</p>
<pre>v.removeEventCallback("SoMouseButtonEvent",c) </pre>
<p>Följande händelsetyper stöds
</p>
<ul><li> SoEvent -- alla sorts händelser</li>
<li> SoButtonEvent -- alla musknapps och tangentbordshändelser</li>
<li> SoLocation2Event -- 2D rörelsehändelser (normalt musförflyttningar)</li>
<li> SoMotion3Event -- 3D rörelsehändelser (normalt spaceball)</li>
<li> SoKeyboardEvent -- tangentbordsknapp ned och upphändelser</li>
<li> SoMouseButtonEvent -- musknapp ned och upphändelser</li>
<li> SoSpaceballButtonEvent -- spaceballknapp ned och upphändelser</li></ul>
<p>Python funktionen som kan registreras med addEventCallback() förväntar sig ett lexikon. Beroende på den övervakade händelsen så kan lexikonet innehålla olika nycklar.
</p><p>För alla händelser så har den nycklarna:
</p>
<ul><li> Type -- händelsetypens namn d.v.s. SoMouseEvent, SoLocation2Event, ... </li>
<li> Time -- nuvarande tid som en sträng</li>
<li> Position -- en tupel med två heltal, musposition </li>
<li> ShiftDown -- en boolesk, sann om Skift var nedtryckt, annars falsk</li>
<li> CtrlDown -- en boolesk, sann om CTRL var nedtryckt, annars falsk </li>
<li> AltDown -- en boolesk, sann om Alt var nedtryckt, annars falsk </li></ul>
<p><br />
För alla knapphändelser, d.v.s. tangentbord, mus eller spaceball händelser
</p>
<ul><li> State -- En sträng 'UP' om knappen var uppe, 'DOWN' om den var nera eller 'UNKNOWN' för alla andra fall </li></ul>
<p><br />
För tangentbordshändelser:
</p>
<ul><li> Key -- tecknet för den nedtryckta tangenten</li></ul>
<p><br />
För musknappshändelser
</p>
<ul><li> Button -- den nedtryckta knappen, kan vara BUTTON1, ..., BUTTON5 eller ANY </li></ul>
<p><br />
För spaceballhändelser:
</p>
<ul><li> Button -- den nedtryckta knappen, kan vara BUTTON1, ..., BUTTON7 eller ANY </li></ul>
<p><br />
Och slutligen rörelsehändelser:
</p>
<ul><li> Förflyttning -- en tupel med tre flyttal</li>
<li> Rotation -- en kvaternion för rotationen, d.v.s. en tupel med fyra flyttal</li></ul>
<h3><span class="mw-headline" id="Display_keys_pressed_and_Events_command">Display keys pressed and Events command</span></h3>
<p>This macro displays in the report view the keys pressed and all events command
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>App.newDocument()
v=Gui.activeDocument().activeView()
class ViewObserver:
def logPosition(self, info):
try:
down = (info["Key"])
FreeCAD.Console.PrintMessage(str(down)+"\n") # here the character pressed
FreeCAD.Console.PrintMessage(str(info)+"\n") # list all events command
FreeCAD.Console.PrintMessage("_______________________________________"+"\n")
except Exception:
None
o = ViewObserver()
c = v.addEventCallback("SoEvent",o.logPosition)
#v.removeEventCallback("SoEvent",c) # remove ViewObserver</pre></div>
<h3><span class="mw-headline" id="Manipulera_scengrafen_i_Python">Manipulera scengrafen i Python</span></h3>
<p>Det är också möjligt att hämta och ändra scengrafen i Python, med 'pivy' modulen -- en Python bindning för Coin.
</p>
<pre>from pivy.coin import * # load the pivy module
view = Gui.ActiveDocument.ActiveView # get the active viewer
root = view.getSceneGraph() # the root is an SoSeparator node
root.addChild(SoCube())
view.fitAll() </pre>
<p>Pivy's Python API skapas med hjälp av verktyget SWIG. Då vi i FreeCAD använder några självskrivna noder så kan du inte skapa dem direkt i Python.
Emellertid så är det möjligt att skapa en nod med dess interna namn. En instans av typen 'SoFCSelection' kan skapas med
</p>
<pre>type = SoType.fromName("SoFCSelection")
node = type.createInstance() </pre>
<h3><span class="mw-headline" id="L.C3.A4gga_till_och_ta_bort_objekt_till.2Ffr.C3.A5n_scengrafen">Lägga till och ta bort objekt till/från scengrafen</span></h3>
<p>Addering av nya noder till scengrafen kan görass på detta sätt. Var noga med att alltid lägga till en SoSeparator för att innehålla geometrin, koordinaterna och materialinformationen på samma objekt. Följande exempel lägger till en röd linje från (0,0,0) till (10,0,0):
</p>
<pre>from pivy import coin
sg = Gui.ActiveDocument.ActiveView.getSceneGraph()
co = coin.SoCoordinate3()
pts = [[0,0,0],[10,0,0]]
co.point.setValues(0,len(pts),pts)
ma = coin.SoBaseColor()
ma.rgb = (1,0,0)
li = coin.SoLineSet()
li.numVertices.setValue(2)
no = coin.SoSeparator()
no.addChild(co)
no.addChild(ma)
no.addChild(li)
sg.addChild(no) </pre>
<p>För att ta bort den, skriv bara:
</p>
<pre>sg.removeChild(no) </pre>
<h3><span class="mw-headline" id="Saves_the_sceneGraph_with_a_rotation_in_a_series_of_36_files_in_the_X_Y_Z_axis">Saves the sceneGraph with a rotation in a series of 36 files in the X Y Z axis</span></h3>
<pre>import math
import time
from FreeCAD import Base
from pivy import coin
size=(1000,1000)
dirname = "C:/Temp/animation/"
steps=36
angle=2*math.pi/steps
matX=Base.Matrix()
matX.rotateX(angle)
stepsX=Base.Placement(matX).Rotation
matY=Base.Matrix()
matY.rotateY(angle)
stepsY=Base.Placement(matY).Rotation
matZ=Base.Matrix()
matZ.rotateZ(angle)
stepsZ=Base.Placement(matZ).Rotation
view=Gui.ActiveDocument.ActiveView
cam=view.getCameraNode()
rotCamera=Base.Rotation(*cam.orientation.getValue().getValue())
# this sets the lookat point to the center of circumsphere of the global bounding box
view.fitAll()
# the camera's position, i.e. the user's eye point
position=Base.Vector(*cam.position.getValue().getValue())
distance=cam.focalDistance.getValue()
# view direction
vec=rotCamera.multVec(Base.Vector(0,0,-1))
# this is the point on the screen the camera looks at
# when rotating the camera we should make this point fix
lookat=position+vec*distance
# around x axis
for i in range(steps):
rotCamera=stepsX.multiply(rotCamera)
cam.orientation.setValue(*rotCamera.Q)
vec=rotCamera.multVec(Base.Vector(0,0,-1))
pos=lookat-vec*distance
cam.position.setValue(pos.x,pos.y,pos.z)
Gui.updateGui()
time.sleep(0.3)
view.saveImage(dirname+"x-%d.png"&#160;% i,*size)
# around y axis
for i in range(steps):
rotCamera=stepsY.multiply(rotCamera)
cam.orientation.setValue(*rotCamera.Q)
vec=rotCamera.multVec(Base.Vector(0,0,-1))
pos=lookat-vec*distance
cam.position.setValue(pos.x,pos.y,pos.z)
Gui.updateGui()
time.sleep(0.3)
view.saveImage(dirname+"y-%d.png"&#160;% i,*size)
# around z axis
for i in range(steps):
rotCamera=stepsZ.multiply(rotCamera)
cam.orientation.setValue(*rotCamera.Q)
vec=rotCamera.multVec(Base.Vector(0,0,-1))
pos=lookat-vec*distance
cam.position.setValue(pos.x,pos.y,pos.z)
Gui.updateGui()
time.sleep(0.3)
view.saveImage(dirname+"z-%d.png"&#160;% i,*size) </pre>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id="L.C3.A4gga_till_anpassade_widgetar_till_gr.C3.A4nssnittet">Lägga till anpassade widgetar till gränssnittet</span></h3>
<p>Du kan skapa anpassade widgetar med Qt designer, omvandla dem till ett python skript, och sedan ladda dem till FreeCAD gränssnittet med PyQt4.
</p>
</div>
<p>Den pythonkod som producerats av Ui pythonkompilatorn (det verktyg som konverterar qt-designer .ui file till pythonkod) ser i allmänhet ut så här (det är enkelt, du kan även skriva det direkt i python):
</p>
<pre>class myWidget_Ui(object):
def setupUi(self, myWidget):
myWidget.setObjectName("my Nice New Widget")
myWidget.resize(QtCore.QSize(QtCore.QRect(0,0,300,100).size()).expandedTo(myWidget.minimumSizeHint())) # sets size of the widget
self.label = QtGui.QLabel(myWidget) # creates a label
self.label.setGeometry(QtCore.QRect(50,50,200,24)) # sets its size
self.label.setObjectName("label") # sets its name, so it can be found by name
def retranslateUi(self, draftToolbar): # built-in QT function that manages translations of widgets
myWidget.setWindowTitle(QtGui.QApplication.translate("myWidget", "My Widget", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("myWidget", "Welcome to my new widget!", None, QtGui.QApplication.UnicodeUTF8)) </pre>
<p>Allt du sedan behöver göra är att skapa en referens till FreeCAD's Qt fönster, sätta in en anpassad widget i det, och "omvandla" denna widget till din med den Ui kod vi just gjorde:
</p>
<pre>app = QtGui.qApp
FCmw = app.activeWindow() # the active qt window, = the freecad window since we are inside it
# FCmw = FreeCADGui.getMainWindow() # use this line if the 'addDockWidget' error is declared
myNewFreeCADWidget = QtGui.QDockWidget() # create a new dckwidget
myNewFreeCADWidget.ui = myWidget_Ui() # load the Ui script
myNewFreeCADWidget.ui.setupUi(myNewFreeCADWidget) # setup the ui
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window </pre>
<h3><span class="mw-headline" id="Adding_a_Tab_to_the_Combo_View">Adding a Tab to the Combo View</span></h3>
<p>The following code allows you to add a tab to the FreeCAD ComboView, besides the "Project" and "Tasks" tabs. It also uses the uic module to load an ui file directly in that tab.
</p>
<pre># create new Tab in ComboView
from PySide import QtGui,QtCore
#from PySide import uic
def getMainWindow():
"returns the main window"
# using QtGui.qApp.activeWindow() isn't very reliable because if another
# widget than the mainwindow is active (e.g. a dialog) the wrong widget is
# returned
toplevel = QtGui.qApp.topLevelWidgets()
for i in toplevel:
if i.metaObject().className() == "Gui::MainWindow":
return i
raise Exception("No main window found")
def getComboView(mw):
dw=mw.findChildren(QtGui.QDockWidget)
for i in dw:
if str(i.objectName()) == "Combo View":
return i.findChild(QtGui.QTabWidget)
elif str(i.objectName()) == "Python Console":
return i.findChild(QtGui.QTabWidget)
raise Exception ("No tab widget found")
mw = getMainWindow()
tab = getComboView(getMainWindow())
tab2=QtGui.QDialog()
tab.addTab(tab2,"A Special Tab")
#uic.loadUi("/myTaskPanelforTabs.ui",tab2)
tab2.show()
#tab.removeTab(2) </pre>
<h3><span class="mw-headline" id="Enable_or_disable_a_window">Enable or disable a window</span></h3>
<pre>from PySide import QtGui
mw=FreeCADGui.getMainWindow()
dws=mw.findChildren(QtGui.QDockWidget)
# objectName may be&#160;:
# "Report view"
# "Tree view"
# "Property view"
# "Selection view"
# "Combo View"
# "Python console"
# "draftToolbar"
for i in dws:
if i.objectName() == "Report view":
dw=i
break
va=dw.toggleViewAction()
va.setChecked(True) # True or False
dw.setVisible(True) # True or False </pre>
<h3><span class="mw-headline" id="Opening_a_custom_webpage">Opening a custom webpage</span></h3>
<pre>import WebGui
WebGui.openBrowser("http://www.example.com") </pre>
<h3><span class="mw-headline" id="Getting_the_HTML_contents_of_an_opened_webpage">Getting the HTML contents of an opened webpage</span></h3>
<pre>from PyQt4 import QtGui,QtWebKit
a = QtGui.qApp
mw = a.activeWindow()
v = mw.findChild(QtWebKit.QWebFrame)
html = unicode(v.toHtml())
print html </pre>
<h3><span class="mw-headline" id="Retrieve_and_use_the_coordinates_of_3_selected_points_or_objects">Retrieve and use the coordinates of 3 selected points or objects</span></h3>
<pre># -*- coding: utf-8 -*-
# the line above to put the accentuated in the remarks
# If this line is missing, an error will be returned
# extract and use the coordinates of 3 objects selected
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base, Console
sel = FreeCADGui.Selection.getSelection() # " sel " contains the items selected
if len(sel)!=3&#160;:
# If there are no 3 objects selected, an error is displayed in the report view
# The \r and \n at the end of line mean return and the newline CR + LF.
Console.PrintError("Select 3 points exactly\r\n")
else&#160;:
points=[]
for obj in sel:
points.append(obj.Shape.BoundBox.Center)
for pt in points:
# display of the coordinates in the report view
Console.PrintMessage(str(pt.x)+"\r\n")
Console.PrintMessage(str(pt.y)+"\r\n")
Console.PrintMessage(str(pt.z)+"\r\n")
Console.PrintMessage(str(pt[1]) + "\r\n") </pre>
<h3><span class="mw-headline" id="List_all_objects">List all objects</span></h3>
<pre># -*- coding: utf-8 -*-
import FreeCAD,Draft
# List all objects of the document
doc = FreeCAD.ActiveDocument
objs = FreeCAD.ActiveDocument.Objects
#App.Console.PrintMessage(str(objs) + "\n")
#App.Console.PrintMessage(str(len(FreeCAD.ActiveDocument.Objects)) + " Objects" + "\n")
for obj in objs:
a = obj.Name # list the Name of the object (not modifiable)
b = obj.Label # list the Label of the object (modifiable)
try:
c = obj.LabelText # list the LabeText of the text (modifiable)
App.Console.PrintMessage(str(a) +" "+ str(b) +" "+ str(c) + "\n") # Displays the Name the Label and the text
except:
App.Console.PrintMessage(str(a) +" "+ str(b) + "\n") # Displays the Name and the Label of the object
#doc.removeObject("Box") # Clears the designated object </pre>
<h3><span class="mw-headline" id="List_the_dimensions_of_an_object.2C_given_its_name">List the dimensions of an object, given its name</span></h3>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>for edge in FreeCAD.ActiveDocument.MyObjectName.Shape.Edges: # replace "MyObjectName" for list
print edge.Length</pre></div>
<p><br />
</p>
<h3><span class="mw-headline" id="Function_resident_with_the_mouse_click_action">Function resident with the mouse click action</span></h3>
<p>Here with <b>SelObserver</b> on a object select
</p>
<pre># -*- coding: utf-8 -*-
# causes an action to the mouse click on an object
# This function remains resident (in memory) with the function "addObserver(s)"
# "removeObserver(s) # Uninstalls the resident function
class SelObserver:
def setPreselection(self,doc,obj,sub): # Preselection object
App.Console.PrintMessage(str(sub)+ "\n") # The part of the object name
def addSelection(self,doc,obj,sub,pnt): # Selection object
App.Console.PrintMessage("addSelection"+ "\n")
App.Console.PrintMessage(str(doc)+ "\n") # Name of the document
App.Console.PrintMessage(str(obj)+ "\n") # Name of the object
App.Console.PrintMessage(str(sub)+ "\n") # The part of the object name
App.Console.PrintMessage(str(pnt)+ "\n") # Coordinates of the object
App.Console.PrintMessage("______"+ "\n")
def removeSelection(self,doc,obj,sub): # Delete the selected object
App.Console.PrintMessage("removeSelection"+ "\n")
def setSelection(self,doc): # Selection in ComboView
App.Console.PrintMessage("setSelection"+ "\n")
def clearSelection(self,doc): # If click on the screen, clear the selection
App.Console.PrintMessage("clearSelection"+ "\n") # If click on another object, clear the previous object
s =SelObserver()
FreeCADGui.Selection.addObserver(s) # install the function mode resident
#FreeCADGui.Selection.removeObserver(s) # Uninstall the resident function </pre>
<p>Other example with <b>ViewObserver</b> on a object select or view
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>App.newDocument()
v=Gui.activeDocument().activeView()
#This class logs any mouse button events. As the registered callback function fires twice for 'down' and
#'up' events we need a boolean flag to handle this.
class ViewObserver:
def __init__(self, view):
self.view = view
def logPosition(self, info):
down = (info["State"] == "DOWN")
pos = info["Position"]
if (down):
FreeCAD.Console.PrintMessage("Clicked on position: ("+str(pos[0])+", "+str(pos[1])+")\n")
pnt = self.view.getPoint(pos)
FreeCAD.Console.PrintMessage("World coordinates: " + str(pnt) + "\n")
info = self.view.getObjectInfo(pos)
FreeCAD.Console.PrintMessage("Object info: " + str(info) + "\n")
o = ViewObserver(v)
c = v.addEventCallback("SoMouseButtonEvent",o.logPosition)</pre></div>
<h3><span class="mw-headline" id="Finding-selecting_all_elements_below_cursor">Finding-selecting all elements below cursor</span></h3>
<pre>from pivy import coin
import FreeCADGui
def mouse_over_cb( event_callback):
event = event_callback.getEvent()
pos = event.getPosition().getValue()
listObjects = FreeCADGui.ActiveDocument.ActiveView.getObjectsInfo((int(pos[0]),int(pos[1])))
obj = []
if listObjects:
FreeCAD.Console.PrintMessage("\n *** Objects under mouse pointer ***")
for o in listObjects:
label = str(o["Object"])
if not label in obj:
obj.append(label)
FreeCAD.Console.PrintMessage("\n"+str(obj))
view = FreeCADGui.ActiveDocument.ActiveView
mouse_over = view.addEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), mouse_over_cb )
# to remove Callback&#160;:
#view.removeEventCallbackPivy( coin.SoLocation2Event.getClassTypeId(), mouse_over)
####
#The easy way is probably to use FreeCAD's selection.
#FreeCADGui.ActiveDocument.ActiveView.getObjectsInfo(mouse_coords)
####
#you get that kind of result&#160;:
#'Document': 'Unnamed', 'Object': 'Box', 'Component': 'Face2', 'y': 8.604081153869629, 'x': 21.0, 'z': 8.553047180175781
####
#You can use this data to add your element to FreeCAD's selection&#160;:
#FreeCADGui.Selection.addSelection(FreeCAD.ActiveDocument.Box,'Face2',21.0,8.604081153869629,8.553047180175781) </pre>
<h3><span class="mw-headline" id="List_the_components_of_an_object">List the components of an object</span></h3>
<pre># -*- coding: utf-8 -*-
# This function list the components of an object
# and extract this object its XYZ coordinates,
# its edges and their lengths center of mass and coordinates
# its faces and their center of mass
# its faces and their surfaces and coordinates
# 8/05/2014
import Draft,Part
def detail():
sel = FreeCADGui.Selection.getSelection() # Select an object
if len(sel)&#160;!= 0: # If there is a selection then
Vertx=[]
Edges=[]
Faces=[]
compt_V=0
compt_E=0
compt_F=0
pas =0
perimetre = 0.0
EdgesLong = []
# Displays the "Name" and the "Label" of the selection
App.Console.PrintMessage("Selection &gt; " + str(sel[0].Name) + " " + str(sel[0].Label) +"\n"+"\n")
for j in enumerate(sel[0].Shape.Edges): # Search the "Edges" and their lengths
compt_E+=1
Edges.append("Edge%d"&#160;% (j[0]+1))
EdgesLong.append(str(sel[0].Shape.Edges[compt_E-1].Length))
perimetre += (sel[0].Shape.Edges[compt_E-1].Length) # calculates the perimeter
# Displays the "Edge" and its length
App.Console.PrintMessage("Edge"+str(compt_E)+" Length &gt; "+str(sel[0].Shape.Edges[compt_E-1].Length)+"\n")
# Displays the "Edge" and its center mass
App.Console.PrintMessage("Edge"+str(compt_E)+" Center &gt; "+str(sel[0].Shape.Edges[compt_E-1].CenterOfMass)+"\n")
num = sel[0].Shape.Edges[compt_E-1].Vertexes[0]
Vertx.append("X1: "+str(num.Point.x))
Vertx.append("Y1: "+str(num.Point.y))
Vertx.append("Z1: "+str(num.Point.z))
# Displays the coordinates 1
App.Console.PrintMessage("X1: "+str(num.Point[0])+" Y1: "+str(num.Point[1])+" Z1: "+str(num.Point[2])+"\n")
try:
num = sel[0].Shape.Edges[compt_E-1].Vertexes[1]
Vertx.append("X2: "+str(num.Point.x))
Vertx.append("Y2: "+str(num.Point.y))
Vertx.append("Z2: "+str(num.Point.z))
except:
Vertx.append("-")
Vertx.append("-")
Vertx.append("-")
# Displays the coordinates 2
App.Console.PrintMessage("X2: "+str(num.Point[0])+" Y2: "+str(num.Point[1])+" Z2: "+str(num.Point[2])+"\n")
App.Console.PrintMessage("\n")
App.Console.PrintMessage("Perimeter of the form &#160;: "+str(perimetre)+"\n")
App.Console.PrintMessage("\n")
FacesSurf = []
for j in enumerate(sel[0].Shape.Faces): # Search the "Faces" and their surface
compt_F+=1
Faces.append("Face%d"&#160;% (j[0]+1))
FacesSurf.append(str(sel[0].Shape.Faces[compt_F-1].Area))
# Displays 'Face' and its surface
App.Console.PrintMessage("Face"+str(compt_F)+" &gt; Surface "+str(sel[0].Shape.Faces[compt_F-1].Area)+"\n")
# Displays 'Face' and its CenterOfMass
App.Console.PrintMessage("Face"+str(compt_F)+" &gt; Center "+str(sel[0].Shape.Faces[compt_F-1].CenterOfMass)+"\n")
# Displays 'Face' and its Coordinates
FacesCoor = []
fco = 0
for f0 in sel[0].Shape.Faces[compt_F-1].Vertexes: # Search the Vertexes of the face
fco += 1
FacesCoor.append("X"+str(fco)+": "+str(f0.Point.x))
FacesCoor.append("Y"+str(fco)+": "+str(f0.Point.y))
FacesCoor.append("Z"+str(fco)+": "+str(f0.Point.z))
# Displays 'Face' and its Coordinates
App.Console.PrintMessage("Face"+str(compt_F)+" &gt; Coordinate"+str(FacesCoor)+"\n")
# Displays 'Face' and its Volume
App.Console.PrintMessage("Face"+str(compt_F)+" &gt; Volume "+str(sel[0].Shape.Faces[compt_F-1].Volume)+"\n")
App.Console.PrintMessage("\n")
# Displays the total surface of the form
App.Console.PrintMessage("Surface of the form &#160;: "+str(sel[0].Shape.Area)+"\n")
# Displays the total Volume of the form
App.Console.PrintMessage("Volume of the form &#160;: "+str(sel[0].Shape.Volume)+"\n")
detail() </pre>
<h3><span class="mw-headline" id="List_the_PropertiesList">List the PropertiesList</span></h3>
<pre>import FreeCADGui
from FreeCAD import Console
o = App.ActiveDocument.ActiveObject
op = o.PropertiesList
for p in op:
Console.PrintMessage("Property: "+ str(p)+ " Value: " + str(o.getPropertyByName(p))+"\r\n") </pre>
<h3><span class="mw-headline" id="Adding_one_Property_.22Comment.22">Adding one Property "Comment"</span></h3>
<pre>import Draft
obj = FreeCADGui.Selection.getSelection()[0]
obj.addProperty("App::PropertyString","GComment","Draft","Font name").GComment = "Comment here"
App.activeDocument().recompute() </pre>
<h3><span class="mw-headline" id="Search_and_data_extraction">Search and data extraction</span></h3>
<p>Examples of research and decoding information on an object.
</p><p>Each section is independently and is separated by "############" can be copied directly into the Python console, or in a macro or use this macro. The description of the macro in the commentary.
</p><p>Displaying it in the "View Report" window (View &gt; Views &gt; View report)
</p>
<pre># -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Exemples de recherche et de decodage d'informations sur un objet
# Chaque section peut etre copiee directement dans la console Python ou dans une macro ou utilisez la macro tel quel
# Certaines commandes se repetent seul l'approche est differente
# L'affichage se fait dans la Vue rapport&#160;: Menu Affichage &gt; Vues &gt; Vue rapport
#
# Examples of research and decoding information on an object
# Each section can be copied directly into the Python console, or in a macro or uses this macro
# Certain commands as repeat alone approach is different
# Displayed on Report view&#160;: Menu View &gt; Views &gt; report view
#
# rev:30/08/2014:29/09/2014:17/09/2015
from FreeCAD import Base
import DraftVecUtils, Draft, Part
mydoc = FreeCAD.activeDocument().Name # Name of active Document
App.Console.PrintMessage("Active docu &#160;: "+(mydoc)+"\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
object_Label = sel[0].Label # Label of the object (modifiable)
App.Console.PrintMessage("object_Label &#160;: "+(object_Label)+"\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
App.Console.PrintMessage("sel &#160;: "+str(sel[0])+"\n\n") # sel[0] first object selected
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
object_Name = sel[0].Name # Name of the object (not modifiable)
App.Console.PrintMessage("object_Name &#160;: "+str(object_Name)+"\n\n")
##################################################################################
try:
SubElement = FreeCADGui.Selection.getSelectionEx() # sub element name with getSelectionEx()
element_ = SubElement[0].SubElementNames[0] # name of 1 element selected
App.Console.PrintMessage("elementSelec &#160;: "+str(element_)+"\n\n")
except:
App.Console.PrintMessage("Oups"+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
App.Console.PrintMessage("sel &#160;: "+str(sel[0])+"\n\n") # sel[0] first object selected
##################################################################################
SubElement = FreeCADGui.Selection.getSelectionEx() # sub element name with getSelectionEx()
App.Console.PrintMessage("SubElement &#160;: "+str(SubElement[0])+"\n\n") # name of sub element
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
i = 0
for j in enumerate(sel[0].Shape.Edges): # list all Edges
i += 1
App.Console.PrintMessage("Edges n&#160;: "+str(i)+"\n")
a = sel[0].Shape.Edges[j[0]].Vertexes[0]
App.Console.PrintMessage("X1 &#160;: "+str(a.Point.x)+"\n") # coordinate XYZ first point
App.Console.PrintMessage("Y1 &#160;: "+str(a.Point.y)+"\n")
App.Console.PrintMessage("Z1 &#160;: "+str(a.Point.z)+"\n")
try:
a = sel[0].Shape.Edges[j[0]].Vertexes[1]
App.Console.PrintMessage("X2 &#160;: "+str(a.Point.x)+"\n") # coordinate XYZ second point
App.Console.PrintMessage("Y2 &#160;: "+str(a.Point.y)+"\n")
App.Console.PrintMessage("Z2 &#160;: "+str(a.Point.z)+"\n")
except:
App.Console.PrintMessage("Oups"+"\n")
App.Console.PrintMessage("\n")
##################################################################################
try:
SubElement = FreeCADGui.Selection.getSelectionEx() # sub element name with getSelectionEx()
subElementName = Gui.Selection.getSelectionEx()[0].SubElementNames[0] # sub element name with getSelectionEx()
App.Console.PrintMessage("subElementName&#160;: "+str(subElementName)+"\n")
subObjectLength = Gui.Selection.getSelectionEx()[0].SubObjects[0].Length # sub element Length
App.Console.PrintMessage("subObjectLength: "+str(subObjectLength)+"\n\n")
subObjectX1 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[0].Point.x # sub element coordinate X1
App.Console.PrintMessage("subObject_X1 &#160;: "+str(subObjectX1)+"\n")
subObjectY1 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[0].Point.y # sub element coordinate Y1
App.Console.PrintMessage("subObject_Y1 &#160;: "+str(subObjectY1)+"\n")
subObjectZ1 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[0].Point.z # sub element coordinate Z1
App.Console.PrintMessage("subObject_Z1 &#160;: "+str(subObjectZ1)+"\n\n")
subObjectX2 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[1].Point.x # sub element coordinate X2
App.Console.PrintMessage("subObject_X2 &#160;: "+str(subObjectX2)+"\n")
subObjectY2 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[1].Point.y # sub element coordinate Y2
App.Console.PrintMessage("subObject_Y2 &#160;: "+str(subObjectY2)+"\n")
subObjectZ2 = Gui.Selection.getSelectionEx()[0].SubObjects[0].Vertexes[1].Point.z # sub element coordinate Z2
App.Console.PrintMessage("subObject_Z2 &#160;: "+str(subObjectZ2)+"\n\n")
subObjectBoundBox = Gui.Selection.getSelectionEx()[0].SubObjects[0].BoundBox # sub element BoundBox coordinates
App.Console.PrintMessage("subObjectBBox &#160;: "+str(subObjectBoundBox)+"\n")
subObjectBoundBoxCenter = Gui.Selection.getSelectionEx()[0].SubObjects[0].BoundBox.Center # sub element BoundBoxCenter
App.Console.PrintMessage("subObjectBBoxCe: "+str(subObjectBoundBoxCenter)+"\n")
surfaceFace = Gui.Selection.getSelectionEx()[0].SubObjects[0].Area # Area of the face selected
App.Console.PrintMessage("surfaceFace &#160;: "+str(surfaceFace)+"\n\n")
except:
App.Console.PrintMessage("Oups"+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
surface = sel[0].Shape.Area # Area object complete
App.Console.PrintMessage("surfaceObjet &#160;: "+str(surface)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
CenterOfMass = sel[0].Shape.CenterOfMass # Center of Mass of the object
App.Console.PrintMessage("CenterOfMass &#160;: "+str(CenterOfMass)+"\n")
App.Console.PrintMessage("CenterOfMassX &#160;: "+str(CenterOfMass[0])+"\n") # coordinates [0]=X [1]=Y [2]=Z
App.Console.PrintMessage("CenterOfMassY &#160;: "+str(CenterOfMass[1])+"\n")
App.Console.PrintMessage("CenterOfMassZ &#160;: "+str(CenterOfMass[2])+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
for j in enumerate(sel[0].Shape.Faces): # List alles faces of the object
App.Console.PrintMessage("Face &#160;: "+str("Face%d"&#160;% (j[0]+1))+"\n")
App.Console.PrintMessage("\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
volume_ = sel[0].Shape.Volume # Volume of the object
App.Console.PrintMessage("volume_ &#160;: "+str(volume_)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
boundBox_= sel[0].Shape.BoundBox # BoundBox of the object
App.Console.PrintMessage("boundBox_ &#160;: "+str(boundBox_)+"\n")
boundBoxLX = boundBox_.XLength # Length x boundBox rectangle
boundBoxLY = boundBox_.YLength # Length y boundBox rectangle
boundBoxLZ = boundBox_.ZLength # Length z boundBox rectangle
boundBoxDiag= boundBox_.DiagonalLength # Diagonal Length boundBox rectangle
App.Console.PrintMessage("boundBoxLX &#160;: "+str(boundBoxLX)+"\n")
App.Console.PrintMessage("boundBoxLY &#160;: "+str(boundBoxLY)+"\n")
App.Console.PrintMessage("boundBoxLZ &#160;: "+str(boundBoxLZ)+"\n")
App.Console.PrintMessage("boundBoxDiag &#160;: "+str(boundBoxDiag)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
pl = sel[0].Shape.Placement # Placement Vector XYZ and Yaw-Pitch-Roll
App.Console.PrintMessage("Placement &#160;: "+str(pl)+"\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
pl = sel[0].Shape.Placement.Base # Placement Vector XYZ
App.Console.PrintMessage("PlacementBase &#160;: "+str(pl)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
Yaw = sel[0].Shape.Placement.Rotation.toEuler()[0] # decode angle Euler Yaw
App.Console.PrintMessage("Yaw &#160;: "+str(Yaw)+"\n")
Pitch = sel[0].Shape.Placement.Rotation.toEuler()[1] # decode angle Euler Pitch
App.Console.PrintMessage("Pitch &#160;: "+str(Pitch)+"\n")
Roll = sel[0].Shape.Placement.Rotation.toEuler()[2] # decode angle Euler Yaw
App.Console.PrintMessage("Roll &#160;: "+str(Roll)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
oripl_X = sel[0].Placement.Base[0] # decode Placement X
oripl_Y = sel[0].Placement.Base[1] # decode Placement Y
oripl_Z = sel[0].Placement.Base[2] # decode Placement Z
App.Console.PrintMessage("oripl_X &#160;: "+str(oripl_X)+"\n")
App.Console.PrintMessage("oripl_Y &#160;: "+str(oripl_Y)+"\n")
App.Console.PrintMessage("oripl_Z &#160;: "+str(oripl_Z)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
rotation = sel[0].Placement.Rotation # decode Placement Rotation
App.Console.PrintMessage("rotation &#160;: "+str(rotation)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
pl = sel[0].Shape.Placement.Rotation # decode Placement Rotation other method
App.Console.PrintMessage("Placement Rot &#160;: "+str(pl)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
pl = sel[0].Shape.Placement.Rotation.Angle # decode Placement Rotation Angle
App.Console.PrintMessage("Placement Rot Angle &#160;: "+str(pl)+"\n\n")
##################################################################################
sel = FreeCADGui.Selection.getSelection() # select object with getSelection()
Rot_0 = sel[0].Placement.Rotation.Q[0] # decode Placement Rotation 0
App.Console.PrintMessage("Rot_0 &#160;: "+str(Rot_0)+ " rad , "+str(180 * Rot_0 / 3.1416)+" deg "+"\n")
Rot_1 = sel[0].Placement.Rotation.Q[1] # decode Placement Rotation 1
App.Console.PrintMessage("Rot_1 &#160;: "+str(Rot_1)+ " rad , "+str(180 * Rot_1 / 3.1416)+" deg "+"\n")
Rot_2 = sel[0].Placement.Rotation.Q[2] # decode Placement Rotation 2
App.Console.PrintMessage("Rot_2 &#160;: "+str(Rot_2)+ " rad , "+str(180 * Rot_2 / 3.1416)+" deg "+"\n")
Rot_3 = sel[0].Placement.Rotation.Q[3] # decode Placement Rotation 3
App.Console.PrintMessage("Rot_3 &#160;: "+str(Rot_3)+"\n\n")
################################################################################## </pre>
<h3><span class="mw-headline" id="Manual_search_of_an_element_with_label">Manual search of an element with label</span></h3>
<pre># Extract the coordinate X,Y,Z and Angle giving the label
App.Console.PrintMessage("Base.x &#160;: "+str(FreeCAD.ActiveDocument.getObjectsByLabel("Cylindre")[0].Placement.Base.x)+"\n")
App.Console.PrintMessage("Base.y &#160;: "+str(FreeCAD.ActiveDocument.getObjectsByLabel("Cylindre")[0].Placement.Base.y)+"\n")
App.Console.PrintMessage("Base.z &#160;: "+str(FreeCAD.ActiveDocument.getObjectsByLabel("Cylindre")[0].Placement.Base.z)+"\n")
App.Console.PrintMessage("Base.Angle &#160;: "+str(FreeCAD.ActiveDocument.getObjectsByLabel("Cylindre")[0].Placement.Rotation.Angle)+"\n\n")
################################################################################## </pre>
<p><b>PS:</b> Usually the angles are given in Radian to convert&#160;:
</p>
<ol><li>angle in Degrees to Radians&#160;:
<ul><li>Angle in radian = <b>pi * (angle in degree) / 180</b></li>
<li>Angle in radian = math.radians(angle in degree)</li></ul></li>
<li>angle in Radians to Degrees&#160;:
<ul><li>Angle in degree = <b>180 * (angle in radian) / pi</b></li>
<li>Angle in degree = math.degrees(angle in radian)</li></ul></li></ol>
<h3><span class="mw-headline" id="Cartesian_coordinates">Cartesian coordinates</span></h3>
<p>This code displays the Cartesian coordinates of the selected item.
</p><p>Change the value of "numberOfPoints" if you want a different number of points (precision)
</p>
<pre>numberOfPoints = 100 # Decomposition number (or precision you can change)
selectedEdge = FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0].copy() # select one element
points = selectedEdge.discretize(numberOfPoints) # discretize the element
i=0
for p in points: # list and display the coordinates
i+=1
print i, " X", p.x, " Y", p.y, " Z", p.z </pre>
<p>Other method display on "Int" and "Float"
</p>
<pre>import Part
from FreeCAD import Base
c=Part.makeCylinder(2,10) # create the circle
Part.show(c) # display the shape
# slice accepts two arguments:
#+ the normal of the cross section plane
#+ the distance from the origin to the cross section plane. Here you have to find a value so that the plane intersects your object
s=c.slice(Base.Vector(0,1,0),0) #
# here the result is a single wire
# depending on the source object this can be several wires
s=s[0]
# if you only need the vertexes of the shape you can use
v=[]
for i in s.Vertexes:
v.append(i.Point)
# but you can also sub-sample the section to have a certain number of points (int) ...
p1=s.discretize(20)
ii=0
for i in p1:
ii+=1
print i # Vector()
print ii, ": X:", i.x, " Y:", i.y, " Z:", i.z # Vector decode
Draft.makeWire(p1,closed=False,face=False,support=None) # to see the difference accuracy (20)
## uncomment to use
#import Draft
#Draft.downgrade(App.ActiveDocument.ActiveObject,delete=True) # first transform the DWire in Wire "downgrade"
#Draft.downgrade(App.ActiveDocument.ActiveObject,delete=True) # second split the Wire in single objects "downgrade"
#
##Draft.upgrade(FreeCADGui.Selection.getSelection(),delete=True) # to attach lines contiguous SELECTED use "upgrade"
# ... or define a sampling distance (float)
p2=s.discretize(0.5)
ii=0
for i in p2:
ii+=1
print i # Vector()
print ii, ": X:", i.x, " Y:", i.y, " Z:", i.z # Vector decode
Draft.makeWire(p2,closed=False,face=False,support=None) # to see the difference accuracy (0.5)
## uncomment to use
#import Draft
#Draft.downgrade(App.ActiveDocument.ActiveObject,delete=True) # first transform the DWire in Wire "downgrade"
#Draft.downgrade(App.ActiveDocument.ActiveObject,delete=True) # second split the Wire in single objects "downgrade"
#
##Draft.upgrade(FreeCADGui.Selection.getSelection(),delete=True) # to attach lines contiguous SELECTED use "upgrade" </pre>
<h3><span class="mw-headline" id="Select_all_objects_in_the_document">Select all objects in the document</span></h3>
<pre>import FreeCAD
for obj in FreeCAD.ActiveDocument.Objects:
print obj.Name # display the object Name
objName = obj.Name
obj = App.ActiveDocument.getObject(objName)
Gui.Selection.addSelection(obj) # select the object </pre>
<h3><span class="mw-headline" id="Selecting_a_face_of_an_object">Selecting a face of an object</span></h3>
<pre># select one face of the object
import FreeCAD, Draft
App=FreeCAD
nameObject = "Box" # objet
faceSelect = "Face3" # face to selection
loch=App.ActiveDocument.getObject(nameObject) # objet
Gui.Selection.clearSelection() # clear all selection
Gui.Selection.addSelection(loch,faceSelect) # select the face specified
s = Gui.Selection.getSelectionEx()
#Draft.makeFacebinder(s) # </pre>
<h3><span class="mw-headline" id="Create_one_object_to_the_position_of_the_Camera">Create one object to the position of the Camera</span></h3>
<pre># create one object of the position to camera with "getCameraOrientation()"
# the object is still facing the screen
import Draft
plan = FreeCADGui.ActiveDocument.ActiveView.getCameraOrientation()
plan = str(plan)
###### extract data
a = ""
for i in plan:
if i in ("0123456789e.- "):
a+=i
a = a.strip(" ")
a = a.split(" ")
####### extract data
#print a
#print a[0]
#print a[1]
#print a[2]
#print a[3]
xP = float(a[0])
yP = float(a[1])
zP = float(a[2])
qP = float(a[3])
pl = FreeCAD.Placement()
pl.Rotation.Q = (xP,yP,zP,qP) # rotation of object
pl.Base = FreeCAD.Vector(0.0,0.0,0.0) # here coordinates XYZ of Object
rec = Draft.makeRectangle(length=10.0,height=10.0,placement=pl,face=False,support=None) # create rectangle
#rec = Draft.makeCircle(radius=5,placement=pl,face=False,support=None) # create circle
print rec.Name </pre>
<p>here same code simplified
</p>
<pre>import Draft
pl = FreeCAD.Placement()
pl.Rotation = FreeCADGui.ActiveDocument.ActiveView.getCameraOrientation()
pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
rec = Draft.makeRectangle(length=10.0,height=10.0,placement=pl,face=False,support=None) </pre>
<h3><span class="mw-headline" id="Find_normal_vector_on_the_surface">Find normal vector on the surface</span></h3>
<p>This example show how to find normal vector on the surface by find the u,v parameters of one point on the surface and use u,v parameters to find normal vector
</p>
<pre>def normal(self):
ss=FreeCADGui.Selection.getSelectionEx()[0].SubObjects[0].copy()#SubObjects[0] is the edge list
points = ss.discretize(3.0)#points on the surface edge,
#this example just use points on the edge for example.
#However point is not necessary on the edge, it can be anywhere on the surface.
face=FreeCADGui.Selection.getSelectionEx()[0].SubObjects[1]
for pp in points:
pt=FreeCAD.Base.Vector(pp.x,pp.y,pp.z)#a point on the surface edge
uv=face.Surface.parameter(pt)# find the surface u,v parameter of a point on the surface edge
u=uv[0]
v=uv[1]
normal=face.normalAt(u,v)#use u,v to find normal vector
print normal
line=Part.makeLine((pp.x,pp.y,pp.z), (normal.x,normal.y,normal.z))
Part.show(line) </pre>
<h3><span class="mw-headline" id="Read_And_write_one_Expression">Read And write one Expression</span></h3>
<pre>import Draft
doc = FreeCAD.ActiveDocument
pl=FreeCAD.Placement()
pl.Rotation.Q=(0.0,-0.0,-0.0,1.0)
pl.Base=FreeCAD.Vector(0.0,0.0,0.0)
obj = Draft.makeCircle(radius=1.0,placement=pl,face=False,support=None) # create circle
print obj.PropertiesList # properties disponible in the obj
doc.getObject(obj.Name).setExpression('Radius', u'2mm') # modify the radius
doc.getObject(obj.Name).setExpression('Placement.Base.x', u'10mm') # modify the placement
doc.getObject(obj.Name).setExpression('FirstAngle', u'90') # modify the first angle
doc.recompute()
expressions = obj.ExpressionEngine # read the expression list
print expressions
for i in expressions: # list and separate the data expression
print i[0]," = ",i[1] </pre>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p><p>Denna sida visar hur lätt avancerad funktionalitet kan byggas i Python. I denna övning, så kommer vi att bygga ett nytt verktyg som ritar en linje. Detta verktyg kan sedan länkas till ett FreeCAD kommando, och det kommandot kan anropas av ett element i gränssnittet, som en menypunkt eller en knapp i en verktygslåda.
</p>
<h2><span class="mw-headline" id="Huvudskriptet">Huvudskriptet</span></h2>
<p>Först kommer vi att skriva ett skript som innehåller all vår funktionalitet. Sedan kommer vi att spara detta i en fil, och importera den i FreeCAD, så att alla klasser och funktioner som vi skriver kommer att vara tillgängliga för FreeCAD. Så, starta din favorit textredigerare, , och skriv följande rader:
</p>
<pre>import FreeCADGui, Part
from pivy.coin import *
class line:
"this class will create a line after the user clicked 2 points on the screen"
def __init__(self):
self.view = FreeCADGui.ActiveDocument.ActiveView
self.stack = []
self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getpoint)
def getpoint(self,event_cb):
event = event_cb.getEvent()
if event.getState() == SoMouseButtonEvent.DOWN:
pos = event.getPosition()
point = self.view.getPoint(pos[0],pos[1])
self.stack.append(point)
if len(self.stack) == 2:
l = Part.Line(self.stack[0],self.stack[1])
shape = l.toShape()
Part.show(shape)
self.view.removeEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.callback) </pre>
<h2><span class="mw-headline" id="Detaljerad_f.C3.B6rklaring_2">Detaljerad förklaring</span></h2>
<pre>import Part, FreeCADGui
from pivy.coin import * </pre>
<p>När du vill använda funktioner från en annan modul I Python, så behöver du importera den. I vårt fall, så behöver vi funktioner från <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a>, för att skapa linjen, och från gränssnittsmodulen (FreeCADGui), för att komma åt 3D vyn. Vi behöver även innehållet i coin biblioteket, så vi kan använda alla coin objekt som SoMouseButtonEvent, etc...
</p>
<pre>class line: </pre>
<p>Här definierar vi vår huvudklass. Varför använder vi en klass och inte en funktion? Skälet är att vårt verktyg behöver "stanna vid liv" medan vi väntar på att användaren ska klicka på skärmen. En funktion avslutas när dess uppgift är klar, men ett objekt (en klass definierar ett objekt) stannar vid liv ända tills den förstörs.
</p>
<pre>"this class will create a line after the user clicked 2 points on the screen" </pre>
<p>I Python, så kan varje klass eller funktion ha en beskrivningssträng. Detta är speciellt användbart i FreeCAD, därför att när du anropar den klassen i tolken, så visas beskrivningssträngen som ett verktygstips.
</p>
<pre>def __init__(self): </pre>
<p>Python klasser kan alltid innehålla en __init__ funktion, vilken utförs när klassen anropas för att skapa ett objekt. Så här lägger vi allt som vi vill ska hända när vårt linjeverktyg börjar.
</p>
<pre>self.view = FreeCADGui.ActiveDocument.ActiveView </pre>
<p>I en klass, så vill du vanligtvis lägga till <i>self.</i> innan ett variabelnamn, så att den kan kommas åt lätt för alla funktioner inuti och utanför den klassen. Här kommer vi att använda self.view för att komma åt och manipulera den aktiva 3D vyn.
</p>
<pre>self.stack = [] </pre>
<p>Här skapar vi en tom lista som kommer att innehålla 3D punkterna som sänds av getpoint funktionen.
</p>
<pre>self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getpoint) </pre>
<p>Detta är den viktiga delen: Eftersom det egentligen är en <a rel="nofollow" class="external text" href="http://www.coin3d.org/">coin3D</a> scen, så använder FreeCAD coin's återanropsmekanism, som tillåter en funktion att anropas varje gång en viss scenhändelse inträffar. I vårt fall, så skapar vi ett återanrop för <a rel="nofollow" class="external text" href="http://doc.coin3d.org/Coin/group__events.html">SoMouseButtonEvent</a> händelser, och vi binder den till getpoint funktionen. Nu, varje gång som en musknapp trycks ned eller släpps, så kommer getpoint funktionen att utföras.
</p><p>Notera att det finns ett alternativ till addEventCallbackPivy() kallat addEventCallback() vilket dispenserar bruket av pivy. Men eftersom pivy är en mycket effektiv och naturlig väg att komma åt en del av coin scenen, så är det mycket bättre att använda den så mycket du kan!
</p>
<pre>def getpoint(self,event_cb): </pre>
<p>Nu definierar vi getpoint funktionen, som kommer utföras när en musknapp trycks ned i en 3D vy. Denna funktion kommer att ta emot ett argument, som vi kommer kalla event_cb. Från denna händelses återanrop kan vi komma åt händelseobjektet, vilket innehåller flera informationsbitar (läge info <a href="/wiki/Code_snippets#Observing_mouse_events_in_the_3D_viewer_via_Python.2Fsv" title="Code snippets">här</a>).
</p>
<pre>if event.getState() == SoMouseButtonEvent.DOWN: </pre>
<p>Getpoint funktionen kommer att anropas när en musknapp trycks ned eller släpps. Men vi vill bara välja en 3D punkt när den trycks ned (annars skulle vi få två 3D punkter mycket nära varann). Så vi måste kontrollera det här.
</p>
<pre>pos = event.getPosition() </pre>
<p>Här får vi musmarkörens skärmkoordinater
</p>
<pre>point = self.view.getPoint(pos[0],pos[1]) </pre>
<p>Denna funktion ger oss en FreeCAD vektor (x,y,z) som innehåller den 3D punkt som ligger på fokalplanet, precis under vår musmarkör. om du är i kameravy, tänk dig en stråle som kommer från kameran, och passerar genom musmarkören, och träffar fokalplanet. Där är vår 3D punkt. On vi är i ortogonal vy, så är strålen parallell med vyriktningen.
</p>
<pre>self.stack.append(point) </pre>
<p>Vi lägger till vår nya punkt till stacken
</p>
<pre>if len(self.stack) == 2: </pre>
<p>Har vi tillräckligt med punkter? Om ja, låt oss då rita linjen!
</p>
<pre>l = Part.Line(self.stack[0],self.stack[1]) </pre>
<p>Här använder vi funktionen Line() från <a href="https://www.freecadweb.org/wiki/index.php?title=Part_Module/sv" title="Part Module/sv">Del Modulen</a> som skapar en linje från två FreeCAD vektorer. Allt som vi skapar och ändrar inuti Del modulen, stannar i Del modulen. Så, tills nu, så har vi skapat en Linje Del. Den är inte bunden till något objekt i vårt aktiva dokument, så inget syns på skärmen.
</p>
<pre>shape = l.toShape() </pre>
<p>FreeCAD dokumentet kan bara acceptera former från Del modulen. Former är Del modulens mest allmäna typ. Så vi behöver konvertera vår linje till en form innan vi lägger till den till dokumentet.
</p>
<pre>Part.show(shape) </pre>
<p>Del modulen har en mycket smidig show() funktion som skapar ett nytt objekt i dokumentet och binder en form till den. Vi skulle också kunna ha skapat ett nytt objekt i dokumentet först, och sedan ha bundit formen till den manuellt.
</p>
<pre>self.view.removeEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.callback) </pre>
<p>Eftersom vi är klara med vår linje, låt oss ta bort vår återanropsmekanism, som använder värdefulla CPU cykler.
</p>
<h2><span class="mw-headline" id="Testa_.26_anv.C3.A4nda_skriptet">Testa &amp; använda skriptet</span></h2>
<p>Låt oss nu spara vårt skript på någon plats där FreeCAD's python tolk kommer att hitta den. När moduler importerass, så kommer tolken att leta på följande platser: python's installationssökväg, FreeCAD bin katalogen, och alla FreeCAD modulkataloger. Så, den bästa lösningen är att skapa en ny katalog i en av FreeCAD's <a href="https://www.freecadweb.org/wiki/index.php?title=Installing_more_workbenches/sv" title="Installing more workbenches/sv">Mod kataloger</a>, och spara vårt skript i den. Låt oss till exempel skapa en "MinaSkript" katalog, och spara vårt skript som "ovning.py".
</p><p>Nu är allt klart, låt oss starta FreeCAD, skapa ett nytt dokument, och i pythontolken skriva:
</p>
<pre>import exercise </pre>
<p>Om inga felmeddelanden kommer fram, så innebär det att vårt övningsskript har laddats. Vi kan nu kontrollera dess innehåll med&#160;:
</p>
<pre>dir(exercise) </pre>
<p>Kommandot dir() är ett inbyggt python kommando som listar modulens innehåll. Vi kan se att vår line() klass är där, som väntar på oss. Låt oss nu testa den:
</p>
<pre>exercise.line() </pre>
<p>Klicka sedan på två olika ställen i 3D vyn, och bingo, där är vår linje! För att göra det igen, skriv bara ovning.line() igen, och igen, och igen... Känns det bra?
</p>
<h2><span class="mw-headline" id="Registrera_skriptet_i_FreeCAD.27s_gr.C3.A4nssnitt">Registrera skriptet i FreeCAD's gränssnitt</span></h2>
<p>För att vårt nya linjeverktyg ska bli ännu häftigare, så borde det ha en knapp i gränssnittet, så vi inte behöver skriva allt det varje gång. Den lättaste vägen är att omvandla vår nya MinaSkript katalog till en full FreeCAD arbetsbänk. Det är lätt, allt som behövs är att lägga in en fil som kallas <b>InitGui.py</b> inuti din MinaSkript katalog. InitGui.py kommer att innehålla instruktioner för att skapa en ny arbetsbänk, och addera vårt nya verktyg till den. Förutom det så behöver vi ändra vår övningskod lite, så att line() verktyget igenkänns som ett officiellt FreeCAD kommando. Låt oss starta genom att göra en InitGui.py fil, och skriva följande kod i den:
</p>
<pre>class MyWorkbench (Workbench):
MenuText = "MyScripts"
def Initialize(self):
import exercise
commandslist = ["line"]
self.appendToolbar("My Scripts",commandslist)
Gui.addWorkbench(MyWorkbench()) </pre>
<p>Jag tror att du redan nu förstår det ovanstående skriptet: Vi skapar en ny klass som vi kallar MinArbetsbänk, vi ger den en titel (MenuText), och vi definierar en Initialize() funktion som kommer att utföras när arbetsbänken laddas till FreeCAD. I den funktionen så laddar vi innehållet i vår övningsfil, och lägger till de FreeCAD kommandon som hittas i det i en kommandolista. Sedan gör vi en verktygslåda som kallas "Mina Skript" och vi tilldelar vår kommandolista till den. För närvarande har vi förstås endast ett verktyg, så vår kommandolista innehåller endast ett element. Sedan, när vår arbetsbänk är klar, så lägger vi till den till huvudgränssnittet.
</p><p>Men det kommer fortfarande inte att fungera, därför att ett FreeCAD kommando måste formatteras på ett visst sätt för att fungera. så vi behöver ändra vårt line() verktyg lite. Vår nya ovning.py skript kommer nu att se ut så här:
</p>
<pre>import FreeCADGui, Part
from pivy.coin import *
class line:
"this class will create a line after the user clicked 2 points on the screen"
def Activated(self):
self.view = FreeCADGui.ActiveDocument.ActiveView
self.stack = []
self.callback = self.view.addEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.getpoint)
def getpoint(self,event_cb):
event = event_cb.getEvent()
if event.getState() == SoMouseButtonEvent.DOWN:
pos = event.getPosition()
point = self.view.getPoint(pos[0],pos[1])
self.stack.append(point)
if len(self.stack) == 2:
l = Part.Line(self.stack[0],self.stack[1])
shape = l.toShape()
Part.show(shape)
self.view.removeEventCallbackPivy(SoMouseButtonEvent.getClassTypeId(),self.callback)
def GetResources(self):
return {'Pixmap'&#160;: 'path_to_an_icon/line_icon.png', 'MenuText': 'Line', 'ToolTip': 'Creates a line by clicking 2 points on the screen'}
FreeCADGui.addCommand('line', line()) </pre>
<p>Vad vi gjorde här var att omvandla vår __init__() funktion till en Activated() funktion, därför att när FreeCAD kommandon körs, så utför de automatiskt Activated() funktionen. Vi lade också till en GetResources() funktion, som informerar FreeCAD var den kan hitta en ikon för verktyget, och namnet och verktygstipset för vårt verktyg. en jpg, png eller svg bild kommer att fungera som en ikon, den kan vara av valfri storlek, men det är bäst att använda en storlek osm är nära den slutliga, som 16x16, 24x24 eller 32x32.
</p><p>Sedan lägger vi till line() klassen som ett officiellt FreeCAD kommando med addCommand() metoden.
</p><p>Klart, nu behöver vi bara starta om FreeCAD och vi kommer att ha en ny snygg arbetsbänk med vårt splitternya verktyg!
</p>
<h2><span class="mw-headline" id="S.C3.A5_du_vill_ha_mer.3F">Så du vill ha mer?</span></h2>
<p>Om du gillade denna övningen, varför inte försöka förbättra detta lilla verktyg? Det finns många saker som kan göras, som till exempel:
</p>
<ul><li> Lägga till feedback för användaren: nu är det ett mycket 'naket' verktyg, så användaren kan bli lite osäker när det används. Så vi skulle kunna lägga till lite feedback, tala om vad som ska göras. Du skulle till exempel kunna mata ur meddelanden till FreeCAD konsolen. Ta en titt i FreeCAD.Console modulen</li>
<li> Lägga till en möjlighet att skriva in 3D punkterna manuellt. Titta på python input() funktionen, till exempel</li>
<li> Lägga till möjligheten att lägga till mer än 2 punkter</li>
<li> Lägga till händelser för andra saker: Nu kontrollerar vi endast musknappshändelser, men om vi också kunde göra något när musen förflyttas, som att visa koordinater?</li>
<li> Ge ett namn till det skapade objektet</li></ul>
<p>Tveka inte att skriva dina frågor eller ideer på <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/">forum</a>!
</p>
<div style="clear:both"></div>
<p><br />
</p><p>På denna sida kommer vi att visa hur man bygger en simpel Qt Dialog med <a rel="nofollow" class="external text" href="http://qt-project.org/doc/qt-4.8/designer-manual.html">Qt Designer</a>, Qt's officiella verktyg för att designa gränssnitt, och sedan konvertera den till pythonkod, och sedan använda den inuti FreeCAD. Jag antar i exemplet att du redan vet hur du ska redigera och köra python skript, och att du kan göra enkla saker i ett terminalfönster som att navigera, etc. Du måste förstås också ha pyqt installerat.
</p>
<h2><span class="mw-headline" id="Designa_dialogen">Designa dialogen</span></h2>
<p>Att i CAD applikationer designa ett bra användargränssnitt är mycket viktigt. Nästan allt som användaren kommer att göra kommer att vara genom någon typ av gränssnitt: läsa dialogrutor, klicka på knappar, välja mellan ikoner, etc. Så det är mycket viktigt att noga tänka igenom vad du vill göra, hur du vill att användaren ska bete sig, och hur arbetsflödet i din aktion kommer att se ut.
</p><p>Det finns några koncept man bör känna till när man designar ett gränssnitt:
</p>
<ul><li> <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Modal_window">Modal/non-modal dialogs</a>: En modal dialog kommer fram längst fram på skärmen, stoppar aktionen i huvudfönstret, och tvingar användare att svara på dialogen, emedan en icke-modal dialog inte stoppar dig från att arbeta med huvudfönstret. I en del fall så är det första bättre, i andra fall inte.</li></ul>
<ul><li> Identifiera vad som krävs och vad som är valbart: Försäkra dig om att användaren vet vad den måste göra. Etikettera allting med en riktig beskrivning, använd verktygstips, etc.</li></ul>
<ul><li> Separera kommandon från parametrar: Detta görs vanligtvis med knappar och textinmatningsfält. Användaren vet att om en knapp klickas så produceras en aktion emedan ändring av ett värde inuti ett textfält kommer att ändra en parameter någonstans. Nuförtidan så vet de flesta användarna vad en kanpp är, vad ett inmatningsfält är, etc. Det gränssnitts verktygskit vi använder, Qt, är en av de bästa verktygskiten, och vi behöver inte bry oss om så mycket om hur man klargör saker, eftersom de redan är mycket tydliga.</li></ul>
<p>Så, nu när vi har definierat vad vi ska göra, så är det dags att öppna qt designer. Låt oss designa en mycket enkel dialog, som den här:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qttestdialog.jpg" class="image"><img alt="Qttestdialog.jpg" src="Qttestdialog.jpg" width="210" height="216" /></a>
</p><p>Vi kommer sedan använda denna dialog i FreeCAD till att producera ett fint rektangulärt plan. Du kanske tycker att det inte är så användbart att producera fina rektangulära plan, men det kommer vara lätt att senare ändra den till att göra mer komplexa saker. När du öppnar det, så ser Qt Designer ut så här:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qtdesigner-screenshot.jpg" class="image"><img alt="Qtdesigner-screenshot.jpg" src="Qtdesigner-screenshot.jpg" width="800" height="486" /></a>
</p><p>Det är mycket enkelt att använda. I den vänstra lådan har du element som kan dras till din widget. på den högra sidan har du egenskapspanelerna som visar alla möjliga redigerbara egenskaper på de valda elementen. Så, börja med att skapa en ny widget. Välj "Dialog without buttons", eftersom vi inte vill ha standard Ok/Cancel knappar. Dra sedan<b>3 labels</b>, på din widget, en för titeln, en för att skriva "Höjd" och en för att skriva "Bredd". Labels är enkla texter som syns på din widget, bara för att informera användaren. Om du väljer en label, så kommer det fram flera egenskaper på den högra sidan som du kan ändra om du vill, som teckensnitt, höjd, etc.
</p><p>Lägg sedan till <b>2 LineEdits</b>, vilket är textfält som användaren kan fylla i, en för höjden och en för bredden. Här kan vi också redigera egenskaper. Till exempel, varför inte ställa in ett standardvärde? Till exempel 1.00 för varje. På detta sätt, när användaren ser dialogen, så kommer båda värdena redan vara ifyllda och om användaren är nöjd så kan den klicka på knappen direkt, och spara dyrbar tid. Lägg sedan till en <b>PushButton</b>, vilken är den knapp som användaren kommer att behöva klicka på efter att de 2 fälten är ifyllda.
</p><p>Notera att jag här valde mycket enkla kontroller, men Qt har många fler alternativ, du kan till exempel använda Spinboxes istället för LineEdits, etc... Ta en titt på vad som finns tillgängligt, du kommer säkert att få andra ideer.
</p><p>Det är ungefär allt vi behöver göra i Qt Designer. En sista sak bara, låt oss döpa om alla våra element till lättare namn, så blir det lättare att identifiera dem i våra skript:
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qtpropeditor.jpg" class="image"><img alt="Qtpropeditor.jpg" src="Qtpropeditor.jpg" width="348" height="321" /></a>
</p>
<h2><span class="mw-headline" id="Konvertera_v.C3.A5r_dialog_till_python">Konvertera vår dialog till python</span></h2>
<p>Låt oss nu spara vår widget någonstans. Den kommar att sparas som en .ui fil, som vi smidigt kan omvandla till python skript med pyuic. på windows, så är pyuic programmet hoppackat med pyqt (ska verifieras), på linux behöver du troligen installera den separat från din pakethanterare (på debian-baserade system, så är det en del av pyqt4-dev-tools paketet). För att göra konverteringen, så behöver du öppna ett terminalfönster (eller ett kommandoprompt fönster på windows), navigera till där du sparade din .ui file, och skriva:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>pyuic mywidget.ui > mywidget.py</pre></div>
<p>Into Windows pyuic.py are located in "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py"
For create batch file "compQt4.bat:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>@"C:\Python27\python" "C:\Python27\Lib\site-packages\PyQt4\uic\pyuic.py" -x %1.ui > %1.py</pre></div>
<p>In the console Dos type without extension
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>compQt4 myUiFile</pre></div>
<p>Into Linux&#160;: to do
</p><p>Since FreeCAD progressively moved away from PyQt after version 0.13, in favour of <a rel="nofollow" class="external text" href="http://qt-project.org/wiki/PySide">PySide</a> (Choice your PySide install <a rel="nofollow" class="external text" href="http://pyside.readthedocs.org/en/latest/building/">building PySide</a>), to make the file based on PySide now you have to use:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>pyside-uic mywidget.ui -o mywidget.py</pre></div>
<p>Into Windows uic.py are located in "C:\Python27\Lib\site-packages\PySide\scripts\uic.py"
For create batch file "compSide.bat":
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>@"C:\Python27\python" "C:\Python27\Lib\site-packages\PySide\scripts\uic.py" %1.ui > %1.py</pre></div>
<p>In the console Dos type without extension
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>compSide myUiFile</pre></div>
<p>Into Linux&#160;: to do
</p><p><br />
På en del system så kallas programmet pyuic4 istället för pyuic. Detta kommer att konvertera .ui filen till ett python skript. Om vi öppnar mywidget.py filen, så är dess innehåll mycket lätt att förstå:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>from PySide import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(187, 178)
self.title = QtGui.QLabel(Dialog)
self.title.setGeometry(QtCore.QRect(10, 10, 271, 16))
self.title.setObjectName("title")
self.label_width = QtGui.QLabel(Dialog)
...
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.title.setText(QtGui.QApplication.translate("Dialog", "Plane-O-Matic", None, QtGui.QApplication.UnicodeUTF8))
...</pre></div>
<p>Som du ser så har det en mycket enkel struktur: En klass benämnd Ui_Dialog skapas, som sparar din widgets gränssnittselement. Den klassen har två metoder, en fär att ställa in widgeten, och en för att översätta dess innehåll, som är en del av de allmäna Qt mekanismerna för översättning av gränssnittselement. Inställningsmetoden skapar, en och en, widgetarna som vi har definierat dem i Qt Designer, och sätter deras alternativ som vi bestämt tidigare. Sedan blir hela gränssnittet översatt, och slutligen, blir sloten anslutna (vi pratar om det senare).
</p><p>Vi kan nu skapa en ny widget, och använda denna klass till att skapa dess gränssnitt. Vi kan redan se vår widget i aktion, genom att sätta vår mywidget.py fil på en plats där FreeCAD kommer att hitta den (i FreeCAD's bin katalog, eller i någon av underkatalogerna till Mod ), och i FreeCAD pythontolken skriva:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>from PySide import QtGui
import mywidget
d = QtGui.QWidget()
d.ui = mywidget.Ui_Dialog()
d.ui.setupUi(d)
d.show()</pre></div>
<p>Och vår dialog kommer fram! Notera att din pythontolk fortfarande fungerar, vi har en icke-modal dialog. Så, för att stänga den, så kan vi (förutom att klicka på dess stängningsikon, förstås) skriva:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d.hide()</pre></div>
<h2><span class="mw-headline" id="Ordna_s.C3.A5_att_v.C3.A5r_dialog_g.C3.B6r_n.C3.A5got">Ordna så att vår dialog gör något</span></h2>
<p>Nu när vi kan visa och gömma vår dialog, så behöver vi bara lägga till en sista bit: Att låta den göra något! Om du leker lite med Qt designer, så kommer du snabbt upptäcka ett helt avsnitt som kallas "signals and slots". I grunden så fungerar det så här: element på dina widgetar (i Qt terminologi, så är dessa element widgetar själva) kan sända signaler. Dessa signaler skiljer sig beroende på widget typ. Till exempel, en knapp kan sända en signal när den är nedtryckt och när den släpps. Dessa signaler kan anslutas till slots, vilka kan vara en speciell funktionalitet i andra widgetar (till exempel en dialog har en "stäng" slot till vilken du kan ansluta signalen från en stäng knapp), eller kan vara anpassade funktioner. <a rel="nofollow" class="external text" href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html">PyQt Referensdokumentation</a> listar alla qt widgetar, vad de kan göra, vilka signaler de kan sända , etc...
</p><p>Vad vi kommer att göra här, är att skapa en ny funktion som kommer att skapa ett plan, baserat på höjd och bredd, och ansluta denna funktion till nedtryckt signalen som sänds av vår "Skapa!" button. Så, låt os börja med att importera våra FreeCAD moduler, genom att sätta följande rader i toppen på skriptet, där vi redan har importerat QtCore och QtGui:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import FreeCAD, Part</pre></div>
<p>Låt oss sedan lägga till en ny funktion till vår Ui_Dialog klass:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>def createPlane(self):
try:
# first we check if valid numbers have been entered
w = float(self.width.text())
h = float(self.height.text())
except ValueError:
print "Error! Width and Height values must be valid numbers!"
else:
# create a face from 4 points
p1 = FreeCAD.Vector(0,0,0)
p2 = FreeCAD.Vector(w,0,0)
p3 = FreeCAD.Vector(w,h,0)
p4 = FreeCAD.Vector(0,h,0)
pointslist = [p1,p2,p3,p4,p1]
mywire = Part.makePolygon(pointslist)
myface = Part.Face(mywire)
Part.show(myface)
self.hide()</pre></div>
<p>Sedan behöver vi informera Qt att ansluta knappen till funktionen, genom att placera följande rad precis innan QtCore.QMetaObject.connectSlotsByName(Dialog):
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>QtCore.QObject.connect(self.create,QtCore.SIGNAL("pressed()"),self.createPlane)</pre></div>
<p>Detta ansluter, som du ser, pressed() signalen från vårt skapade objekt ("Skapa!" knappen), till en slot benämnd createPlane, som vi just definierade. Klart! Nu, som en slutlig justering, så kan vi lägga till lite funktion för att skapa dialogen, så kommer den bli lättare att anropa. Utanför Ui_Dialog klassan, så lägger vi till denna kod:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>class plane():
def __init__(self):
self.d = QtGui.QWidget()
self.ui = Ui_Dialog()
self.ui.setupUi(self.d)
self.d.show()</pre></div>
<p>(Python reminder: the __init__ method of a class is automatically executed whenever a new object is created!)
</p><p>Det enda vi sedan behöver göra från FreeCAD är:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import mywidget
myDialog = mywidget.plane()</pre></div>
<p>Det var allt. Nu kan du försöka andra saker, som till exempel sätta in din widget i FreeCAD's gränssnitt (se <a href="https://www.freecadweb.org/wiki/index.php?title=Code_snippets/sv" title="Code snippets/sv">kodbitar</a> sidan), eller göra mycket mer avancerade verktyg, genom att använda andra element på din widget.
</p>
<h2><span class="mw-headline" id="Det_kompletta_skriptet_2">Det kompletta skriptet</span></h2>
<p>För referens, så är det kompletta skriptet här:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mywidget.ui'
#
# Created: Mon Jun 1 19:09:10 2009
# by: PyQt4 UI code generator 4.4.4
# Modified for PySide 16:02:2015
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
import FreeCAD, Part
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(187, 178)
self.title = QtGui.QLabel(Dialog)
self.title.setGeometry(QtCore.QRect(10, 10, 271, 16))
self.title.setObjectName("title")
self.label_width = QtGui.QLabel(Dialog)
self.label_width.setGeometry(QtCore.QRect(10, 50, 57, 16))
self.label_width.setObjectName("label_width")
self.label_height = QtGui.QLabel(Dialog)
self.label_height.setGeometry(QtCore.QRect(10, 90, 57, 16))
self.label_height.setObjectName("label_height")
self.width = QtGui.QLineEdit(Dialog)
self.width.setGeometry(QtCore.QRect(60, 40, 111, 26))
self.width.setObjectName("width")
self.height = QtGui.QLineEdit(Dialog)
self.height.setGeometry(QtCore.QRect(60, 80, 111, 26))
self.height.setObjectName("height")
self.create = QtGui.QPushButton(Dialog)
self.create.setGeometry(QtCore.QRect(50, 140, 83, 26))
self.create.setObjectName("create")
self.retranslateUi(Dialog)
QtCore.QObject.connect(self.create,QtCore.SIGNAL("pressed()"),self.createPlane)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
self.title.setText(QtGui.QApplication.translate("Dialog", "Plane-O-Matic", None, QtGui.QApplication.UnicodeUTF8))
self.label_width.setText(QtGui.QApplication.translate("Dialog", "Width", None, QtGui.QApplication.UnicodeUTF8))
self.label_height.setText(QtGui.QApplication.translate("Dialog", "Height", None, QtGui.QApplication.UnicodeUTF8))
self.create.setText(QtGui.QApplication.translate("Dialog", "Create!", None, QtGui.QApplication.UnicodeUTF8))
def createPlane(self):
try:
# first we check if valid numbers have been entered
w = float(self.width.text())
h = float(self.height.text())
except ValueError:
print "Error! Width and Height values must be valid numbers!"
else:
# create a face from 4 points
p1 = FreeCAD.Vector(0,0,0)
p2 = FreeCAD.Vector(w,0,0)
p3 = FreeCAD.Vector(w,h,0)
p4 = FreeCAD.Vector(0,h,0)
pointslist = [p1,p2,p3,p4,p1]
mywire = Part.makePolygon(pointslist)
myface = Part.Face(mywire)
Part.show(myface)
class plane():
def __init__(self):
self.d = QtGui.QWidget()
self.ui = Ui_Dialog()
self.ui.setupUi(self.d)
self.d.show()</pre></div>
<h2><span class="mw-headline" id="Creation_of_a_dialog_with_buttons">Creation of a dialog with buttons</span></h2>
<h3><span class="mw-headline" id="Method_1">Method 1</span></h3>
<p>An example of a dialog box complete with its connections.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
# Create by flachyjoe
from PySide import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def __init__(self, MainWindow):
self.window = MainWindow
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(400, 300)
self.centralWidget = QtGui.QWidget(MainWindow)
self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
self.pushButton = QtGui.QPushButton(self.centralWidget)
self.pushButton.setGeometry(QtCore.QRect(30, 170, 93, 28))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.pushButton.clicked.connect(self.on_pushButton_clicked) #connection pushButton
self.lineEdit = QtGui.QLineEdit(self.centralWidget)
self.lineEdit.setGeometry(QtCore.QRect(30, 40, 211, 22))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.lineEdit.returnPressed.connect(self.on_lineEdit_clicked) #connection lineEdit
self.checkBox = QtGui.QCheckBox(self.centralWidget)
self.checkBox.setGeometry(QtCore.QRect(30, 90, 81, 20))
self.checkBox.setChecked(True)
self.checkBox.setObjectName(_fromUtf8("checkBoxON"))
self.checkBox.clicked.connect(self.on_checkBox_clicked) #connection checkBox
self.radioButton = QtGui.QRadioButton(self.centralWidget)
self.radioButton.setGeometry(QtCore.QRect(30, 130, 95, 20))
self.radioButton.setObjectName(_fromUtf8("radioButton"))
self.radioButton.clicked.connect(self.on_radioButton_clicked) #connection radioButton
MainWindow.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 26))
self.menuBar.setObjectName(_fromUtf8("menuBar"))
MainWindow.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(MainWindow)
self.mainToolBar.setObjectName(_fromUtf8("mainToolBar"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(MainWindow)
self.statusBar.setObjectName(_fromUtf8("statusBar"))
MainWindow.setStatusBar(self.statusBar)
self.retranslateUi(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None))
self.pushButton.setText(_translate("MainWindow", "OK", None))
self.lineEdit.setText(_translate("MainWindow", "tyty", None))
self.checkBox.setText(_translate("MainWindow", "CheckBox", None))
self.radioButton.setText(_translate("MainWindow", "RadioButton", None))
def on_checkBox_clicked(self):
if self.checkBox.checkState()==0:
App.Console.PrintMessage(str(self.checkBox.checkState())+" CheckBox KO\r\n")
else:
App.Console.PrintMessage(str(self.checkBox.checkState())+" CheckBox OK\r\n")
# App.Console.PrintMessage(str(self.lineEdit.setText("tititi"))+" LineEdit\r\n") #write text to the lineEdit window !
# str(self.lineEdit.setText("tititi")) #écrit le texte dans la fenêtre lineEdit
App.Console.PrintMessage(str(self.lineEdit.displayText())+" LineEdit\r\n")
def on_radioButton_clicked(self):
if self.radioButton.isChecked():
App.Console.PrintMessage(str(self.radioButton.isChecked())+" Radio OK\r\n")
else:
App.Console.PrintMessage(str(self.radioButton.isChecked())+" Radio KO\r\n")
def on_lineEdit_clicked(self):
# if self.lineEdit.textChanged():
App.Console.PrintMessage(str(self.lineEdit.displayText())+" LineEdit Display\r\n")
def on_pushButton_clicked(self):
App.Console.PrintMessage("Terminé\r\n")
self.window.hide()
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow(MainWindow)
MainWindow.show()</pre></div>
<p>Here the same window but with an icon on each button.
</p><p>Download associated icons (Click rigth "Copy the image below ...)"
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Icone01.png" class="image"><img alt="Icone01.png" src="Icone01.png" width="64" height="64" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Icone02.png" class="image"><img alt="Icone02.png" src="Icone02.png" width="64" height="64" /></a> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Icone03.png" class="image"><img alt="Icone03.png" src="Icone03.png" width="64" height="64" /></a>
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
from PySide import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def __init__(self, MainWindow):
self.window = MainWindow
path = FreeCAD.ConfigGet("UserAppData")
# path = FreeCAD.ConfigGet("AppHomePath")
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(400, 300)
self.centralWidget = QtGui.QWidget(MainWindow)
self.centralWidget.setObjectName(_fromUtf8("centralWidget"))
self.pushButton = QtGui.QPushButton(self.centralWidget)
self.pushButton.setGeometry(QtCore.QRect(30, 170, 93, 28))
self.pushButton.setObjectName(_fromUtf8("pushButton"))
self.pushButton.clicked.connect(self.on_pushButton_clicked) #connection pushButton
self.lineEdit = QtGui.QLineEdit(self.centralWidget)
self.lineEdit.setGeometry(QtCore.QRect(30, 40, 211, 22))
self.lineEdit.setObjectName(_fromUtf8("lineEdit"))
self.lineEdit.returnPressed.connect(self.on_lineEdit_clicked) #connection lineEdit
self.checkBox = QtGui.QCheckBox(self.centralWidget)
self.checkBox.setGeometry(QtCore.QRect(30, 90, 100, 20))
self.checkBox.setChecked(True)
self.checkBox.setObjectName(_fromUtf8("checkBoxON"))
self.checkBox.clicked.connect(self.on_checkBox_clicked) #connection checkBox
self.radioButton = QtGui.QRadioButton(self.centralWidget)
self.radioButton.setGeometry(QtCore.QRect(30, 130, 95, 20))
self.radioButton.setObjectName(_fromUtf8("radioButton"))
self.radioButton.clicked.connect(self.on_radioButton_clicked) #connection radioButton
MainWindow.setCentralWidget(self.centralWidget)
self.menuBar = QtGui.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 400, 26))
self.menuBar.setObjectName(_fromUtf8("menuBar"))
MainWindow.setMenuBar(self.menuBar)
self.mainToolBar = QtGui.QToolBar(MainWindow)
self.mainToolBar.setObjectName(_fromUtf8("mainToolBar"))
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
self.statusBar = QtGui.QStatusBar(MainWindow)
self.statusBar.setObjectName(_fromUtf8("statusBar"))
MainWindow.setStatusBar(self.statusBar)
self.retranslateUi(MainWindow)
# Affiche un icone sur le bouton PushButton
# self.image_01 = "C:\Program Files\FreeCAD0.13\Icone01.png" # adapt the icon name
self.image_01 = path+"Icone01.png" # adapt the name of the icon
icon01 = QtGui.QIcon()
icon01.addPixmap(QtGui.QPixmap(self.image_01),QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton.setIcon(icon01)
self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button
# Affiche un icone sur le bouton RadioButton
# self.image_02 = "C:\Program Files\FreeCAD0.13\Icone02.png" # adapt the name of the icon
self.image_02 = path+"Icone02.png" # adapter le nom de l'icone
icon02 = QtGui.QIcon()
icon02.addPixmap(QtGui.QPixmap(self.image_02),QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.radioButton.setIcon(icon02)
# self.radioButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button
# Affiche un icone sur le bouton CheckBox
# self.image_03 = "C:\Program Files\FreeCAD0.13\Icone03.png" # the name of the icon
self.image_03 = path+"Icone03.png" # adapter le nom de l'icone
icon03 = QtGui.QIcon()
icon03.addPixmap(QtGui.QPixmap(self.image_03),QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.checkBox.setIcon(icon03)
# self.checkBox.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "FreeCAD", None))
self.pushButton.setText(_translate("MainWindow", "OK", None))
self.lineEdit.setText(_translate("MainWindow", "tyty", None))
self.checkBox.setText(_translate("MainWindow", "CheckBox", None))
self.radioButton.setText(_translate("MainWindow", "RadioButton", None))
def on_checkBox_clicked(self):
if self.checkBox.checkState()==0:
App.Console.PrintMessage(str(self.checkBox.checkState())+" CheckBox KO\r\n")
else:
App.Console.PrintMessage(str(self.checkBox.checkState())+" CheckBox OK\r\n")
# App.Console.PrintMessage(str(self.lineEdit.setText("tititi"))+" LineEdit\r\n") # write text to the lineEdit window !
# str(self.lineEdit.setText("tititi")) #écrit le texte dans la fenêtre lineEdit
App.Console.PrintMessage(str(self.lineEdit.displayText())+" LineEdit\r\n")
def on_radioButton_clicked(self):
if self.radioButton.isChecked():
App.Console.PrintMessage(str(self.radioButton.isChecked())+" Radio OK\r\n")
else:
App.Console.PrintMessage(str(self.radioButton.isChecked())+" Radio KO\r\n")
def on_lineEdit_clicked(self):
# if self.lineEdit.textChanged():
App.Console.PrintMessage(str(self.lineEdit.displayText())+" LineEdit Display\r\n")
def on_pushButton_clicked(self):
App.Console.PrintMessage("Terminé\r\n")
self.window.hide()
MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow(MainWindow)
MainWindow.show()</pre></div>
<p>Here the code to display the icon on the <b>pushButton</b>, change the name for another button, (<b>radioButton, checkBox</b>) and the path to the icon.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> # Affiche un icône sur le bouton PushButton
# self.image_01 = "C:\Program Files\FreeCAD0.13\icone01.png" # the name of the icon
self.image_01 = path+"icone01.png" # the name of the icon
icon01 = QtGui.QIcon()
icon01.addPixmap(QtGui.QPixmap(self.image_01),QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton.setIcon(icon01)
self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button</pre></div>
<p>The command
<b>UserAppData</b> gives the user path
<b>AppHomePath</b> gives the installation path of FreeCAD
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># path = FreeCAD.ConfigGet("UserAppData")
path = FreeCAD.ConfigGet("AppHomePath")</pre></div>
<p>This command reverses the horizontal button, right to left.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button</pre></div>
<h3><span class="mw-headline" id="Method_2">Method 2</span></h3>
<p>Another method to display a window, here by creating a file <b>QtForm.py</b> which contains the header program (module called with <b>import QtForm</b>), and a second module that contains the code window all these accessories, and your code (the calling module).
</p><p>This method requires two separate files, but allows to shorten your program using the file ' ' QtForm.py ' ' import. Then distribute the two files together, they are inseparable.
</p><p>The file <b>QtForm.py</b>
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
# Create by flachyjoe
from PySide import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Form(object):
def __init__(self, title, width, height):
self.window = QtGui.QMainWindow()
self.title=title
self.window.setObjectName(_fromUtf8(title))
self.window.setWindowTitle(_translate(self.title, self.title, None))
self.window.resize(width, height)
def show(self):
self.createUI()
self.retranslateUI()
self.window.show()
def setText(self, control, text):
control.setText(_translate(self.title, text, None))</pre></div>
<p>The appellant, file that contains the window and your code.
</p><p>The file my_file.py
</p><p>The connections are to do, a good exercise.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
# Create by flachyjoe
from PySide import QtCore, QtGui
import QtForm
class myForm(QtForm.Form):
def createUI(self):
self.centralWidget = QtGui.QWidget(self.window)
self.window.setCentralWidget(self.centralWidget)
self.pushButton = QtGui.QPushButton(self.centralWidget)
self.pushButton.setGeometry(QtCore.QRect(30, 170, 93, 28))
self.pushButton.clicked.connect(self.on_pushButton_clicked)
self.lineEdit = QtGui.QLineEdit(self.centralWidget)
self.lineEdit.setGeometry(QtCore.QRect(30, 40, 211, 22))
self.checkBox = QtGui.QCheckBox(self.centralWidget)
self.checkBox.setGeometry(QtCore.QRect(30, 90, 81, 20))
self.checkBox.setChecked(True)
self.radioButton = QtGui.QRadioButton(self.centralWidget)
self.radioButton.setGeometry(QtCore.QRect(30, 130, 95, 20))
def retranslateUI(self):
self.setText(self.pushButton, "Fermer")
self.setText(self.lineEdit, "essai de texte")
self.setText(self.checkBox, "CheckBox")
self.setText(self.radioButton, "RadioButton")
def on_pushButton_clicked(self):
self.window.hide()
myWindow=myForm("Fenetre de test",400,300)
myWindow.show()</pre></div>
<p><b>Other example</b>
</p>
<center>
<ul class="gallery mw-gallery-traditional">
<li class="gallerybox" style="width: 435px"><div style="width: 435px">
<div class="thumb" style="width: 430px;"><div style="margin:15px auto;"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qt_Example_00.png" class="image"><img alt="" src="167px-Qt_Example_00.png" width="167" height="200" srcset="/wiki/images/thumb/f/fe/Qt_Example_00.png/250px-Qt_Example_00.png 1.5x, /wiki/images/thumb/f/fe/Qt_Example_00.png/333px-Qt_Example_00.png 2x" /></a></div></div>
<div class="gallerytext">
<p>Qt example 1
</p>
</div>
</div></li>
<li class="gallerybox" style="width: 435px"><div style="width: 435px">
<div class="thumb" style="width: 430px;"><div style="margin:15px auto;"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qt_Example_01.png" class="image"><img alt="" src="167px-Qt_Example_01.png" width="167" height="200" srcset="/wiki/images/thumb/d/d4/Qt_Example_01.png/250px-Qt_Example_01.png 1.5x, /wiki/images/thumb/d/d4/Qt_Example_01.png/333px-Qt_Example_01.png 2x" /></a></div></div>
<div class="gallerytext">
<p>Qt example details
</p>
</div>
</div></li>
</ul>
</center>
<div style="clear:both"></div>
<p><br />
Are treated&#160;:
</p>
<ol><li> icon for window</li>
<li> horizontalSlider</li>
<li> progressBar horizontal</li>
<li> verticalSlider</li>
<li> progressBar vertical</li>
<li> lineEdit</li>
<li> lineEdit</li>
<li> doubleSpinBox</li>
<li> doubleSpinBox</li>
<li> doubleSpinBox</li>
<li> buttom</li>
<li> buttom</li>
<li> radioButtom with icons</li>
<li> checkBox with icon checked and unchecked</li>
<li> textEdit</li>
<li> graphicsView with 2 graphes</li></ol>
<p>The code page and the icons <a href="Qt_Example.html" title="Qt Example">Qt_Example</a>
</p>
<h2><span class="mw-headline" id="Icon_personalized_in_ComboView">Icon personalized in ComboView</span></h2>
<p>Here example create object with property and icon personalized in ComboView
</p><p>Download the example icon to place in same directory of the macro <a href="https://www.freecadweb.org/wiki/index.php?title=File:FreeCADIco.png" class="image" title="icon Example for the macro"><img alt="icon Example for the macro" src="24px-FreeCADIco.png" width="24" height="22" srcset="/wiki/images/thumb/8/86/FreeCADIco.png/36px-FreeCADIco.png 1.5x, /wiki/images/thumb/8/86/FreeCADIco.png/48px-FreeCADIco.png 2x" /></a>
</p><p>The icon used is one icon to file disk, one icon to resource FreeCAD and one icon include in the macro (format .XPM)
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Qt_Example_02.png" class="image" title="icon personalized"><img alt="icon personalized" src="Qt_Example_02.png" width="338" height="490" /></a>
</p>
<div style="clear:both"></div>
<p><br />
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>import PySide
import FreeCAD, FreeCADGui, Part
from pivy import coin
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
import Draft
global path
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path in FreeCAD preferences
path = param.GetString("MacroPath","") + "/" # macro path
path = path.replace("\\","/") # convert the "\" to "/"
class IconViewProviderToFile: # Class ViewProvider create Property view of object
def __init__( self, obj, icon):
self.icone = icon
def getIcon(self): # GetIcon
return self.icone
def attach(self, obj): # Property view of object
self.modes = []
self.modes.append("Flat Lines")
self.modes.append("Shaded")
self.modes.append("Wireframe")
self.modes.append("Points")
obj.addDisplayMode( coin.SoGroup(),"Flat Lines" ) # Display Mode
obj.addDisplayMode( coin.SoGroup(),"Shaded" )
obj.addDisplayMode( coin.SoGroup(),"Wireframe" )
obj.addDisplayMode( coin.SoGroup(),"Points" )
return self.modes
def getDisplayModes(self,obj):
return self.modes
#####################################################
########## Example with icon to file # begin ########
#####################################################
object1 = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Icon_In_File_Disk") # create your object
object1.addProperty("App::PropertyString","Identity", "ExampleTitle0", "Identity of object").Identity = "FCSpring" # Identity of object
object1.addProperty("App::PropertyFloat" ,"Pitch", "ExampleTitle0", "Pitch betwen 2 heads").Pitch = 2.0 # other Property Data
object1.addProperty("App::PropertyBool" ,"View", "ExampleTitle1", "Hello world").View = True # ...
object1.addProperty("App::PropertyColor" ,"LineColor","ExampleTitle2", "Color to choice").LineColor = (0.13,0.15,0.37) # ...
#...other Property Data
#...other Property Data
#
object1.ViewObject.Proxy = IconViewProviderToFile( object1, path + "FreeCADIco.png") # icon download to file
App.ActiveDocument.recompute()
#
#__Detail__:
# FreeCAD.ActiveDocument.addObject( = create now object personalized
# "App::FeaturePython", = object as FeaturePython
# "Icon_In_File_Disk") = internal name of your object
#
#
# "App::PropertyString", = type of Property , availlable : PropertyString, PropertyFloat, PropertyBool, PropertyColor
# "Identity", = name of the feature
# "ExampleTitle0", = title of the "section"
# "Identity of object") = tooltip displayed on mouse
# .Identity = variable (same of name of the feature)
# object1.ViewObject.Proxy = create the view object and gives the icon
#
########## example with icon to file end
#####################################################
########## Example with icon in macro # begin #######
#####################################################
def setIconInMacro(self): # def contener the icon in format .xpm
# File format XPM created by Gimp "https://www.gimp.org/"
# Choice palette Tango
# Create your masterwork ...
# For export the image in XPM format
# Menu File > Export as > .xpm
# (For convert image true color in Tango color palette :
# Menu Image > Mode > Indexed ... > Use custom palette > Tango Icon Theme > Convert)
return """
/* XPM */
static char * XPM[] = {
"22 24 5 1",
" c None",
".c #CE5C00",
"+c #EDD400",
"@c #F57900",
"#c #8F5902",
" ",
" ",
" .... ",
" ..@@@@.. ",
" . ...@...... ",
" .+++++++++... ",
" . ....++... ",
" .@..@@@@@@.+++++.. ",
" .@@@@@..# ++++ .. ",
" . ++++ .@.. ",
" .++++++++ .@@@.+. ",
" . ..@@@@@. ++. ",
" ..@@@@@@@@@. +++ . ",
" ....@...# +++++ @.. ",
" . ++++++++ .@. . ",
" .++++++++ .@@@@ . ",
" . #....@@@@. ++. ",
" .@@@@@@@@@.. +++ . ",
" ........ +++++... ",
" ... ..+++++ ..@.. ",
" ...... .@@@ +. ",
" ......++. ",
" ... ",
" "};
"""
object2 = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Icon_XPM_In_Macro") #
object2.addProperty("App::PropertyString","Identity","ExampleTitle","Identity of object").Identity = "FCSpring"
#...other Property Data
#...other Property Data
#
object2.ViewObject.Proxy = IconViewProviderToFile( object2, setIconInMacro("")) # icon in macro (.XPM)
App.ActiveDocument.recompute()
########## example with icon in macro end
####################################################################
########## Example with icon to FreeCAD ressource # begin ##########
####################################################################
object3 = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "Icon_Ressource_FreeCAD") #
object3.addProperty("App::PropertyString","Identity","ExampleTitle","Identity of object").Identity = "FCSpring"
#...other Property Data
#...other Property Data
#
object3.ViewObject.Proxy = IconViewProviderToFile( object3, ":/icons/Draft_Draft.svg") # icon to FreeCAD ressource
App.ActiveDocument.recompute()
########## example with icon to FreeCAD ressource end</pre></div>
<p>Other complete example creation cube with icon in macro
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>#https://forum.freecadweb.org/viewtopic.php?t=10255#p83319
import FreeCAD, Part, math
from FreeCAD import Base
from PySide import QtGui
global path
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")# macro path in FreeCAD preferences
path = param.GetString("MacroPath","") + "/" # macro path
path = path.replace("\\","/") # convert the "\" to "/"
def setIconInMacro(self):
return """
/* XPM */
static char * xpm[] = {
"22 22 12 1",
" c None",
".c #A40000",
"+c #2E3436",
"@c #CE5C00",
"#c #F57900",
"$c #FCAF3E",
"%c #5C3566",
"&amp;c #204A87",
"*c #555753",
"=c #3465A4",
"-c #4E9A06",
";c #729FCF",
" ",
" ",
" ",
" .. .. ",
" +@#+++.$$ ",
" +.#+%..$$ ",
" &amp;*$ &amp;*#* ",
" &amp; =&amp;= = ",
" ++&amp; +.== %= ",
" ++$@ ..$ %= &amp; ",
" ..-&amp;%.#$$ &amp;## +=$ ",
" .# ..$ ..#%%.#$$ ",
" ; =+=## %-$# ",
" &amp;= ;&amp; %= ",
" ;+ &amp;=; %= ",
" ++$- +*$- ",
" .#&amp;&amp;+.@$$ ",
" ..$# ..$# ",
" .. .. ",
" ",
" ",
" "};
"""
class PartFeature:
def __init__(self, obj):
obj.Proxy = self
class Box(PartFeature):
def __init__(self, obj):
PartFeature.__init__(self, obj)
obj.addProperty("App::PropertyLength", "Length", "Box", "Length of the box").Length = 1.0
obj.addProperty("App::PropertyLength", "Width", "Box", "Width of the box" ).Width = 1.0
obj.addProperty("App::PropertyLength", "Height", "Box", "Height of the box").Height = 1.0
def onChanged(self, fp, prop):
try:
if prop == "Length" or prop == "Width" or prop == "Height":
fp.Shape = Part.makeBox(fp.Length,fp.Width,fp.Height)
except:
pass
def execute(self, fp):
fp.Shape = Part.makeBox(fp.Length,fp.Width,fp.Height)
class ViewProviderBox:
def __init__(self, obj, icon):
obj.Proxy = self
self.icone = icon
def getIcon(self):
return self.icone
def attach(self, obj):
return
def setupContextMenu(self, obj, menu):
action = menu.addAction("Set default height")
action.triggered.connect(lambda f=self.setDefaultHeight, arg=obj:f(arg))
action = menu.addAction("Hello World")
action.triggered.connect(self.showHelloWorld)
def setDefaultHeight(self, view):
view.Object.Height = 15.0
def showHelloWorld(self):
QtGui.QMessageBox.information(None, "Hi there", "Hello World")
def makeBox():
FreeCAD.newDocument()
a=FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Box")
Box(a)
# ViewProviderBox(a.ViewObject, path + "FreeCADIco.png") # icon download to file
# ViewProviderBox(a.ViewObject, ":/icons/Draft_Draft.svg") # icon to FreeCAD ressource
ViewProviderBox(a.ViewObject, setIconInMacro("")) # icon in macro (.XPM)
App.ActiveDocument.recompute()
makeBox()</pre></div>
<h2><span class="mw-headline" id="Use_QFileDialog_for_write_the_file">Use QFileDialog for write the file</span></h2>
<p>Complete code:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
path = FreeCAD.ConfigGet("UserAppData")
try:
SaveName = QFileDialog.getSaveFileName(None,QString.fromLocal8Bit("Save a file txt"),path, "*.txt") # PyQt4
# "here the text displayed on windows" "here the filter (extension)"
except Exception:
SaveName, Filter = PySide.QtGui.QFileDialog.getSaveFileName(None, "Save a file txt", path, "*.txt") # PySide
# "here the text displayed on windows" "here the filter (extension)"
if SaveName == "": # if the name file are not selected then Abord process
App.Console.PrintMessage("Process aborted"+"\n")
else: # if the name file are selected or created then
App.Console.PrintMessage("Registration of "+SaveName+"\n") # text displayed to Report view (Menu > View > Report view checked)
try: # detect error ...
file = open(SaveName, 'w') # open the file selected to write (w)
try: # if error detected to write ...
# here your code
print "here your code"
file.write(str(1)+"\n") # write the number convert in text with (str())
file.write("FreeCAD the best") # write the the text with (" ")
except Exception: # if error detected to write
App.Console.PrintError("Error write file "+"\n") # detect error ... display the text in red (PrintError)
finally: # if error detected to write ... or not the file is closed
file.close() # if error detected to write ... or not the file is closed
except Exception:
App.Console.PrintError("Error Open file "+SaveName+"\n") # detect error ... display the text in red (PrintError)</pre></div>
<h2><span class="mw-headline" id="Use_QFileDialog_for_read_the_file">Use QFileDialog for read the file</span></h2>
<p>Complete code:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
path = FreeCAD.ConfigGet("UserAppData")
OpenName = ""
try:
OpenName = QFileDialog.getOpenFileName(None,QString.fromLocal8Bit("Read a file txt"),path, "*.txt") # PyQt4
# "here the text displayed on windows" "here the filter (extension)"
except Exception:
OpenName, Filter = PySide.QtGui.QFileDialog.getOpenFileName(None, "Read a file txt", path, "*.txt") #PySide
# "here the text displayed on windows" "here the filter (extension)"
if OpenName == "": # if the name file are not selected then Abord process
App.Console.PrintMessage("Process aborted"+"\n")
else:
App.Console.PrintMessage("Read "+OpenName+"\n") # text displayed to Report view (Menu > View > Report view checked)
try: # detect error to read file
file = open(OpenName, "r") # open the file selected to read (r) # (rb is binary)
try: # detect error ...
# here your code
print "here your code"
op = OpenName.split("/") # decode the path
op2 = op[-1].split(".") # decode the file name
nomF = op2[0] # the file name are isolated
App.Console.PrintMessage(str(nomF)+"\n") # the file name are displayed
for ligne in file: # read the file
X = ligne.rstrip('\n\r') #.split() # decode the line
print X # print the line in report view other method
# (Menu > Edit > preferences... > Output window > Redirect internal Python output (and errors) to report view checked)
except Exception: # if error detected to read
App.Console.PrintError("Error read file "+"\n") # detect error ... display the text in red (PrintError)
finally: # if error detected to read ... or not error the file is closed
file.close() # if error detected to read ... or not error the file is closed
except Exception: # if one error detected to read file
App.Console.PrintError("Error in Open the file "+OpenName+"\n") # if one error detected ... display the text in red (PrintError)</pre></div>
<h2><span class="mw-headline" id="Use_QColorDialog_for_get_the_color">Use QColorDialog for get the color</span></h2>
<p>Complete code:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># -*- coding: utf-8 -*-
# https://deptinfo-ensip.univ-poitiers.fr/ENS/pyside-docs/PySide/QtGui/QColor.html
import PySide
from PySide import QtGui ,QtCore
from PySide.QtGui import *
from PySide.QtCore import *
path = FreeCAD.ConfigGet("UserAppData")
couleur = QtGui.QColorDialog.getColor()
if couleur.isValid():
red = int(str(couleur.name()[1:3]),16) # decode hexadecimal to int()
green = int(str(couleur.name()[3:5]),16) # decode hexadecimal to int()
blue = int(str(couleur.name()[5:7]),16) # decode hexadecimal to int()
print couleur #
print "hexadecimal ",couleur.name() # color format hexadecimal mode 16
print "Red color ",red # color format decimal
print "Green color ",green # color format decimal
print "Blue color ",blue # color format decimal</pre></div>
<h2><span class="mw-headline" id="Some_useful_commands">Some useful commands</span></h2>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># Here the code to display the icon on the '''pushButton''',
# change the name to another button, ('''radioButton, checkBox''') as well as the path to the icon,
# Displays an icon on the button PushButton
# self.image_01 = "C:\Program Files\FreeCAD0.13\icone01.png" # he name of the icon
self.image_01 = path+"icone01.png" # the name of the icon
icon01 = QtGui.QIcon()
icon01.addPixmap(QtGui.QPixmap(self.image_01),QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.pushButton.setIcon(icon01)
self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the direction of the button
# path = FreeCAD.ConfigGet("UserAppData") # gives the user path
path = FreeCAD.ConfigGet("AppHomePath") # gives the installation path of FreeCAD
# This command reverses the horizontal button, right to left
self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) # This command reverses the horizontal button
# Displays an info button
self.pushButton.setToolTip(_translate("MainWindow", "Quitter la fonction", None)) # Displays an info button
# This function gives a color button
self.pushButton.setStyleSheet("background-color: red") # This function gives a color button
# This function gives a color to the text of the button
self.pushButton.setStyleSheet("color : #ff0000") # This function gives a color to the text of the button
# combinaison des deux, bouton et texte
self.pushButton.setStyleSheet("color : #ff0000; background-color : #0000ff;" ) # combination of the two, button, and text
# replace the icon in the main window
MainWindow.setWindowIcon(QtGui.QIcon('C:\Program Files\FreeCAD0.13\View-C3P.png'))
# connects a lineEdit on execute
self.lineEdit.returnPressed.connect(self.execute) # connects a lineEdit on "def execute" after validation on enter
# self.lineEdit.textChanged.connect(self.execute) # connects a lineEdit on "def execute" with each keystroke on the keyboard
# display text in a lineEdit
self.lineEdit.setText(str(val_X)) # Displays the value in the lineEdit (convert to string)
# extract the string contained in a lineEdit
val_X = self.lineEdit.text() # extract the (string) string contained in lineEdit
val_X = float(val_X0) # converted the string to an floating
val_X = int(val_X0) # convert the string to an integer
# This code allows you to change the font and its attributes
font = QtGui.QFont()
font.setFamily("Times New Roman")
font.setPointSize(10)
font.setWeight(10)
font.setBold(True) # same result with tags "&lt;b>your text&lt;/b>" (in quotes)
self.label_6.setFont(font)
self.label_6.setObjectName("label_6")
self.label_6.setStyleSheet("color : #ff0000") # This function gives a color to the text
self.label_6.setText(_translate("MainWindow", "Select a view", None))</pre></div>
<p>By using the characters with accents, where you get the error&#160;:
</p><p>Several solutions are possible.
</p><p><font color="#FF0000"><b>UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-2: invalid data</b></font>
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># conversion from a lineEdit
App.activeDocument().CopyRight.Text = str(unicode(self.lineEdit_20.text() , 'ISO-8859-1').encode('UTF-8'))
DESIGNED_BY = unicode(self.lineEdit_01.text(), 'ISO-8859-1').encode('UTF-8')</pre></div>
<p>or with the procedure
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>def utf8(unio):
return unicode(unio).encode('UTF8')</pre></div>
<p><font color="#FF0000"><b>UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 9: ordinal not in range(128)</b></font>
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre># conversion
a = u"Nom de l'élément : "
f.write('''a.encode('iso-8859-1')'''+str(element_)+"\n")</pre></div>
<p>or with the procedure
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>def iso8859(encoder):
return unicode(encoder).encode('iso-8859-1')</pre></div>
<p>or
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>iso8859(unichr(176))</pre></div>
<p>or
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>unichr(ord(176))</pre></div>
<p>or
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>uniteSs = "mm"+iso8859(unichr(178))
print unicode(uniteSs, 'iso8859')</pre></div>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h1><span class="mw-headline" id="Utveckla_applikationer_f.C3.B6r_FreeCAD">Utveckla applikationer för FreeCAD</span></h1>
<h3><span class="mw-headline" id="Uttalande_fr.C3.A5n_underh.C3.A5llaren">Uttalande från underhållaren</span></h3>
<p>Jag vet att diskussionen om <i>"rätt"</i> licens för öppen källkod tar upp en signifikant del av internetbandbredden, så här är skälen till varför, enligt min åsikt, FreeCAD ska ha denna.
</p><p>Jag valde <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/GNU_Lesser_General_Public_License">LGPL</a> och <a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/GNU_General_Public_License">GPL</a> för projektet och jag vet för- och nackdelarna med LGPL och vill ge dig några skäl till det beslutet.
</p><p>FreeCAD är en blandning av bibliotek och en applikation, så GPL skulle vara lite för starkt för det. Det skulle förhindra skapande av kommersiella moduler för FreeCAD därför att det skulle förhindra länkning med FreeCAD's basbibliotek. Du kanske frågar dig: varför kommersiella moduler överhuvudtaget? Därför är Linux ett bra exempel. Skulle Linux vara så framgångsrikt om GNU C Biblioteket skulle vara GPL och därför förhindra länkning mot icke-GPL applikationer? Och fastän jag älskar friheten i Linux, så vill jag också kunna använda den mycket bra NVIDIA 3D grafikdrivrutinen. Jag förstår och accepterar anledningen till att NVIDIA inte vill ge bort drivrutinskod. Vi jobbar alla för företag och behöver lön eller åtninstone mat. Så för mig är en samexistens av öppen källkod och sluten källkodsmjukvara inte något dåligt, när det följer reglerna i LGPL. Jag skulle vilja se någon som skriver en Catia import/export processor för FreeCAD och distribuerar den gratis eller för lite pengar. Jag tycker inte om att tvinga honom att ge bort mer än han vill. Det skulle inte vara bra varken för honom eller FreeCAD.
</p><p>Detta beslut är ändå bara gjort för FreeCAD's kärnsystem. Var och en som skriver en applikationsmodul kan ta sina egna beslut.
</p>
<h3><span class="mw-headline" id="Anv.C3.A4nda_licenser">Använda licenser</span></h3>
<p>Här är de tre licenserna under vilka FreeCAD är publicerad:
</p><p>FreeCAD uses two different licenses, one for the application itself, and one for the documentation:
</p>
<dl><dt><a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/GNU_General_Public_License">GPL</a></dt>
<dd> För Python sripten för att bygga binärfilerna som uttalat i .py filerna i src/Tools</dd></dl>
<dl><dt><a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/GNU_Lesser_General_Public_License">LGPL</a></dt>
<dd> För kärnbiblioteken som uttalat i .h och .cpp filerna i src/App src/Gui src/Base och de flesta <a href="https://www.freecadweb.org/wiki/index.php?title=Workbenches/sv" title="Workbenches/sv">modulerna</a> i src/Mod och för de körbara som uttalat i .h och .cpp filerna i src/main</dd></dl>
<dl><dt><a href="http://en.wikipedia.org/wiki/Open_Publication_License" class="extiw" title="wikipedia:Open Publication License">Open Publication Licence</a></dt>
<dd> För dokumentationen på <a rel="nofollow" class="external free" href="http://free-cad.sourceforge.net/">http://free-cad.sourceforge.net/</a> om inget annat markerats av författaren </dd></dl>
<p><br />
Se FreeCAD's <a rel="nofollow" class="external text" href="http://free-cad.git.sourceforge.net/git/gitweb.cgi?p=free-cad/free-cad;a=blob;f=package/debian/copyright;h=a97cf019d020edba596f2d0f614c9b09ce546b0f;hb=HEAD">debian copyright file</a> för mer detaljer om de licenser som används i FreeCAD
</p>
<h3><span class="mw-headline" id="Licensernas_inverkan">Licensernas inverkan</span></h3>
<h4><span class="mw-headline" id="Privata_anv.C3.A4ndare">Privata användare</span></h4>
<p>Privata användare kan använda FreeCAD utan avgift och kan göra ungefär vad de vill med den....
</p>
<h4><span class="mw-headline" id="Professionella_anv.C3.A4ndare">Professionella användare</span></h4>
<p>Kan använda FreeCAD fritt, för alla sorters privata eller professionella arbeten. De kan anpassa applikationen som de önskar. De kan skriva öppen eller sluten källkodsextensioner till FreeCAD. De är alltid herrar över deras data, de är inte tvingade att uppdatera FreeCAD, ändra deras bruk av FreeCAD. Att använda FreeCAD binder dem inte till några kontrakt eller krav.
</p>
<h4><span class="mw-headline" id=".C3.96ppen_k.C3.A4llkodsutvecklare">Öppen källkodsutvecklare</span></h4>
<p>Kan använda FreeCAD som grundplattform för egna extensionsmoduler för speciella ändamål. De kan välja antingen GPL eller LGPL för att tillåta bruk av deras arbete i proprietär mjukvara, eller inte.
</p>
<h4><span class="mw-headline" id="Professionella_utvecklare">Professionella utvecklare</span></h4>
<p>Professionella utvecklare Kan använda FreeCAD som grundplattform för egna extensionsmoduler för speciella ändamål och är inte tvingade att göra sina moduler till öppen källkod. De kan använda alla moduler som använder LGPL. De är tillåtna att distribuera FreeCAD tillsammans med deras proprietära mjukvara. De kommer få support av författarna så länge som den inte är enkelriktad. Om du vill sälja din modul så behöver du en Coin3D licens, annars är du tvingad av detta bibliotek att göra den till öppen källkod.
</p>
<h2><span class="mw-headline" id="OpenCasCade_License_side_effects_.28for_FreeCAD_version_0.13_and_older.29">OpenCasCade License side effects (for FreeCAD version 0.13 and older)</span></h2>
<p>The following is no more applicable since version 0.14, since both FreeCAD and OpenCasCade are now fully LGPL.
</p><p><br />
Up to Version 0.13 FreeCAD is delivered as GPL2+, although the source itself is under LGPL2+. Thats because of linkage of Coin3D (GPL2) and PyQt(GPL). Starting with 0.14 we will be completely GPL free. PyQt will be replaced by PySide, and Coin3D was re-licensed under BSD. One problem, we still have to face, license-wise, the <a rel="nofollow" class="external text" href="http://www.opencascade.org/getocc/license/">OCTPL (Open CASCADE Technology Public License)</a>. Its a License mostly LGPL similar, with certain changes. On of the originators, Roman Lygin, elaborated on the License on his <a rel="nofollow" class="external text" href="http://opencascade.blogspot.de/2008/12/license-to-kill-license-to-use.html">Blog</a>. The home-brew OCTPL license leads to all kind of side effects for FreeCAD, which where widely discussed on different forums and mailing lists, e.g. on <a rel="nofollow" class="external text" href="http://www.opencascade.org/org/forum/thread_15859/?forum=3">OpenCasCade forum itself</a>. I will link here some articles for the biggest problems.
</p>
<h4><span class="mw-headline" id="GPL2.2FGPL3.2FOCTLP_incompatibility">GPL2/GPL3/OCTLP incompatibility</span></h4>
<p>We first discovered the problem by a discussion on the <a rel="nofollow" class="external text" href="http://www.fsf.org/">FSF</a> high priority project <a rel="nofollow" class="external text" href="https://groups.google.com/forum/#!topic/polignu/XRergtwsm80">discussion list</a>. It was about a library we look at, which was licensed with GPL3. Since we linked back then with Coin3D, with GPL2 only, we was not able to adopt that lib. Also the
OCTPL is considered <a rel="nofollow" class="external text" href="http://www.opencascade.org/occt/faq/">GPL incompatible</a>. This Libre Graphics World article <a rel="nofollow" class="external text" href="http://libregraphicsworld.org/blog/entry/libredwg-drama-the-end-or-the-new-beginning">"LibreDWG drama: the end or the new beginning?"</a> shows up the drama of LibreDWG project not acceptably in FreeCAD or LibreCAD.
</p>
<h4><span class="mw-headline" id="Debian">Debian</span></h4>
<p>The incompatibility of the OCTPL <a rel="nofollow" class="external text" href="http://lists.debian.org/debian-legal/2009/10/msg00000.html">was discussed on the debian legal list</a> and lead to a <a rel="nofollow" class="external text" href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=617613">bug report on the FreeCAD package</a> which prevent (ignor-tag) the transition from debian-testing to the main distribution. But its also mentioned thats a FreeCAD, which is free of GPL code and libs, would be acceptably. With a re-licensed Coin3D V4 and a substituted PyQt we will hopefully reach GPL free with the 0.14 release.
</p>
<h4><span class="mw-headline" id="Fedora.2FRedHat_non-free">Fedora/RedHat non-free</span></h4>
<p>In the Fedora project OpenCasCade is listed "non-free". This means basically it won't make it into Fedora or RedHat. This means also FreeCAD won't make it into Fedora/RedHat until OCC is changing its license. Here the links to the license evaluation:
</p>
<ul><li> <a rel="nofollow" class="external text" href="http://lists.fedoraproject.org/pipermail/legal/2011-September/001713.html">Discussion on the Fedora-legal-list</a></li>
<li> <a rel="nofollow" class="external text" href="https://bugzilla.redhat.com/show_bug.cgi?id=458974#c10">License review entry in the RedHat bug tracker</a></li></ul>
<p>The main problem they have AFIK is that the OCC license demand non discriminatory support fees if you want to do paid support. It has nothing to do with "free" or OpenSource, its all about RedHat's business model!
</p>
<div style="clear:both"></div>
<p><br />
</p>
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantis_logo_262x90.png" class="image" title="link=https://freecadweb.org/tracker/MantisBT is the bugtracker framework FreeCAD uses"><img alt="link=https://freecadweb.org/tracker/MantisBT is the bugtracker framework FreeCAD uses" src="Mantis_logo_262x90.png" width="262" height="90" /></a></div>
<p>The address of our bug tracker is:
</p><p><a rel="nofollow" class="external free" href="https://www.freecadweb.org/tracker">https://www.freecadweb.org/tracker</a>
</p><p>There you can report bugs, submit feature requests, patches, or request to merge your branch if you developed something using git. The tracker is divided into modules, so please be specific and file your request in the appropriate subsection. In case of doubt, leave it in the "FreeCAD" section.
</p><p>Please before creating tickets, always first discuss bugs in the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewforum.php?f=3">Help forum</a> and feature requests in the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewforum.php?f=8">Open discussion forum</a>.
</p>
<h2><span class="mw-headline" id="Rapportera_buggar">Rapportera buggar</span></h2>
<p>If you think you might have found a bug, you are welcome to report it there so long as you have first discussed the matter in the appropriate forum. But before reporting a bug, please check the following items:
</p>
<ul><li> Make sure your bug is really a bug, that is, something that should be working and that is not working. If you are not sure, don't hesitate to explain your problem on the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/">forum</a> and ask what to do.</li>
<li> Before submitting anything, read the <a href="FAQ.html" title="FAQ">frequently asked questions</a>, do a search on the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/">forum</a>, and make sure the same bug hasn't been reported before, by doing a search on the bug tracker.</li>
<li> Describe as clearly as possible the problem, and how it can be reproduced. If we can not verify the bug, we might not be able to fix it.</li>
<li> Include all the information from the "Copy to Clipboard" button in the Help (menu) -&gt; About FreeCAD dialogue and do so from either the Part or PartDesign workbench so that your data will include your OCC or OCE version. </li>
<li> Please file one separate report for each bug.</li>
<li> If you are on a linux system and your bug causes a crash in FreeCAD, you can try running a debug backtrace: From a terminal run <i>gdb freecad</i> (assuming package gdb is installed), then, inside gdb, type <i>run</i> . FreeCAD will then run. After the crash happens, type <i>bt</i> , to get the full backtrace. Include that backtrace in your bug report.</li></ul>
<h2><span class="mw-headline" id="Beg.C3.A4ra_funktioner">Begära funktioner</span></h2>
<p>If you want something to appear in FreeCAD that is not implemented yet, <u>it is not a bug but a feature request</u>. You can also submit it on the same tracker (file it under <i>feature request</i> instead of bug), but keep in mind there are no guarantees that your wish will be fulfilled.
</p>
<div class="thumb tright"><div class="thumbinner" style="width:302px;"><a href="https://www.freecadweb.org/wiki/index.php?title=File:MantisBT-setting-Feature-Request.jpg" class="image"><img alt="" src="300px-MantisBT-setting-Feature-Request.jpg" width="300" height="219" class="thumbimage" srcset="/wiki/images/thumb/b/bb/MantisBT-setting-Feature-Request.jpg/450px-MantisBT-setting-Feature-Request.jpg 1.5x, /wiki/images/thumb/b/bb/MantisBT-setting-Feature-Request.jpg/600px-MantisBT-setting-Feature-Request.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.freecadweb.org/wiki/index.php?title=File:MantisBT-setting-Feature-Request.jpg" class="internal" title="Enlarge"></a></div>FreeCAD Bugtracker report page - use the dropdown to correctly designate what the ticket is</div></div></div>
<h2><span class="mw-headline" id="Skicka_patchar">Skicka patchar</span></h2>
<p>Om du har programmerat en buggfix, en extension eller något annat som kan vara allmänt gångbart i FreeCAD, skapa en patch genom att använda Subversion's diff verktyg och posta den på samma tracker (posta den som en patch).
</p>
<h2><span class="mw-headline" id="Requesting_merge">Requesting merge</span></h2>
<p>If you have created a git branch containing changes that you would like to see merged into the FreeCAD code, you can ask there to have your branch reviewed and merged if the FreeCAD developers are OK with it. You must first publish your branch to a public git repository (github,bitbucket, sourceforge...) and then give the URL of your branch in your merge request.
</p>
<h2><span class="mw-headline" id="MantisBT_Tips_and_Tricks">MantisBT Tips and Tricks</span></h2>
<p>MantisBT (Mantis Bug Tracker) has it's own unique markup. Here is a list of useful ones:
</p>
<ul><li> <b>@</b>mention - works just like on GitHub where if you prepend '@' to someone's username they will receive an email that they have been 'mentioned' in a ticket thread</li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-mention-example.jpg" class="image"><img alt="Mantisbt-mention-example.jpg" src="600px-Mantisbt-mention-example.jpg" width="600" height="70" srcset="/wiki/images/thumb/b/ba/Mantisbt-mention-example.jpg/900px-Mantisbt-mention-example.jpg 1.5x, /wiki/images/b/ba/Mantisbt-mention-example.jpg 2x" /></a></div></div>
<ul><li> <b>#</b>1234 - By adding a hash tag in front of a number a shortcut to link to another ticket within MantisBT will present.
<dl><dd> <b>Note</b>: if you hover over a ticket it will show you the summary + if the ticket is closed, it will be struck-through like <s>#1234</s>.</dd></dl></li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-ticket-shortcut-example.jpg" class="image"><img alt="Mantisbt-ticket-shortcut-example.jpg" src="600px-Mantisbt-ticket-shortcut-example.jpg" width="600" height="112" srcset="/wiki/images/4/47/Mantisbt-ticket-shortcut-example.jpg 1.5x" /></a></div></div>
<ul><li> <b>~</b>5678 - a shortcut that links to a bug note within a ticket. This can be used to reference someone's response within the thread. Each person that posts will show a unique ~#### number next to their username. If you look at the image in the example, you see that the shortcut is referencing the <i>ticket number:comment number</i> of said ticket</li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-comment-shortcut-example.jpg" class="image"><img alt="Mantisbt-comment-shortcut-example.jpg" src="600px-Mantisbt-comment-shortcut-example.jpg" width="600" height="74" srcset="/wiki/images/thumb/2/23/Mantisbt-comment-shortcut-example.jpg/900px-Mantisbt-comment-shortcut-example.jpg 1.5x, /wiki/images/thumb/2/23/Mantisbt-comment-shortcut-example.jpg/1200px-Mantisbt-comment-shortcut-example.jpg 2x" /></a></div></div>
<ul><li> <b>&lt;del&gt;&lt;/del&gt;</b> - Using these tags will <s>strikeout text</s>. </li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-strikeout-text-example.jpg" class="image"><img alt="Mantisbt-strikeout-text-example.jpg" src="600px-Mantisbt-strikeout-text-example.jpg" width="600" height="30" srcset="/wiki/images/thumb/4/49/Mantisbt-strikeout-text-example.jpg/900px-Mantisbt-strikeout-text-example.jpg 1.5x, /wiki/images/4/49/Mantisbt-strikeout-text-example.jpg 2x" /></a></div></div>
<ul><li> <b>&lt;code&gt;&lt;/code&gt;</b> - To present a line or block of code, use this tag and it will colorize and differentiate it elegantly. </li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-colorized-code-example.jpg" class="image"><img alt="Mantisbt-colorized-code-example.jpg" src="600px-Mantisbt-colorized-code-example.jpg" width="600" height="191" srcset="/wiki/images/thumb/f/f3/Mantisbt-colorized-code-example.jpg/900px-Mantisbt-colorized-code-example.jpg 1.5x, /wiki/images/thumb/f/f3/Mantisbt-colorized-code-example.jpg/1200px-Mantisbt-colorized-code-example.jpg 2x" /></a></div></div>
<h3><span class="mw-headline" id="MantisBT_.3C.3D.3E_GitHub_Markup">MantisBT &lt;=&gt; GitHub Markup</span></h3>
<p>Below are special MantisBT Source-Integration plugin keywords which will link to the FreeCAD GitHub repo. See <a href="/wiki/Tracker#GitHub_and_MantisBT" title="Tracker">Tracker#GitHub_and_MantisBT</a>.
</p>
<ul><li> <b>c:FreeCAD:git commit hash:</b> - <b>c</b> stands for 'commit'. FreeCAD stands for the FreeCAD GitHub repo. 'git commit hash' is the specific git commit hash to reference. Note: the trailing colon is necessary. Exampleː <code>cːFreeCADː709d2f325db0490016807b8fa6f49d1c867b6bd8ː</code> </li>
<li> <b>d:FreeCAD:git commit hash:</b> - similar to the above, <b>d</b> stands for 'diff' which will provide a Diff view of the commit. Exampleː <code>dːFreeCADː709d2f325db0490016807b8fa6f49d1c867b6bd8ː</code> </li>
<li> <b>p:FreeCAD:pullrequest:</b> - similar to the above, <b>p</b> stands for Pull Request. Exampleː <code>pːFreeCADː498ː</code> </li></ul>
<div class="center"><div class="floatnone"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Mantisbt-source-integration-markup.jpg" class="image"><img alt="Mantisbt-source-integration-markup.jpg" src="600px-Mantisbt-source-integration-markup.jpg" width="600" height="75" srcset="/wiki/images/2/20/Mantisbt-source-integration-markup.jpg 1.5x" /></a></div></div>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="GitHub_and_MantisBT">GitHub and MantisBT</span></h2>
<p>The FreeCAD bugtracker has a plug-in called <a rel="nofollow" class="external text" href="https://github.com/mantisbt-plugins/source-integration">Source Integration</a> which essentially ties both the FreeCAD GitHub repo to our MantisBT tracker. It makes it easier to track and associate git commits with their respective MantisBT tickets. <b>The Source Integration plugin scans the git commit messages for specific keywords in order to execute the following actions:</b>
</p><p><b>Note</b> The below keywords need to be added in the <u>git commit message</u> and not the PR subject
</p>
<h3><span class="mw-headline" id="Attaching_a_git_commit_to_a_ticket">Attaching a git commit to a ticket</span></h3>
<p>The format MantisBT will recognize:
</p>
<ul><li> bug #1234</li>
<li> bugs #1234, #5678</li>
<li> issue #1234</li>
<li> issues #1234, #5678</li>
<li> report #1234</li>
<li> reports #1234, #5678</li></ul>
<p><small>For the inquisitive here is the regex MantisBT uses for this operation: <br />
<code>/(?:bugs?|issues?|reports?)+\s*:?\s+(?:#(?:\d+)[,\.\s]*)+/i</code></small>
</p>
<h3><span class="mw-headline" id="Remotely_resolving_a_ticket">Remotely resolving a ticket</span></h3>
<p>The format MantisBT will recognize:
</p>
<ul><li> fix #1234</li>
<li> fixed #1234</li>
<li> fixes #1234</li>
<li> fixed #1234, #5678</li>
<li> fixes #1234, #5678</li>
<li> resolve #1234</li>
<li> resolved #1234</li>
<li> resolves #1234</li>
<li> resolved #1234, #5678</li>
<li> resolves #1234, #5678</li></ul>
<p><small>For the inquisitive here is the regex MantisBT uses for this operation: <br />
<code>/(?:fixe?d?s?|resolved?s?)+\s*:?\s+(?:#(?:\d+)[,\.\s]*)+/i</code></small>
</p>
<div style="clear:both"></div>
<p><br />
</p><p>This article explains step by step <b>how to compile FreeCAD on Windows</b>.
</p><p>See also
</p>
<ul><li> <a href="Compile_on_Windows_with_VS2013.html" title="Compile on Windows with VS2013">Compile on Windows with Visual Studio 2013</a></li>
<li> <a href="/wiki/Compiling_(Speeding_up)" title="Compiling (Speeding up)">Compiling - Speeding up</a></li></ul>
<h2><span class="mw-headline" id="Prerequisites">Prerequisites</span></h2>
<h3><span class="mw-headline" id="Required_programs">Required programs</span></h3>
<ul><li> <a rel="nofollow" class="external text" href="http://git-scm.com/">Git</a> There are a number of alternatives such as GitCola, Tortoise Git, and others.</li>
<li> <a rel="nofollow" class="external text" href="http://www.cmake.org/cmake/resources/software.html">CMake</a> version 2.x.x or Cmake 3.x.x</li>
<li> Python &gt;2.5 (This is only required if NOT using the Libpack. The Libpack comes with a minimal Python(2.7.x) suitable for compiling and running FreeCAD)</li></ul>
<h3><span class="mw-headline" id="Source_Code">Source Code</span></h3>
<h4><span class="mw-headline" id="Using_Git_.28Preferred.29">Using Git (Preferred)</span></h4>
<p>To create a local tracking branch and download the source code you need to open a terminal(command prompt) and cd to the directory you want the source, then type:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>git clone https://github.com/FreeCAD/FreeCAD.git free-cad-code</pre></div>
<h3><span class="mw-headline" id="Compiler">Compiler</span></h3>
<p>On Windows, the default compiler is MS Visual Studio.
<a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/blob/master/appveyor.yml">CI</a> uses 2013 version.
</p><p>For those who want to avoid installing the huge Visual Studio for the mere purpose of having a compiler, see <a href="CompileOnWindows_-_Reducing_Disk_Footprint.html" title="CompileOnWindows - Reducing Disk Footprint">CompileOnWindows - Reducing Disk Footprint</a>.
</p>
<div class="note"><b>Note</b>
<p>Though it may be possible to use Cygwin or MinGW gcc it's not tested or ported so far.
</p>
</div>
<p><br />
</p>
<h3><span class="mw-headline" id="Third_Party_Libraries">Third Party Libraries</span></h3>
<p>You will need all of the <a href="Third_Party_Libraries.html" title="Third Party Libraries">Third Party Libraries</a> to successfully compile FreeCAD. If you use the MS compilers it is recommended to install a <a rel="nofollow" class="external text" href="http://sourceforge.net/projects/free-cad/files/FreeCAD%20LibPack/">FreeCAD LibPack</a>, which provides all of the required libraries to build FreeCAD in Windows.
You will need the Libpack for your architecture and compiler. FreeCAD currently supplies Libpack Version11 for x32 and x64, for VS9 2008, VS11 2012, and VS12 2013.
</p>
<h3><span class="mw-headline" id="Optional_programs">Optional programs</span></h3>
<ul><li> <a rel="nofollow" class="external text" href="http://sourceforge.net/projects/nsis/">NSIS</a> Windows installer (note: formerly, <a rel="nofollow" class="external text" href="http://wixtoolset.org/">WiX</a> installer was used - now under transition to NSIS) - if you want to make msi installer</li></ul>
<h3><span class="mw-headline" id="System_Path_Configuration">System Path Configuration</span></h3>
<p>Inside your system path be sure to set the correct paths to the following programs:
</p>
<ul><li> git (not tortoiseGit, but git.exe) This is necessary for Cmake to properly update the "About FreeCAD" information in the version.h file which allows FreeCAD to report the proper version in About FreeCAD from the help menu.</li>
<li>Optionally you can include the Libpack in your system path. This is useful if you plan to build multiple configurations/versions of FreeCAD, you will need to copy less files as explained later in the build process.</li></ul>
<p>To add to your system path:
</p>
<ul><li> Start menu -&gt; Right click on Computer -&gt; Properties -&gt; Advanced system settings</li>
<li> Advanced tab -&gt; Environment Variables...</li>
<li> Add the PATH/TO/GIT to the <b>PATH</b></li>
<li> It should be separated from the others with a semicolon `;`</li></ul>
<h2><span class="mw-headline" id="Configuration_with_CMake">Configuration with CMake</span></h2>
<h3><span class="mw-headline" id="The_switch_to_CMake">The switch to CMake</span></h3>
<div class="note"><b>Warning</b>
<p>Since FreeCAD version 0.9 we have stopped providing .vcproj files.
</p>
</div>
<p>Currently, FreeCAD uses the CMake build system to generate build and make files that can be used between different operating systems and compilers.
If you want build former versions of FreeCAD (0.8 and older) see
<a href="#Building_older_versions">Building older versions</a> later in this article.
</p><p>We switched because it became more and more painful to maintain project files for 30+
build targets and x compilers. CMake gives us the possibility to support alternative
IDEs, like Code::Blocks, Qt Creator and Eclipse CDT.
The main compiler is still MS VC9 Express, though. But we plan for the future a build process on
Windows without proprietary compiler software.
</p>
<h3><span class="mw-headline" id="CMake">CMake</span></h3>
<p>The first step to build FreeCAD with CMake is to configure the environment. There
are two ways to do it:
</p>
<ul><li> Using the LibPack</li>
<li> Installing all the needed libraries and let CMake find them</li></ul>
<p><br />
The following process will assume you are using the LipPack. The second option may be discussed
in <a href="#Options_for_the_Build_Process">Options for the Build Process</a>.
</p>
<h3><span class="mw-headline" id="Configure_CMake_using_GUI">Configure CMake using GUI</span></h3>
<ul><li> Open the CMake GUI</li>
<li> Specify the source folder</li>
<li> Specify the build folder</li>
<li> Click <b>Configure</b></li>
<li> Specify the generator according to the IDE that you'll use. </li></ul>
<p><br />
This will begin configuration and should fail because the location of
<b>FREECAD_LIBPACK_DIR</b> is unset.
</p>
<ul><li> Expand the <b>FREECAD</b> category and set <b>FREECAD_LIBPACK_DIR</b> to the correct location</li>
<li> Check <b>FREECAD_USE_EXTERNAL_PIVY</b></li>
<li> Optionally Check <b>FREECAD_USE_FREETYPE</b> this is required to use the Draft WB's Shape String functionality</li>
<li> Click <b>Configure</b> again</li>
<li> There should be no errors</li>
<li> Click <b>Generate</b></li>
<li> Close CMake</li>
<li> Copy <b>libpack\bin</b> folder into the new build folder CMake created</li></ul>
<h3><span class="mw-headline" id="Options_for_the_Build_Process">Options for the Build Process</span></h3>
<p>The CMake build system gives us a lot more flexibility over the build process. That means
we can switch on and off some features or modules. It's in a way like the Linux kernel build.
You have a lot of switches to determine the build process.
</p><p>Here is the description of some of these switches. They will most likely change a lot in the future
because we want to increase the build flexibility a lot more.
</p><p><br />
</p>
<table class="wikitable" style="text-align:left">
<caption> Link table
</caption>
<tr>
<th> Variable name </th>
<th> Description </th>
<th> Default
</th></tr>
<tr>
<td> FREECAD_LIBPACK_USE </td>
<td> Switch the usage of the FreeCAD LibPack on or off </td>
<td> On Win32 on, otherwise off
</td></tr>
<tr>
<td> FREECAD_LIBPACK_DIR </td>
<td> Directory where the LibPack is </td>
<td> FreeCAD SOURCE dir
</td></tr>
<tr>
<td> FREECAD_BUILD_GUI </td>
<td> Build FreeCAD with all Gui related modules </td>
<td> ON
</td></tr>
<tr>
<td> FREECAD_BUILD_CAM </td>
<td> Build the CAM module, experimental! </td>
<td> OFF
</td></tr>
<tr>
<td> FREECAD_BUILD_INSTALLER </td>
<td> Create the project files for the Windows installer. </td>
<td> OFF
</td></tr>
<tr>
<td> FREECAD_BUILD_DOXYGEN_DOCU </td>
<td> Create the project files for source code documentation. </td>
<td> OFF
</td></tr>
<tr>
<td> FREECAD_MAINTAINERS_BUILD </td>
<td> Switch on stuff needed only when you do a Release build. </td>
<td> OFF
</td></tr></table>
<p>If you are building with Qt Creator, jump to
<a href="#Building_with_Qt_Creator">Building with Qt Creator</a>,
otherwise proceed to
<a href="#Building_with_Visual_Studio_9_2008">Building with Visual Studio 9 2008</a>.
</p>
<h2><span class="mw-headline" id="Building_FreeCAD">Building FreeCAD</span></h2>
<p>Depending on your current setup, the process for building FreeCAD will be slightly different. This is due to the differences in available software and software versions for each operating system.
</p><p><br />
The following procedure will work for compiling on Windows Vista/7/8, for XP an alternate VS tool set is required for VS 2012 and 2013, which has not been tested successfully with the current Libpacks. To target XP(both x32 and x64) it is recommended to use VS2008 and Libpack FreeCADLibs_11.0_x86_VC9.7z
</p>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Building_with_Visual_Studio_12_2013">Building with Visual Studio 12 2013</span></h3>
<div class="mw-collapsible-content">
<p>Make sure to specify <b>Visual Studio 12 x64</b>(or the alternate C-Compiler you are using) as the generator in CMake before you continue.
</p>
<ul><li>Start Visual Studio 12 2013 by clicking on the desktop icon created at installation.</li></ul>
<ul><li>Open the project by:</li></ul>
<p>File -&gt; Open -&gt; Project/Solution
</p>
<ul><li>Open FreeCAD_Trunk.sln from the build folder CMake created</li></ul>
<ul><li>Switch the Solutions Configuration drop down at the top to <b>Release</b> <b>X64</b></li></ul>
<p>This may take a while depending on your sytem
</p>
<ul><li>Build -&gt; Build Solution</li></ul>
<ul><li>This will take a long time... </li></ul>
<p>If you don't get any errors you are done. Exit Visual Studio and start FreeCAD by double clicking the FreeCAD icon in the bin folder of the build directory.
</p>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Building_with_Visual_Studio_9_2008">Building with Visual Studio 9 2008</span></h3>
<div class="note"><b>Warning</b>
<p>Since early 0.17 cycle Freecad uses c++11 features that are not supported by 2008 version
</p>
</div>
<p><br />
</p>
<h3><span class="mw-headline" id="Building_with_Qt_Creator">Building with Qt Creator</span></h3>
<div class="mw-collapsible-content">
<h4><span class="mw-headline" id="Installation_and_configuration_of_Qt_Creator">Installation and configuration of Qt Creator</span></h4>
<ul><li> Download and install <a rel="nofollow" class="external text" href="https://qt-project.org/downloads">Qt Creator</a></li>
<li> Tools -&gt; Options -&gt; Text Editor -&gt; Behavior tab:
<ul><li> File Encodings -&gt; Default Encodings:</li>
<li> Set to: <b>ISO-8859-1 /...csISOLatin1</b> (Certain characters create errors/warnings with Qt Creator if left set to UTF-8. This seems to fix it.)</li></ul></li>
<li> Tools -&gt; Options -&gt; Build &amp; Run:
<ul><li> CMake tab
<ul><li> Fill Executable box with path to cmake.exe</li></ul></li>
<li> Kits tab
<ul><li> Name: MSVC 2008</li>
<li> Compiler: Microsoft Visual C++ Compiler 9.0 (x86)</li>
<li> Debugger: Auto detected...</li>
<li> Qt version: None</li></ul></li>
<li> General tab
<ul><li> Uncheck: Always build project before deploying it</li>
<li> Uncheck: Always deploy project before running it</li></ul></li></ul></li></ul>
<h4><span class="mw-headline" id="Import_project_and_Build">Import project and Build</span></h4>
<ul><li> File -&gt; Open File or Project</li>
<li> Open <b>CMakeLists.txt</b> which is in the top level of the source</li>
<li> This will start CMake</li>
<li> Choose build directory and click next</li>
<li> Set generator to <b>NMake Generator (MSVC 2008)</b></li>
<li> Click Run CMake. Follow the instructions depicted above to configure CMake to your liking.</li></ul>
<p>Now FreeCAD can be built
</p>
<ul><li> Build -&gt; Build All</li>
<li> This will take a long time...</li></ul>
<p>Once complete, it can be run:
There are 2 green triangles at the bottom left. One is debug.
The other is run. Pick whichever you want.
</p>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Command_line_build">Command line build</span></h3>
<div class="mw-collapsible-content">
<p>Here an example how to build FreeCAD from the Command line:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> rem @echo off
rem Build script, uses vcbuild to completetly build FreeCAD
rem update trunc
d:
cd "D:\_Projekte\FreeCAD\FreeCAD_0.9"
"C:\Program Files (x86)\Subversion\bin\svn.exe" update
rem set the aprobiated Variables here or outside in the system
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set INCLUDE=
set LIB=
rem Register VS Build programms
call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
rem Set Standard include paths
set INCLUDE=%INCLUDE%;%FrameworkSDKDir%\include
set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include
rem Set lib Pathes
set LIB=%LIB%;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
set LIB=%LIB%;%PROGRAMFILES%\Microsoft Visual Studio\VC98\Lib
rem Start the Visuall Studio build process
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\vcbuild.exe" "D:\_Projekte\FreeCAD FreeCAD_0.9_build\FreeCAD_trunk.sln" /useenv</pre></div>
</div>
</div>
<p><br />
</p>
<h2><span class="mw-headline" id="Building_older_versions">Building older versions</span></h2>
<h3><span class="mw-headline" id="Using_LibPack">Using LibPack</span></h3>
<p>To make it easier to get FreeCAD compiled, we provide a collection of all
needed libraries. It's called the <a href="Third_Party_Libraries.html" title="Third Party Libraries">LibPack</a>. You can find it on the <a rel="nofollow" class="external text" href="http://sourceforge.net/project/showfiles.php?group_id=49159">download page</a> on
sourceforge.
</p><p>You need to set the following environment variables:
</p>
<dl><dd><b>FREECADLIB</b> = "D:\Wherever\LIBPACK"</dd></dl>
<dl><dd><b>QTDIR</b> = "%FREECADLIB%"</dd></dl>
<p>Add "%FREECADLIB%\bin" and "%FREECADLIB%\dll" to the system <i>PATH</i> variable. Keep in mind that you have to replace "%FREECADLIB%" with the path name, since Windows does not recursively replace environment variables.
</p>
<h4><span class="mw-headline" id="Directory_setup_in_Visual_Studio">Directory setup in Visual Studio</span></h4>
<p>Some search path of Visual Studio need to be set.
To change them, use the menu <i>Tools→Options→Directory</i>
</p>
<h5><span class="mw-headline" id="Includes">Includes</span></h5>
<p>Add the following search path to the include path search list:
</p>
<ul><li>&#160;%FREECADLIB%\include</li>
<li>&#160;%FREECADLIB%\include\Python</li>
<li>&#160;%FREECADLIB%\include\boost</li>
<li>&#160;%FREECADLIB%\include\xercesc</li>
<li>&#160;%FREECADLIB%\include\OpenCascade</li>
<li>&#160;%FREECADLIB%\include\OpenCV</li>
<li>&#160;%FREECADLIB%\include\Coin</li>
<li>&#160;%FREECADLIB%\include\SoQt</li>
<li>&#160;%FREECADLIB%\include\QT</li>
<li>&#160;%FREECADLIB%\include\QT\Qt3Support</li>
<li>&#160;%FREECADLIB%\include\QT\QtCore</li>
<li>&#160;%FREECADLIB%\include\QT\QtGui</li>
<li>&#160;%FREECADLIB%\include\QT\QtNetwork</li>
<li>&#160;%FREECADLIB%\include\QT\QtOpenGL</li>
<li>&#160;%FREECADLIB%\include\QT\QtSvg</li>
<li>&#160;%FREECADLIB%\include\QT\QtUiTools</li>
<li>&#160;%FREECADLIB%\include\QT\QtXml</li>
<li>&#160;%FREECADLIB%\include\Gts</li>
<li>&#160;%FREECADLIB%\include\zlib</li></ul>
<h5><span class="mw-headline" id="Libs">Libs</span></h5>
<p>Add the following search path to the lib path search list:
</p>
<ul><li>&#160;%FREECADLIB%\lib</li></ul>
<h5><span class="mw-headline" id="Executables">Executables</span></h5>
<p>Add the following search path to the executable path search list:
</p>
<ul><li>&#160;%FREECADLIB%\bin</li>
<li> TortoiseSVN binary installation directory, usually "C:\Programm Files\TortoiseSVN\bin", this is needed for a distribution build when <i>SubWVRev.exe</i> is used to extract the version number from Subversion.</li></ul>
<h4><span class="mw-headline" id="Python_needed">Python needed</span></h4>
<p>During the compilation some Python scripts get executed. So the Python
interpreter has to function on the OS. Use a command box to check it. If
the Python library is not properly installed you will get an error message
like <i>Cannot find python.exe</i>. If you use the LibPack you can also use the
python.exe in the bin directory.
</p>
<h4><span class="mw-headline" id="Special_for_VC8">Special for VC8</span></h4>
<p>When building the project with VC8, you have to change the link information for the WildMagic library, since you need a different version for VC6 and VC8. Both versions are supplied in <i>LIBPACK/dll</i>. In the project properties for <i>AppMesh</i> change the library name for the <i>wm.dll</i> to the VC8 version. Take care to change it in Debug <i>and</i> Release configuration.
</p>
<h3><span class="mw-headline" id="Compile">Compile</span></h3>
<p>After you conform to all prerequisites the compilation is - hopefully - only a mouse click in VC
</p>
<h3><span class="mw-headline" id="After_Compiling">After Compiling</span></h3>
<p>To get FreeCAD up and running from the compiler environment you need to copy a few files from the <a href="Third_Party_Libraries.html" title="Third Party Libraries">LibPack</a> to the <i>bin</i> folder where FreeCAD.exe is installed after a successful build:
</p>
<ul><li> <i>python.exe</i> and <i>python_d.exe</i> from <i>LIBPACK/bin</i></li>
<li> <i>python25.dll</i> and <i>python25_d.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>python25.zip</i> from <i>LIBPACK/bin</i></li>
<li> make a copy of <i>Python25.zip</i> and rename it to <i>Python25_d.zip</i></li>
<li> <i>QtCore4.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>QtGui4.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>boost_signals-vc80-mt-1_34_1.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>boost_program_options-vc80-mt-1_34_1.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>xerces-c_2_8.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>zlib1.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>coin2.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>soqt1.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>QtOpenGL4.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>QtNetwork4.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>QtSvg4.dll</i> from <i>LIBPACK/bin</i></li>
<li> <i>QtXml4.dll</i> from <i>LIBPACK/bin</i></li></ul>
<p>When using a <a href="Third_Party_Libraries.html" title="Third Party Libraries">LibPack</a> with a Python version older than 2.5 you have to copy two further files:
</p>
<ul><li> <i>zlib.pyd</i> and <i>zlib_d.pyd</i> from <i>LIBPACK/bin/lib</i>. This is needed by python to open the zipped python library.</li>
<li> <i>_sre.pyd</i> and <i>_sre_d.pyd</i> from <i>LIBPACK/bin/lib</i>. This is needed by python for the built in help system.</li></ul>
<p>If you don't get it running due to a Python error it is very likely that one of the <i>zlib*.pyd</i> files is missing.
</p><p>Alternatively, you can copy the whole bin folder of libpack into bin folder of the build. This is easier, but takes time and disk space. This can be substited by making links instead of copying files, see <a href="/wiki/CompileOnWindows_-_Reducing_Disk_Footprint#avoiding_copying_any_libpack_files_to_launch_FreeCAD" title="CompileOnWindows - Reducing Disk Footprint">CompileOnWindows - Reducing Disk Footprint</a>.
</p>
<h3><span class="mw-headline" id="Additional_stuff">Additional stuff</span></h3>
<p>If you whant to build the source code documentation you need <a rel="nofollow" class="external text" href="http://www.stack.nl/~dimitri/doxygen/">DoxyGen</a>.
</p><p>To create an intstaller package you need <a rel="nofollow" class="external text" href="http://wix.sourceforge.net/">WIX</a>.
</p><p><br />
During the compilation some Python scripts get executed. So the Python interpreter has to work properly.
</p><p>For more details have also a look to <i>README.Linux</i> in your sources.
</p><p>First of all you should build the Qt plugin that provides all custom widgets of FreeCAD we need for the Qt Designer. The sources are located under
</p>
<pre>
//src/Tools/plugins/widget//.
</pre>
<p>So far we don't provide a makefile -- but calling
</p>
<pre>
qmake plugin.pro
</pre>
<p>creates it. Once that's done, calling <i>make</i> will create the library
</p>
<pre>
//libFreeCAD_widgets.so//.
</pre>
<p>To make this library known to your <i>Qt Designer</i> you have to copy the file to
</p>
<pre>
//$QTDIR/plugin/designer//.
</pre>
<h2><span class="mw-headline" id="References">References</span></h2>
<div style="clear:both"></div>
<p><br />
</p><p>On recent linux distributions, FreeCAD is generally easy to build, since all dependencies are usually provided by the package manager. It basically involves 3 steps:
</p>
<ol><li> Getting the FreeCAD source code</li>
<li> Getting the dependencies (packages FreeCAD depends upon)</li>
<li> Configure with "cmake" and Compile with "make"</li></ol>
<p>Below, you'll find detailed explanations of the whole process, some <a href="#Automatic_build_scripts">build scripts</a>, and particularities you might encounter. If you find anything wrong or out-of-date in the text below (Linux distributions change often), or if you use a distribution which is not listed, please help us correcting it.
</p>
<h2><span class="mw-headline" id="Getting_the_source">Getting the source</span></h2>
<p>Before you can compile FreeCAD, you need the source code. There are 3 ways to get it:
</p>
<h3><span class="mw-headline" id="Git">Git</span></h3>
<p>The quickest and best way to get the code is to clone the read-only git repository now hosted on GitHub (you need the <a rel="nofollow" class="external text" href="http://git-scm.com/">git</a> package installed):
</p>
<pre>git clone https://github.com/FreeCAD/FreeCAD.git free-cad-code </pre>
<p>This will place a copy of the latest version of the FreeCAD source code in a new directory called "free-cad-code".
</p>
<h3><span class="mw-headline" id="Github">Github</span></h3>
<p>The official FreeCAD repository is on Github:
<a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD">github.com/FreeCAD/FreeCAD</a>
</p>
<h3><span class="mw-headline" id="Source_package">Source package</span></h3>
<p>Alternatively you can download a source package, but they could be already quite old so it's always better to get the latest sources via git or github.
</p>
<ul><li> Official FreeCAD source packages (distribution-independent): <a rel="nofollow" class="external text" href="https://github.com/FreeCAD/FreeCAD/archive/0.17_pre.zip">FreeCAD-0.17_pre.zip</a>.</li></ul>
<h2><span class="mw-headline" id="Getting_the_dependencies">Getting the dependencies</span></h2>
<p>To compile FreeCAD under Linux you have to install all libraries mentioned in <a href="Third_Party_Libraries.html" title="Third Party Libraries">Third Party Libraries</a> first. Please note that the names and availability of the libraries will depend on your distribution. Note that if you don't use the most recent version of your distribution, some of the packages below might be missing from your repositories. In that case, look in the <a href="#Older_and_non-conventional_distributions">Older and non-conventional distributions</a> section below.
</p><p><a href="#Compile_FreeCAD">Skip to Compile FreeCAD</a>
</p>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Debian_and_Ubuntu">Debian and Ubuntu</span></h3>
<div class="mw-collapsible-content">
<p>On Debian-based systems (Debian, Ubuntu, Mint, etc...) it is quite easy to get all needed dependencies installed. Most of the libraries are available via apt-get or synaptic package manager.
</p>
<ul><li>build-essential</li>
<li>cmake</li>
<li>python</li>
<li>python-matplotlib</li>
<li>libtool</li></ul>
<p>either:
</p>
<dl><dd><ul><li>libcoin60-dev (Debian Wheezy, Wheezy-backports, Ubuntu 13.04 and before)</li></ul></dd></dl>
<p>or:
</p>
<dl><dd><ul><li>libcoin80-dev (Debian unstable(Jesse), testing, Ubuntu 13.10 and forward)</li></ul></dd></dl>
<ul><li>libsoqt4-dev</li>
<li>libxerces-c-dev</li>
<li>libboost-dev</li>
<li>libboost-filesystem-dev</li>
<li>libboost-regex-dev</li>
<li>libboost-program-options-dev </li>
<li>libboost-signals-dev</li>
<li>libboost-thread-dev</li>
<li>libboost-python-dev</li>
<li>libqt4-dev</li>
<li>libqt4-opengl-dev</li>
<li>qt4-dev-tools</li>
<li>python-dev</li>
<li>python-pyside</li>
<li>pyside-tools</li></ul>
<p>either:
</p>
<dl><dd><ul><li>libopencascade-dev (official opencascade version)</li></ul></dd></dl>
<p>or:
</p>
<dl><dd><ul><li>liboce*-dev (opencascade community edition)</li>
<li>oce-draw</li></ul></dd></dl>
<ul><li>libeigen3-dev</li>
<li>libqtwebkit-dev</li>
<li>libshiboken-dev</li>
<li>libpyside-dev</li>
<li>libode-dev</li>
<li>swig</li>
<li>libzipios++-dev</li>
<li>libfreetype6</li>
<li>libfreetype6-dev</li></ul>
<p><a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=4&amp;t=5096#p40018">Additional instruction</a> for libcoin80-dev Debian wheezy-backports, unstable, testing, Ubuntu 13.10 and forward
</p><p>Note that liboce*-dev includes the following libraries:
</p>
<ul><li>liboce-foundation-dev </li>
<li>liboce-modeling-dev </li>
<li>liboce-ocaf-dev </li>
<li>liboce-visualization-dev </li>
<li>liboce-ocaf-lite-dev </li></ul>
<p>You may have to install these packages by individual name.
</p><p>Optionally you can also install these extra packages:
</p>
<ul><li>libsimage-dev (to make Coin to support additional image file formats)</li>
<li>checkinstall (to register your installed files into your system's package manager, so yo can easily uninstall later)</li>
<li>python-pivy (needed for the 2D Drafting module)</li>
<li>python-qt4 (needed for the 2D Drafting module)</li>
<li>doxygen and libcoin60-doc (if you intend to generate source code documentation)</li>
<li>libspnav-dev (for 3Dconnexion devices support like the Space Navigator or Space Pilot)</li></ul>
<p><br />
</p>
<pre>sudo apt install build-essential cmake python python-matplotlib libtool libcoin80-dev libsoqt4-dev libxerces-c-dev libboost-dev libboost-filesystem-dev libboost-regex-dev libboost-program-options-dev libboost-signals-dev libboost-thread-dev libboost-python-dev libqt4-dev libqt4-opengl-dev qt4-dev-tools python-dev python-pyside pyside-tools libeigen3-dev libqtwebkit-dev libshiboken-dev libpyside-dev libode-dev swig libzipios++-dev libfreetype6-dev liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-visualization-dev liboce-ocaf-lite-dev libsimage-dev checkinstall python-pivy python-qt4 doxygen libspnav-dev oce-draw liboce-foundation-dev liboce-modeling-dev liboce-ocaf-dev liboce-ocaf-lite-dev liboce-visualization-dev libmedc-dev libvtk6-dev libproj-dev </pre>
<p>Ubuntu 16.04 users please see also these <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=4&amp;t=16292">Additional instructions</a>.
</p>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Fedora">Fedora</span></h3>
<div class="mw-collapsible-content">
<p>You need the following packages&#160;:
</p>
<ul><li>gcc-c++ (or possibly another C++ compiler?)</li>
<li>cmake</li>
<li>doxygen</li>
<li>swig</li>
<li>gettext</li>
<li>dos2unix</li>
<li>desktop-file-utils</li>
<li>libXmu-devel</li>
<li>freeimage-devel</li>
<li>mesa-libGLU-devel</li>
<li>OCE-devel</li>
<li>python</li>
<li>python-devel</li>
<li>python-pyside-devel</li>
<li>pyside-tools</li>
<li>boost-devel</li>
<li>tbb-devel</li>
<li>eigen3-devel</li>
<li>qt-devel</li>
<li>qt-webkit-devel</li>
<li>ode-devel</li>
<li>xerces-c</li>
<li>xerces-c-devel</li>
<li>opencv-devel</li>
<li>smesh-devel</li>
<li>coin3-devel</li></ul>
<p>(if coin2 is the latest available for your version of Fedora, use packages from <a rel="nofollow" class="external free" href="http://www.zultron.com/rpm-repo/">http://www.zultron.com/rpm-repo/</a>)
</p>
<ul><li>soqt-devel</li>
<li>freetype</li>
<li>freetype-devel</li></ul>
<p>And optionally&#160;:
</p>
<ul><li>libspnav-devel (for 3Dconnexion devices support like the Space Navigator or Space Pilot)</li>
<li>pivy ( <a rel="nofollow" class="external free" href="https://bugzilla.redhat.com/show_bug.cgi?id=458975">https://bugzilla.redhat.com/show_bug.cgi?id=458975</a> Pivy is not mandatory but needed for the Draft module)</li></ul>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Gentoo_2">Gentoo</span></h3>
<div class="mw-collapsible-content">
<p>Easiest way to check which packages are needed to compile FreeCAD is to check via portage:
</p><p><tt>emerge -pv freecad</tt>
</p><p>This should give a nice list of extra packages that you need installed on your system.
</p>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="OpenSUSE_2">OpenSUSE</span></h3>
<div class="mw-collapsible-content">
<p>You need the following packages:
</p>
<ul><li>gcc</li>
<li>cmake</li>
<li>OpenCASCADE-devel</li>
<li>libXerces-c-devel</li>
<li>python-devel</li>
<li>libqt4-devel</li>
<li>libshiboken-devel </li>
<li>python-pyside-devel</li>
<li>python-pyside-tools</li>
<li>Coin-devel</li>
<li>SoQt-devel</li>
<li>boost-devel</li>
<li>libode-devel</li>
<li>libQtWebKit-devel</li>
<li>libeigen3-devel</li>
<li>gcc-fortran</li>
<li>freetype2</li>
<li>freetype2-devel</li>
<li><a rel="nofollow" class="external text" href="http://software.opensuse.org/search?q=eigen3&amp;baseproject=openSUSE%3A12.1&amp;lang=en&amp;exclude_debug=true">Eigen3</a></li>
<li><a rel="nofollow" class="external text" href="http://software.opensuse.org/search?q=swig&amp;baseproject=openSUSE%3A12.1&amp;lang=en&amp;exclude_debug=true">swig</a></li></ul>
<p>For FreeCAD 0.14 stable and 0.15 unstable, if Eigen3 and swig libraries are not found in standard repos, you can get them with a one-click install here:
</p>
<ul><li><a rel="nofollow" class="external text" href="http://software.opensuse.org/search?q=eigen3&amp;baseproject=openSUSE%3A12.1&amp;lang=en&amp;exclude_debug=true">Eigen3</a></li>
<li><a rel="nofollow" class="external text" href="http://software.opensuse.org/search?q=swig&amp;baseproject=openSUSE%3A12.1&amp;lang=en&amp;exclude_debug=true">swig</a></li></ul>
<p>Also, note that the Eigen3 Library from Factory Education was causing problems sometimes, so use the one from the KDE 4.8 Extra repo
</p><p>Starting with 0.17pre Opensuse 13.2 is too old to build due to too old boost.
</p>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Arch_Linux">Arch Linux</span></h3>
<div class="mw-collapsible-content">
<p>You will need the following libraries from the official repositories:
</p>
<ul><li>boost-libs</li>
<li>curl</li>
<li>hicolor-icon-theme</li>
<li>libspnav</li>
<li>opencascade</li>
<li>python2-pivy</li>
<li>python2-matplotlib</li>
<li>python2-pyside</li>
<li>python2-shiboken</li>
<li>qtwebkit</li>
<li>shared-mime-info</li>
<li>xerces-c</li>
<li>boost</li>
<li>cmake</li>
<li>coin</li>
<li>desktop-file-utils</li>
<li>eigen</li>
<li>gcc-fortran</li>
<li>swig</li></ul>
<p>Also, make sure to check the AUR for any missing packages that are not on the repositories, currently:
</p>
<ul><li>python2-pyside-tools</li>
<li>med (Modelisation et Echanges de Donnees)</li></ul>
<pre>sudo pacman -S boost-libs curl hicolor-icon-theme libspnav opencascade python2-pivy python2-matplotlib python2-pyside python2-shiboken qtwebkit shared-mime-info xerces-c boost cmake coin desktop-file-utils eigen gcc-fortran med python2-pyside-tools </pre>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Older_and_non-conventional_distributions">Older and non-conventional distributions</span></h3>
<div class="mw-collapsible-content">
<p>On other distributions, we have very few feedback from users, so it might be harder to find the required packages. Try first locating the required libraries mentioned in <a href="Third_Party_Libraries.html" title="Third Party Libraries">Third Party Libraries</a>. Beware that some of them might have a slightly different package name in your distribution (such as name, libname, name-dev, name-devel, etc...).
</p><p>You also need the <a href="http://en.wikipedia.org/wiki/GNU_Compiler_Collection" class="extiw" title="wikipedia:GNU Compiler Collection">GNU gcc compiler</a> version equal or above 3.0.0. g++ is also needed because FreeCAD is completely written in C++. During the compilation some Python scripts get executed. So the Python interpreter has to work properly. To avoid any linker problems during the build process it is also a good idea to have the library paths either in your <i>LD_LIBRARY_PATH</i> variable or in your <i>ld.so.conf</i> file. This is normally already the case in recent distributions.
</p><p>For more details have also a look to <i>README.Linux</i> in your sources.
</p>
</div>
</div>
<h4><span class="mw-headline" id="Pivy">Pivy</span></h4>
<p>Pivy is not needed to build FreeCAD or to run it, but it is needed for the 2D Drafting module to work. If you are not going to use that module, you won't need pivy. By November 2015 the obsolete version of Pivy included with FreeCAD source code will no longer compile on many systems, due to its age. If you cannot find Pivy in your distribution's packages repository ort elsewhere, you can compile pivy yourself:
</p><p><a href="/wiki/Extra_python_modules#Pivy" title="Extra python modules">Pivy compilation instructions</a>
</p>
<h2><span class="mw-headline" id="Compile_FreeCAD">Compile FreeCAD</span></h2>
<h3><span class="mw-headline" id="Using_cMake">Using cMake</span></h3>
<p>cMake is a newer build system which has the big advantage of being common for different target systems (Linux, Windows, MacOSX, etc). FreeCAD is now using the cMake system as its main building system. Compiling with cMake is usually very simple and happens in 2 steps. In the first step, cMake checks that every needed programs and libraries are present on your system and sets up all that's necessary for the subsequent compilation. You are given a few alternatives detailed below, but FreeCAD comes with sensible defaults. The second step is the compiling itself, which produces the FreeCAD executable. Changing any options for cmake away from their default values, is much easier with cmake-gui or other graphical cmake applications than with cmake on the command line, as the graphical applications will give you interactive feed back.
</p><p>Since FreeCAD is a heavy application, compiling can take a bit of time (about 10 minutes on a fast machine, 30 minutes (or more) on a slow one)
</p>
<h4><span class="mw-headline" id="In-source_building">In-source building</span></h4>
<p>If you are unsure then, due to its limitations, do not make an in-source build, create an out-of-source build as explained in the next section. However FreeCAD can be built in-source, which means that all the files resulting from the compilation stay in the same folder as the source code. This is fine if you are just looking at FreeCAD, and want to be able to remove it easily by just deleting that folder. But in case you are planning to compile it often, you are advised to make an out-of-source build, which offers many more advantages. The following commands will compile FreeCAD:
</p>
<pre>$ cd freecad (the folder where you cloned the freecad source) </pre>
<p>If you want to use your system's copy of Pivy, which you most commonly will, then if not on Linux, set the compiler flag to use the correct pivy (via FREECAD_USE_EXTERNAL_PIVY=1). Using external Pivy became the default for Linux, during development of FreeCAD 0.16, so it does not need to be manually set when compiling this version onwards, on Linux. Also, set the build type to Debug if you want a debug build or Release if not. A Release build will run much faster than a Debug build. Sketcher becomes very slow with complex sketches if your FreeCAD is a Debug build. (NOTE: the space and "." after the cmake flags are CRITICAL!):
</p>
<h5><span class="mw-headline" id="For_a_Debug_build">For a Debug build</span></h5>
<pre>$ cmake -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Debug .
# Note: to speed up build use all CPU cores: make -j$(nproc)
$ make </pre>
<h5><span class="mw-headline" id="Or_for_a_Release_build">Or for a Release build</span></h5>
<pre>$ cmake -DFREECAD_USE_EXTERNAL_PIVY=1 -DCMAKE_BUILD_TYPE=Release .
# Note: to speed up build use all CPU cores: make -j$(nproc)
$ make </pre>
<p>Your FreeCAD executable will then reside in the "bin" folder, and you can launch it with:
</p>
<pre>$ ./bin/FreeCAD </pre>
<h4><span class="mw-headline" id="How_to_repair_your_source_code_directory_after_accidentally_running_an_in-source_build.">How to repair your source code directory after accidentally running an in-source build.</span></h4>
<p>This is a method, using Git, to repair your source code directory after accidentally running an in-source build.
</p>
<pre>1) delete everything in your source base directory EXCEPT the hidden .git folder
2) In terminal 'git reset --hard HEAD'
//any remnants of an 'in source' build will be gone.
3) delete everything from your 'out of source' build directory and start over again with cmake and a full new clean build. </pre>
<h4><span class="mw-headline" id="Out-of-source_build">Out-of-source build</span></h4>
<p>If you intend to follow the fast evolution of FreeCAD, building in a separate folder is much more convenient. Every time you update the source code, cMake will then intelligently distinguish which files have changed, and recompile only what is needed. Out-of-source builds are specially handy when using the Git system, because you can easily try other branches without confusing the build system. To build out-of-source, simply create a build directory, distinct from your FreeCAD source folder, and, from the build folder, point cMake (or if using cmake-gui replace "cmake" in the code below with "cmake-gui") to the source folder:
</p>
<pre>mkdir freecad-build
cd freecad-build
cmake ../freecad (or whatever the path is to your FreeCAD source folder)
# Note: to speed up build use all CPU cores: make -j$(nproc)
make </pre>
<p>The FreeCAD executable will then reside in the "bin" directory (within your freecad-build directory).
</p>
<h4><span class="mw-headline" id="Configuration_options">Configuration options</span></h4>
<p>There are a number of experimental or unfinished modules you may have to build if you want to work on them. To do so, you need to set the proper options for the configuration phase. Do it either on the command line, passing -D &lt;var&gt;:&lt;type&gt;=&lt;value&gt; options to cMake or using one of the availables gui-frontends (eg for Debian, packages cmake-qt-gui or cmake-curses-gui). Changing any options for cmake away from their default values, is much easier with cmake-gui or other graphical cmake applications than with cmake on the command line, as they will give you interactive feed back.
</p><p>As an example, to configure FreeCAD with the Assembly module built just tick the box in a cmake gui application (e.g. cmake-gui) or on the command line issue:
</p>
<pre>cmake -D FREECAD_BUILD_ASSEMBLY:BOOL=ON ''path-to-freecad-root'' </pre>
<p>Possible options are listed in FreeCAD's root CmakeLists.txt file.
</p>
<h4><span class="mw-headline" id="Qt_designer_plugin">Qt designer plugin</span></h4>
<p>If you want to develop Qt stuff for FreeCAD, you'll need the Qt Designer plugin that provides all custom widgets of FreeCAD. Go to
</p>
<pre>freecad/src/Tools/plugins/widget </pre>
<p>So far we don't provide a makefile -- but calling
</p>
<pre>qmake plugin.pro </pre>
<p>creates it. Once that's done, calling
</p>
<pre>make </pre>
<p>will create the library libFreeCAD_widgets.so. To make this library known to Qt Designer you have to copy the file to $QTDIR/plugin/designer
</p>
<h4><span class="mw-headline" id="Doxygen">Doxygen</span></h4>
<p>If you feel bold enough to dive in the code, you could take advantage to build and consult Doxygen generated FreeCAD's <a href="https://www.freecadweb.org/wiki/index.php?title=Source_documentation" title="Source documentation">Source documentation</a>
</p>
<h3><span class="mw-headline" id="Making_a_debian_package">Making a debian package</span></h3>
<p>If you plan to build a Debian package out of the sources you need to install those packages first:
</p>
<pre>dh-make
devscripts
#optional, used for checking if packages are standard-compliant
lintian </pre>
<p>To build a package open a console, simply go to the FreeCAD directory and call
</p>
<pre>debuild </pre>
<p>Once the package is built, you can use lintian to check if the package contains errors
</p>
<pre>#replace by the name of the package you just created
lintian your-fresh-new-freecad-package.deb </pre>
<h2><span class="mw-headline" id="Troubleshooting">Troubleshooting</span></h2>
<h3><span class="mw-headline" id="Note_for_64bit_systems">Note for 64bit systems</span></h3>
<p>When building FreeCAD for 64-bit there is a known issue with the OpenCASCADE 64-bit package. To get FreeCAD running properly you might need to run the ./configure script with the additional define _OCC64 set:
</p>
<pre>./configure CXXFLAGS="-D_OCC64" </pre>
<p>For Debian based systems this workaround is not needed when using the prebuilt package because there the OpenCASCADE package is built to set internally this define. Now you just need to compile FreeCAD the same way as described above.
</p>
<h2><span class="mw-headline" id="Automatic_build_scripts">Automatic build scripts</span></h2>
<p>Here is all what you need for a complete build of FreeCAD. It's a one-script-approach
and works on a fresh installed distro. The commands will ask for root password
(for installation of packages) and sometime to acknowledge a fingerprint for
an external repository server or https-subversion repository. These scripts should
run on 32 and 64 bit versions. They are written for different versions, but are
also likely to run on a later version with or without major changes.
</p><p>If you have such a script for your preferred distro, please send it! We will
incorporate it into this article.
</p>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Ubuntu">Ubuntu</span></h3>
<div class="mw-collapsible-content">
<p>These scripts provide a reliable way to install the correct set of dependencies required to build and run FreeCAD on Ubuntu. They make use of the FreeCAD Ubuntu PPA repositories, and should work on any version of Ubuntu targeted by the PPA. The <a rel="nofollow" class="external text" href="https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily">'daily' PPA</a> targets recent versions of Ubuntu, and the <a rel="nofollow" class="external text" href="https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-stable">'stable' PPA</a> targets all officially supported versions of Ubuntu.
</p><p>This script installs dependencies for the daily development snapshot of FreeCAD.
</p>
<pre>#!/bin/sh
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-daily &amp;&amp; sudo apt-get update
# Install the dependencies needed to build FreeCAD
sudo apt-get build-dep freecad-daily
# Install the dependencies needed to run FreeCAD (and a build of FreeCAD itself)
sudo apt-get install freecad-daily </pre>
<p>This script installs dependencies for the latest stable release of FreeCAD.
(For Ubuntu 12.04, omit "--enable-source" from the add-apt-repository command.)
</p>
<pre>#!/bin/sh
sudo add-apt-repository --enable-source ppa:freecad-maintainers/freecad-stable &amp;&amp; sudo apt-get update
# Install the dependencies needed to build FreeCAD
sudo apt-get build-dep freecad
# Install the dependencies needed to run FreeCAD (and a build of FreeCAD itself)
sudo apt-get install freecad </pre>
<p>(These scripts also install the PPA build of FreeCAD itself, as a side effect. You could then uninstall that while leaving the dependencies in place. However, leaving it installed will enable the package manager to keep the set of dependencies up to date, which is useful if you are following the development for a long time.)
</p><p>After installing the dependencies, please see the generic instructions for getting the source code, running CMake, and compiling. The following script is an example of one way to do this.
</p>
<pre>#!/bin/sh
# checkout the latest source
git clone https://github.com/FreeCAD/FreeCAD.git freecad
# go to source dir
cd freecad
# open cmake-gui window
cmake-gui .
# build configuration
cmake .
# build FreeCAD
# Note: to speed up build use all CPU cores: make -j$(nproc)
make </pre>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="OpenSUSE_12.2">OpenSUSE 12.2</span></h3>
<div class="mw-collapsible-content">
<p>No external Repositories are needed to compile FreeCAD 0.13 with this release. However, there is an imcompatability with python3-devel which needs to be removed. FreeCAD can be compiled from GIT similar to in OpenSUSE 12.2
</p>
<pre># install needed packages for development
sudo zypper install gcc cmake OpenCASCADE-devel libXerces-c-devel \
python-devel libqt4-devel python-qt4 Coin-devel SoQt-devel boost-devel \
libode-devel libQtWebKit-devel libeigen3-devel gcc-fortran git swig
# create new dir, and go into it
mkdir FreeCAD-Compiled
cd FreeCAD-Compiled
# get the source
git clone https://github.com/FreeCAD/FreeCAD.git free-cad
# Now you will have subfolder in this location called free-cad. It contains the source
# make another dir for compilation, and go into it
mkdir FreeCAD-Build1
cd FreeCAD-Build1
# build configuration
cmake ../free-cad
# build FreeCAD
make
# test FreeCAD
cd bin
./FreeCAD -t 0 </pre>
<p>Since you are using git, next time you wish to compile you do not have to clone everything, just pull from git and compile once more
</p>
<pre># go into free-cad dir created earlier
cd free-cad
# pull
git pull
# get back to previous dir
cd ..
# Now repeat last few steps from before.
# make another dir for compilation, and go into it
mkdir FreeCAD-Build2
cd FreeCAD-Build2
# build configuration
cmake ../free-cad
# build FreeCAD
# Note: to speed up build use all CPU cores: make -j$(nproc)
make
# test FreeCAD
cd bin
./FreeCAD -t 0 </pre>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Debian_Squeeze">Debian Squeeze</span></h3>
<div class="mw-collapsible-content">
<pre># get the needed tools and libs
sudo apt-get install build-essential python libcoin60-dev libsoqt4-dev \
libxerces-c2-dev libboost-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-graph-dev libboost-iostreams-dev libboost-program-options-dev \
libboost-serialization-dev libboost-signals-dev libboost-regex-dev \
libqt4-dev qt4-dev-tools python2.5-dev \
libsimage-dev libopencascade-dev \
libsoqt4-dev libode-dev subversion cmake libeigen2-dev python-pivy \
libtool autotools-dev automake gfortran
# checkout the latest source
git clone https://github.com/FreeCAD/FreeCAD.git freecad
# go to source dir
cd freecad
# build configuration
cmake .
# build FreeCAD
# Note: to speed up build use all CPU cores: make -j$(nproc)
make
# test FreeCAD
cd bin
./FreeCAD -t 0 </pre>
</div>
</div>
<div class="mw-collapsible mw-collapsed toccolours">
<h3><span class="mw-headline" id="Fedora_22.2F23.2F24">Fedora 22/23/24</span></h3>
<div class="mw-collapsible-content">
<p>Posted by user [<a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3666">PrzemoF</a>] in the forum.
</p>
<pre>#!/bin/bash
#ARCH=x86_64
#ARCH=i686
ARCH=$(arch)
MAIN_DIR=FreeCAD
BUILD_DIR=build
#FEDORA_VERSION=22
FEDORA_VERSION=23
#FEDORA_VERSION=24
echo "Installing packages required to build FreeCAD"
sudo dnf -y install gcc cmake gcc-c++ boost-devel zlib-devel swig eigen3 qt-devel \
shiboken shiboken-devel pyside-tools python-pyside python-pyside-devel xerces-c \
xerces-c-devel OCE-devel smesh graphviz python-pivy python-matplotlib tbb-devel \
freeimage-devel Coin3 Coin3-devel med-devel vtk-devel
cd ~
mkdir $MAIN_DIR || { echo "~/$MAIN_DIR already exist. Quitting.."; exit; }
cd $MAIN_DIR
git clone https://github.com/FreeCAD/FreeCAD.git
mkdir $BUILD_DIR || { echo "~/$BUILD_DIR already exist. Quitting.."; exit; }
cd $BUILD_DIR
cmake ../FreeCAD
# Note: to speed up build use all CPU cores: make -j$(nproc)
make </pre>
</div>
</div>
<h2><span class="mw-headline" id="Updating_the_source_code">Updating the source code</span></h2>
<p>FreeCAD development happens fast, everyday or so there are bug fixes or new features. The cmake systems allows you to intelligently update the source code, and only recompile what has changed, making subsequent compilations very fast. Updating the source code with git or subversion is very easy:
</p>
<pre>#Replace with the location where you cloned the source code the first time
cd freecad
#If you are using git
git pull </pre>
<p>Move into the appropriate build directory and run cmake again (as cmake updates the version number data for the Help menu, ...about FreeCAD), however you do not need to add the path to source code after "cmake", just a space and a dot:
</p>
<pre>#Replace with the location of the build directory
cd ../freecad-build
cmake .
# to use all cpu cores change to: make -j$(nproc)
make </pre>
<h2><span class="mw-headline" id="Links_4">Links</span></h2>
<p>See also <a href="/wiki/Compiling_(Speeding_up)" title="Compiling (Speeding up)">Compiling - Speeding up</a> How to speed up compilation
</p>
<p><br />
</p><p>This page explains how to compile the latest FreeCAD source code on Mac OS X. It is meant as a starting point for developing on FreeCAD; if you instead want to try using the latest pre-release version of FreeCAD, downloads are available from our continuous integration system at <a rel="nofollow" class="external free" href="https://github.com/FreeCAD/FreeCAD/releases">https://github.com/FreeCAD/FreeCAD/releases</a> .
</p>
<h2><span class="mw-headline" id="Prerequisites_2">Prerequisites</span></h2>
<p>First of all, you will need to install the following software.
</p>
<h3><span class="mw-headline" id="Package_Manager">Package Manager</span></h3>
<p>For FreeCAD, we usually use <a rel="nofollow" class="external text" href="https://brew.sh/">Homebrew</a>, though MacPorts was used previously.
</p>
<h3><span class="mw-headline" id="CMake_2">CMake</span></h3>
<p>FreeCAD uses <a rel="nofollow" class="external text" href="http://www.cmake.org/">CMake</a> to build the source. CMake comes in two versions, command-line and GUI. Use whichever you prefer.
</p><p>The command-line version of CMake will be automatically installed by Homebrew in the prerequisites step, or the GUI version can be downloaded directly from <a rel="nofollow" class="external free" href="https://www.cmake.org/download">https://www.cmake.org/download</a> .
</p>
<h2><span class="mw-headline" id="Installing_the_Dependencies">Installing the Dependencies</span></h2>
<p>All of the needed libraries can be installed using Homebrew. We maintain a "tap" including a formula for FreeCAD, it can be used to get the relevant dependencies.
</p><p>We are currently transitioning FreeCAD from Qt 4 to Qt 5; the Homebrew formula will default to installing Qt5.6 unless --with-qt4 is specified along with --only-dependencies.
</p><p><i>Note that there is currently a bug where the dependencies aren't all installed on the first run of brew install... - the duplicate line below is intentional</i>
</p>
<pre>
brew tap homebrew/science
brew tap freecad/freecad
brew install --only-dependencies freecad
brew install --only-dependencies freecad
</pre>
<h2><span class="mw-headline" id="Getting_the_source_2">Getting the source</span></h2>
<p>In this guide, the source and build folders are created in <b>/Users/username/FreeCAD</b>, but you can of course use whatever folder you want.
</p>
<pre>
mkdir ~/FreeCAD
cd ~/FreeCAD
</pre>
<p>To get the FreeCAD source code, this command will create a "clone" of the FreeCAD git repository in to a new directory called FreeCAD-git:
</p>
<pre>
git clone https://github.com/FreeCAD/FreeCAD FreeCAD-git
</pre>
<h2><span class="mw-headline" id="Building_FreeCAD_2">Building FreeCAD</span></h2>
<p>Create a new folder for the build:
</p>
<pre>
mkdir ~/FreeCAD/build
</pre>
<p>Now you will need to run CMake to generate the build files. Several options will need to be given to CMake, which can be accomplished either with the CMake GUI application, or via the command line.
</p>
<h3><span class="mw-headline" id="CMake_Options">CMake Options</span></h3>
<table class="wikitable" style="text-align:left">
<tr>
<th> Name </th>
<th> Value </th>
<th> Notes
</th></tr>
<tr>
<td> BUILD_QT5 </td>
<td> 1 (checked) </td>
<td> Set 0 (unchecked) if building with Qt4.
</td></tr>
<tr>
<td> FREECAD_USE_EXTERNAL_KDL </td>
<td> 1 (checked) </td>
<td>
</td></tr>
<tr>
<td> CMAKE_BUILD_TYPE </td>
<td> Debug </td>
<td> Can be Debug or Release. Debug is generally used for development
</td></tr>
<tr>
<td> BUILD_FEM_NETGEN </td>
<td> 1 (checked) </td>
<td>
</td></tr>
<tr>
<td> FREECAD_CREATE_MAC_APP </td>
<td> 1 (checked) </td>
<td> If you want to make a FreeCAD.app , this CMake option will cause "make install" to create a FreeCAD.app bundle in CMAKE_INSTALL_PREFIX .
</td></tr></table>
<h3><span class="mw-headline" id="CMake_GUI">CMake GUI</span></h3>
<p>Open the CMake app, and fill in the source and build folder fields. In this case, it would be <b>/Users/username/FreeCAD/FreeCAD-git</b> for the source, and <b>/Users/username/FreeCAD/build</b> for the build folder.
</p><p>Next, click the <b>Configure</b> button to populate the list of configuration options. This will display a dialog asking you to specify what generator to use. Leave it at the default <b>Unix Makefiles.</b> Configuring will fail the first time because there are some options that need to be changed. Note: You will need to check the <b>Advanced</b> checkbox to get all of the options.
</p><p>Set options from the table above, then click <b>Configure</b> again and then <b>Generate</b>.
</p>
<h3><span class="mw-headline" id="CMake_command_line">CMake command line</span></h3>
<p>Open a terminal, cd in to the build directory that was created above. Run cmake with options from the table above, following the formula -D(Name)="(Value)", and the path to your FreeCAD source directory as the final argument.
</p>
<pre>
$cd ~/FreeCAD/build
$cmake -DFREECAD_USE_EXTERNAL_KDL="1" ...options continue... -DFREECAD_CREATE_MAC_APP ="1" ../FreeCAD-git
</pre>
<h3><span class="mw-headline" id="Make">Make</span></h3>
<p>Finally, from a terminal run <b>make</b> to compile FreeCAD.
</p>
<pre>
cd ~/FreeCAD/build
make j3
</pre>
<p>The -j option specifies how many make processes to run at once. One plus the number of CPU cores is usually a good number to use. However, if compiling fails for some reason, it is useful to rerun make without the -j option, so that you can see exactly where the error occurred.
</p><p>See also <a href="/wiki/Compiling_(Speeding_up)" title="Compiling (Speeding up)">Compiling - Speeding up</a>.
</p><p>If make finishes without any errors, you can now launch FreeCAD, either from Terminal with <b>./bin/FreeCAD</b>, or by double clicking the executable in Finder.
</p>
<h2><span class="mw-headline" id="Updating">Updating</span></h2>
<p>FreeCAD development happens fast; every day or so there are bug fixes or new features. To get the latest changes, use git to update the source directory (see <a href="Source_code_management.html" title="Source code management">Source code management</a>), then re-run the CMake and make steps above. It is not usually necessary to start with a clean build directory in this case, and subsequent compiles will generally go much faster than the first one.
</p>
<h2><span class="mw-headline" id="Troubleshooting_2">Troubleshooting</span></h2>
<h3><span class="mw-headline" id="Fortran">Fortran</span></h3>
<p><i>"No CMAKE_Fortran_COMPILER could be found."</i> during configuration - Older versions of FreeCAD will need a fortran compiler installed. With Homebrew, do "brew install gcc" and try configuring again, giving cmake the path to Fortran ie -DCMAKE_Fortran_COMPILER=/opt/local/bin/gfortran-mp-4.9 . Or, preferably use a more current version of FreeCAD source!
</p>
<h3><span class="mw-headline" id="OpenGL">OpenGL</span></h3>
<p>See <a href="OpenGL_on_MacOS.html" title="OpenGL on MacOS">OpenGL on MacOS</a> for OpenGL issues when Qt 4.8 and earlier are used on MacOS.
</p>
<h3><span class="mw-headline" id="FreeType">FreeType</span></h3>
<p>When using CMake versions older than 3.1.0, it's necessary to set CMake variable FREETYPE_INCLUDE_DIR_freetype2 manually, eg /usr/local/include/freetype2
</p>
<div style="clear:both"></div>
<p><br />
</p>
<div class="mw-translate-fuzzy">
<h3><span class="mw-headline" id=".C3.96versikt">Översikt</span></h3>
<p>Detta är bibliotek som inte har förändrats i FreeCAD projektet. De används som de är som ett dynamiskt länkbibliotek (*.so or *.dll). Om en ändring är nödvändig eller om en wrapper klass behövs, så måste wrapperns kod eller den förändrade bibliotekskoden flyttas till FreeCADs baspaket.
</p><p>De använda biblioteken är:
</p>
</div>
<div class="mw-translate-fuzzy">
<p>Överväg att använda <a href="#LibPack.2Fsv">LibPack</a> istället för att ladda ned och installera alla saker själv.
</p>
</div>
<h3><span class="mw-headline" id="L.C3.A4nkar_2">Länkar</span></h3>
<div class="mw-translate-fuzzy">
<table class="wikitable" style="text-align:left">
<caption> Länktabell
</caption>
<tr>
<th> Biblioteksnamn </th>
<th> Nödvändig version </th>
<th> Länk till den
</th></tr>
<tr>
<td> Python </td>
<td> &gt;= 2.5.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.python.org/">http://www.python.org/</a>
</td></tr>
<tr>
<td> OpenCasCade </td>
<td> &gt;= 5.2 </td>
<td> <a rel="nofollow" class="external free" href="http://www.opencascade.org">http://www.opencascade.org</a>
</td></tr>
<tr>
<td> Qt </td>
<td> &gt;= 4.1.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.qtsoftware.com">http://www.qtsoftware.com</a>
</td></tr>
<tr>
<td> Coin3D </td>
<td> &gt;= 2.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.coin3d.org">http://www.coin3d.org</a>
</td></tr>
<tr>
<td> ODE </td>
<td> &gt;= 0.10.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.ode.org">http://www.ode.org</a>
</td></tr>
<tr>
<td> SoQt </td>
<td> &gt;= 1.2 </td>
<td> <a rel="nofollow" class="external free" href="http://www.coin3d.org">http://www.coin3d.org</a>
</td></tr>
<tr>
<td> Xerces-C++ </td>
<td> &gt;= 2.7.x &lt; 3.0 </td>
<td> <a rel="nofollow" class="external free" href="http://xml.apache.org/xerces-c/">http://xml.apache.org/xerces-c/</a>
</td></tr>
<tr>
<td> GTS </td>
<td> &gt;= 0.7.x </td>
<td> <a rel="nofollow" class="external free" href="http://gts.sourceforge.net/">http://gts.sourceforge.net/</a>
</td></tr>
<tr>
<td> Zlib </td>
<td> &gt;= 1.x.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.zlib.net/">http://www.zlib.net/</a>
</td></tr>
<tr>
<td> Boost </td>
<td> &gt;= 1.33.x </td>
<td> <a rel="nofollow" class="external free" href="http://www.boost.org/">http://www.boost.org/</a>
</td></tr>
<tr>
<td> Eigen3 </td>
<td> &gt;= 3.0.1 </td>
<td> <a rel="nofollow" class="external free" href="https://www.freecadweb.org/wiki/index.php?title=Main_Page">http://eigen.tuxfamily.org/index.php?title=Main_Page</a>
</td></tr></table>
</div>
<h3><span class="mw-headline" id="Detaljer">Detaljer</span></h3>
<h4><span class="mw-headline" id="Python">Python</span></h4>
<p><b>Version:</b> 2.5 eller högre
</p><p><b>License:</b> Python 2.5 licens
</p><p>Du kan använda käll- eller binärkod från <a rel="nofollow" class="external free" href="http://www.python.org/">http://www.python.org/</a> eller alternativt använda ActiveState Python från <a rel="nofollow" class="external free" href="http://www.activestate.com/">http://www.activestate.com/</a> fast det kan vara svårt att få avbuggningsbiblioteken från ActiveState.
</p>
<div class="mw-translate-fuzzy">
<h5><span class="mw-headline" id="Beskrivning">Beskrivning</span></h5>
<p>Python är det huvudsakliga skriptspråket och används på många ställen i applikationen.
</p><p>Till exempel:
</p>
<ul><li> Implementation av testskript för att testa:
<ul><li> minnesläckor</li>
<li> försäkra funktionalitet efter ändringar</li>
<li> efterbyggningskontroller</li>
<li> testa täckningstester</li></ul></li>
<li> Makron och makro inspelning</li>
<li> Implementation av applikationslogik för standardpaket</li>
<li> Implementation av hela arbetsbänkar</li>
<li> Dynamisk laddning av paket</li>
<li> Implementering av regler för design (Knowledge engineering)</li>
<li> Göra häftiga internetsaker som arbetsgrupper och PDM</li>
<li> Och så vidare ...</li></ul>
</div>
<p>Speciellt Pythons dynamiska paketladdning används under körning för att ladda ytterligare funktionalitet och arbetsbänkar som behövs för de aktuella uppgifterna. För en närmare titt på Python se: www.python.org Varför Python kanske du frågar dig? Det finns några skäl: Hittills så har Jag använt följande olika skriptspråk i mitt professionella liv:
</p>
<ul><li> Perl</li>
<li> Tcl/Tk</li>
<li> VB</li>
<li> Java</li></ul>
<p>Python är mer OO än Perl och Tcl, koden är inte lika stökig som i Perl och VB. Java är för det första inte ett skriptspråk och är svårt (eller omöjligt) att bädda in. Python är väldokumenterat och lätt att bädda in och bygga ut. Det är också vältestat och har en stark uppbackning i öppen-källkods samhället.
</p>
<h5><span class="mw-headline" id="Krediter">Krediter</span></h5>
<p>Går till Guido van Rossum och en massa andra människor som gjorde Python till en sådan framgång!
</p>
<h4><span class="mw-headline" id="OpenCasCade">OpenCasCade</span></h4>
<p><b>Version:</b> 5.2 eller högre
</p>
<div class="mw-translate-fuzzy">
<p><b>Licens:</b> OCTPL
</p>
</div>
<p>OCC är en fullödig CAD Kärna. Från början utvecklades den av Matra Datavision i Frankrike för Strim (Styler) och Euclid Quantum applikationerna och ändrades senare till öppen källkod. Det är verkligen ett stort bibliotek, och gör en fri cad applikation möjlig, genom att erbjuda några paket som skulle vara svåra eller omöjliga att implementera i ett öppen källkodsprojekt:
</p>
<ul><li> En komplett STEP kompliant geometrikärna</li>
<li> En topologisk datamodell och alla nödvändiga funktioner att arbeta med (klipp, förena, extrudera, och så vidare. . . )</li>
<li> Standard Import- / Export processorer som STEP, IGES, VRML</li>
<li> 3D och 2D visare med markeringssupport</li>
<li> En dokument och projektdatastruktur med support för spara och återställa, extern länkning av dokument, omberäkning av designhistoria (parametrisk modellering) och en facilitet för att ladda nya datatyper dynamiskt som ett utökningspaket</li></ul>
<p>För att lära dig mer om OpenCasCade, ta en titt på OpenCasCade sidan eller <a rel="nofollow" class="external free" href="http://www.opencascade.org">http://www.opencascade.org</a>.
</p>
<h4><span class="mw-headline" id="Qt">Qt</span></h4>
<p><b>Version:</b> 4.1.x eller högre
</p><p><b>Licens:</b> GPL v2.0/v3.0 eller Kommersiell (från version 4.5 och framåt även v2.1)
</p><p>Jag tror inte jag behöver berätta så mycket om Qt. Det är en av de mest använda verktygsseten för grafiskt gränssnitt i öppen källkodsprojekt. För mig är den viktigaste anledningen att använda Qt är Designer och möjligheten att ladda hela dialogrutor som en (XML) resurs och integrera specialiserade widgets. I en CAX applikation så är användarinteraktionen och dialogrutorna den absolut största delen av koden och för en bra dialogkonstruktör är dett mycket viktigt att lätt kunna utöka FreeCAD med ny funktionalitet. Ytterligare information och en mycket bra online dokumentation hittar du på <a rel="nofollow" class="external free" href="http://www.qtsoftware.com">http://www.qtsoftware.com</a>.
</p>
<h4><span class="mw-headline" id="Coin3D">Coin3D</span></h4>
<div class="mw-translate-fuzzy">
<p><b>Version:</b> 2.0 eller högre
</p>
</div>
<p><b>Licens:</b> GPL v2.0 eller Kommersiell
</p><p>Coin är ett högnivå 3D grafikbibliotek med ett C++ Applikationsprogrammeringsgränssnitt. Coin använder scengraf datastrukturer för att rendera realtidsgrafik som passar för de flesta vetenskapliga och konstruktions visualiserings applikationer.
</p><p>Coin kan portas över många plattformar: alla UNIX / Linux / *BSD plattformar, alla Microsoft Windows operativsystem, och Mac OS X.
</p><p>Coin är byggt på industristandard OpenGL direktrenderingsbiblioteket, och adderar abstraktioner för högnivåprimitiver, erbjuder 3D interaktivitet, ökar bekvämligheten och produktiviteten för programmeraren, och innehåller många komplexa optimeringsfunktioner för snabb rendering som är transparent för programmeraren.
</p><p>Coin är baserat på SGI Open Inventor API. Open Inventor, för de som inte vet vad det är, har sedan länge varit de facto standard grafikbibliotek för 3D visualisering och visuell simuleringsmjukvara i vetenskapliga och konstruktörssammanhang. Det har bevisat sitt värde i mer än 10 år, dess mogenhet bidrar till dess framgång som ett huvudsakligt byggblock i tusentals storskaliga ingenjörsapplikationer världen runt.
</p><p>Vi kommer att använda OpenInventor som 3D visare i FreeCAD eftersom OpenCasCade visaren (AIS och Graphics3D) har allvarliga begränsningar och prestandaflaskhalsar, speciellt när det gäller storskalig konstruktionsrendering. Andra saker som texturer eller volymetrisk rendering är inte väl stödda, och så vidare ....
</p><p>Sedan Version 2.0 så använder Coin en annan licensmodell. Den är inte längre LGPL. De använder GPL för öppen källkod och en kommersiell licens för stängd källkod. Det innebär att om du vill sälja ditt arbete som är baserat på FreeCAD (utökningsmoduler) så måste du köpa en Coin licens!
</p>
<h4><span class="mw-headline" id="SoQt">SoQt</span></h4>
<p><b>Version:</b> 1.2.0 eller högre
</p><p><b>Licens:</b> GPL v2.0 eller Kommersiell
</p><p>SoQt är Inventor bindningen till Qt gränssnittsverktygsset. Olyckligtvis så är det inte längre LGPL så vi måste ta bort det från FreeCADs kodbas och länka den som ett bibliotek. Den har samma licensmodell som Coin. Och du måste kompilera den med din Qt version.
</p>
<h4><span class="mw-headline" id="Xerces-C.2B.2B">Xerces-C++</span></h4>
<p><b>Version:</b> 2.7.0 eller högre
</p><p><b>Licens:</b> Apache Software License Version 2.0
</p><p>Xerces-C++ är en validerande XML läsare som är skriven i C++ portabla delset. Xerces-C++ gör det lätt att ge din applikation möjligheten att läsa och skriva XML data. Ett delat bibliotek erbjuds för läsning, generering, manipulering, och validering av XML dokument.
</p><p>Xerces-C++ är trogen till XML 1.0 rekommendationen och många associerade standarder (se Egenskaper nedan).
</p><p>Läsaren erbjuder hög prestanda, modularitet, och skalbarhet. Källkod, exempel och API dokumentation är medskickade med läsaren. För portabilitet så har det tagits hänsyn till att använda så lite mallar som möjligt, ingen RTTI, och minimalt bruk av #ifdefs.
</p><p>Läsaren används för att spara och återkalla parametrar i FreeCAD.
</p>
<h4><span class="mw-headline" id="Zlib">Zlib</span></h4>
<p><b>Version:</b> 1.x.x
</p><p><b>Licens:</b> zlib Licens
</p><p>zlib är designat att vara ett fritt, allmänt, juridiskt obegränsat -- vilket innebär, ej begränsat av några patent -- förlustfritt datakompressionsbibliotek som kan användas på i stort sett all datorhårdvara och operativsystem. zlib dataformat är i sig själv portabelt över olika plattformar. Till skillnad från kompressionsmetoden LZW som används i Unix compress(1) och i bildformatet GIF, så expanderar aldrig den kompressionsmetod som för närvarande används i zlib datan. (LZW kan dubblera eller tredubbla filstorleken i extrema fall.) zlib's storlek i minnet är också oberoende av inmatningsdatan och kan om nödvändigt reduceras, till en kostnad av kompressionsgrad.
</p>
<h4><span class="mw-headline" id="Boost">Boost</span></h4>
<p><b>Version:</b> 1.33.x
</p><p><b>Licens:</b> Boost Software License - Version 1.0
</p><p>Boost C++ biblioteken är en samling av granskade, öppen källkodsbibliotek som utökar C++ funktionalitet. Biblioteken är licensierade under Boost Software License, som är anpassad för att Boost ska tillåtas att användas med både sluten och öppen källkodsprojekt. Många av Boosts grundare är med i C++ standardkommiten och flera Boost bibliotek har accepterats for integrering i Teknisk Rapport 1 av C++0x.
</p><p>Biblioteken är riktade till ett stort område av C++ användare och applikationsområden. De sträcker sig från allmäna bibliotek som SmartPtr, till OS Abstraktioner som FileSystem, till bibliotek som huvdsakligen riktar sig till andra biblioteksutvecklare och avancerade C++ användare, som MPL.
</p><p>För att försäkra effektivitet och flexibilitet, så använder Boost en hel del mallar. Boost har varit en källa för extensivt arbete och forskning i allmän programmering och meta-programmering i C++.
</p><p>Se: <a rel="nofollow" class="external free" href="http://www.boost.org/">http://www.boost.org/</a> för detaljer.
</p>
<h4><span class="mw-headline" id="libarea">libarea</span></h4>
<p><b>Version:</b> N/A
</p><p><b>License:</b> New BSD (BSD 3-Clause)
</p><p>Area is a piece of software created by Dan Heeks for HeeksCNC. It is employed as a library for generation of CAM related operations in the Path Workbench.
</p>
<h3><span class="mw-headline" id="LibPack">LibPack</span></h3>
<p>LibPack är ett smidigt paket med alla ovanstående bibliotek ihoppackade. Det är för närvarande tillgängligt för
</p><p>Windows plattformen på <a href="https://www.freecadweb.org/wiki/index.php?title=Download/sv" title="Download/sv">Nedladdningssidan</a>! Om du arbetar under Linux så behöver du inte LibPack, istället ska du använda paketförråden för din Linux distribution.
</p>
<h4><span class="mw-headline" id="FreeCADLibs7.x_.C3.84ndringslogg">FreeCADLibs7.x Ändringslogg</span></h4>
<ul><li> Använder QT 4.5.x och Coin 3.1.x</li>
<li> Eigen exempelbibliotek fär robot tillagt</li>
<li> SMESH experimentell </li></ul>
<p><br />
</p>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="Verktygssida">Verktygssida</span></h2>
<p>För allt seriös mjukvaruutveckling så behöver du verktyg. Här är en lista på verktyg som vi använder för att utveckla FreeCAD:
</p>
<h3><span class="mw-headline" id="Plattformsoberoende_verktyg">Plattformsoberoende verktyg</span></h3>
<h4><span class="mw-headline" id="Qt-Toolkit">Qt-Toolkit</span></h4>
<p>Qt-toolkit är en fantastisk, plattformsoberoende designverktyg för att skapa gränssnitt. den finns i FreeCAD's <a href="https://www.freecadweb.org/wiki/index.php?title=Third_Party_Libraries/sv" title="Third Party Libraries/sv">LibPack</a>, men kan också laddas ned på <a rel="nofollow" class="external text" href="http://qt-project.org/downloads">Qt project</a>.
</p>
<h4><span class="mw-headline" id="InkScape">InkScape</span></h4>
<p>Bra vektorritningsprogram. Följer SVG standarden och används till att rita ikoner och bilder. Hämta det på <a rel="nofollow" class="external text" href="http://www.inkscape.org">www.inkscape.org</a>.
</p>
<h4><span class="mw-headline" id="Doxygen_2">Doxygen</span></h4>
<p>Ett mycket bra och stabilt verktyg för att generera källdokumentation från .h och .cpp filerna.
</p>
<h4><span class="mw-headline" id="The_Gimp">The Gimp</span></h4>
<p>Inte mycket att säga om Gnu Image Manipulation Program. Förutom att det kan hantera .xpm filer vilket är en mycket smidigt sätt att hantera Ikoner i QT Program. XPM är egentligen C-kod som kan kompileras in i ett program.
</p><p>Hämta GIMP här: <a rel="nofollow" class="external text" href="http://www.gimp.org/">www.gimp.org</a>
</p>
<h3><span class="mw-headline" id="Verktyg_p.C3.A5_Windows">Verktyg på Windows</span></h3>
<h4><span class="mw-headline" id="Visual_Studio_8_Express">Visual Studio 8 Express</span></h4>
<p>Fastän VC8 är för C++ utveckling, så är det inte något stort steg från VisualStudio 6 (enligt min åsikt ett stort steg bakåt), det är ett fritt utvecklingssystem på Windows. För nativa Win32 applikationer såbehöver du ladda ned PlatformSDK från M$.
</p><p>Så Express varianten är svår att hitta. Men du kan försöka med <a rel="nofollow" class="external text" href="http://msdn.microsoft.com/vstudio/express/visualc/default.aspx">denna länk</a>
</p>
<h4><span class="mw-headline" id="CamStudio">CamStudio</span></h4>
<p>Är ett öppen källkodsverktyg för att spela in skärmfilmer (Webfilmer). Det är ett mycket bra verktyg för att skapa övningar genom att spela in dem. Det är inte alls så tråkigt som att skriva dokumentation.
</p><p>Se <a rel="nofollow" class="external text" href="http://camstudio.org/">camstudio.org</a> för detaljer.
</p><p><br />
</p>
<h4><span class="mw-headline" id="Tortoise_SVN">Tortoise SVN</span></h4>
<p>Detta är ett mycket bra verktyg. Det gör användandet av Subversion (vårt versionskontrollsystem på sf.net) till ett rent nöje. Du kan genom utforskarintegrationen, lätt hantera Revisioner, kontrollera Diffs, lösa konflikter, göra grenar, och så vidare.... själva skickadialogen är ett konstverk. Den ger dig en överblick över dina ändrade filer och tillåter dig att lägga dem i skicka eller inte. Det gör det lätt att bunta ihop förändringarna till logiska enheter och ge dem ett tydligt skickameddelande.
</p><p>Du hittar TortoiseSVN på <a rel="nofollow" class="external text" href="http://tortoisesvn.tigris.org/">tortoisesvn.tigris.org</a>.
</p>
<h4><span class="mw-headline" id="StarUML">StarUML</span></h4>
<p>Ett helt öppen källkod UML program. Det har många funktioner från de stora, inkluvive reverse engineering C++ källkod....
</p><p>Ladda ned här: <a rel="nofollow" class="external text" href="http://staruml.sourceforge.net/en/">staruml.sourceforge.net</a>
</p><p><br />
</p>
<h3><span class="mw-headline" id="Verktyg_p.C3.A5_Linux">Verktyg på Linux</span></h3>
<p>ATTGÖRA
</p>
<div style="clear:both"></div>
<p><br />
</p><p>Denna sida visar olika sätt att starta FreeCAD och de viktigaste konfigurationsegenskaperna.
</p>
<h2><span class="mw-headline" id="Starta_FreeCAD_fr.C3.A5n_Kommandoraden">Starta FreeCAD från Kommandoraden</span></h2>
<p>FreeCAD kan startas normalt, genom att dubbelklicka på dess skrivbordsikon eller genom att välja den från startmenyn, men det kan också startas direkt från kommandoraden. Detta tillåter dig att ändra några av standard uppstartsalternativen.
</p>
<h3><span class="mw-headline" id="Kommandoradsalternativ">Kommandoradsalternativ</span></h3>
<p>Kommandoradsalternativen förändras ofta, så därför är det en bra ide att kontrollera alternativen genom att skriva:
</p>
<pre>FreeCAD --help
</pre>
<p>Från svaret kan du läsa de möjliga parametrarna:
</p>
<pre>Usage:
FreeCAD [options] File1 File2 .....
Allowed options:
Generic options:
-v [ --version ] print version string
-h [ --help ] print help message
-c [ --console ] start in console mode
--response-file arg can be specified with '@name', too
</pre>
<pre>Configuration:
-l [ --write-log ] arg write a log file to default location(Run FreeCAD --h to see default location)
--log-file arg Unlike to --write-log this allows to log to an arbitrary file
-u [ --user-cfg] arg User config file to load/save user settings
-s [ --system-cfg] arg System config file to load/save system settings
-t [ --run-test ] arg test level
-M [ --module-path ] arg additional module paths
-P [ --python-path ] arg additional python paths
</pre>
<p>EX: (Windows)
</p>
<pre>"C:\Program Files\FreeCAD 0.14\bin\FreeCAD.exe" -M "N:\FreeCAD\Mod\Draft" -M "N:\FreeCAD\Mod\Part" -M "N:\FreeCAD\Mod\Drawing" -u "N:\FreeCAD\Config\user.cfg" -s "N:\FreeCAD\Config\system.cfg" </pre>
<p><br />
</p>
<h3><span class="mw-headline" id="Respons_och_konfigurationsfiler">Respons och konfigurationsfiler</span></h3>
<p>FreeCAD kan läsa en del av dessa alternativ från en konfigurationsfil. Denna fil måste ligga i bin sökvägen och måste ha namnet FreeCAD.cfg. Tänk på att alternativ som specificeras på kommandoraden har högre prioritet än konfigurationsfilen!
</p><p>En del operativsystem har en låg gräns på kommandoradens längd. Det vanliga sättet att komma runt dessa begränsningar är att använda responsfiler. En responsfil är bara en konfigurationsfil som använder samma syntax som kommandoraden. Om kommandoraden specificerar namnet på den responsfil som ska användas, så laddas den och läses i tillägg till kommandoraden:
</p>
<pre>FreeCAD @ResponseFile.txt </pre>
<p>eller:
</p>
<pre>FreeCAD --response-file=ResponseFile.txt </pre>
<h3><span class="mw-headline" id="G.C3.B6mda_alternativ">Gömda alternativ</span></h3>
<p>Det finns en del alternativ som inte visas för användaren. Dessa alternativ är egentligen X-fönsterparametrar som läses av fönstersystemet:
</p>
<ul><li> -display display, väljer X skärmen (standard är $DISPLAY).</li>
<li> -geometry geometry, väljer klientgeometrin för det första fönstret som visas.</li>
<li> -fn or -font font, definierar applikationens typsnitt. Typsnittet ska specificeras med en X logisk typsnittsbeskrivning.</li>
<li> -bg or -background color, väljer standard bakgrundsfärg och en applikationspalett (ljusa och mörka skuggor beräknas).</li>
<li> -fg or -foreground color, väljer standard förgrundsfärg.</li>
<li> -btn or -button color, väljer standard knappfärg.</li>
<li> -name name, väljer applikationsnamnet.</li>
<li> -title title, väljer applikationstiteln.</li>
<li> -visual TrueColor, tvingar applikationen att använda TrueColor på en 8-bits skärm.</li>
<li> -ncols count, Begränsar antalet färger som allokeras i färgkuben på en 8-bitars skärm, om applikationen använder QApplication::ManyColor färgspecifikationen. Om antalet är 216 så används en 6x6x6 färgkub (d.v.s. 6 nivåer på rött, 6 på grönt, och 6 på blått); för andra värden, så används en kub som är ungefärligt proportionell till en 2x3x1 kub.</li>
<li> -cmap, får applikationen att installera en privat färgkarta på en 8-bitars skärm.</li></ul>
<div class="mw-translate-fuzzy">
<h2><span class="mw-headline" id="K.C3.B6ra_FreeCAD_utan_anv.C3.A4ndargr.C3.A4nssnitt">Köra FreeCAD utan användargränssnitt</span></h2>
</div>
<div class="mw-translate-fuzzy">
<p>FreeCAD startar normalt i gränssnittsläge, men du kan också tvinga det att starta i konsolläge genom att skriva:
</p>
</div>
<pre>FreeCAD -c
</pre>
<p>på kommandoraden. I konsolläge, så kommer inget användargränssnitt att visas, och du kommer att presenteras med en pythontolks prompt. Från den pythonprompten så har du samma funktionalitet som den pythontolk som körs inuti FreeCAD gränssnittet, med normal åtkomst till alla FreeCADs moduler och plugin, förutom FreeCADGui modulen. Tänk på att moduler som beror på FreeCADGui kanske inte heller finns tillgängliga.
</p><p>Python scripts/FreeCAD macro files can be specified as command line arguments to either of the executables mentioned above.
</p>
<h2><span class="mw-headline" id="Konfigurationssetet">Konfigurationssetet</span></h2>
<p>Vid varje uppstart så undersöker FreeCAD sin omgivning och kommandoradsparametrarna. Det bygger upp ett <b>configuration set</b> vilket innehåller den huvudsakliga körinformationen. Denna information används senare för att avgöra vilken plats som användardata eller loggfiler ska sparas. Det är också mycket viktigt för postmortem analyser. Därför så sparas det i loggfilen.
</p>
<h3><span class="mw-headline" id="Anv.C3.A4ndarrelaterad_information">Användarrelaterad information</span></h3>
<table border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;">
<caption> Användarkonfiguration
</caption>
<tr>
<th> Konfig. var. namn </th>
<th> Förklaring </th>
<th> Exempel M$ </th>
<th> Exempel Posix (Linux)
</th></tr>
<tr>
<td> UserAppData </td>
<td> Sökväg där FreeCAD lagrar användarrelaterad applikationsdata. </td>
<td> C:\Documents and Settings\username\Application Data\FreeCAD </td>
<td>/home/username/.FreeCAD
</td></tr>
<tr>
<td> UserParameter </td>
<td> Fil där FreeCAD lagrar användarrelaterad applikationsdata. </td>
<td> C:\Documents and Settings\username\Application Data\FreeCAD\user.cfg </td>
<td>/home/username/.FreeCAD/user.cfg
</td></tr>
<tr>
<td> SystemParameter </td>
<td> Fil där FreeCAD lagrar applikationsrelaterad data. </td>
<td> C:\Documents and Settings\username\Application Data\FreeCAD\system.cfg </td>
<td>/home/username/.FreeCAD/system.cfg
</td></tr>
<tr>
<td> UserHomePath </td>
<td> Nuvarande användares sökväg till hem mappen </td>
<td> C:\Documents and Settings\username\My Documents </td>
<td>/home/username
</td></tr></table>
<h3><span class="mw-headline" id="Kommandoradsargument">Kommandoradsargument</span></h3>
<table border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;">
<caption> Användarkonfiguration
</caption>
<tr>
<th> Konfig. var. namn </th>
<th> Förklaring </th>
<th> Exempel
</th></tr>
<tr>
<td> LoggingFile </td>
<td> 1 om loggningen är påslagen </td>
<td> 1
</td></tr>
<tr>
<td> LoggingFileName </td>
<td> Filnamn där loggen sparas </td>
<td> C:\Documents and Settings\username\Application Data\FreeCAD\FreeCAD.log
</td></tr>
<tr>
<td> RunMode </td>
<td> Detta indikerar hur huvudslingan kommer att fungera. <b>"Script"</b> innebär att det givna skriptet anropas och avslutas efter det. <b>"Cmd"</b> kör kommandotolken. <b>"Internal"</b> kör ett internt skript. <b>"Gui"</b> startar händelseslingan för gränssnittet. <b>"Module"</b> laddar en given python modul. </td>
<td> "Cmd"
</td></tr>
<tr>
<td> FileName </td>
<td> Innebörd beror på RunMode </td>
<td>
</td></tr>
<tr>
<td> ScriptFileName </td>
<td> Innebörd beror på RunMode </td>
<td>
</td></tr>
<tr>
<td> Verbose </td>
<td> FreeCADs pratighet, d.v.s. hur mycket som loggas </td>
<td> "" eller "strict"
</td></tr>
<tr>
<td> OpenFileCount </td>
<td>Innehåller antalet filer som öppnas genom kommandoradsargument </td>
<td> "12"
</td></tr>
<tr>
<td> AdditionalModulePaths</td>
<td>Innehåller sökvägen för de extramoduler som ges i kommandoraden </td>
<td> "extraModules/"
</td></tr></table>
<h3><span class="mw-headline" id="Systemrelaterat">Systemrelaterat</span></h3>
<table border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;">
<caption> Användarkonfiguration
</caption>
<tr>
<th> Konfig. var. namn </th>
<th> Förklaring </th>
<th> Exempel M$ </th>
<th> Exempel Posix (Linux)
</th></tr>
<tr>
<td> AppHomePath </td>
<td> Sökväg där FreeCAD är installerat </td>
<td> c:/Progam Files/FreeCAD_0.7</td>
<td> /user/local/FreeCAD_0.7
</td></tr>
<tr>
<td> PythonSearchPath </td>
<td> Innehåller en lista på sökvägar där python söker efter moduler. Detta är vid uppstart och kan ändras under körning </td>
<td> </td>
<td>
</td></tr></table>
<p>En del bibliotek behöver anropa systemmiljövariabler. ibland när det är ett problem med en FreeCAD installation, så beror det på att en del miljövariabler saknas eller är felinställda. Därför dupliceras några viktiga variabler i Konfigurationen och sparas i loggfilen.
</p><p><b>Python relaterade miljövariabler:</b>
</p>
<ul><li> PYTHONPATH</li>
<li> PYTHONHOME</li>
<li> TCL_LIBRARY</li>
<li> TCLLIBPATH</li></ul>
<p><b>OpenCascade relaterade miljövariabler:</b>
</p>
<ul><li> CSF_MDTVFontDirectory</li>
<li> CSF_MDTVTexturesDirectory</li>
<li> CSF_UnitsDefinition</li>
<li> CSF_UnitsLexicon</li>
<li> CSF_StandardDefaults</li>
<li> CSF_PluginDefaults</li>
<li> CSF_LANGUAGE</li>
<li> CSF_SHMessage</li>
<li> CSF_XCAFDefaults</li>
<li> CSF_GraphicShr</li>
<li> CSF_IGESDefaults</li>
<li> CSF_STEPDefaults</li></ul>
<p><b>System relaterade miljövariabler:</b>
</p>
<ul><li> PATH</li></ul>
<h3><span class="mw-headline" id="Bygga_relaterad_information">Bygga relaterad information</span></h3>
<div class="mw-translate-fuzzy">
<p>Tabellen nedan visar tillgänglig information om Byggversionen. Det flesta av dem kommer från Subversion förrådet. dessa saker behövs för att exakt återuppbygga en version!
</p>
</div>
<div class="mw-translate-fuzzy">
<table border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;">
<caption> Användarkonfiguration
</caption>
<tr>
<th> Konfig. var. namn </th>
<th> Förklaring </th>
<th> Exempel
</th></tr>
<tr>
<td> BuildVersionMajor </td>
<td> Byggningens Major Versionsnummer. Definierad i src/Build/Version.h.in </td>
<td> 0
</td></tr>
<tr>
<td> BuildVersionMinor </td>
<td> Byggningens Minor Versionsnummer. Definierad i src/Build/Version.h.in </td>
<td> 7
</td></tr>
<tr>
<td> BuildRevision </td>
<td> Källkodens SVN Repository Revisionnummer i byggningen. Genererad av SVN </td>
<td> 356
</td></tr>
<tr>
<td> BuildRevisionRange </td>
<td> Område för olika ändringar </td>
<td> 123-356
</td></tr>
<tr>
<td> BuildRepositoryURL </td>
<td> URL adress för förråd </td>
<td> <a rel="nofollow" class="external free" href="https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk/src">https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk/src</a>
</td></tr>
<tr>
<td> BuildRevisionDate </td>
<td> Datum av ovanstående Revision </td>
<td> 2007/02/03 22:21:18
</td></tr>
<tr>
<td> BuildScrClean </td>
<td> Indikerar om källkoden har ändrats efter kontroll </td>
<td> Källkod ändrad
</td></tr>
<tr>
<td> BuildScrMixed </td>
<td> </td>
<td> Källkod inte blandad
</td></tr></table>
</div>
<h3><span class="mw-headline" id="M.C3.A4rkningsrelaterat">Märkningsrelaterat</span></h3>
<p>Dessa konfigurationspunkter är relaterade till FreeCADs märkningsmekanism. Se <a href="https://www.freecadweb.org/wiki/index.php?title=Branding/sv" title="Branding/sv">Branding/sv</a> för mer detaljer.
</p>
<div class="mw-translate-fuzzy">
<table border="2" cellpadding="4" cellspacing="0" style="margin-top:1em; margin-bottom:1em; background:#f9f9f9; border:1px #aaa solid; border-collapse:collapse;">
<caption> Användarkonfiguration
</caption>
<tr>
<th> Konfig. var. namn </th>
<th> Förklaring </th>
<th> Exempel
</th></tr>
<tr>
<td> ExeName </td>
<td> Namn på den byggda körfilen. Kan skilja sig från FreeCAD om en annan main.cpp används. </td>
<td> FreeCAD.exe
</td></tr>
<tr>
<td> ExeVersion </td>
<td> Allmän version som visas vid uppstart </td>
<td> V0.7
</td></tr>
<tr>
<td> AppIcon </td>
<td> Ikon som används för körfilen, visas i Applikationens huvudfönster. </td>
<td> "FCIcon"
</td></tr>
<tr>
<td> ConsoleBanner </td>
<td> Den banner som visas i konsolläge </td>
<td>
</td></tr>
<tr>
<td> SplashPicture </td>
<td> Namn på den ikon som används till uppstartsskärmen </td>
<td> "FreeCADSplasher"
</td></tr>
<tr>
<td> SplashAlignment </td>
<td> Textjustering i uppstartsdialogen </td>
<td>Left"
</td></tr>
<tr>
<td> SplashTextColor </td>
<td> Textfärg i uppstartsfönstret </td>
<td> "#000000"
</td></tr>
<tr>
<td> StartWorkbench </td>
<td> Namn på den arbetsbänk som ska startas automatiskt efter uppstart </td>
<td> "Part design"
</td></tr>
<tr>
<td> HiddenDockWindow </td>
<td> Lista på dockningsfönster (separerade av semikolon) som kommer att inaktiveras </td>
<td> "Property editor"
</td></tr></table>
</div>
<div style="clear:both"></div>
<p><br />
</p><p><b>FreeCAD byggverktyg</b> eller <b>fcbt</b> är ett pythonskript placerat i
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> trunc/src/Tools/fcbt.py</pre></div>
<p>Det kan användas till att förenkla en del frekventa uppgifter vid byggande, distribution och utökning av FreeCAD.
</p>
<h2><span class="mw-headline" id="Bruk">Bruk</span></h2>
<p>Med [<a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Python_(programspråk)">Python</a>] korrekt installerat, så kan <i>fcbt</i> startas med kommandot
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> python fbct.py</pre></div>
<p>det visar en meny, där du kan välja den uppgift som du vill använda den till:
</p>
<pre>FreeCAD Build Tool
Usage:
fcbt &lt;command name&gt; [command parameter]
possible commands are:
- DistSrc (DS) Build a source Distr. of the current source tree
- DistBin (DB) Build a binary Distr. of the current source tree
- DistSetup (DI) Build a Setup Distr. of the current source tree
- DistSetup (DUI) Build a User Setup Distr. of the current source tree
- DistAll (DA) Run all three above modules
- NextBuildNumber (NBN) Increase the Build Number of this Version
- CreateModule (CM) Insert a new FreeCAD Module in the module directory
For help on the modules type:
fcbt &lt;command name&gt;&#160;?
</pre>
<p>Mata vid inmatningsprompten in det förkortade kommandot som du vill använda. Skriv till exempel "CM" för <a href="https://www.freecadweb.org/wiki/index.php?title=Module_Creation/sv" title="Module Creation/sv">Skapa en modul</a>.
</p>
<h3><span class="mw-headline" id="DistSrc">DistSrc</span></h3>
<p>Kommandot "DS" <b>skapar en källdistribution</b> från det gällande källträdet.
</p>
<h3><span class="mw-headline" id="DistBin">DistBin</span></h3>
<p>Kommandot "DB" <b>skapar en binär distribution</b> från det gällande källträdet.
</p>
<h3><span class="mw-headline" id="DistSetup">DistSetup</span></h3>
<p>Kommandot "DI" <b>skapar en setup distribution</b> från det gällande källträdet.
</p>
<h3><span class="mw-headline" id="DistSetup_2">DistSetup</span></h3>
<p>Kommandot "DUI" <b>skapar en användar setup distribution från det gällande källträdet.</b>
</p>
<h3><span class="mw-headline" id="DistAll">DistAll</span></h3>
<p>Kommandot "DA" utför "DS", "DB" och "DI" i sekvens.
</p>
<h3><span class="mw-headline" id="NextBuildNumber">NextBuildNumber</span></h3>
<p>Kommandot "NBN" <b>ökar byggnumret</b> för att skapa en ny släppversion av FreeCAD.
</p>
<h3><span class="mw-headline" id="CreateModule">CreateModule</span></h3>
<p>Kommandot "CM" <a href="https://www.freecadweb.org/wiki/index.php?title=Module_Creation/sv" title="Module Creation/sv">skapar en ny applikationsmodul</a>.
</p>
<div style="clear:both"></div>
<p><br />
</p><p>Adding new modules and workbenches in FreeCAD is very easy. A module is any extension of FreeCAD, while a workbench is a special GUI configuration that groups some toolbars and menus. Usually you create a new module which contains its own workbench.
</p><p>Modules can be programmed in C++ or in python, or in a mixture of both, but the module init files must be in python. Setting up a new module with those init files is easy, and can be done either manually or with the FreeCAD build tool.
</p>
<h2><span class="mw-headline" id="Using_the_FreeCAD_Build_tool">Using the FreeCAD Build tool</span></h2>
<p><b>Att skapa en ny applikationsmodul</b> i FreeCAD är ganska lätt. I FreeCAD's utvecklingsträd så finns <i><a href="https://www.freecadweb.org/wiki/index.php?title=FreeCAD_Build_Tool/sv" title="FreeCAD Build Tool/sv">FreeCAD Byggverktyg</a></i> (fcbt) som gör de viktigaste sakerna för dig. Det är ett [<a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Python_(programspråk)">Python</a>] skript som är placerat i
</p>
<pre>
trunk/src/Tools/fcbt.py
</pre>
<p>När din python tolk är korrekt installerad så kan du köra skriptet från en kommandorad med
</p>
<pre>
python fcbt.py
</pre>
<p>Det kommer att visa följande meny:
</p>
<pre>
FreeCAD Build Tool
Usage:
fcbt &lt;command name&gt; [command parameter]
possible commands are:
- DistSrc (DS) Build a source Distr. of the current source tree
- DistBin (DB) Build a binary Distr. of the current source tree
- DistSetup (DI) Build a Setup Distr. of the current source tree
- DistSetup (DUI) Build a User Setup Distr. of the current source tree
- DistAll (DA) Run all three above modules
- NextBuildNumber (NBN) Increase the Build Number of this Version
- CreateModule (CM) Insert a new FreeCAD Module in the module directory
- CreatePyModule (CP) Insert a new FreeCAD Python Module in the module directory
For help on the modules type:
fcbt &lt;command name&gt;&#160;?
</pre>
<p>Skriv <i>CM</i> vid kommandoprompten för att starta skapandet av en modul:
</p>
<pre>
Insert command: ''CM''
</pre>
<p>Nu efterfrågas det om ett namn på din nya modul. Låt oss till exempel kalla den för <i>TestMod</i>&#160;:
</p>
<pre>
Please enter a name for your application: ''TestMod''
</pre>
<p>Efter att du har tryckt <i>enter</i> så startar fcbt att kopiera alla nödvändiga filer för din modul till en ny mapp vid
</p>
<pre>
trunk/src/Mod/TestMod/
</pre>
<p>Sedan ändras alla filer med ditt nya modulnamn. Den enda saken du behöver göra nu är att lägga till de två nya projekten "appTestMod" och "appTestModGui" till din arbetsyta (på Windows) eller till dina makefile mål (unix). Det är allt!
</p>
<h2><span class="mw-headline" id="Setting_up_a_new_module_manually">Setting up a new module manually</span></h2>
<p>You need two things to create a new module:
</p>
<ul><li> A new <b>folder</b> in the FreeCAD Mod folder (either in InstalledPath/FreeCAD/Mod or in UserPath/.FreeCAD/Mod). You can name it as you like.</li>
<li> Inside that folder, an <b>InitGui.py</b> file. That file will be executed automatically on FreeCAD start (it can be empty, but just to test it,, put a print("hello world") inside)</li></ul>
<p>Additionally, you can also add an <b>Init.py</b> file. InitGui.py file is loaded only when FreeCAD runs in GUI mode, whereas the Init.py file is always loaded. Since we're creating a workbench, however, we'll put our code in InitGui.py, since workbenches are GUI-only tools.
</p>
<h2><span class="mw-headline" id="Creating_a_new_workbench">Creating a new workbench</span></h2>
<p>Inside the InitGui.py file, the first thing you will want to do is define a workbench. You can use the following example as a template:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> class MyWorkbench ( Workbench ):
"My workbench object"
Icon = """
/* XPM */
static const char *test_icon[]={
"16 16 2 1",
"a c #000000",
". c None",
"................",
"................",
"..############..",
"..############..",
"..############..",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"................",
"................"};
"""
MenuText = "My Workbench"
ToolTip = "This is my extraordinary workbench"
def GetClassName(self):
return "Gui::PythonWorkbench"
def Initialize(self):
import myModule1, myModule2
self.appendToolbar("My Tools", ["MyCommand1","MyCommand2"])
self.appendMenu("My Tools", ["MyCommand1","MyCommand2"])
Log ("Loading MyModule... done\n")
def Activated(self):
# do something here if needed...
Msg ("MyWorkbench.Activated()\n")
def Deactivated(self):
# do something here if needed...
Msg ("MyWorkbench.Deactivated()\n")
FreeCADGui.addWorkbench(MyWorkbench)</pre></div>
<p>The workbench must have all these attributes defined:
</p>
<ul><li> <b>Icon</b> - An XPM image. Most image software (like GIMP) can convert an image into xpm format, which is a text file. You can then paste the contents here.</li>
<li> <b>MenuText</b> - The workbench name as it appears in the workbenches list</li>
<li> <b>Tooltip</b> - Defines the tooltip text</li>
<li> <b>Initialize()</b> - Executed when FreeCAD loads and creates all menus and toolbars that the workbench will use. If you are going to make your module in C++, you can also define your menus and toolbars inside the C++ module rather than the InitGui.py file. The important thing is that they are created now, before the module is activated.</li>
<li> <b>Activated()</b> - Executed when the user switches to your workbench</li>
<li> <b>Deactivated()</b> - Executed when the user switches away to another workbench or leaves FreeCAD</li></ul>
<h2><span class="mw-headline" id="Creating_FreeCAD_commands_in_Python">Creating FreeCAD commands in Python</span></h2>
<p>Usually you define all your tools (called Commands in FreeCAD) in another module, then import that module before creating the toolbars and menus. Here is a simple example that can be used as a template:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> import FreeCAD,FreeCADGui
class MyTool:
"My tool object"
def GetResources(self):
return {"MenuText": "My Command",
"Accel": "Ctrl+M",
"ToolTip": "My extraordinary command",
"Pixmap" : """
/* XPM */
static const char *test_icon[]={
"16 16 2 1",
"a c #000000",
". c None",
"................",
"................",
"..############..",
"..############..",
"..############..",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"......####......",
"................",
"................"};
"""}
def IsActive(self):
if FreeCAD.ActiveDocument == None:
return False
else:
return True
def Activated(self):
# do something here...
FreeCADGui.addCommand('MyCommand1',MyTool())</pre></div>
<p>Note there are three methods defined:
</p>
<ul><li> <b>GetResources()</b> - Returns a dictionary with the visual attributes of your tool. The <b>Accel</b> parameter defines an optional shortcut key.</li>
<li> <b>IsActive()</b> - Determines whether or not the command is active. Inactive commands are indicated by a greyed-out icon in the menus and toolbars.</li>
<li> <b>Activated()</b> - Executed when the Command is called, whether through a toolbar button, menu or script API call.</li></ul>
<h2><span class="mw-headline" id="Creating_FreeCAD_Commands_in_C.2B.2B">Creating FreeCAD Commands in C++</span></h2>
<p>To Be Documented
</p>
<h2><span class="mw-headline" id="Links_5">Links</span></h2>
<ul><li> Some examples how power users have extended FreeCAD with various custom external workbenches are collected in <a href="External_workbenches.html" title="External workbenches">External workbenches</a></li>
<li>Other example in Power user hub <a href="Workbench_creation.html" title="Workbench creation">Workbench creation</a></li>
<li>Creating Commands <a href="Command.html" title="Command">Command</a></li></ul>
<div style="clear:both"></div>
<p><br />
</p>
<h2><span class="mw-headline" id="Test_First">Test First</span></h2>
<p>Before you go through the pain of debugging use the <a href="Testing.html" title="Testing">Test framework</a> to check if the standard tests work properly. If they do not run complete there is possibly a broken installation.
</p>
<h2><span class="mw-headline" id="Command_Line">Command Line</span></h2>
<p>The <i>debugging</i> of FreeCAD is supported by a few internal mechanisms. The command line version of FreeCAD provides some options for debugging support.
</p><p>These are the currently recognized options in FreeCAD 0.15:
</p><p>Generic options:
</p>
<pre> -v [ --version ] Prints version string
-h [ --help ] Prints help message
-c [ --console ] Starts in console mode
--response-file arg Can be specified with '@name', too
</pre>
<p>Configuration:
</p>
<pre> -l [ --write-log ] Writes a log file to:
$HOME/.FreeCAD/FreeCAD.log
--log-file arg Unlike to --write-log this allows to log to an
arbitrary file
-u [ --user-cfg ] arg User config file to load/save user settings
-s [ --system-cfg ] arg Systen config file to load/save system settings
-t [ --run-test ] arg Test level
-M [ --module-path ] arg Additional module paths
-P [ --python-path ] arg Additional python paths
</pre>
<h2><span class="mw-headline" id="Generating_a_Backtrace">Generating a Backtrace</span></h2>
<p>If you are running a version of FreeCAD from the bleeding edge of the development curve, it may "crash". You can help solve such problems by providing the developers with a "backtrace". To do this, you need to be running a "debug build" of the software. "Debug build" is a parameter that is set at compile time, so you'll either need to compile FreeCAD yourself, or obtain a pre-compiled "debug" version.
</p>
<h3><span class="mw-headline" id="For_Linux">For Linux</span></h3>
<p>Prerequisites:
</p>
<ul><li> software package gdb installed</li>
<li> a debug build of FreeCAD (at this time only available by <a href="/wiki/CompileOnUnix#For_a_Debug_build" title="CompileOnUnix">building from source</a>)</li>
<li> a FreeCAD model that causes a crash</li></ul>
<p>Steps:
Enter the following in your terminal window:
</p>
<pre>
$ cd FreeCAD/bin
$ gdb FreeCAD
</pre>
<p>GNUdebugger will output some initializing information. The (gdb) shows GNUDebugger is running in the terminal, now input:
</p>
<pre>
(gdb) handle SIG33 noprint nostop
(gdb) run
</pre>
<p>FreeCAD will now start up. Perform the steps that cause FreeCAD to crash or freeze, then enter in the terminal window:
</p>
<pre>
(gdb) bt
</pre>
<p>This will generate a lengthy listing of exactly what the program was doing when it crashed or froze. Include this with your problem report.
</p>
<h3><span class="mw-headline" id="For_MacOSX">For MacOSX</span></h3>
<p>Prerequisites:
</p>
<ul><li> software package lldb installed</li>
<li> a debug build of FreeCAD</li>
<li> a FreeCAD model that causes a crash</li></ul>
<p>Steps:
Enter the following in your terminal window:
</p>
<pre>
$ cd FreeCAD/bin
$ lldb FreeCAD
</pre>
<p>LLDB will output some initializing information. The (lldb) shows the debugger is running in the terminal, now input:
</p>
<pre>
(lldb) run
</pre>
<p>FreeCAD will now start up. Perform the steps that cause FreeCAD to crash or freeze, then enter in the terminal window:
</p>
<pre>
(lldb) bt
</pre>
<p>This will generate a lengthy listing of exactly what the program was doing when it crashed or froze. Include this with your problem report.
</p>
<h2><span class="mw-headline" id="Python_Debugging">Python Debugging</span></h2>
<p>Here is an example of using winpdb inside FreeCAD:
</p>
<ol><li> Run winpdb and set the password (e.g. test)</li>
<li> Create a Python file with this content</li></ol>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> import rpdb2
rpdb2.start_embedded_debugger("test")
import FreeCAD
import Part
import Draft
print "hello"
print "hello"
import Draft
points=[FreeCAD.Vector(-3.0,-1.0,0.0),FreeCAD.Vector(-2.0,0.0,0.0)]
Draft.makeWire(points,closed=False,face=False,support=None)</pre></div>
<ol><li> Start FreeCAD and load the above file into FreeCAD</li>
<li> Press F6 to execute it</li>
<li> Now FreeCAD will become unresponsive because the Python debugger is waiting</li>
<li> Switch to the Windpdb GUI and click on "Attach". After a few seconds an item "&lt;Input&gt;" appears where you have to double-click</li>
<li> Now the currently executed script appears in Winpdb.</li>
<li> Set a break at the last line and press F5</li>
<li> Now press F7 to step into the Python code of Draft.makeWire</li></ol>
<div style="clear:both"></div>
<p><br />
</p><p>FreeCAD kommer med ett extensivt testramverk. Testerna baseras på ett set med Pythonskript som finns i testmodulen.
</p>
<h2><span class="mw-headline" id="Introduction">Introduction</span></h2>
<p>This is the list of test apps as of 0.15 Git 4207:
</p>
<h3><span class="mw-headline" id="TestAPP.All">TestAPP.All</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="BaseTests">BaseTests</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="UnitTests">UnitTests</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="Document">Document</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="UnicodeTests">UnicodeTests</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="MeshTestsApp">MeshTestsApp</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="TestSketcherApp">TestSketcherApp</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="TestPartApp">TestPartApp</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="TestPartDesignApp">TestPartDesignApp</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="Workbench">Workbench</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="Menu">Menu</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="Menu.MenuDeleteCases">Menu.MenuDeleteCases</span></h3>
<p>Add test function
</p>
<h3><span class="mw-headline" id="Menu.MenuCreateCases">Menu.MenuCreateCases</span></h3>
<p>Add test function
</p>
<div style="clear:both"></div>
<p><br />
</p><p>Denna artikel diskuterar <b>Branding</b> av FreeCAD. Branding innebär att du gör din egen applikation med FreeCAD som bas. Det kan sträcka sig från att bara ha en egen startfil eller uppstartsbild till ett helt och hållet omarbetat program. På basis FreeCAD's flexibla arkitektur så är det lätt att använda den som bas för dina egna program för speciella ändmål.
</p>
<h3><span class="mw-headline" id="Allm.C3.A4nt">Allmänt</span></h3>
<p>Den mesta brandingen görs i <b>MainCmd.cpp<i> or </i>MainGui.cpp</b>. Dessa Projekt genererar FreeCAD's körbara filer. För att göra din egen variant så behöver du bara kopiera Main eller MainGui projekten och ge den körbara filen ett eget namn, d.v.s. FooApp.exe.
</p><p>De viktigaste inställningarna för ett nytt utseende kan göras på en plats i main() funktionen. Här är den kodsektion som kontrollerar branding:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> int main( int argc, char ** argv )
{
// Name and Version of the Application
App::Application::Config()["ExeName"] = "FooApp";
App::Application::Config()["ExeVersion"] = "0.7";
// set the banner (for loging and console)
App::Application::Config()["CopyrightInfo"] = sBanner;
App::Application::Config()["AppIcon"] = "FooAppIcon";
App::Application::Config()["SplashScreen"] = "FooAppSplasher";
App::Application::Config()["StartWorkbench"] = "Part design";
App::Application::Config()["HiddenDockWindow"] = "Property editor";
App::Application::Config()["SplashAlignment" ] = "Bottom|Left";
App::Application::Config()["SplashTextColor" ] = "#000000"; // black
// Inits the Application
App::Application::Config()["RunMode"] = "Gui";
App::Application::init(argc,argv);
Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);
Gui::Application::initApplication();
Gui::Application::runApplication();
App::Application::destruct();
return 0;
}</pre></div>
<p>Den första Config punkten definierar programmets namn. Detta är inte det körbara namnet, vilket kan ändras genom att döpa om eller genom inställningar i kompilatorn, utan det namn som visas i windows programrad eller i programlistan på Unixsystem.
</p><p>Efterföljande rader definierar Config punkterna för din FooApp Applikation. En beskrivning av Config och dess punkter hittar du i <a href="https://www.freecadweb.org/wiki/index.php?title=Start_up_and_Configuration/sv" title="Start up and Configuration/sv">Uppstart och Konfiguration</a>.
</p>
<h3><span class="mw-headline" id="Images">Images</span></h3>
<p>Image resources are compiled into FreeCAD using <a rel="nofollow" class="external text" href="http://qt-project.org/doc/qt-4.8/resources.html">Qt's resource system</a>. Therefore you have to write a .qrc file, an XML-based file format that lists image files on the disk but also any other kind of resource files. To load the compiled resources inside the application you have to add a line
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> Q_INIT_RESOURCE(FooApp);</pre></div>
<p>into the main() function. Alternatively, if you have an image in XPM format you can directly include it into your main.cpp and add the following line to register it:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> Gui::BitmapFactory().addXPM("FooAppSplasher", ( const char** ) splash_screen);</pre></div>
<h3><span class="mw-headline" id="Branding_XML">Branding XML</span></h3>
<p>In FreeCAD there is also a method supported without writing a customized main() function. For this method you must write a file name called branding.xml and put it into the installation directory of FreeCAD. Here is an example with all supported tags:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> &lt;?xml version="1.0" encoding="utf-8"?>
&lt;Branding>
&lt;Application>FooApp&lt;/Application>
&lt;WindowTitle>Foo App in title bar&lt;/WindowTitle>
&lt;BuildVersionMajor>1&lt;/BuildVersionMajor>
&lt;BuildVersionMinor>0&lt;/BuildVersionMinor>
&lt;BuildRevision>1234&lt;/BuildRevision>
&lt;BuildRevisionDate>2014/1/1&lt;/BuildRevisionDate>
&lt;CopyrightInfo>(c) My copyright&lt;/CopyrightInfo>
&lt;MaintainerUrl>Foo App URL&lt;/MaintainerUrl>
&lt;ProgramLogo>Path to logo (appears in bottom right corner)&lt;/ProgramLogo>
&lt;WindowIcon>Path to icon file&lt;/WindowIcon>
&lt;ProgramIcons>Path to program icons&lt;/ProgramIcons>
&lt;SplashScreen>splashscreen.png&lt;/SplashScreen>
&lt;SplashAlignment>Bottom|Left&lt;/SplashAlignment>
&lt;SplashTextColor>#ffffff&lt;/SplashTextColor>
&lt;SplashInfoColor>#c8c8c8&lt;/SplashInfoColor>
&lt;StartWorkbench>PartDesignWorkbench&lt;/StartWorkbench>
&lt;/Branding></pre></div>
<p>All of the listed tags are optional.
</p>
<div style="clear:both"></div>
<p><br />
</p><p><b>Lokalisering</b> är i allmänhet den process som ger användargränssnittet i ett program flera språk. I FreeCAD så kan du ställa in användargränssnittets språk under <i>Redigera?Alternativ?Allmänt</i>. FreeCAD använder [<a rel="nofollow" class="external text" href="http://sv.wikipedia.org/wiki/Qt">Qt</a>] för att aktivera flerspråkssupport. På Unix/Linux system så använder FreeCAD som standard de gällande locale-inställningarna för systemet.
</p>
<h2><span class="mw-headline" id="Hj.C3.A4lpa_till_med_att_.C3.B6vers.C3.A4tta_FreeCAD">Hjälpa till med att översätta FreeCAD</span></h2>
<p>En av de mycket viktiga saker du kan göra för FreeCAD, om du inte är en programmerare, är att hjälpa till att översätta programmet till ditt språk. Det är nu lättare än någonsin att göra det då vi nu använder oss av <a rel="nofollow" class="external text" href="http://crowdin.net">Crowdin</a> online översättningssystemet där man kan samarbeta med flera personer
</p>
<h3><span class="mw-headline" id="Hur_man_.C3.B6vers.C3.A4tter">Hur man översätter</span></h3>
<ul><li> Gå till <a rel="nofollow" class="external text" href="http://crowdin.net/project/freecad">FreeCADs projektsida för översättning på Crowdin</a>;</li>
<li> Logga in genom att skapa en ny profil, eller genom att använda ett tredjepartskonto som t.ex din Gmail adress;</li>
<li> Klicka på det språk som du vill översätta;</li>
<li> Börja översätt genom att klicka på Translate knappen intill en av filerna. <i>FreeCAD.ts</i> innehåller till exempel textsträngarna för FreeCADs huvudgränssnitt.</li>
<li> Du kan rösta på existerande översättningar, eller så kan du skapa dina egna.</li></ul>
<pre> <b>Notera</b>: Om du deltar aktivt i översättningen av FreeCAD och vill bli
informerad innan nästa utgåva är klar att släppas,
so du får tid att granska din översättning, så prenumerera på
denna punkt: <a rel="nofollow" class="external free" href="http://www.freecadweb.org/tracker/view.php?id=137">http://www.freecadweb.org/tracker/view.php?id=137</a>
</pre>
<p><br />
</p>
<h3><span class="mw-headline" id=".C3.96vers.C3.A4tta_med_Qt-Linguist_.28det_gamla_s.C3.A4ttet.29">Översätta med Qt-Linguist (det gamla sättet)</span></h3>
<table class="mw-collapsible mw-collapsed wikitable">
<tr>
<td>The following information doesn't need to be used anymore and will likely become obsolete.
<p>It is being kept here so that programmers may familiarize themselves with how it works.
</p>
</td></tr>
<tr>
<td>
<ul><li> Open all of the language folders of FreeCAD shown below</li>
<li> Verify that a .ts file with your language code doesn't exist ("fr" for french, "de" for german, etc...)</li>
<li> If it exists, you can download that file, if you want to modify/review/better the translation (click the file, then download)</li>
<li> If it doesn't exist, download the .ts file without language code (or any other .ts available, it will work too)</li>
<li> Rename that file with your language code</li>
<li> Open it with the Qt-Linguist program</li>
<li> Start translating (Qt Linguist is very easy to use)</li>
<li> Once it's completely done, save your file</li>
<li> <a rel="nofollow" class="external text" href="http://www.freecadweb.org/tracker/main_page.php">send the files to us</a> so we can include them in the freecad source code so they benefit other users too.<br /></li></ul>
<p><b> Available translation files </b><br />
</p>
<ul><li> The following links all direct to the sourceforge which is no longer used by FreeCAD. The code is hosted at <a rel="nofollow" class="external free" href="https://github.com/FreeCAD/FreeCAD">https://github.com/FreeCAD/FreeCAD</a>.</li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Gui/Language/">FreeCAD main GUI</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Complete/Gui/Resources/translations/">Complete Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Drawing/Gui/Resources/translations/">Drawing Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Draft/Resources/translations/">Draft Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/ReverseEngineering/Gui/Resources/translations/">Reverse Engineering Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Fem/Gui/Resources/translations/">FEM Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Robot/Gui/Resources/translations/">Robot Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Image/Gui/Resources/translations/">Image Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Sketcher/Gui/Resources/translations/">Sketcher Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Mesh/Gui/Resources/translations/">Mesh Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Test/Gui/Resources/translations/">Test Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Points/Gui/Resources/translations/">Points Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Raytracing/Gui/Resources/translations/">Raytracing Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Part/Gui/Resources/translations/">Part Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/PartDesign/Gui/Resources/translations/">PartDesign Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/Assembly/Gui/Resources/translations/">Assembly Workbench</a></li>
<li> <a rel="nofollow" class="external text" href="http://free-cad.svn.sourceforge.net/viewvc/free-cad/trunk/src/Mod/MeshPart/Gui/Resources/translations/">MeshPart Workbench</a></li>
<li> There is a very good Forum post about the old way of translation, but it is in German. See <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/viewtopic.php?f=13&amp;t=19496&amp;start=60#p152655">http://forum.freecadweb.org/viewtopic.php?f=13&amp;t=19496&amp;start=60#p152655</a></li></ul>
</td></tr></table>
<h2><span class="mw-headline" id="F.C3.B6rbereda_dina_egna_moduler.2Fapplikationer_f.C3.B6r_.C3.B6vers.C3.A4ttning">Förbereda dina egna moduler/applikationer för översättning</span></h2>
<h3><span class="mw-headline" id="F.C3.B6rkrav">Förkrav</span></h3>
<p>För att lokalisera din applikationsmodul så behöver du de hjälpare som kommer tillsammans med <i>Qt</i>. Du kan ladda ned dem från <a rel="nofollow" class="external text" href="http://www.trolltech.com/products/qt/downloads">Trolltech-Webbplatsen</a>, men de finns också i <a href="https://www.freecadweb.org/wiki/index.php?title=Third_Party_Libraries/sv" title="Third Party Libraries/sv">LibPack</a>:
</p>
<dl><dt>qmake</dt>
<dd> Genererar projektfiler</dd>
<dt>lupdate</dt>
<dd> Extraherar eller uppdaterar originaltexterna i ditt projekt genom att skanna källkoden</dd>
<dt>Qt-Linguist</dt>
<dd> <i>Qt-Linguist</i> är mycket enkelt att använda och hjälper dig att översätta med fina egenskaper som en frasbok för vanliga ord/meningar.</dd></dl>
<h3><span class="mw-headline" id="Inst.C3.A4llning_av_Projekt">Inställning av Projekt</span></h3>
<p>För att påbörja lokaliseringen av ditt projekt, gå till GUI-delen av din modul och skriv följande på kommandoraden:
</p>
<pre>
qmake -project
</pre>
<p>Detta skannar din projektkatalog efter filer som innehåller textsträngar och skapar en projektfil som i följande exempel:
</p>
<pre>
######################################################################
# Automatically generated by qmake (1.06c) Do 2. Nov 14:44:21 2006
######################################################################
TEMPLATE = app
DEPENDPATH += .\Icons
INCLUDEPATH += .
# Input
HEADERS += ViewProvider.h Workbench.h
SOURCES += AppMyModGui.cpp \
Command.cpp \
ViewProvider.cpp \
Workbench.cpp
TRANSLATIONS += MyMod_de.ts
</pre>
<p>Du kan lägga till filer manuellt här. Avsnittet <tt>TRANSLATIONS</tt> innehåller en lista med filer med översättningen för varje språk. I ovanstående exempel så är <i>MyMod_de.ts</i> den tyska översättningen.
</p><p>Nu behöver du köra <tt>lupdate</tt> för att plocka ut alla textsträngar i ditt gränssnitt. Genmóm att köra <tt>lupdate</tt> efter ändringar i källkoden är alltid säkert eftersom den aldrig raderar strängar från dina översättningsfiler. Den lägger endast till nya strängar.
</p><p>Nu behöver du lägga till <tt>.ts</tt>-filerna till ditt VisualStudio projekt. Specificera följande anpassade byggmetod för dem:
</p>
<pre>python ..\..\..\Tools\qembed.py "$(InputDir)\$(InputName).ts"
"$(InputDir)\$(InputName).h" "$(InputName)" </pre>
<p>Notera: skriv detta i en enda kommandorad, radbrytningen är endast för utseendet här.
</p><p>Genom att kompilera <tt>.ts</tt>-filen i ovanstående exempel, så skapas headerfilen <i>MyMod_de.h</i> . Bästa platsen att inkludera denna är i <i>App&lt;Modul&gt;Gui.cpp</i>. I vårt exempel så skulle det vara <i>AppMyModGui.cpp</i>. Där lägger du till raden
</p>
<pre>new Gui::LanguageProducer("Deutsch", &lt;Modul&gt;_de_h_data, &lt;Modul&gt;_de_h_len); </pre>
<p>för att publicera din översättning i applikationen.
</p>
<h3><span class="mw-headline" id="St.C3.A4lla_in_pythonfiler_f.C3.B6r_.C3.B6vers.C3.A4ttning">Ställa in pythonfiler för översättning</span></h3>
<p>För att förenkla lokalisering av py filer så kan du använda verktyget "pylupdate4" vilket accepterar en eller fler py filer. Med alternativet -ts så kan du förbereda/uppdatera en eller fler .ts filer. För att till exempel förbereda en .ts fil för Franska, skriv i kommandoraden:
</p>
<pre>
pylupdate4 *.py -ts YourModule_fr.ts
</pre>
<p>pylupdate verktyget kommer att skanna dina .py filer för translate() eller tr() funktioner och skapa en YourModule_fr.ts fil. Den filen kan sedan översättas med Qt-Linguist och en YourModule_fr.qm fil producerad från Qt-Linguist eller mad kommandot
</p>
<pre>
lrelease YourModule_fr.ts
</pre>
<p>Var uppmärksam på att verktyget pylupdate4 inte är speciellt bra på att känna igen translate() funktioner, de måste formatteras mycket specifikt ( se Ritmodul filerna för exempel). Inuti din fil, så kan du ställa in en översättare som denna (efter att du har laddat din QApplication men INNAN du skapar några qt widgetar):
</p>
<pre>
translator = QtCore.QTranslator()
translator.load("YourModule_"+languages[ln])
QtGui.QApplication.installTranslator(translator)
</pre>
<p>Alternativt, så kan du även skapa filen XML Draft.qrc med detta innehåll:
</p>
<pre>
&lt;RCC&gt;
&lt;qresource prefix="/translations" &gt;
&lt;file&gt;Draft_fr.qm&lt;/file&gt;
&lt;/qresource&gt;
&lt;/RCC&gt;
</pre>
<p>och genom att köra pyrcc4 Draft.qrc -o qrc_Draft.py så skapas en stor Python som innehåller alla resurser. Detta sätt fungerar också för att lägga alla ikonfiler i en resursfil
</p>
<h2><span class="mw-headline" id=".C3.96vers.C3.A4tta_wikin">Översätta wikin</span></h2>
<p>This wiki is hosting a lot of contents, the majority of which build up the manual. You can browse the documentation starting from the <a href="https://www.freecadweb.org/wiki/index.php?title=Main_Page" title="Main Page">Main Page</a>, or have a look at the User's manual <a href="Online_Help_Toc.html" title="Online Help Toc">Online Help Toc</a>.
</p>
<h3><span class="mw-headline" id="Translation_plugin">Translation plugin</span></h3>
<p>When the Wiki moved away from SourceForge, <a href="https://www.freecadweb.org/wiki/index.php?title=User:Yorik" title="User:Yorik">Yorik</a> installed a <a class="external text" href="http://www.mediawiki.org/wiki/Help:Extension:Translate">Translation plugin</a> which allows to ease translations between pages. For example, the page title can now be translated. Other advantages of the Translation plugin are that it keeps track of translations, notifies if the original page has been updated, and maintains translations in sync with the original English page.
</p><p>The tool is documented in <a class="external text" href="http://www.mediawiki.org/wiki/Help:Extension:Translate">Extension:Translate</a>, and is part of a <a class="external text" href="http://www.mediawiki.org/wiki/MediaWiki_Language_Extension_Bundle">Language Extension Bundle</a>.
</p><p>To quickly get started on preparing a page for translation and activating the plugin, please read the <a class="external text" href="http://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_example">Page translation example</a>.
</p><p>To see an example of how the Translation tool works once the translation plugin is activated on a page, you can visit the <a href="https://www.freecadweb.org/wiki/index.php?title=Main_Page" title="Main Page">Main Page</a>. You will see a new language menu bar at the bottom. It is automatically generated. Click for instance on the German link, it will get you to <a href="https://www.freecadweb.org/wiki/index.php?title=Main_Page/de" title="Main Page/de">Main Page/de</a>. Right under the title, you can read "This page is a <b>translated version</b> of a page Main Page and the translation is xx% complete." (xx being the actual percentage of translation). Click on the "translated version" link to start translation, or to update or correct the existing translation.
</p><p>You will notice that you cannot directly edit a page anymore once it's been marked as a translation. You have to go through the translation utility.
</p><p>When adding new content, the English page should be created first, then translated into another language. If someone wants to change/add content in a page, he should do the English one first.
</p><p>It is recommended to have basic knowledge of wiki style formatting and general guidelines of the FreeCAD wiki, because you will have to deal with some tags while translating. You can find this information on <a href="WikiPages.html" title="WikiPages">WikiPages</a>.
</p><p>The sidebar (navigation menu on the left) is also translatable. Please follow dedicated instructions on <a href="Localisation_Sidebar.html" title="Localisation Sidebar">Localisation Sidebar</a> page.
</p><p><b>REMARK: The first time you switch a page to the new translation system, it looses all its old 'manual' translations. To recover the translation, you need to open an earlier version from the history, and copy/paste manually the paragraphs to the new translation system.</b>
</p><p>Remark: to be able to translate in the wiki, you must of course <a href="/wiki/FAQ#How_can_I_get_edit_permission_on_the_wiki.3F" title="FAQ">gain wiki edit permission</a>.
</p><p><br />
If you are unsure how to proceed, don't hesitate to ask for help in the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org">forum</a>.
</p>
<h3><span class="mw-headline" id="Old_translation_instructions">Old translation instructions</span></h3>
<table class="mw-collapsible mw-collapsed wikitable">
<tr>
<td>These instructions are for historical background only, while the pages are being passed to the new translation plugin.
</td></tr>
<tr>
<td>
<p>So the first step is to <b>check if the manual translation has already been started for your language</b> (look in the left sidebar, under "manual").<br />
If not, head to the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/">forum</a> and say that you want to start a new translation, we'll create the basic setup for the language you want to work on.<br />
You must then <a href="/wiki/FAQ#How_can_I_get_edit_permission_on_the_wiki.3F" title="FAQ">gain wiki edit permission</a>.<br />
If your language is already listed, see what pages are still missing a translation (they will be listed in red). The technique is simple: <b>go into a red page, and copy/paste the contents of the corresponding English page, and start translating</b>.<br />
Do not forget to include all the tags and templates from the original English page. Some of those templates will have an equivalent in your language (for example, there is a French Docnav template called Docnav/fr). You should use <b>a slash and your language code</b> in almost all the links. Look at other already translated pages to see how they did it.<br />
Add a slash and your language code in the categories, like [[Category:Developer Documentation/fr]] <br />
And if you are unsure, head to the forums and ask people to check what you did and tell you if it's right or not.<br />
Four templates are commonly used in manual pages. These 4 templates have localized versions (Template:Docnav/fr, Template:fr, etc...)
</p>
<ul><li> <a href="Command.html" title="Template:GuiCommand">Template:GuiCommand</a>&#160;: is the Gui Command information block in upper-right of command documentation.</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=Template:Docnav" title="Template:Docnav">Template:Docnav</a>&#160;: it is the navigation bar at the bottom of the pages, showing previous and next pages.</li></ul>
<p><b> Page Naming Convention </b><br />
Please take note that, due to limitations in the Sourceforge implementation of the MediaWiki engine, we require that your pages all keep their original English counterpart's name, appending a slash and your language code. For example, the translated page for About FreeCAD should be About Freecad/es for Spanish, About FreeCAD/pl for polish, etc. The reason is simple: so that if translators go away, the wiki's administrators, who do not speak all languages, will know what these pages are for. This will facilitate maintenance and avoid lost pages.<br />
If you want the Docnav template to show linked pages in your language, you can use <b>redirect pages</b>. They are basically shortcut links to the actual page. Here is an example with the French page for About FreeCAD.<br />
</p>
<ul><li> The page About FreeCAD/fr is the page with content</li>
<li> The page À propos de FreeCAD contains this code:</li></ul>
<pre>#REDIRECT [[About FreeCAD/fr]]
</pre>
<ul><li> In the About FreeCAD/fr page, the Docnav code will look like this:</li></ul>
<pre>{{docnav/fr|Bienvenue sur l'aide en ligne|Fonctionnalités}}
</pre>
<p>The page "Bienvenue sur l'aide en ligne" redirects to Online Help Startpage/fr, and the page "Fonctionnalités" redirects to Feature list/fr.
</p>
</td></tr></table>
<div style="clear:both"></div>
<p><br />
</p><p>This page lists several additional python modules or other pieces of software that can be downloaded freely from the internet, and add functionality to your FreeCAD installation.
</p>
<h2><span class="mw-headline" id="PySide_.28previously_PyQt4.29">PySide (previously PyQt4)</span></h2>
<ul><li> homepage (PySide): <a rel="nofollow" class="external free" href="http://qt-project.org/wiki/PySide">http://qt-project.org/wiki/PySide</a></li>
<li> license: LGPL </li>
<li> optional, but needed by several modules: Draft, Arch, Ship, Plot, OpenSCAD, Spreadsheet</li></ul>
<p>PySide (previously PyQt) is required by several modules of FreeCAD to access FreeCAD's Qt interface. It is already bundled in the windows verison of FreeCAD, and is usually installed automatically by FreeCAD on Linux, when installing from official repositories. If those modules (Draft, Arch, etc) are enabled after FreeCAD is installed, it means PySide (previously PyQt) is already there, and you don't need to do anything more.
</p><p><b>Notera</b>: av följande moduler, så är Pivy nu helt integrerad i alla FreeCAD installationspaket, och PyQt4 är också integrerat i Windows installationspaket.
</p>
<h3><span class="mw-headline" id="Installation_3">Installation</span></h3>
<h4><span class="mw-headline" id="Linux">Linux</span></h4>
<p>The simplest way to install PySide is through your distribution's package manager. On Debian/Ubuntu systems, the package name is generally <i>python-PySide</i>, while on RPM-based systems it is named <i>pyside</i>. The necessary dependencies (Qt and SIP) will be taken care of automatically.
</p>
<h4><span class="mw-headline" id="Windows">Windows</span></h4>
<p>The program can be downloaded from <a rel="nofollow" class="external free" href="http://qt-project.org/wiki/Category:LanguageBindings::PySide::Downloads">http://qt-project.org/wiki/Category:LanguageBindings::PySide::Downloads</a> . You'll need to install the Qt and SIP libraries before installing PySide (to be documented).
</p>
<h4><span class="mw-headline" id="MacOSX">MacOSX</span></h4>
<p>PyQt on Mac can be installed via homebrew or port. See <a href="/wiki/CompileOnMac#Install_Dependencies" title="CompileOnMac">CompileOnMac#Install_Dependencies</a> for more information.
</p>
<h3><span class="mw-headline" id="Usage">Usage</span></h3>
<p>Once it is installed, you can check that everything is working by typing in FreeCAD python console:
</p>
<pre>import PySide </pre>
<p>To access the FreeCAD interface, type&#160;:
</p>
<pre>from PySide import QtCore,QtGui
FreeCADWindow = FreeCADGui.getMainWindow() </pre>
<p>Now you can start to explore the interface with the dir() command. You can add new elements, like a custom widget, with commands like&#160;:
</p>
<pre>FreeCADWindow.addDockWidget(QtCore.Qt.RghtDockWidgetArea,my_custom_widget) </pre>
<p>Working with Unicode&#160;:
</p>
<pre>text = text.encode('utf-8') </pre>
<p>Working with QFileDialog and OpenFileName&#160;:
</p>
<pre>path = FreeCAD.ConfigGet("AppHomePath")
#path = FreeCAD.ConfigGet("UserAppData")
OpenName, Filter = PySide.QtGui.QFileDialog.getOpenFileName(None, "Read a txt file", path, "*.txt") </pre>
<p>Working with QFileDialog and SaveFileName&#160;:
</p>
<pre>path = FreeCAD.ConfigGet("AppHomePath")
#path = FreeCAD.ConfigGet("UserAppData")
SaveName, Filter = PySide.QtGui.QFileDialog.getSaveFileName(None, "Save a file txt", path, "*.txt") </pre>
<h3><span class="mw-headline" id="Example_of_transition_from_PyQt4_and_PySide">Example of transition from PyQt4 and PySide</span></h3>
<p>PS: these examples of errors were found in the transition PyQt4 to PySide and these corrections were made, other solutions are certainly available with the examples above
</p>
<pre>try:
import PyQt4 # PyQt4
from PyQt4 import QtGui ,QtCore # PyQt4
from PyQt4.QtGui import QComboBox # PyQt4
from PyQt4.QtGui import QMessageBox # PyQt4
from PyQt4.QtGui import QTableWidget, QApplication # PyQt4
from PyQt4.QtGui import * # PyQt4
from PyQt4.QtCore import * # PyQt4
except Exception:
import PySide # PySide
from PySide import QtGui ,QtCore # PySide
from PySide.QtGui import QComboBox # PySide
from PySide.QtGui import QMessageBox # PySide
from PySide.QtGui import QTableWidget, QApplication # PySide
from PySide.QtGui import * # PySide
from PySide.QtCore import * # PySide </pre>
<p>To access the FreeCAD interface, type&#160;:
You can add new elements, like a custom widget, with commands like&#160;:
</p>
<pre>myNewFreeCADWidget = QtGui.QDockWidget() # create a new dockwidget
myNewFreeCADWidget.ui = Ui_MainWindow() # myWidget_Ui() # load the Ui script
myNewFreeCADWidget.ui.setupUi(myNewFreeCADWidget) # setup the ui
try:
app = QtGui.qApp # PyQt4 # the active qt window, = the freecad window since we are inside it
FCmw = app.activeWindow() # PyQt4 # the active qt window, = the freecad window since we are inside it
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window
except Exception:
FCmw = FreeCADGui.getMainWindow() # PySide # the active qt window, = the freecad window since we are inside it
FCmw.addDockWidget(QtCore.Qt.RightDockWidgetArea,myNewFreeCADWidget) # add the widget to the main window </pre>
<p>Working with Unicode&#160;:
</p>
<pre>try:
text = unicode(text, 'ISO-8859-1').encode('UTF-8') # PyQt4
except Exception:
text = text.encode('utf-8') # PySide </pre>
<p>Working with QFileDialog and OpenFileName&#160;:
</p>
<pre>OpenName = ""
try:
OpenName = QFileDialog.getOpenFileName(None,QString.fromLocal8Bit("Lire un fichier FCInfo ou txt"),path,"*.FCInfo *.txt") # PyQt4
except Exception:
OpenName, Filter = PySide.QtGui.QFileDialog.getOpenFileName(None, "Lire un fichier FCInfo ou txt", path, "*.FCInfo *.txt")#PySide </pre>
<p>Working with QFileDialog and SaveFileName&#160;:
</p>
<pre>SaveName = ""
try:
SaveName = QFileDialog.getSaveFileName(None,QString.fromLocal8Bit("Sauver un fichier FCInfo"),path,"*.FCInfo") # PyQt4
except Exception:
SaveName, Filter = PySide.QtGui.QFileDialog.getSaveFileName(None, "Sauver un fichier FCInfo", path, "*.FCInfo")# PySide </pre>
<p>The MessageBox:
</p>
<pre>def errorDialog(msg):
diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg )
try:
diag.setWindowFlags(PyQt4.QtCore.Qt.WindowStaysOnTopHint) # PyQt4 # this function sets the window before
except Exception:
diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)# PySide # this function sets the window before
# diag.setWindowModality(QtCore.Qt.ApplicationModal) # function has been disabled to promote "WindowStaysOnTopHint"
diag.exec_() </pre>
<p>Working with setProperty (PyQt4) and setValue (PySide)
</p>
<pre>self.doubleSpinBox.setProperty("value", 10.0) # PyQt4 </pre>
<p>replace to&#160;:
</p>
<pre>self.doubleSpinBox.setValue(10.0) # PySide </pre>
<p>Working with setToolTip
</p>
<pre>self.doubleSpinBox.setToolTip(_translate("MainWindow", "Coordinate placement Axis Y", None)) # PyQt4 </pre>
<p>replace to&#160;:
</p>
<pre>self.doubleSpinBox.setToolTip(_fromUtf8("Coordinate placement Axis Y")) # PySide </pre>
<p>or&#160;:
</p>
<pre>self.doubleSpinBox.setToolTip(u"Coordinate placement Axis Y.")# PySide </pre>
<h3><span class="mw-headline" id="Additional_documentation">Additional documentation</span></h3>
<p>Some pyQt4 tutorials (including how to build interfaces with Qt Designer to use with python):
</p>
<ul><li> <a rel="nofollow" class="external free" href="http://pyqt.sourceforge.net/Docs/PyQt4/classes.html">http://pyqt.sourceforge.net/Docs/PyQt4/classes.html</a> - the PyQt4 API Reference on sourceforge</li>
<li> <a rel="nofollow" class="external free" href="http://www.rkblog.rk.edu.pl/w/p/introduction-pyqt4/">http://www.rkblog.rk.edu.pl/w/p/introduction-pyqt4/</a> - a simple introduction</li>
<li> <a rel="nofollow" class="external free" href="http://www.zetcode.com/tutorials/pyqt4/">http://www.zetcode.com/tutorials/pyqt4/</a> - very complete in-depth tutorial</li></ul>
<h2><span class="mw-headline" id="Pivy_2">Pivy</span></h2>
<ul><li> homepage: <a rel="nofollow" class="external free" href="https://bitbucket.org/Coin3D/coin/wiki/Home">https://bitbucket.org/Coin3D/coin/wiki/Home</a></li>
<li> license: BSD</li>
<li> optional, but needed by several modules of FreeCAD: Draft, Arch</li></ul>
<p>Pivy is a needed by several modules to access the 3D view of FreeCAD. On windows, Pivy is already bundled inside the FreeCAD installer, and on Linux it is usually automatically installed when you install FreeCAD from an official repository. On MacOSX, unfortunately, you will need to compile pivy yourself.
</p>
<h3><span class="mw-headline" id="Installation_4">Installation</span></h3>
<h4><span class="mw-headline" id="Prerequisites_3">Prerequisites</span></h4>
<p>I believe before compiling Pivy you will want to have Coin and SoQt installed.
</p><p>I found for building on Mac it was sufficient to install the <a rel="nofollow" class="external text" href="http://www.coin3d.org/lib/plonesoftwarecenter_view">Coin3 binary package</a>. Attempting to install coin from MacPorts was problematic: tried to add a lot of X Windows packages and ultimately crashed with a script error.
</p><p>For Fedora I found an RPM with Coin3.
</p><p>SoQt compiled from <a rel="nofollow" class="external text" href="http://www.coin3d.org/lib/soqt/releases/1.5.0">source</a> fine on Mac and Linux.
</p>
<h4><span class="mw-headline" id="Debian_.26_Ubuntu">Debian &amp; Ubuntu</span></h4>
<p>Med början i Debian Squeeze och Ubuntu Lucid, så kommer pivy att finnas tillgängligt direkt från de officiella förråden, vilket sparar mycket krångel. Innan dess, så kan du antingen ladda ned ett av de paket som vi har gjort (för debian och ubuntu karmic) tillgängliga på <a href="https://www.freecadweb.org/wiki/index.php?title=Download/sv" title="Download/sv">Nedladdningssidorna</a>, eller så kan du kompilera det själv.
</p>
<div class="mw-translate-fuzzy">
<p>Det bästa sättet att kompilera pivy smidigt är att hämta debians källkodspaket för pivy och göra ett paket med debuild. Det är samma källkod som på den officiella pivysajten, men debianfolket har gjort flera bugg-fixningstillägg. Det kompilerar också bra på ubuntu karmic: <a rel="nofollow" class="external free" href="http://packages.debian.org/squeeze/python-pivy">http://packages.debian.org/squeeze/python-pivy</a> (ladda ned .orig.gz och .diff.gz file, packa upp båda, tillämpa sedan .diff på källkoden: gå till den uppackade pivy källkodsmappen, och tillämpa .diff patchen:
</p>
</div>
<pre>patch -p1 &lt; ../pivy_0.5.0~svn765-2.diff </pre>
<p>sedan
</p>
<pre>debuild </pre>
<p>för att få pivy korrekt byggt till ett officiellt installerbart paket. Sedan så är det bara att installera paketet med gdebi.
</p>
<h4><span class="mw-headline" id="Other_linux_distributions">Other linux distributions</span></h4>
<p>First get the latest sources from the <a rel="nofollow" class="external text" href="http://pivy.coin3d.org/mercurial/">project's repository</a>:
</p>
<pre>hg clone http://hg.sim.no/Pivy/default Pivy </pre>
<p>As of March 2012, the latest version is Pivy-0.5.
</p><p>Sedan behöver du ett verktyg som kallas för SWIG för att generera C++ koden för Pythonbindningarna. Det rekommenderas att version 1.3.25 av SWIG används, inte den senaste versionen, därför att pivy för tillfället endast fungerar korrekt med 1.3.25. Ladda ned 1.3.25 source tarball från <a rel="nofollow" class="external free" href="http://www.swig.org">http://www.swig.org</a>. Packa sedan upp den, och gör som root följande i en konsol:
</p>
<pre>./configure
make
make install (or checkinstall if you use it) </pre>
<p>Det tar bara några sekunder att bygga.
</p><p>Alternatively, you can try building with a more recent SWIG. As of March 2012, a typical repository version is 2.0.4. Pivy has a minor compile problem with SWIG 2.0.4 on Mac OS (see below) but seems to build fine on Fedora Core 15.
</p><p>Efter det, gå till pivy källkoden och anropa
</p>
<pre>python setup.py build </pre>
<p>which creates the source files. Note that build can produce thousands of warnings, but hopefully there will be no errors.
</p><p>viltet skapar källkodsfilerna. Du kan få kompileringsfel där en 'const char*' inte kan konverteras till en 'char*'. För att fixa det så behöver du bara skriva en 'const' innan raderna som orsakade felet.
</p><p>Det finns sex rader att fixa. Efter det, installera genom att skriva (som root):
</p>
<pre>python setup.py install (or checkinstall python setup.py install) </pre>
<p>Klart! Pivy är installerat.
</p>
<h4><span class="mw-headline" id="Mac_OS">Mac OS</span></h4>
<p>These instructions may not be complete. Something close to this worked for OS 10.7 as of March 2012. I use MacPorts for repositories, but other options should also work.
</p><p>As for linux, get the latest source:
</p>
<pre>hg clone http://hg.sim.no/Pivy/default Pivy </pre>
<p>If you don't have hg, you can get it from MacPorts:
</p>
<pre>port install mercurial </pre>
<p>Then, as above you need SWIG. It should be a matter of:
</p>
<pre>port install swig </pre>
<p>I found I needed also:
</p>
<pre>port install swig-python </pre>
<p>As of March 2012, MacPorts SWIG is version 2.0.4. As noted above for linux, you might be better off downloading an older version. SWIG 2.0.4 seems to have a bug that stops Pivy building. See first message in this digest: <a rel="nofollow" class="external free" href="https://sourceforge.net/mailarchive/message.php?msg_id=28114815">https://sourceforge.net/mailarchive/message.php?msg_id=28114815</a>
</p><p>This can be corrected by editing the 2 source locations to add dereferences: *arg4, *arg5 in place of arg4, arg5. Now Pivy should build:
</p>
<pre>python setup.py build
sudo python setup.py install </pre>
<h4><span class="mw-headline" id="Windows_2">Windows</span></h4>
<p>När du använder Visual Studio 2005 eller senare så ska du öppna en kommandoprompt med 'Visual Studio 2005 Command prompt' från Tools menyn.
Om du ännu inte har Pythontolken i systemsökvägen, gör
</p>
<pre>set PATH=path_to_python_2.5;%PATH% </pre>
<p>För att få pivy att fungera så ska du hämta den senaste källkoden från projektets förråd:
</p>
<pre>svn co https://svn.coin3d.org/repos/Pivy/trunk Pivy </pre>
<p>Sedan behöver du ett verktyg som kallas för SWIG för att generera C++ koden för Python bindningarna. Det rekommenderas att version 1.3.25 av SWIG används, inte den senaste versionen, därför att pivy för tillfället endast fungerar korrekt med 1.3.25. Ladda ned binärkoden för 1.3.25 från <a rel="nofollow" class="external free" href="http://www.swig.org">http://www.swig.org</a>. Packa sedan upp den och lägg till den i systemsökvägen från kommandoraden
</p>
<pre>set PATH=path_to_swig_1.3.25;%PATH% </pre>
<p>och ställ in COINDIR till den riktiga sökvägen
</p>
<pre>set COINDIR=path_to_coin </pre>
<p>På Windows så förväntar sig pivys konfigurationsfil SoWin istället för SoQt som standard. Jag har inte hittat en självklart sätt att bygga med SoQt, så Jag modifierade filen setup.py direkt.
</p><p>Ta på rad 200 bort delen 'sowin'&#160;: ('gui._sowin', 'sowin-config', 'pivy.gui.') (ta inte bort den stängande parentesen).
</p><p>Efter det, gå till pivy källkoden och anropa
</p>
<pre>python setup.py build </pre>
<p>vilket skapar källkodsfilerna. Du kan få kompileringsfel för att flera headerfiler inte kunde hittas. I detta fall så får du justera INCLUDE variabeln
</p>
<pre>set INCLUDE=%INCLUDE%;path_to_coin_include_dir </pre>
<p>och om SoQt headers int är på samma plats som Coin headers så får du också justera
</p>
<pre>set INCLUDE=%INCLUDE%;path_to_soqt_include_dir </pre>
<p>och slutligen Qt headers
</p>
<pre>set INCLUDE=%INCLUDE%;path_to_qt4\include\Qt </pre>
<p>Om du använder Expressutgåvan av Visual Studio så kan du få ett python keyerror undantag.
</p><p>I detta fall så måste du ändra en del saker i msvccompiler.py som finns i din python installation.
</p><p>Gå till rad 122 och byt ut raden
</p>
<pre>vsbase = r"Software\Microsoft\VisualStudio\%0.1f"&#160;% version </pre>
<p>mot
</p>
<pre>vsbase = r"Software\Microsoft\VCExpress\%0.1f"&#160;% version </pre>
<p>Försök sedan igen.
</p><p>Om du får ett andra fel som
</p>
<pre>error: Python was built with Visual Studio 2003;... </pre>
<p>Så måste du även byta ut rad 128
</p>
<pre>self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") </pre>
<p>mot
</p>
<pre>self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv2.0") </pre>
<p>Försök igen. Om du åter får ett fel som
</p>
<pre>error: Python was built with Visual Studio version 8.0, and extensions need to be built with the same version of the compiler, but it isn't installed. </pre>
<p>så ska du kontrollera miljövariablerna DISTUTILS_USE_SDK och MSSDK med
</p>
<pre>echo&#160;%DISTUTILS_USE_SDK%
echo&#160;%MSSDK% </pre>
<p>Om de inte är inställda än, ställ in dem till 1
</p>
<pre>set DISTUTILS_USE_SDK=1
set MSSDK=1 </pre>
<p>Nu kan du få kompileringsfel där en 'const char*' inte kan konverteras till en 'char*'. För att fixa det så behöver du bara skriva en 'const' innan raderna som orsakade felet. Det finns sex rader att fixa.
</p><p>Kopiera sedan den genererade pivykatalogen till en plats där pythontolken i FreeCAD kan hitta den.
</p>
<h3><span class="mw-headline" id="Usage_2">Usage</span></h3>
<p>To check if Pivy is correctly installed:
</p>
<pre>import pivy </pre>
<p>För att Pivy ska komma åt FreeCAD scengrafen, gör följande:
</p>
<pre>from pivy import coin
App.newDocument() # Open a document and a view
view = Gui.ActiveDocument.ActiveView
FCSceneGraph = view.getSceneGraph() # returns a pivy Python object that holds a SoSeparator, the main "container" of the Coin scenegraph
FCSceneGraph.addChild(coin.SoCube()) # add a box to scene </pre>
<p>Nu kan du utforska FCSceneGraph med dir() kommandot.
</p>
<h3><span class="mw-headline" id="Dokumentation_2">Dokumentation</span></h3>
<p>Olyckligtvis så existerar det knappast ännu någon dokumentation om pivy på nätet. Men Coin dokumentationen kan vara användbar, eftersom pivy helt enkelt översätter Coin funktioner, noder och metoder i python, allt behåller samma namn och egenskaper, bara man tänker på syntaxskillnaden mellan C och python:
</p>
<ul><li> <a rel="nofollow" class="external free" href="https://bitbucket.org/Coin3D/coin/wiki/Documentation">https://bitbucket.org/Coin3D/coin/wiki/Documentation</a> - Coin3D API Reference</li>
<li> <a rel="nofollow" class="external free" href="http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/index.html">http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/index.html</a> - The Inventor Mentor - The "bible" of Inventor scene description language.</li></ul>
<p>Du kan också titta på Draft.py filen i FreeCAD Mod/Draft mappen, eftersom den använder pivy mycket.
</p>
<h2><span class="mw-headline" id="pyCollada">pyCollada</span></h2>
<ul><li> homepage: <a rel="nofollow" class="external free" href="http://pycollada.github.com">http://pycollada.github.com</a></li>
<li> license: BSD</li>
<li> optional, needed to enable import and export of Collada (.DAE) files</li></ul>
<p>pyCollada is a python library that allow programs to read and write <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/COLLADA">Collada (*.DAE)</a> files. When pyCollada is installed on your system, FreeCAD will be able to handle importing and exporting in the Collada file format.
</p>
<h3><span class="mw-headline" id="Installation_5">Installation</span></h3>
<p>Pycollada is usually not yet available in linux distributions repositories, but since it is made only of python files, it doesn't require compilation, and is easy to install. You have 2 ways, or directly from the official pycollada git repository, or with the easy_install tool.
</p>
<h4><span class="mw-headline" id="Linux_2">Linux</span></h4>
<p>In either case, you'll need the following packages already installed on your system:
</p>
<pre>python-lxml
python-numpy
python-dateutil </pre>
<h5><span class="mw-headline" id="From_the_git_repository">From the git repository</span></h5>
<pre>git clone git://github.com/pycollada/pycollada.git pycollada
cd pycollada
sudo python setup.py install </pre>
<h5><span class="mw-headline" id="With_easy_install">With easy_install</span></h5>
<p>Assuming you have a complete python installation already, the easy_install utility should be present already:
</p>
<pre>easy_install pycollada </pre>
<p>You can check if pycollada was correctly installed by issuing in a python console:
</p>
<pre>import collada </pre>
<p>If it returns nothing (no error message), then all is OK
</p>
<h4><span class="mw-headline" id="Windows_3">Windows</span></h4>
<p>On Windows since 0.15 pycollada is included in both the FreeCAD release and developer builds so no additional steps are necessary.
</p>
<h4><span class="mw-headline" id="Mac_OS_2">Mac OS</span></h4>
<p>If you are using the Homebrew build of FreeCAD you can install pycollada into your system Python using pip.
</p><p>If you need to install pip:
</p>
<pre>$ sudo easy_install pip </pre>
<p>Install pycollada:
</p>
<pre>$ sudo pip install pycollada </pre>
<p>If you are using a binary version of FreeCAD, you can tell pip to install pycollada into the site-packages inside FreeCAD.app:
</p>
<pre>$ pip install --target="/Applications/FreeCAD.app/Contents/lib/python2.7/site-packages" pycollada </pre>
<p>or after downloading the pycollada code
</p>
<pre>$ export PYTHONPATH=/Applications/FreeCAD\ 0.16.6706.app/Contents/lib/python2.7/site-packages:$PYTHONPATH
$ python setup.py install --prefix=/Applications/FreeCAD\ 0.16.6706.app/Contents </pre>
<h2><span class="mw-headline" id="IfcOpenShell">IfcOpenShell</span></h2>
<ul><li> homepage: <a rel="nofollow" class="external free" href="http://www.ifcopenshell.org">http://www.ifcopenshell.org</a></li>
<li> license: LGPL</li>
<li> optional, needed to extend import abilities of IFC files</li></ul>
<p>IFCOpenShell is a library currently in development, that allows to import (and soon export) <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Industry_Foundation_Classes">Industry foundation Classes (*.IFC)</a> files. IFC is an extension to the STEP format, and is becoming the standard in <a rel="nofollow" class="external text" href="http://en.wikipedia.org/wiki/Building_information_modeling">BIM</a> workflows. When ifcopenshell is correctly installed on your system, the FreeCAD <a href="Arch_Module.html" title="Arch Module">Arch Module</a> will detect it and use it to import IFC files, instead of its built-in rudimentary importer. Since ifcopenshell is based on OpenCasCade, like FreeCAD, the quality of the import is very high, producing high-quality solid geometry.
</p>
<h3><span class="mw-headline" id="Installation_6">Installation</span></h3>
<p>Since ifcopenshell is pretty new, you'll likely need to compile it yourself.
</p>
<h4><span class="mw-headline" id="Linux_3">Linux</span></h4>
<p>You will need a couple of development packages installed on your system in order to compile ifcopenshell:
</p>
<pre>liboce-*-dev
python-dev
swig </pre>
<p>but since FreeCAD requires all of them too, if you can compile FreeCAD, you won't need any extra dependency to compile IfcOpenShell.
</p><p>Grab the latest source code from here:
</p>
<pre>git clone https://github.com/IfcOpenShell/IfcOpenShell.git </pre>
<p>The build process is very easy:
</p>
<pre>mkdir ifcopenshell-build
cd ifcopenshell-build
cmake ../IfcOpenShell/cmake </pre>
<p>or, if you are using oce instead of opencascade:
</p>
<pre>cmake -DOCC_INCLUDE_DIR=/usr/include/oce ../ifcopenshell/cmake </pre>
<p>Since ifcopenshell is made primarily for Blender, it uses python3 by default. To use it inside FreeCAD, you need to compile it against the same version of python that is used by FreeCAD. So you might need to force the python version with additional cmake parameters (adjust the python version to yours):
</p>
<pre>cmake -DOCC_INCLUDE_DIR=/usr/include/oce -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/python2.7.so ../ifcopenshell/cmake </pre>
<p>Then:
</p>
<pre>make
sudo make install </pre>
<p>You can check that ifcopenshell was correctly installed by issuing in a python console:
</p>
<pre>import ifcopenshell </pre>
<p>If it returns nothing (no error message), then all is OK
</p>
<h4><span class="mw-headline" id="Windows_4">Windows</span></h4>
<p><i>Copied from the IfcOpenShell README file</i>
</p><p>Users are advised to use the Visual Studio .sln file in the win/ folder. For Windows users a prebuilt Open CASCADE version is available from the <a rel="nofollow" class="external free" href="http://opencascade.org">http://opencascade.org</a> website. Download and install this version and provide the paths to the Open CASCADE header and library files to MS Visual Studio C++.
</p><p>For building the IfcPython wrapper, SWIG needs to be installed. Please download the latest swigwin version from <a rel="nofollow" class="external free" href="http://www.swig.org/download.html">http://www.swig.org/download.html</a> . After extracting the .zip file, please add the extracted folder to the PATH environment variable. Python needs to be installed, please provide the include and library paths to Visual Studio.
</p>
<h3><span class="mw-headline" id="Links_6">Links</span></h3>
<p>Tutorial <a href="https://www.freecadweb.org/wiki/index.php?title=Import/Export_IFC_-_compiling_IfcOpenShell" title="Import/Export IFC - compiling IfcOpenShell">Import/Export IFC - compiling IfcOpenShell</a>
</p>
<h2><span class="mw-headline" id="Teigha_Converter">Teigha Converter</span></h2>
<ul><li> homepage: <a rel="nofollow" class="external free" href="http://www.opendesign.com/guestfiles/Teigha_File_Converter">http://www.opendesign.com/guestfiles/Teigha_File_Converter</a></li>
<li> license: freeware</li>
<li> optional, used to enable import and export of DWG files</li></ul>
<p>The Teigha Converter is a small freely available utility that allows to convert between several versions of DWG and DXF files. FreeCAD can use it to offer DWG import and export, by converting DWG files to the DXF format under the hood,then using its standard DXF importer to import the file contents. The restrictions of the <a href="Draft_DXF.html" title="Draft DXF">DXF importer</a> apply.
</p>
<h3><span class="mw-headline" id="Installation_7">Installation</span></h3>
<p>On all platforms, only by installing the appropriate package from <a rel="nofollow" class="external free" href="http://www.opendesign.com/guestfiles/Teigha_File_Converter">http://www.opendesign.com/guestfiles/Teigha_File_Converter</a> . After installation, if the utility is not found automatically by FreeCAD, you might need to set the path to the converter executable manually, Change workbench to "Draft", than in the menu Edit -&gt; Preferences -&gt; Import/Export -&gt; DWG and fill "Path to Teigha File Converter" appropriately.
</p>
<div style="clear:both"></div>
<p><br />
</p><p><br />
</p>
<h1><span class="mw-headline" id="Krediter_2">Krediter</span></h1>
<p>&lt;translate&gt;
FreeCAD would not be what it is without the generous contributions of many people. Here's an overview of the people and companies who contributed to FreeCAD over time. For credits for the third party libraries see the <a href="Third_Party_Libraries.html" title="Third Party Libraries">Third Party Libraries</a> page.
</p>
<h3><span class="mw-headline" id="Development">Development</span></h3>
<h4><span class="mw-headline" id="Project_managers">Project managers</span></h4>
<p>Lead developers of the FreeCAD project:
&lt;/translate&gt;
</p>
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Jriegel" title="User:Jriegel">Jürgen Riegel</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Wmayer" title="User:Wmayer">Werner Mayer</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Yorikvanhavre" class="mw-redirect" title="User:Yorikvanhavre">Yorik van Havre</a></li></ul>
<p>&lt;translate&gt;
</p>
<h4><span class="mw-headline" id="Main_developers">Main developers</span></h4>
<p>People who work regularly on the FreeCAD code (retrieved from <a rel="nofollow" class="external free" href="https://github.com/FreeCAD/FreeCAD/graphs/contributors">https://github.com/FreeCAD/FreeCAD/graphs/contributors</a>):
&lt;/translate&gt;
</p>
<ul><li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3232">Abdullah Tahiriyo</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=4325">Alexander Golubev (Fat-Zer)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=2069">Bernd Hahnbach</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=708">Brad Collette (sliptonic)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=689">Daniel Falck</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1546">Eivind Kvedalen</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=6125">f3nix</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3449">Ian Rees</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=997">Jan Rheinlaender</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=681">Jonathan Wiedemann (rockn)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=574">Jose Luis Cercos Pita (sanguinariojoe)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=270">Logari81</a></li>
<li> <a rel="nofollow" class="external text" href="http://freecadamusements.blogspot.co.uk/">Luke A. Parry</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=2928">mdinger</a></li>
<li> mghansen</li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3666">Przemo Firszt(PrzemoF)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=4252">sgrogan</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=765">shoogen</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=686">Stefan Tröger (ickby)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=208">tanderson69 (blobfish)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=7506">vejmarie</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3888">Victor Titov (DeepSOIC)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1375">wandererfan</a></li></ul>
<p>&lt;translate&gt;
</p>
<h4><span class="mw-headline" id="Other_coders">Other coders</span></h4>
<p>Other people who contributed code to the FreeCAD project:
&lt;/translate&gt;
</p>
<ul><li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=611">jmaustpc</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=652">j-dowsett</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=930">keithsloan52</a></li>
<li> Joachim Zettler</li>
<li> Graeme van der Vlugt</li>
<li> Berthold Grupp</li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Xorx" title="User:Xorx">Georg Wiora</a></li>
<li> Martin Burbaum</li>
<li> Jacques-Antoine Gaudin</li>
<li> Ken Cline</li>
<li> Dmitry Chigrin</li>
<li> Remigiusz Fiedler (DXF-parser)</li>
<li> peterl94 </li>
<li> jobermayr</li>
<li> ovginkel</li>
<li> triplus</li>
<li> tomate44</li>
<li> maurerpe</li>
<li> Johan3DV</li>
<li> Mandeep Singh</li>
<li> fandaL</li>
<li> jonnor</li>
<li> usakhelo</li>
<li> plaes</li>
<li> SebKuzminsky</li>
<li> jcc242</li>
<li> ezzieyguywuf</li>
<li> marktaff</li>
<li> poutine70</li>
<li> qingfengxia</li>
<li> dbtayl</li>
<li> itain</li>
<li> Barleyman</li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Companies">Companies</span></h3>
<p>Companies which donated code or developer time:
&lt;/translate&gt;
</p>
<ul><li> Imetric 3D</li>
<li> <a rel="nofollow" class="external text" href="https://www.alephobjects.com/">AlephObjects</a></li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Forum_moderators">Forum moderators</span></h3>
<p>People in charge of the <a rel="nofollow" class="external text" href="http://forum.freecadweb.org">FreeCAD forum</a> (retrieved from <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/memberlist.php?mode=team">http://forum.freecadweb.org/memberlist.php?mode=team</a>):
&lt;/translate&gt;
</p>
<ul><li> <a rel="nofollow" class="external text" href="https://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=11337">agryson</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=689">Daniel Falck</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3888">DeepSOIC</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1783">ediloren</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=611">jmaustpc</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=67">jriegel</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=270">Logari81</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=607">mrlukeparry</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=729">onesz</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3666">PrzemoF</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1529">r-frank</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=3315">Renato Rebelo</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=681">rockn</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=765">shoogen</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=69">wmayer</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=68">yorik</a></li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Community">Community</span></h3>
<p>People from the community who put a lot of efforts in helping the FreeCAD project either by being active on the forum, keeping a blog about FreeCAD, making video tutorials, packaging FreeCAD for Windows/Linux/MacOS X, writing a FreeCAD book... (listed by alphabetical order) (retrieved from <a rel="nofollow" class="external free" href="http://forum.freecadweb.org/memberlist.php?mode=&amp;sk=d&amp;sd=d#memberlist">http://forum.freecadweb.org/memberlist.php?mode=&amp;sk=d&amp;sd=d#memberlist</a>)
&lt;/translate&gt;
</p>
<ul><li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1940">bejant</a></li>
<li> <a rel="nofollow" class="external text" href="http://www.packtpub.com/freecad-solid-modeling-with-python/book">Brad Collette</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=251">cblt2l</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=4523">cox</a></li>
<li> <a rel="nofollow" class="external text" href="http://opensourcedesigntools.blogspot.com/">Daniel Falck</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Emagdalena" title="User:Emagdalena">Eduardo Magdalena</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=725">hobbes1069</a></li>
<li> <a rel="nofollow" class="external text" href="http://www.youtube.com/user/5needinput">jdurston (5needinput)</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=861">John Morris (butchwax)</a></li>
<li> <a rel="nofollow" class="external text" href="http://freecad-tutorial.blogspot.com/">Kwahooo</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=108">lhagan</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1047">marcxs</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Normandc" title="User:Normandc">Normandc</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1819">peterl94</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=356">pperisin</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Quick61" title="User:Quick61">Quick61</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Renatorivo" title="User:Renatorivo">Renatorivo</a></li>
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=User:Rockn" title="User:Rockn">Rockn</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=782">triplus</a></li>
<li> <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/memberlist.php?mode=viewprofile&amp;u=1928">ulrich1a</a></li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Documentation_writers">Documentation writers</span></h3>
<p>People who wrote the documentation on this <a href="https://www.freecadweb.org/wiki/index.php?title=Main_Page" title="Main Page">wiki</a>:
&lt;/translate&gt;
</p>
<ul><li> Renato Rivoira (renatorivo)</li>
<li> Honza32</li>
<li> Hervé Blorec</li>
<li> Eduardo Magdalena</li>
<li> piffpoof</li>
<li> Wurstwasser</li>
<li> Roland Frank (r-frank)</li>
<li> bejant</li>
<li> Ediloren</li>
<li> Isaac Ayala</li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Translators">Translators</span></h3>
<p>People who helped to translate the FreeCAD application (retrieved from <a rel="nofollow" class="external free" href="https://crowdin.com/project/freecad">https://crowdin.com/project/freecad</a>):
&lt;/translate&gt;
</p>
<ul><li> Gerhard Scheepers</li>
<li> wbrwbr2011</li>
<li> hanhsuan</li>
<li> hicarl</li>
<li> fandaL</li>
<li> Peta T</li>
<li> Zdeněk Havlík</li>
<li> Jodbe</li>
<li> Peter Hageman</li>
<li> Vilfredo</li>
<li> Bruno Gonçalves Pirajá</li>
<li> Timo Seppola</li>
<li> rako</li>
<li> Pasi Kukkola</li>
<li> Ettore Atalan</li>
<li> nikoss</li>
<li> yang12</li>
<li> totyg</li>
<li> htsubota</li>
<li> asakura</li>
<li> Masaya Ootsuki</li>
<li> Jiyong Choi</li>
<li> Bartlomiej Niemiec</li>
<li> trzyha</li>
<li> bluecd</li>
<li> Miguel Morais</li>
<li> Nicu Tofan</li>
<li> Victor Radulescu</li>
<li> Angelescu Constantin</li>
<li> sema</li>
<li> Николай Матвеев</li>
<li> pinkpony</li>
<li> Alexandre Prokoudine</li>
<li> Марко Пејовић</li>
<li> Marosh</li>
<li> Peter Klofutar</li>
<li> Raulshc</li>
<li> javierMG</li>
<li> Lars</li>
<li> kunguz</li>
<li> Igor</li>
<li> Федір</li></ul>
<p>&lt;translate&gt;
</p>
<h3><span class="mw-headline" id="Addons_developers">Addons developers</span></h3>
<p>Developers of FreeCAD addons (retrieved from <a rel="nofollow" class="external free" href="https://github.com/FreeCAD/FreeCAD-addons">https://github.com/FreeCAD/FreeCAD-addons</a>):
&lt;/translate&gt;
</p>
<ul><li> microelly2</li>
<li> hamish2014</li>
<li> jreinhardt</li>
<li> jmwright</li>
<li> cblt2l</li>
<li> javierMG</li>
<li> looooo</li>
<li> shaise</li>
<li> marmni</li>
<li> Maaphoo</li>
<li> Rentlau</li></ul>
<p>&lt;translate&gt;
&lt;/translate&gt;
</p>
<div style="clear:both"></div>
<p><br />
</p>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Manual/sv&amp;oldid=147726">http://www.freecadweb.org/wiki/index.php?title=Manual/sv&amp;oldid=147726</a>"</div>
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
</body></html>