Surface Sections: Difference between revisions

From FreeCAD Documentation
m (→‎Scripting: small changes)
(Module to Workbench renaming.)
 
(14 intermediate revisions by 4 users not shown)
Line 2: Line 2:
<translate>
<translate>


<!--T:1-->
{{Docnav
|[[Surface_GeomFillSurface|GeomFillSurface]]
|[[Surface_ExtendFace|ExtendFace]]
|[[Surface_Workbench|Surface]]
|IconL=Surface_GeomFillSurface.svg
|IconR=Surface_ExtendFace.svg
|IconC=Workbench_Surface.svg
}}

<!--T:2-->
{{GuiCommand
{{GuiCommand
|Name=Surface Sections
|Name=Surface Sections
|MenuLocation=Surface → Sections...
|MenuLocation=Surface → Sections
|Workbenches=[[Surface_Module|Surface]]
|Workbenches=[[Surface_Workbench|Surface]]
|Version=0.19
|Version=0.19
}}
}}


==Description==
==Description== <!--T:3-->


<!--T:4-->
[[Surface_Sections|Surface Sections]] is used to create a surface from edges that represent transversal sections of a surface.
{{Button|[[File:Surface_Sections.svg|16px]] [[Surface_Sections|Surface Sections]]}} is used to create a surface from edges that represent transversal sections of a surface.


</translate>
</translate>
Line 17: Line 29:
<translate>
<translate>


<!--T:5-->
{{Caption|Left: control edges (transversal sections). Right: surface produced from these edges.}}
{{Caption|Left: control edges (transversal sections). Right: surface produced from these edges.}}


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


<!--T:7-->
# Make sure you have at lease two edges or curves in space. For example, these can be created with tools of the [[File:Workbench_Draft.svg|24px]] [[Draft_Module|Draft Workbench]] or the [[File:Workbench_Sketcher.svg|24px]] [[Sketcher_Workbench|Sketcher]].
# Make sure you have at lease two edges or curves in space. For example, these can be created with tools of the [[File:Workbench_Draft.svg|24px]] [[Draft_Workbench|Draft Workbench]] or the [[File:Workbench_Sketcher.svg|24px]] [[Sketcher_Workbench|Sketcher]].
# Press the {{Button|[[File:Surface_Sections.svg|16px]] [[Surface_Sections|Surface sections]]}} button.
# Press the {{Button|[[File:Surface_Sections.svg|16px]] [[Surface_Sections|Surface sections]]}} button.
# Press {{Button|Add edge}}.
# Press {{Button|Add edge}}.
Line 27: Line 41:
# Press {{Button|OK}} to complete the operation.
# Press {{Button|OK}} to complete the operation.


== Options ==
== Options == <!--T:8-->


<!--T:9-->
* {{Button|Add edge}}: press once to start picking edges in the [[3D_view|3D view]]. Individual lines such as {{Button|[[File:Draft_BSpline.svg|16px]] [[Draft_BSpline|Draft BSplines]]}} and {{Button|[[File:Sketcher_CreateBSpline.svg|16px]] [[Sketcher_CreateBSpline|Sketcher BSplines]]}} can be chosen, as well as any edge from solid objects, like those of {{Button|[[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|PartDesign Bodies]]}} and {{Button|[[File:Part_Primitives.svg|16px]] [[Part_Primitives|Part Primitives]]}}.
* {{Button|Add edge}}: press once to start picking edges in the [[3D_view|3D view]]. Individual lines such as {{Button|[[File:Draft_BSpline.svg|16px]] [[Draft_BSpline|Draft BSplines]]}} and {{Button|[[File:Sketcher_CreateBSpline.svg|16px]] [[Sketcher_CreateBSpline|Sketcher BSplines]]}} can be chosen, as well as any edge from solid objects, like those of {{Button|[[File:PartDesign_Body.svg|16px]] [[PartDesign_Body|PartDesign Bodies]]}} and {{Button|[[File:Part_Primitives.svg|16px]] [[Part_Primitives|Part Primitives]]}}.
* {{Button|Remove edge}}: press once to start picking edges in the [[3D_view|3D view]]; these must edges that were previously selected to create the surface.
* {{Button|Remove edge}}: press once to start picking edges in the [[3D_view|3D view]]; these must be edges that were previously picked with {{Button|Add edge}}.
* {{KEY|Right mouse button}}: open the context menu and select {{Button|Remove}}, or press {{KEY|Del}} in the keyboard, to remove the currently selected edge in the list.
* {{KEY|Right mouse button}}: open the context menu and select {{Button|Remove}}, or press {{KEY|Del}} in the keyboard, to remove the currently selected edge in the list.
* {{MenuCommand|Drag}}: drag the currently selected element in the list in order to change the order in which it will be processed; the list is processed from top to bottom.
* {{MenuCommand|Drag}}: drag the currently selected element in the list in order to change the order in which it will be processed; the list is processed from top to bottom.
* Press {{Button|Cancel}} or {{KEY|Esc}} to abort the current operation.
* Press {{Button|Cancel}} or {{KEY|Esc}} to abort the current operation.


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


<!--T:11-->
=== Data ===
A [[Surface_Sections|Surface Sections]] ({{incode|Surface::Sections}} class) is derived from the basic [[Part_Feature|Part Feature]] ({{incode|Part::Feature}} class, through the {{incode|Part::Spline}} subclass), therefore it shares all the latter's properties.


<!--T:12-->
In addition to the properties described in [[Part_Feature|Part Feature]], the Surface Sections has the following properties in the [[property_editor|property editor]].

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

<!--T:14-->
{{TitleProperty|Sections}}
{{TitleProperty|Sections}}
* {{PropertyData|NSections|LinkSubList}}: a list of edges that will be used to build the curve.


<!--T:15-->
=== View ===
* {{PropertyData|NSections|LinkSubList}}: a list of edges that will be used to build the surface.


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

<!--T:17-->
{{TitleProperty|Base}}
{{TitleProperty|Base}}

<!--T:18-->
* {{PropertyView|Control Points|Bool}}: it defaults to {{FALSE}}; if set to {{TRUE}}, it will show an overlay with the control points of the surface.
* {{PropertyView|Control Points|Bool}}: it defaults to {{FALSE}}; if set to {{TRUE}}, it will show an overlay with the control points of the surface.


== Twisting of the surface == <!--T:23-->
== Scripting ==

<!--T:24-->
The shape of the surface depends on the direction of the chosen edges; if edges are selected and the result is a surface that "twists" on itself, one of the edges may need its list of vertices in the reverse order. See the information in {{Button|[[File:Surface_GeomFillSurface.svg|16px]] [[Surface_GeomFillSurface|GeomFillSurface]]}} for a more complete explanation.

</translate>
[[File:Surface_twisting_example_smooth.png|330px]] [[File:Surface_twisting_example_twisted.png|330px]]
<translate>

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


<!--T:20-->
{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].
{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]].


<!--T:21-->
The Surface Sections tool can be used in [[macros|macros]] and from the [[Python|Python]] console by adding the {{incode|Surface::Sections}} object. The edges to be used to define the surface must be assigned as a [[LinkSubList|LinkSubList]] to the {{incode|NSections}} property of the object.
The Surface Sections tool can be used in [[macros|macros]] and from the [[Python|Python]] console by adding the {{incode|Surface::Sections}} object.
* The edges to be used to define the surface must be assigned as a [[LinkSubList|LinkSubList]] to the {{incode|NSections}} property of the object.
* All objects with edges need to be computed before they can be used as input for the properties of the Sections object.


</translate>
</translate>
Line 86: Line 126:
}}
}}
<translate>
<translate>


<!--T:22-->
{{Docnav
|[[Surface_GeomFillSurface|GeomFillSurface]]
|[[Surface_ExtendFace|ExtendFace]]
|[[Surface_Workbench|Surface]]
|IconL=Surface_GeomFillSurface.svg
|IconR=Surface_ExtendFace.svg
|IconC=Workbench_Surface.svg
}}


</translate>
</translate>
{{Surface Tools navi{{#translation:}}}}
{{Surface Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 14:20, 16 August 2021

Other languages:

Surface Sections

Menu location
Surface → Sections
Workbenches
Surface
Default shortcut
None
Introduced in version
0.19
See also
None

Description

Surface Sections is used to create a surface from edges that represent transversal sections of a surface.

Left: control edges (transversal sections). Right: surface produced from these edges.

Usage

  1. Make sure you have at lease two edges or curves in space. For example, these can be created with tools of the Draft Workbench or the Sketcher.
  2. Press the Surface sections button.
  3. Press Add edge.
  4. Use the pointer to pick the desired edges in the 3D view; a preview of the final shape will be shown after selecting two valid edges.
  5. Press OK to complete the operation.

Options

  • Add edge: press once to start picking edges in the 3D view. Individual lines such as Draft BSplines and Sketcher BSplines can be chosen, as well as any edge from solid objects, like those of PartDesign Bodies and Part Primitives.
  • Remove edge: press once to start picking edges in the 3D view; these must be edges that were previously picked with Add edge.
  • Right mouse button: open the context menu and select Remove, or press Del in the keyboard, to remove the currently selected edge in the list.
  • Drag: drag the currently selected element in the list in order to change the order in which it will be processed; the list is processed from top to bottom.
  • Press Cancel or Esc to abort the current operation.

Properties

A Surface Sections (Surface::Sections class) is derived from the basic Part Feature (Part::Feature class, through the Part::Spline subclass), therefore it shares all the latter's properties.

In addition to the properties described in Part Feature, the Surface Sections has the following properties in the property editor.

Data

Sections

  • DataNSections (LinkSubList): a list of edges that will be used to build the surface.

View

Base

  • ViewControl Points (Bool): it defaults to false; if set to true, it will show an overlay with the control points of the surface.

Twisting of the surface

The shape of the surface depends on the direction of the chosen edges; if edges are selected and the result is a surface that "twists" on itself, one of the edges may need its list of vertices in the reverse order. See the information in GeomFillSurface for a more complete explanation.

Scripting

See also: FreeCAD Scripting Basics.

The Surface Sections tool can be used in macros and from the Python console by adding the Surface::Sections object.

  • The edges to be used to define the surface must be assigned as a LinkSubList to the NSections property of the object.
  • All objects with edges need to be computed before they can be used as input for the properties of the Sections object.
import FreeCAD as App
import Draft

doc = App.newDocument()

pl1 = App.Placement()
obj1 = Draft.make_circle(50, placement=pl1, face=False, startangle=0, endangle=180)

pl2 = App.Placement(App.Vector(0, 0, 25), App.Rotation())
obj2 = Draft.make_circle(30, placement=pl2, face=False, startangle=0, endangle=180)

points3 = [App.Vector(18, -10, 50),
           App.Vector(12, 10, 50),
           App.Vector(-12, 10, 50),
           App.Vector(-18, -10, 50)]
obj3 = Draft.make_bspline(points3)

points4 = [App.Vector(15, -20, 100),
           App.Vector(0, 6, 100),
           App.Vector(-15, -20, 100)]
obj4 = Draft.make_bspline(points4)
doc.recompute()

surf = doc.addObject("Surface::Sections", "Surface")
surf.NSections = [(obj1, "Edge1"),
                  (obj2, "Edge1"),
                  (obj3, "Edge1"),
                  (obj4, "Edge1")]
doc.recompute()