Part TopoShape/it: Difference between revisions

From FreeCAD Documentation
(Created page with "In particolare, l'oggetto base che gestisce questi tipi di forme è la Part Feature (classe {{incode|Part::Feature}}). Tutti gli oggetti derivati da questa...")
(Created page with "Alcuni degli oggetti più importanti con Part TopoShape sono i seguenti: * Qualsiasi solido primitivo creato con Part. * Qualsiasi PartDesign_Body/it|...")
Line 18: Line 18:
In particolare, l'oggetto base che gestisce questi tipi di forme è la [[Part_Feature/it|Part Feature]] (classe {{incode|Part::Feature}}). Tutti gli oggetti derivati da questa classe avranno accesso a una Part TopoShape.
In particolare, l'oggetto base che gestisce questi tipi di forme è la [[Part_Feature/it|Part Feature]] (classe {{incode|Part::Feature}}). Tutti gli oggetti derivati da questa classe avranno accesso a una Part TopoShape.


Some of the most important objects with Part TopoShape are the following:
Alcuni degli oggetti più importanti con Part TopoShape sono i seguenti:
* Any primitive solid created with the [[Part_Workbench|Part Workbench]].
* Qualsiasi solido primitivo creato con [[Part_Workbench/it|Part]].
* Any [[PartDesign_Body|PartDesign Body]] and [[PartDesign_Feature|PartDesign Feature]] created with the [[PartDesign_Workbench|PartDesign Workbench]].
* Qualsiasi [[PartDesign_Body/it|Corpo di PartDesign]] e [[PartDesign_Feature/it|PartDesign Feature]] creati con [[PartDesign_Workbench/it|PartDesign]].
* Any object derived from [[Part_Part2DObject|Part Part2DObject]], like most objects created with the [[Draft_Workbench|Draft Workbench]].
* Qualsiasi oggetto derivato da [[Part_Part2DObject/it|Part Part2DObject]], come la maggior parte degli oggetti creati con [[Draft_Workbench/it|Draft]].
* Any [[Sketch|sketch]], that is, [[Sketcher_SketchObject|Sketcher SketchObject]], created with the [[Sketcher_Workbench|Sketcher Workbench]].
* Qualsiasi [[Sketch/it|schizzo]], cioè, [[Sketcher_SketchObject/it|Sketcher SketchObject]], creato con [[Sketcher_Workbench/it|Sketcher]].
* Any object created by importing a STEP, BREP, and similar solid format files.
* Qualsiasi oggetto creato importando uno STEP, BREP e file simili in formato solido.


== Scripting ==
== Scripting ==

Revision as of 20:47, 2 June 2020

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.

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:

Scripting

See also: FreeCAD Scripting Basics, and scripted objects.

All objects derived from Part::Feature will have a Part TopoShape, which is normally accessible from its Shape attribute.

import FreeCAD as App

doc = App.newDocument()
obj = App.ActiveDocument.addObject("Part::Box", "Box")
print(obj.Shape)

A TopoShape has many attributes (variables) and methods that contain information about it, and which allow doing operations with it. These variables and methods can be tested in the Python console.

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")

For a full list of attributes and methods, consult the source documentation, and the Std PythonHelp tool.