Part Tube: Difference between revisions

From FreeCAD Documentation
(Undo revision 1222498 by David69 (talk)The Part_Tube command works differently. You can specify the dimensions in the initial task panel.)
Tag: Undo
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{UnfinishedDocu{{#translation:}}}}
<translate>
<translate>


Line 19: Line 18:
|Workbenches=[[Part_Workbench|Part]]
|Workbenches=[[Part_Workbench|Part]]
|Version=0.19
|Version=0.19
|SeeAlso=[[Part_CreatePrimitives|Part CreatePrimitives]]
|SeeAlso=[[Part_Primitives|Part Primitives]]
}}
}}


Line 25: Line 24:


<!--T:4-->
<!--T:4-->
The [[Image:Part_Tube.svg|24px]] [[Part_Tube|Part Tube]] command creates a parametric tube solid. In the coordinate system defined by its {{PropertyData|Placement}} property, the bottom face of the tube lies on the XY plane with its center at the origin.
The [[Image:Part_Tube.svg|24px]] '''Part Tube''' command creates a parametric tube solid. In the coordinate system defined by its {{PropertyData|Placement}} property, the bottom face of the tube lies on the XY plane with its center at the origin.


</translate>
</translate>
Line 32: Line 31:


==Usage== <!--T:6-->
==Usage== <!--T:6-->

=== Create === <!--T:15-->


<!--T:7-->
<!--T:7-->
# There are several ways to invoke the command:
# There are several ways to invoke the command:
#* Press the {{Button|[[Image:Part_Tube.svg|16px]] [[Part Tube|Tube]]}} button.
#* Press the {{Button|[[Image:Part_Tube.svg|16px]] [[Part_Tube|Part Tube]]}} button.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Tube.svg|16px]] Tube}} option from the menu.
#* Select the {{MenuCommand|Part → Primitives → [[Image:Part_Tube.svg|16px]] Create tube}} option from the menu.
# The {{MenuCommand|Tube}} task panel opens and a preview of the tube is displayed in the [[3D_view|3D view]].
# Specify the dimensions.
# The preview is dynamically updated.
# Press the {{Button|OK}} button.
# The tube is created.
# Optionally change the {{PropertyData|Placement}} of the tube in the [[Property_editor|Property editor]], or with the [[Image:Std_TransformManip.svg|16px]] [[Std_TransformManip|Std TransformManip]] command.

=== Edit === <!--T:16-->


<!--T:17-->
== Example ==
# Double-click the tube in the [[Tree_view|Tree view]]
# The {{MenuCommand|Tube}} task panel opens.
# Change one or more dimensions.
# The tube is dynamically updated in the [[3D_view|3D view]].
# Press the {{Button|OK}} button.


== Example == <!--T:18-->
[[File:Part Tube Scripting Example.png|thumb|Part Tube scripting example.]]


<!--T:19-->
A Part Tube object with the values of the bottom scripting example are shown here.
[[Image:Part_Tube_Scripting_Example.png|thumb|Part Tube from the scripting example]]

<!--T:20-->
A Part Tube object created with the [[#Scripting|scripting example]] below is shown here.


==Properties== <!--T:9-->
==Properties== <!--T:9-->


<!--T:21-->
See also: [[Property_editor|Property editor]].
See also: [[Property_editor|Property editor]].


<!--T:22-->
A Part Tube object is derived from a [[Part_Feature|Part Feature]] object and inherits all its properties. It also has the following additional properties:
A Part Tube object is derived from a [[Part_Feature|Part Feature]] object and inherits all its properties. It also has the following additional properties:


=== Data ===
=== Data === <!--T:23-->


<!--T:24-->
{{TitleProperty|Attachment}}
{{TitleProperty|Attachment}}


<!--T:25-->
The object has the same attachment properties as a [[Part_Part2DObject#Data|Part Part2DObject]].
The object has the same attachment properties as a [[Part_Part2DObject#Data|Part Part2DObject]].


<!--T:26-->
{{TitleProperty|Tube}}
{{TitleProperty|Tube}}


Line 64: Line 87:


== Scripting == <!--T:12-->
== Scripting == <!--T:12-->

<!--T:27-->
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation], [[Part_scripting|Part scripting]] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:13-->
<!--T:13-->
A Part Tube can be created with the following code from the {{Incode|CommandShapes.py}} file:
A Part Tube can be created with the {{Incode|addTube()}} method ({{Version|0.20}}) of the Shapes module:


</translate>
</translate>
{{Code|code=
{{Code|code=
tube = Shapes.addTube(FreeCAD.ActiveDocument, "myTube")
from BasicShapes import Shapes
from BasicShapes import ViewProviderShapes

tube = FreeCAD.ActiveDocument.addObject("Part::FeaturePython", "myTube")

Shapes.TubeFeature(tube)
ViewProviderShapes.ViewProviderTube(tube.ViewObject)
}}
}}
<translate>
<translate>


<!--T:14-->
<!--T:14-->
* Where {{Incode|myTube}} is the name for the object. The name must be unique for the entire document.
* Where {{Incode|"myTube"}} is the name for the object.
* The function returns the newly created object.
* The function returns the newly created object.


<!--T:28-->
You have to [[Std Refresh|recompute]] the current document with
Example:


</translate>
{{Code|code=
{{Code|code=
import FreeCAD as App
App.activeDocument().recompute(None,True,True)
from BasicShapes import Shapes
}}


doc = App.activeDocument()
to see the tube.


tube = Shapes.addTube(FreeCAD.ActiveDocument, "myTube")
The {{Incode|Label}} is the user editable name for the object. It can be easily changed by

</translate>
{{Code|code=
tube.Label = "new myTubeName"
}}
<translate>

<!--T:28-->
You can access and modify attributes of the {{Incode|tube}} object. For example, you may wish to modify the length, width and height parameters.

</translate>
{{Code|code=
tube.Height = 20
tube.Height = 20
tube.InnerRadius = 2
tube.InnerRadius = 2
tube.OuterRadius = 3
tube.OuterRadius = 3
tube.Placement = App.Placement(App.Vector(2, 4, 5), App.Rotation(60, 60, 30))
}}
<translate>


doc.recompute()
<!--T:31-->
You can change its placement with:

</translate>
{{Code|code=
tube.Placement = FreeCAD.Placement(FreeCAD.Vector(1, 2, 3), FreeCAD.Rotation(60, 60, 30))
}}
}}
<translate>
<translate>
Line 132: Line 136:


</translate>
</translate>
{{Part Tools navi{{#translation:}}}}
{{Part_Tools_navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 11:40, 21 January 2023

Part Tube

Menu location
Part → Primitives → Create tube
Workbenches
Part
Default shortcut
None
Introduced in version
0.19
See also
Part Primitives

Description

The Part Tube command creates a parametric tube solid. In the coordinate system defined by its DataPlacement property, the bottom face of the tube lies on the XY plane with its center at the origin.

Usage

Create

  1. There are several ways to invoke the command:
    • Press the Part Tube button.
    • Select the Part → Primitives → Create tube option from the menu.
  2. The Tube task panel opens and a preview of the tube is displayed in the 3D view.
  3. Specify the dimensions.
  4. The preview is dynamically updated.
  5. Press the OK button.
  6. The tube is created.
  7. Optionally change the DataPlacement of the tube in the Property editor, or with the Std TransformManip command.

Edit

  1. Double-click the tube in the Tree view
  2. The Tube task panel opens.
  3. Change one or more dimensions.
  4. The tube is dynamically updated in the 3D view.
  5. Press the OK button.

Example

Part Tube from the scripting example

A Part Tube object created with the scripting example below is shown here.

Properties

See also: Property editor.

A Part Tube object is derived from a Part Feature object and inherits all its properties. It also has the following additional properties:

Data

Attachment

The object has the same attachment properties as a Part Part2DObject.

Tube

  • DataHeight (Length): The height of the tube. The default is 10mm.
  • DataInner Radius (Length): The inner radius of the tube. Must be smaller than DataOuter Radius. Can be 0. The default is 2mm.
  • DataOuter Radius (Length): The outer radius of the tube. Must be larger than DataInner Radius. The default is 5mm.

Scripting

See also: Autogenerated API documentation, Part scripting and FreeCAD Scripting Basics.

A Part Tube can be created with the addTube() method (introduced in version 0.20) of the Shapes module:

tube = Shapes.addTube(FreeCAD.ActiveDocument, "myTube")
  • Where "myTube" is the name for the object.
  • The function returns the newly created object.

Example:

import FreeCAD as App
from BasicShapes import Shapes

doc = App.activeDocument()

tube = Shapes.addTube(FreeCAD.ActiveDocument, "myTube")
tube.Height = 20
tube.InnerRadius = 2
tube.OuterRadius = 3
tube.Placement = App.Placement(App.Vector(2, 4, 5), App.Rotation(60, 60, 30))

doc.recompute()