|
Part |
| Umístění Menu |
|---|
| Žádné |
| Pracovní stoly |
| Všechny |
| Výchozí zástupce |
| Nikdo |
| Představen ve verzi |
| 0.17 |
| Viz také |
| Group, PartDesign Tělo |
Díl (interně označovaný jako App Part) je univerzální kontejner, který sdružuje skupinu objektů tak, aby je bylo možné ve 3D zobrazení přesouvat jako jeden celek.
Objekt Díl byl vyvinut jako základní stavební prvek pro vytváření mechanických sestav. Je určen zejména k uspořádání objektů, které mají Part TopoShape, jako jsou Part Základní tvary, PartDesign Těla a další Part Features. Objekt Díl poskytuje objekt Počátek s lokálními osami X, Y a Z a standardními rovinami, které lze použít jako referenci pro umístění obsažených objektů. Kromě toho lze objekty Díl vnořit do jiných objektů Díl a vytvořit tak velkou sestavu z menších podsestav.
Ačkoli je Díl určen především pro pevná tělesa, lze ho použít ke správě jakéhokoli objektu, který má vlastnost Umístění, takže může obsahovat také sítové prvky, náčrtky a další objekty odvozené od třídy App GeoFeature.
Nezaměňujte PartDesign Tělo s
Dílem. První z nich je specifický objekt používaný v
Pracovním postředí PartDesign, určený k modelování objektu pomocí PartDesign Prvků. Naopak Díl se nepoužívá k modelování, ale pouze k uspořádání objektů v prostoru za účelem vytvoření sestav.
Nástroj Díl není vázán na konkrétní pracovní prostředí, ale je součástí základního systému, a proto se nachází na panelu nástrojů Struktura, který je k dispozici ve všech pracovních prostředích. Chcete-li libovolně seskupit objekty bez ohledu na jejich polohu, použijte Skupina. Tento objekt nemá vliv na umístění prvků, které obsahuje, je to pouze složka pro uspořádání stromového zobrazení.
Vlevo: prvky uvnitř standardní součásti ve stromovém zobrazení. Vpravo: objekty umístěné v prostoru, vztažené k počátku standardní součásti.
Díl, interně označovaný jako App Part (třída App::Part), je odvozen od App GeoFeature (třída App::GeoFeature) a přebírá téměř všechny jeho vlastnosti. Má také několik dalších vlastností. Jedná se zejména o vlastnosti, které mu pomáhají spravovat informace v kontextu sestavy, například ÚdajeType, ÚdajeId, ÚdajeLicense, ÚdajeLicenseURL a ÚdajeGroup.
Toto jsou vlastnosti dostupné v okně vlastností. Skryté vlastnosti lze zobrazit pomocí příkazu Zobrazit skryté v kontextovém menu okna vlastností.
Vysvětlení některých níže uvedených vlastností najdete v sekci Vlastnosti součásti.
Base
String): a description for this object. By default, it is an empty string "".Link): the material for this object.Map): map with additional meta information. By default, it is empty {}.String): an identification or part number for this object. By default, it is an empty string "".UUID): the universally unique identifier (UUID) (128-bit number) of the object. This is assigned at creation time.String): a field to specify the license for this object. By default, it is an empty string "".String): a field to specify the web address to the license or contract for this object. By default, it is an empty string "".Color): a tuple of four floating point RGBA values to define the color of the object.Placement)String)String)String)ExpressionEngine)Bool)Link): the App Origin object that is the positional reference for all elements listed in ÚdajeGroup.LinkList): a list of referenced objects. By default, it is empty [].Bool): whether the group is touched or not.Part
ShapeCache): Shape cache. Not available if ÚdajeGroup is empty.Base
Placement)Display Options
Enumeration): Group.Bool)Bool)Selection
Enumeration)Enumeration)An open document can contain multiple Parts. But only one Part can be active. The active Part is displayed in the Tree View with the background color specified by the Active container object value in the Preferences Editor. It will also be shown with bold text.
To activate or de-activate a Part:
Document with two Std Parts, of which the second one is active.
The Origin consists of the three standard axes (X, Y, Z) and three standard planes (XY, XZ and YZ). Sketches and other objects can be attached to these elements when creating them.
Left: Part Origin in the Tree View. Right: representation of the Origin elements in the 3D View.
Note: the Origin is an App Origin object (App::Origin class), while the axes and planes are objects of type App::Line and App::Plane respectively. Each of these elements can be hidden and unhidden individually with the Space bar; this is useful to choose the correct reference when creating other objects.
Note 2: all elements inside the Part are referenced to the Part's Origin which means that the Part can be moved and rotated in reference to the global coordinate system without affecting the placement of the elements inside.
The Part's visibility supersedes the visibility of any object it contains. If the Part is hidden, the objects it contains will be hidden as well, even if their individual PohledVisibility property is set to true. If the Part is visible, then each object's PohledVisibility determines whether the object is shown or not.
The visibility of the Std Part determines whether the objects grouped under it are shown in the 3D View or not. Left: the Part is hidden, so none of the objects will be shown in the 3D View. Right: the Part is visible, so each object controls its own visibility.
See also: FreeCAD Scripting Basics and scripted objects.
See Part Feature for the general information on adding objects to the document.
A Std Part (App Part) is created with the addObject() method of the document. Once a Part exists, other objects can be added to it with the addObject() or addObjects() methods.
import FreeCAD as App
doc = App.newDocument()
part = App.ActiveDocument.addObject("App::Part", "Part")
obj1 = App.ActiveDocument.addObject("PartDesign::Body", "Body")
obj2 = App.ActiveDocument.addObject("Part::Box", "Box")
part.addObjects([obj1, obj2])
App.ActiveDocument.recompute()
You cannot create a scripted App::Part. However, you can add App::Part behavior to a scripted Part::FeaturePython object by using the following code:
class MyGroup(object):
def __init__(self, obj=None):
self.Object = obj
if obj:
self.attach(obj)
def dumps(self):
return
def loads(self, _state):
return
def attach(self, obj):
obj.addExtension("App::OriginGroupExtensionPython")
obj.Origin = FreeCAD.ActiveDocument.addObject("App::Origin", "Origin")
def onDocumentRestored(self, obj):
self.Object = obj
class ViewProviderMyGroup(object):
def __init__(self, vobj=None):
if vobj:
vobj.Proxy = self
self.attach(vobj)
else:
self.ViewObject = None
def attach(self, vobj):
vobj.addExtension("Gui::ViewProviderOriginGroupExtensionPython")
self.ViewObject = vobj
def dumps(self):
return None
def loads(self, _state):
return None
App.ActiveDocument.addObject("Part::FeaturePython",
"Group",
MyGroup(),
ViewProviderMyGroup(),
True)