Part Module/cs: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 118: | Line 118: | ||
* [[Image:Part_CheckGeometry.svg|32px]] [[Part CheckGeometry|Check geometry]]: Checks the geometry of selected objects for errors. |
* [[Image:Part_CheckGeometry.svg|32px]] [[Part CheckGeometry|Check geometry]]: Checks the geometry of selected objects for errors. |
||
=== |
=== Context menu items === |
||
*[[Std_SetAppearance|Appearance]]: determines appearance of the whole part (color transparency etc.). |
*[[Std_SetAppearance|Appearance]]: determines appearance of the whole part (color transparency etc.). |
||
Line 129: | Line 129: | ||
* [[Image:Preferences-import-export.svg|32px]] [[Import_Export_Preferences|Import Export Preferences]]: preferences available for importing from and exporting to different file formats. |
* [[Image:Preferences-import-export.svg|32px]] [[Import_Export_Preferences|Import Export Preferences]]: preferences available for importing from and exporting to different file formats. |
||
* [[Fine-tuning]]: some extra parameters to fine-tune Part behavior. |
* [[Fine-tuning]]: some extra parameters to fine-tune Part behavior. |
||
<div class="mw-translate-fuzzy"> |
|||
=== Vysvětlení pojmů === |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
V terminologii OpenCasCade odlišujeme geometrické primitivy a (topologické) tvary. Geometrický primitiv může být bod, linka, kružnice, rovina atd. nebo i komplexnější typy jako je B-Spline (aproximační) křivka nebo plocha. Topologický tvar může být vrchol, hrana, drát, povrch, těleso nebo složenina z jiných tvarů. Geometrické primitivy nejsou určeny k přímému zobrazení ve 3D zobrazení, ale hlavně k použití jako stavební prvek pro 3D tvary. Například hrana může být zkonstruována z linky nebo z části kružnice. |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Souhrnně se dá říct, že geometrické primitivy jsou "beztvaré" stavební bloky. A tvary jsou prostorové konstrukce na prvcích vystavěné. |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Jejich kompletní seznam je na [http://www.opencascade.org/org/doc/ OCC documentation] (Alternativně: [http://opencascade.sourcearchive.com/documentation/6.3.0.dfsg.1-1/classes.html sourcearchive.com]) a hledání textů '''Geom_*''' (pro geometrické primitivy) a '''TopoDS_*''' (pro tvary). Můžete se tam také dočíst o rozdílech mezi geometrickými primitivy a tvary. Všimněte si také, prosím, že naneštěstí oficiální OCC dokumentace není dostupná online (musíte si stáhnout archiv) a je hlavně určena pro programátory a ne pro koncové uživatele. Ale pro začátek naštěstí najdete dost informací zde. |
|||
</div> |
|||
<blockquote style="color: slategray">''At a very high level, topology tells what pieces an object is made of, and the logical relationships between them. A shape is made of a certain set of faces. A face is bounded by a certain set of edges. Two faces are adjacent if they share a common edge.''</blockquote> |
|||
<blockquote style="color: slategray">''Topology alone does not tell you the size, curvature, or 3D locations of any of those pieces. However, each piece of topology does knows about it's underlying geometry. A face knows what surface it lies on. An edge knows what curve it lies on. The geometry knows about curvature and location in space.'' - [https://www.opencascade.com/content/geometry-and-topology Source]</blockquote> |
|||
<hr /> |
|||
<blockquote style="color: slategray">''Thus, Topology defines the relationship between simple geometric entities, which can be linked together to represent complex shapes.'' - [https://www.opencascade.com/doc/occt-7.0.0/overview/html/occt_user_guides__modeling_data.html Modeling Data User's Guide]</blockquote> |
|||
[[File:ClassTopoDS_Shape_inherit_graph.png]] |
|||
<div class="mw-translate-fuzzy"> |
|||
Geometrické typy mohou být rozděleny do dvou hlavních skupin: linky a povrchy. Nad linkami (přímka, kružnice,...) můžete přímo budovat hrany, na plochách (rovina, válec, ...) zase povrchy. Například základní přímka je nekonečná, tj. je definována základním vektorem a směrovým vektorem, zatímco jeho tvarová reprezentace musí být nějak omezena počátečním a koncovým bodem. A kvádr -- těleso -- může být vytvořeno šesti omezenými rovinami. |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Z hran nebo povrchů se můžete také vrátit k jeho původním geometrickým primitivům. |
|||
</div> |
|||
<div class="mw-translate-fuzzy"> |
|||
Tudíž, z tvarů můžete stavět velmi komplexní díly nebo opačně odebírat všechny poddíly pro vytváření ještě komplexnějších dílů. |
|||
</div> |
|||
Thus, out of shapes you can build very complex parts or, the other way round, extract all sub-shapes a more complex shape is made of. |
|||
[[File:Part_TopoShape_relationships.svg|600px]] |
|||
{{Caption|The {{incode|Part::TopoShape}} class is the geometrical object that is seen on screen. Essentially all workbenches use these [[Part_TopoShape|TopoShapes]] internally to build and display edges, faces, and solids.}} |
|||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
||
Line 179: | Line 134: | ||
</div> |
</div> |
||
See [[Part scripting|Part scripting]]. |
|||
== Tutorials == |
|||
<div class="mw-translate-fuzzy"> |
|||
Hlavní datová struktura použitá v modulu Díl je datový typ |
|||
[http://en.wikipedia.org/wiki/Boundary_representation BRep] z OpenCascade. |
|||
Téměř celý obsah a objektové typy modulu Díl jsou dostupné skriptování v Pythonu. Zahrnuje to geometrické primitivy, jako jsou Linky, Kružnice (nebo Úhly) a celá oblast TopoTvarů, jako jsou Vrcholy, Hrany, Dráty, Plochy, Tělesa a Složeniny. Pro každý z těchto objektů existuje několik metod pro jejich vytváření a pro některé z nich, zvláště pro TopoTvary, jsou dostupné rozšířené operace jako logické sjednocení/rozdíly/průniky. Projděte si obsah modulu Díl jak je popsán na stránce [[FreeCAD Scripting Basics]] abyste jej lépe pochopili. |
|||
</div> |
|||
The most basic object that can be created is a [[Part Feature|Part Feature]], which has a simple {{PropertyData|Placement}} property, and basic properties to define its color and appearance. |
|||
Another simple object used in 2D geometrical objects is [[Part Part2DObject|Part Part2DObject]], which is the base of [[Sketcher_SketchObject|Sketcher SketchObject]] ([[Sketcher Workbench|Sketcher]]), and most [[Draft Workbench|Draft elements]]. |
|||
=== Test script === |
|||
Test the creation of [[Part_Primitives|Part Primitives]] with a script. {{Version|0.19}} |
|||
{{Code|code= |
|||
import parttests.part_test_objects as pto |
|||
pto.create_test_file("example_file") |
|||
}} |
|||
This script is located in the installation directory of the program, and can be examined to see how the basic primitives are built. |
|||
{{Code|code= |
|||
$INSTALL_DIR/Mod/Part/parttests/part_test_objects.py |
|||
}} |
|||
=== Příklady === |
|||
Pro vytvoření přímkového elementu přepněte do konzoly Pythonu a zapište: |
|||
{{Code|code= |
|||
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() |
|||
}} |
|||
Projděme si výše uvedený příklad v Pythonu krok po kroku: |
|||
{{Code|code= |
|||
import Part,PartGui |
|||
doc=App.newDocument() |
|||
}} |
|||
natáhne modul Díl (Part) a vytvoří nový dokument |
|||
{{Code|code= |
|||
l=Part.LineSegment() |
|||
l.StartPoint=(0.0,0.0,0.0) |
|||
l.EndPoint=(1.0,1.0,1.0) |
|||
}} |
|||
přímka je ve skutečnosti přímkový segment, proto má počáteční a koncový bod. |
|||
{{Code|code= |
|||
doc.addObject("Part::Feature","Line").Shape=l.toShape() |
|||
}} |
|||
<div class="mw-translate-fuzzy"> |
|||
Přidá do dokumentu objektový typ Díl (Part) a přiřadí přidanému objektu reprezentaci tvaru přímkového segmentu do vlastnosti 'Tvar' (Shape). Zde je důležité pochopit, že jsme použili geometrický primitiv (Přímka - Part.Line) k vytvoření TopoTvaru ( metoda toShape() ). Do dokumentu mohou být přidávány pouze tvary. Ve FreeCADu jsou geometrické primitivy používány jako "stavební struktury" pro Tvary. |
|||
</div> |
|||
{{Code|code= |
|||
doc.recompute() |
|||
}} |
|||
Aktualizuje dokument. Také připravuje vizuální reprezentaci nového dílu. |
|||
<div class="mw-translate-fuzzy"> |
|||
Všimněte si také, že přímka může být vytvořena přímo zadáním jejího počátečního a koncového bodu v konstruktoru, např. Part.Line(point1,point2) nebo můžeme vytořit obecnou přímku a pak jí dodatečně přiřadit vlastnosti, jako jsme to udělali zde. |
|||
</div> |
|||
A Line can be created also using: |
|||
{{Code|code= |
|||
import FreeCAD |
|||
import Part |
|||
DOC = FreeCAD.newDocument() |
|||
def mycreateLine(pt1, pt2, objName): |
|||
obj = DOC.addObject("Part::Line", objName) |
|||
obj.X1 = pt1[0] |
|||
obj.Y1 = pt1[2] |
|||
obj.Z1 = pt1[2] |
|||
obj.X2 = pt2[0] |
|||
obj.Y2 = pt2[1] |
|||
obj.Z2 = pt2[2] |
|||
DOC.recompute() |
|||
return obj |
|||
line = mycreateLine((0,0,0), (0,10,0), "LineName") |
|||
}} |
|||
Kružnice může být vytvořena podobně: |
|||
{{Code|code= |
|||
import Part |
|||
doc = App.activeDocument() |
|||
c = Part.Circle() |
|||
c.Radius=10.0 |
|||
f = doc.addObject("Part::Feature", "Circle") |
|||
f.Shape = c.toShape() |
|||
doc.recompute() |
|||
}} |
|||
or using: |
|||
{{Code|code= |
|||
import FreeCAD |
|||
import Part |
|||
DOC = FreeCAD.newDocument() |
|||
def mycreateCircle(rad, objName): |
|||
obj = DOC.addObject("Part::Circle", objName) |
|||
obj.Radius = rad |
|||
DOC.recompute() |
|||
return obj |
|||
circle = mycreateCircle(5.0, "CircleName") |
|||
}} |
|||
Znovu si všimněte, že jsme použili kružnici (geometrický primitiv) ke konstrukci tvaru nad ní. Samozřejmě stále zůstává přístup ke geometrii konstrukce, zadáním: |
|||
{{Code|code= |
|||
s = f.Shape |
|||
e = s.Edges[0] |
|||
c = e.Curve |
|||
}} |
|||
Zde si vezmeme tvar(Shape) našeho objektu f, potom si z něho vezmeme seznam hran. V tomto případě to bude jen jedna hrana, protože celý tvar děláme z jedné kružnicem a proto si vezmeme ze seznamu pouze první hranu a z ní její přímku. Každá hrana má přímku, což je geometrický primitiv, na kterém je hrana založena. |
|||
<div class="mw-translate-fuzzy"> |
|||
Chcete-li vědět více jděte na stránku [[Topological data scripting]]. |
|||
</div> |
|||
== Tutorials == |
|||
* [[Import_from_STL_or_OBJ|Import from STL or OBJ]] : How to import STL/OBJ files in FreeCAD |
* [[Import_from_STL_or_OBJ|Import from STL or OBJ]] : How to import STL/OBJ files in FreeCAD |
||
* [[Export_to_STL_or_OBJ|Export to STL or OBJ]] : How to export STL/OBJ files from FreeCAD |
* [[Export_to_STL_or_OBJ|Export to STL or OBJ]] : How to export STL/OBJ files from FreeCAD |
||
* [[Whiffle_Ball_tutorial|Whiffle Ball tutorial]] : How to use the Part Module |
* [[Whiffle_Ball_tutorial|Whiffle Ball tutorial]] : How to use the Part Module |
||
<div class="mw-translate-fuzzy"> |
<div class="mw-translate-fuzzy"> |
Revision as of 11:57, 24 August 2020
CAD možnosti FreeCADu jsou založeny na jádře OpenCasCade. Modul Díl umožňuje FreeCADu přístup a používání objektů a funkcí OpenCasCade. OpenCascade je profesionální CAD jádro, jehož vlastnosti umožňují pokročilou manipulaci s 3D konstrukcemi a objekty. Objekty Díl, narozdíl od objektů Modulu Síť, jsou mnohem komplexnější a proto umožňují mnohem dokonalejší operace, jako jsou logické boolean operace, modifikace historie a parametrické chování.
The objects created with the Part Workbench are relatively simple; they are intended to be used with boolean operations (unions and cuts) in order to build more complex shapes. This modeling paradigm is known as the constructive solid geometry (CSG) workflow, and it was the traditional methodology used in early CAD systems. On the other hand, the PartDesign Workbench provides a more modern workflow to constructing shapes: it uses a parametrically defined sketch, that is extruded to form a basic solid body, which is then modified by parametric transformations (feature editing), until the final object is obtained.
Part objects are more complex than mesh objects created with the Mesh Workbench, as they permit more advanced operations like coherent boolean operations, modifications history, and parametric behaviour.
The Part Workbench is the basic layer that exposes the OCCT drawing functions to all workbenches in FreeCAD.
Nástroje
Nástroje modulu Díl jsou všechny umístěny v menu Díl, který se zobrazí když natáhnete modul Díl.
Primitives
These are tools for creating primitive objects.
- Box: Draws a box by specifying its dimensions
- Cylinder: Draws a cylinder by specifying its dimensions
- Sphere: Draws a sphere by specifying its dimensions
- Cone: Draws a cone by specifying its dimensions
- Torus: Draws a torus (ring) by specifying its dimensions
- Primitives: A tool to add any of the defined geometric primitives.
- Shapebuilder: A tool to create more complex shapes from various parametric geometric primitives
Modifying objects
These are tools for modifying existing objects. They will allow you to choose which object to modify.
- Extrude: Extrudes planar faces of an object
- Revolve: Creates a solid by revolving another object (not solid) around an axis
- Mirror: Mirrors the selected object on a given mirror plane
- Fillet: Fillets (rounds) edges of an object
- Chamfer: Chamfers edges of an object
- Ruled Surface:
- Loft: Lofts from one profile to another
- Sweep: Sweeps one or more profiles along a path
- Offset tools:
- 3D Offset: Constructs a parallel shape at a certain distance from original.
- 2D Offset: Constructs a parallel wire at certain distance from original, or enlarges/shrinks a planar face. introduced in version 0.17
- Thickness: Hollows out a solid, leaving openings next to select faces.
- Projection on surface: Project a logo, text or any face,wire,edge to a surface. With the projection part it is possible to create a solid or wire. introduced in version 0.19
- Compound Tools:
- Make compound: Creates a compound from the selected objects.
- Explode Compound: Tool to split up compounds of shapes
- Compound Filter: The CompoundFilter can be used to extract the individual pieces.
- Boolean: Performs boolean operations on objects
- Union: Fuses (unions) two objects
- Common: Extracts the common (intersection) part of two objects
- Cut: Cuts (subtracts) one object from another
- Join features: smart booleans for walled objects (e.g., pipes) introduced in version 0.16
- Connect: Connects interiors of objects introduced in version 0.16
- Embed: Embeds a walled object into another walled object introduced in version 0.16
- Cutout: Creates a cutout in a wall of an object for another walled object introduced in version 0.16
- Splitting tools: introduced in version 0.17
- Boolean fragments: makes all the pieces that can be obtained by Boolean operations between objects introduced in version 0.17
- Slice a part: tool to split shapes by intersection with other shapes
- Slice: Splits an object into pieces by intersections with another object introduced in version 0.17
- XOR: removes space shared by even number of objects (symmetric version of Cut) introduced in version 0.17
- Defeaturing: introduced in version 0.18
- Section: Creates a section by intersecting an object with a section plane
- Cross sections...: Creates one or more cross-sections through a selected shape
- Attachment: attachment is a utility to attach an object to another one.
Measure
File:Std Measure Menu.png Measure: Allows linear and angular measurement between points, edges, and faces.
- Measure Linear allows you to make linear measurements.
- Measure Angular allows you to make angular measurements.
- Measure Refresh updates the measurements on screen.
- Clear All Clears all measurements.
- Toggle All shows or hides all measurements.
- File:Part Measure Toggle 3d.svg Toggle 3D shows or hides 3D measurements.
- Toggle Delta shows or hides delta measurements.
Other tools
- Import: This tool allows you to add a file *.IGES, *.STEP, *.BREP to the current document.
- Export: This tool allows you to export a part object in a *.IGES, *.STEP, *.BREP file.
- BoxSelection: add to the selection the faces of the shapes that are touches by the rectangular selection. introduced in version 0.19
- Shape from Mesh: Creates a shape object from a mesh object.
- Points from mesh: creates a shape object made of points from the mesh. introduced in version 0.19
- Convert to solid: Converts a shape object to a solid object.
- Reverse shapes: Flips the normals of all faces of the selected object.
- Create a copy:
- Create simple copy: Creates a simple copy of the selected object.
- Create transformed copy: creates a transformed copy of the selected object. introduced in version 0.19
- Create shape element copy: creates a copy from an element (vertex, edge, face) of the selected object. introduced in version 0.19
- Refine shape: Cleans faces by removing unnecessary lines.
- Check geometry: Checks the geometry of selected objects for errors.
- Appearance: determines appearance of the whole part (color transparency etc.).
- Set colors: assigns colors to part faces.
Preferences
- Preferences: preferences available for Part Tools (the Part workbench also uses the PartDesign Preferences).
- Import Export Preferences: preferences available for importing from and exporting to different file formats.
- Fine-tuning: some extra parameters to fine-tune Part behavior.
Skriptování
See Part scripting.
Tutorials
- Import from STL or OBJ : How to import STL/OBJ files in FreeCAD
- Export to STL or OBJ : How to export STL/OBJ files from FreeCAD
- Whiffle Ball tutorial : How to use the Part Module
- Primitives: Box, Cylinder, Sphere, Cone, Torus, Tube, Create primitives, Shape builder
- Creation and modification: Extrude, Revolve, Mirror, Fillet, Chamfer, Make face from wires, Ruled Surface, Loft, Sweep, Section, Cross sections, 3D Offset, 2D Offset, Thickness, Projection on surface, Attachment
- Boolean: Make compound, Explode Compound, Compound Filter, Boolean, Cut, Fuse, Common, Connect, Embed, Cutout, Boolean fragments, Slice apart, Slice, XOR
- Measure: Measure Linear, Measure Angular, Measure Refresh, Clear All, Toggle All, Toggle 3D, Toggle Delta
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub