Surface Sections: Difference between revisions
(Surface Sections is used to create a surface from edges that represent transversal sections of surface.) |
(→Scripting: More complete example) |
||
Line 41: | Line 41: | ||
== Scripting == |
== Scripting == |
||
{{Emphasis|See also:}} [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]]. |
|||
The Surface Section 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}} attribute of the object. |
|||
</translate> |
|||
{{Code|code= |
{{Code|code= |
||
import FreeCAD as App |
import FreeCAD as App |
||
import Draft |
import Draft |
||
doc = App.newDocument() |
|||
pl1 = App.Placement() |
pl1 = App.Placement() |
||
Line 51: | Line 58: | ||
obj2 = Draft.make_circle(30, placement=pl2, face=False, startangle=0, endangle=180) |
obj2 = Draft.make_circle(30, placement=pl2, face=False, startangle=0, endangle=180) |
||
points3 = [App.Vector(18, -10, 50), |
|||
App.Vector(12, 10, 50), |
|||
obj3 = Draft.make_rectangle(20, height=20, placement=pl3, face=False) |
|||
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 = doc.addObject("Surface::Sections", "Surface") |
||
surf.NSections = [(obj1, "Edge1"), |
surf.NSections = [(obj1, "Edge1"), |
||
(obj2, "Edge1"), |
|||
(obj3, "Edge1"), |
|||
(obj4, "Edge1")] |
|||
}} |
}} |
||
<translate> |
|||
</translate> |
</translate> |
Revision as of 20:52, 27 September 2020
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 surface.
Left: three control edges. Right: surface produced from these edges.
Usage
- Make sure you have at lease two edges or curves in space.
- Press the Surface sections button.
- Press Add edge.
- Click on the desired edges that you wish to use to create the surface; a preview of the final result will be produced on the 3D view.
- Press OK to complete the operation.
Properties
Data
Sections
- DataNSections (
LinkSubList
): a list of edges that will be used to build the curve.
View
Base
- ViewControl Points (
Bool
): it defaults tofalse
; if set totrue
, it will show an overlay with the control points of the surface.
Scripting
See also: FreeCAD Scripting Basics.
The Surface Section 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
attribute of the 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")]
User documentation
- 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, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web
- Hubs: User hub, Power users hub, Developer hub