Part TopoShape
Introduzione
Una Part TopoShape, o formalmente una Part::TopoShape, è una classe che definisce una "forma topologica" parametrica nel software. Gli oggetti del documento che mostrano qualcosa nella Vista 3D normalmente hanno una TopoShape.
Le forme topologiche, così come i loro metodi, sono definiti dal kernel OpenCASCADE Technology (OCCT). FreeCAD usa queste forme e crea dei App DocumentObjects attorno ad esse.
Un altro tipo di classe è quella meshes; questa classe non è molto parametrica perché non può essere ridefinita facilmente se non specificando singoli vertici e superfici triangolari.
A sinistra: Part TopoShape parametrico definito dalle proprietà. A destra: mesh non parametrico, definito da vertici e superfici triangolari.
Diagramma semplificato delle relazioni tra gli oggetti principali del programma. La classe Part::TopoShape è incorporata nell'oggetto Part::Feature e da lì viene propagata a tutti gli oggetti che ne derivano.
Utilizzo
TopoShape è un oggetto assegnato ad alcuni App DocumentObjects.
In particolare, l'oggetto base che gestisce questi tipi di forme è la Part Feature (classe Part::Feature). Tutti gli oggetti derivati da questa classe avranno accesso a una Part TopoShape.
Alcuni degli oggetti più importanti con Part TopoShape sono i seguenti:
- Qualsiasi solido primitivo creato con Part.
- Qualsiasi Corpo di PartDesign e PartDesign Feature creati con PartDesign.
- Qualsiasi oggetto derivato da Part Part2DObject, come la maggior parte degli oggetti creati con Draft.
- Qualsiasi schizzo, cioè, Sketcher SketchObject, creato con Sketcher.
- Qualsiasi oggetto creato importando uno STEP, BREP e file simili in formato solido.
Script
Vedere anche: Script di base per FreeCAD, e script di oggetti.
Tutti gli oggetti derivati da Part::Feature avranno un Part TopoShape, che è normalmente accessibile dal suo attributo Shape.
import FreeCAD as App
doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Box", "Box")
print(obj.Shape)
Un TopoShape ha molti attributi (variabili) e metodi che contengono informazioni su di esso e che consentono di eseguire operazioni con esso. Queste variabili e metodi possono essere testati nella console Python.
print(obj.Shape.Area)
print(obj.Shape.BoundBox)
print(obj.Shape.CenterOfMass)
print(obj.Shape.ShapeType)
obj.Shape.check()
obj.Shape.copy()
obj.Shape.exportStep("my_file.step")
obj.Shape.exportStl("my_file.stl")
Per un elenco completo di attributi e metodi, consultare la documentazione sorgente e lo strumento Documentazione dei moduli Python.
Si può ottenere un rapido riepilogo di tutti i metodi utilizzando la funzione integrata help() di Python.
help(obj.Shape)
- Primitives: Box, Cylinder, Sphere, Cone, Torus, Tube, Create primitives, Shape builder
- Creation and modification: Create sketch, Extrude, Revolve, Mirror, Scale, Fillet, Chamfer, Make face from wires, Ruled Surface, Loft, Sweep, Section, Cross sections, 3D Offset, 2D Offset, Thickness, Projection on surface, Color per face
- Boolean: Make compound, Explode compound, Compound Filter, Boolean, Cut, Union, Intersection, Connect objects, Embed object, Cutout for object, Boolean fragments, Slice apart, Slice to compound, Boolean XOR, Check geometry, Defeaturing
- Other tools: Import CAD file, Export CAD file, Box selection, Create shape from mesh, Create points object from geometry, Convert to solid, Reverse shapes, Create simple copy, Create transformed copy, Create shape element copy, Refine shape, Attachment
- Preferences: Preferences, Fine tuning
- Cuore: App DocumentObject
- Base: App FeaturePython, App GeoFeature, Part Feature, Mesh Feature, Fem FemMeshObject
- Forme interne: Part TopoShape, Mesh MeshObject, Fem FemMesh
- Struttura: App DocumentObjectGroup (Std Group), App Part (Std Part), App Link
- Derivate: Part Part2DObject, Sketcher SketchObject, PartDesign Body, PartDesign Feature
- 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, Assembly, BIM, CAM, Draft, FEM, Inspection, Material, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
- Hubs: User hub, Power users hub, Developer hub