Draft BSpline/cs: Difference between revisions

From FreeCAD Documentation
(Created page with "Kreslení B-spline křivky")
 
(Updating to match new version of source page)
(37 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
{{GuiCommand|Name=Draft BSpline|Workbenches=[[Draft Module|Draft]], [[Arch Module|Arch]]|MenuLocation=Draft -> BSpline|Shortcut=B S|SeeAlso=[[Draft Wire]]}}
{{Docnav
|[[Draft_Dimension|Dimension]]
|[[Draft_Point|Point]]
|[[Draft_Module|Draft]]
|IconL=Draft_Dimension.svg
|IconR=Draft_Point.svg
|IconC=Workbench_Draft.svg
}}


<div class="mw-translate-fuzzy">
==Description==
{{GuiCommand/cs|Name=Draft BSpline|Name/cs=Draft BSpline|Workbenches=[[Draft Module/cs|Kreslení]], [[Arch Module/cs|Architektura]]|MenuLocation=Draft → BSpline|Shortcut=B S|SeeAlso=[[Draft Wire/cs|Drát]]}}
The BSpline tool creates a [http://en.wikipedia.org/wiki/B-spline B-Spline curve] from several points in the current [[Draft Workingplane|work plane]]. It takes the [[Draft Linestyle|linewidth and color]] previously set on the Tasks tab. The BSpline tool behaves exactly like the [[Draft Wire]] tool.
</div>


==Description==

<div class="mw-translate-fuzzy">
==Popis==
Nástroj B-křivka vytváří [http://en.wikipedia.org/wiki/B-spline B-křivku] z několika bodů v aktuální [[Draft SelectPlane/cs|pracovní rovině]]. Přebírá [[Draft Linestyle/cs|tloušťku čáry a barvu]] předtím nastavenou v záložce nástrojů. Nástroj B-křivka se chová přesně stejně jako nástroj [[Draft Wire/cs|Drát]].
</div>

The BSpline tool behaves like the {{Button|[[File:Draft_Wire.svg|16px]] [[Draft_Wire|Wire]]}} tool, except that each of its segments is curved instead of being a straight line. Use {{Button|[[File:Draft_WireToBSpline.svg|16px]] [[Draft_WireToBSpline|Wire to B-spline]]}} to convert one to the other.

The BSpline tool specifies the exact points through which the curve will go; on the other hand the {{Button|[[File:Draft_BezCurve.svg|16px]] [[Draft_BezCurve|Bezier curve]]}} tool uses {{Emphasis|control points}} to define the direction of the curve. To create exact circular or elliptical curves, use {{Button|[[File:Draft_Arc.svg|16px]] [[Draft_Arc|Arc]]}} and {{Button|[[File:Draft_Ellipse.svg|16px]] [[Draft_Ellipse|Ellipse]]}}.

[[Image:Draft_bspline_example.jpg|400px]]
<div class="mw-translate-fuzzy">
[[Image:Draft_bspline_example.jpg|400px]]
[[Image:Draft_bspline_example.jpg|400px]]
</div>


==How to use==
==Usage==
# Press the {{KEY|[[Image:Draft BSpline.png|16px]] [[Draft BSpline]]}} button, or press {{KEY|B}} then {{KEY|S}} keys
# Click a first point on the 3D view, or type a [[Draft_Coordinates|coordinate]]
# Click additional point on the 3D view, or type a [[Draft_Coordinates|coordinate]]
# Press {{KEY|F}} or {{KEY|C}}, or double-click the last point, or click on the first point to finish or close the spline. If the spline is closed, it will also be a face, even if it appears as wireframe.


<div class="mw-translate-fuzzy">
==Options==
==Použití==
* Press {{KEY|F}} or the {{KEY|[[Image:Draft FinishLine.png|12px]] '''[[Draft_FinishLine|Finish]]'''}} button to finish the spline, leaving it open
# Stiskněte tlačítko {{KEY|[[Image:Draft BSpline.png|16px]] [[Draft BSpline|B-křivka]]}} nebo klávesy {{KEY|B}} potom {{KEY|S}}
* Press {{KEY|C}} or the {{KEY|[[Image:Draft CloseLine.png|12px]] '''[[Draft_CloseLine|Close]]'''}} button or click on the first point to finish the spline, but making it closed by adding a last segment between the last point and the first one.
# Klikněte na první bod ve 3D pohledu nebo zadejte jeho [[Draft_Coordinates|souřadnice]]
* Press {{KEY|X}}, {{KEY|Y}} or {{KEY|Z}} after a point to constrain the next point on the given axis.
# Klikněte na další bod ve 3D pohledu nebo zadejte jeho [[Draft_Coordinates|souřadnice]]
* To enter coordinates manually, simply enter the numbers, then press {{KEY|ENTER}} between each X, Y and Z component.
# Stiskněte klávesu {{KEY|F}} nebo {{KEY|C}} nebo dvojklikněte na poslední bod pro ukončení nebo uzavření křivky. Je-li křivka uzavřena, bude zároveň i povrchem i když se jeví jako drátový model.
* Press {{KEY|R}} or click the checkbox to check/uncheck the {{KEY|'''Relative'''}} button. If relative mode is on, the coordinates of the next point are relative to the last one. If not, they are absolute, taken from the (0,0,0) origin point.
</div>
* Press {{KEY|T}} or click the checkbox to check/uncheck the {{KEY|'''Continue'''}} button. If continue mode is on, the BSpline tool will restart after you finish or close it, allowing you to draw another one without pressing the BSpline button again.
* Press {{KEY|CTRL}} while drawing to force [[Draft_Snap|snapping]] your point to the nearest snap location, independently of the distance.
* Press {{KEY|SHIFT}} while drawing to [[Draft_Constrain|constrain]] your next point horizontally or vertically in relation to the last one.
* Press {{KEY|W}} or press the {{KEY|[[Image:Draft Wipe.png|12px]] '''Wipe'''}} button to remove the existing segments and start the spline from the last point.
* Press {{KEY|CTRL}}+{{KEY|Z}} or press the {{KEY|[[Image:Draft UndoLine.png|12px]] '''[[Draft_UndoLine|Undo]]'''}} button to undo the last point.
* Press {{KEY|I}} or the {{KEY|'''Filled'''}} button to have the spline to appear as a face after it has been closed. This simply sets the View->Property of the Wire to "Flat lines" or "Wireframe", so it can easily be changed later.
* Press {{KEY|ESC}} or the {{KEY|'''Cancel'''}} button to abort the current BSpline command.


The spline can be edited by double clicking on the element in the tree view, or by pressing the {{Button|[[Image:Draft_Edit.svg|16px]] [[Draft Edit|Draft Edit]]}} button. Then you can move the points to a new position, or click {{Button|[[Image:Draft_AddPoint.svg|16px]] [[Draft_AddPoint|add point]]}} or {{Button|[[Image:Draft_DelPoint.svg|16px]] [[Draft_DelPoint|remove point]]}} and then click on the wire to add or remove points.
==Properties==
* {{PropertyData|Closed}}: Specifies if the spline is closed or not
* {{PropertyView|End Arrow}}: Shows an arrow symbol at the last point of the spline, so it can be used as an annotation leader line


<div class="mw-translate-fuzzy">
==Scripting==
==Volby==
The BSpline tool can by used in [[macros]] and from the python console by using the following function:
* Stiskněte klávesu {{KEY|F}} nebo tlačítko {{KEY|[[Image:Draft FinishLine.png|12px]] '''[[Draft_FinishLine|Ukončení]]'''}} pro ukončení křivky bez jejího uzavření
* Stiskněte klávesu {{KEY|C}} nebo tlačítko {{KEY|[[Image:Draft CloseLine.png|12px]] '''[[Draft_CloseLine|Uzavření]]'''}} nebo klikněte na počáteční bod. Tím ukončíte zadávání, ale zároveň se doplní poslední segment křivky, který poslední bod spojí s počátečním bodem.
* Stisknutím klávesy {{KEY|X}}, {{KEY|Y}} nebo {{KEY|Z}} po zadání bodu zajistíte, že následující bod bude ležet na dané ose.
* Pro ruční zadávání souřadnic jednoduše zadávejte čísla a mezi každou komponentou X, Y a Z stiskněte {{KEY|ENTER}}.
* Stiskněte klávesu {{KEY|R}} nebo klikněte/odklikněte zaklikávací políčko {{KEY|'''Relativní'''}}. Je-li nastaven relativní mód jsou souřadnice následujícího bodu relativní k předchozímu bodu. Je-li mód absolutní souřadnice jsou vztaženy k počátečnímu bodu (0,0,0).
* Stiskněte klávesu {{KEY|T}} nebo klikněte/odklikněte zaklikávací políčko {{KEY|'''Pokračovat'''}}. Je-li nastaven pokračovací mód, nástroj B-křivka bude po ukončení křivky restartován a připraven ke kreslení další křivky bez nutnosti znovu jej spouštět klikáním na tlačítko B-křivka.
* Stiskněte při kreslení klávesu {{KEY|CTRL}} pro [[Draft_Snap|přichycení]] Vašeho bodu k nejbližšímu uchopovacímu místu, nezávisle na vzdálenosti od něho.
* Stiskněte při kreslení klávesu {{KEY|SHIFT}} pro nastavení [[Draft_Constrain|vazby]] Vašeho dalšího bodu vodorovně nebo svisle v relaci k předchozímu bodu.
* Stiskněte klávesu {{KEY|W}} nebo stiskněte tlačítko {{KEY|[[Image:Draft Wipe.png|12px]] '''Smaž'''}} pro odstranění existujících segmentů a začněte křivku z posledního bodu.
* Stiskněte klávesy {{KEY|CTRL}}+{{KEY|Z}} nebo tlačítko {{KEY|[[Image:Draft UndoLine.png|12px]] '''[[Draft_UndoLine|Undo]]'''}} k návratu na poslední bod.
* Stiskněte klávesu {{KEY|I}} nebo tlačítko {{KEY|'''Filled'''}} aby se křivka po jejím uzavření zobrazovala jako plocha. To jednoduše nastavuje Pohled->Vlastnost Drát na "Otevřené čáry" nebo "Drátový model", toto také může být snadno změněno později.
* Stiskněte klávesu {{KEY|ESC}} nebo tlačítko {{KEY|'''Cancel'''}} pro ukončení aktuálního příkazu B-křivka.
* B-křivky mohou v zobrazovacím módu "Jednoduché čáry" zobrazovat šrafovací vzory nastavením vlastnosti "Vzor" dole.
</div>


<div class="mw-translate-fuzzy">
<syntaxhighlight>
==Vlastnosti==
'''makeBSpline (pointslist,[closed],[placement])'''
* {{PropertyData|Uzavřená}}: Specifikuje zda je křivka uzavřená nebo ne
</syntaxhighlight>
* {{PropertyView|Koncová šipka}}: Ukazuje sumbol šipky na koncovém bodě křivky, takže ten může být použit jako linka pro vysvělivku
* Creates a B-Spline object from the given list of vectors.
* {{PropertyView|Vzor}}: Specifikuje šrafovací vzor pro vyplnění drátu
* If closed is True or first and last points are identical, the wire is closed.
* {{PropertyView|Rozměr vzoru}}: Specifikuje rozměr šrafovacího vzoru
* If face is true (and the bspline is closed), the bspline will appear filled.
</div>
* Instead of a list of points, you can also pass a Part Wire.
* Returns the newly created object.


A BSpline object shares most properties from a [[Draft Wire|Draft Wire]], however, most properties only make sense for a Wire.
Example:


=== Data ===
<syntaxhighlight>
* {{PropertyData|Closed}}: specifies if the spline is closed or not. If the spline is initially open, this value is {{FALSE}}; setting it to {{TRUE}} will draw a curve segment to close the spline. If the spline is initially closed, this value is {{TRUE}}; setting it to {{FALSE}} will remove the last curve segment, and make the spline open.
import FreeCAD,Draft
* {{PropertyData|Make Face}}: specifies if the spline makes a face or not. If it is {{TRUE}} a face is created, otherwise only the perimeter is considered part of the object. This property only works if {{PropertyData|Closed}} is {{TRUE}}.
p1 = FreeCAD.Vector(0,0,0)
:{{Emphasis|Note:}} do not set {{PropertyData|Make Face}} to {{TRUE}} if the spline intersects itself, as it won't create a proper face.
p2 = FreeCAD.Vector(1,1,0)
* {{PropertyData|Parameterization}}: affects the shape of the BSpline.
p3 = FreeCAD.Vector(2,0,0)
Draft.makeBSpline([p1,p2,p3],closed=True)


=== View ===
</syntaxhighlight>
* {{PropertyView|Arrow Size}}: specifies the size of the symbol displayed at the end of the spline.
* {{PropertyView|Arrow Type}}: specifies the type of symbol displayed at the end of the spline, which can be "Dot", "Circle", "Arrow", or "Tick".
* {{PropertyView|End Arrow}}: specifies whether to show a symbol at the last point of the spline, so it can be used as an annotation line.
* {{PropertyView|Pattern}}: specifies a [[Draft Pattern|Draft Pattern]] with which to fill the face of a closed spline. This property only works if {{PropertyData|Make Face}} is {{TRUE}}, and if {{PropertyView|Display Mode}} is "Flat Lines".
* {{PropertyView|Pattern Size}}: specifies the size of the [[Draft Pattern|Draft Pattern]].

<div class="mw-translate-fuzzy">
==Skriptování==
Nástroj B-křivka může být využit v [[macros|makrech]] a z konzoly Pythonu použitím následující funkce:
</div>

The BSpline tool can be used in [[macros|macros]] and from the [[Python|Python]] console by using the following function:

{{Code|code=
BSpline = make_bspline(pointslist, closed=False, placement=None, face=None, support=None)
BSpline = make_bspline(Part.Wire, closed=False, placement=None, face=None, support=None)
}}

<div class="mw-translate-fuzzy">
* Vytváří objekt B-křivka podle daného seznamu vektorů (pointslist).
* Je-li closed True nebo jsou-li první a poslední bod identické, drát je uzavřen.
* Je-li face (plocha) True (a křivka je uzavřena), bude se křivka jevit jako vyplněná plocha.
* Místo seznamu bodů můžete vložit Drát (Part Wire) (lomená čára).
* Vrací nově vytvořený objekt.
</div>

Příklad:

{{Code|code=
import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(1000, 1000, 0)
p3 = App.Vector(2000, 0, 0)

spline1 = Draft.make_bspline([p1, p2, p3], closed=False)
spline2 = Draft.make_bspline([p1, 2*p3, 1.3*p2], closed=False)
spline3 = Draft.make_bspline([1.3*p3, p1, -1.7*p2], closed=False)
doc.recompute()
}}

{{Docnav
|[[Draft_Dimension|Dimension]]
|[[Draft_Point|Point]]
|[[Draft_Module|Draft]]
|IconL=Draft_Dimension.svg
|IconR=Draft_Point.svg
|IconC=Workbench_Draft.svg
}}

{{Draft Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}
{{clear}}
<languages/>

Revision as of 13:43, 1 December 2020

Draft BSpline

Umístění Menu
Draft → BSpline
Pracovní stoly
Kreslení, Architektura
Výchozí zástupce
B S
Představen ve verzi
-
Viz také
Drát

Description

Popis

Nástroj B-křivka vytváří B-křivku z několika bodů v aktuální pracovní rovině. Přebírá tloušťku čáry a barvu předtím nastavenou v záložce nástrojů. Nástroj B-křivka se chová přesně stejně jako nástroj Drát.

The BSpline tool behaves like the Wire tool, except that each of its segments is curved instead of being a straight line. Use Wire to B-spline to convert one to the other.

The BSpline tool specifies the exact points through which the curve will go; on the other hand the Bezier curve tool uses control points to define the direction of the curve. To create exact circular or elliptical curves, use Arc and Ellipse.

Usage

Použití

  1. Stiskněte tlačítko B-křivka nebo klávesy B potom S
  2. Klikněte na první bod ve 3D pohledu nebo zadejte jeho souřadnice
  3. Klikněte na další bod ve 3D pohledu nebo zadejte jeho souřadnice
  4. Stiskněte klávesu F nebo C nebo dvojklikněte na poslední bod pro ukončení nebo uzavření křivky. Je-li křivka uzavřena, bude zároveň i povrchem i když se jeví jako drátový model.

The spline can be edited by double clicking on the element in the tree view, or by pressing the Draft Edit button. Then you can move the points to a new position, or click add point or remove point and then click on the wire to add or remove points.

Volby

  • Stiskněte klávesu F nebo tlačítko Ukončení pro ukončení křivky bez jejího uzavření
  • Stiskněte klávesu C nebo tlačítko Uzavření nebo klikněte na počáteční bod. Tím ukončíte zadávání, ale zároveň se doplní poslední segment křivky, který poslední bod spojí s počátečním bodem.
  • Stisknutím klávesy X, Y nebo Z po zadání bodu zajistíte, že následující bod bude ležet na dané ose.
  • Pro ruční zadávání souřadnic jednoduše zadávejte čísla a mezi každou komponentou X, Y a Z stiskněte ENTER.
  • Stiskněte klávesu R nebo klikněte/odklikněte zaklikávací políčko Relativní. Je-li nastaven relativní mód jsou souřadnice následujícího bodu relativní k předchozímu bodu. Je-li mód absolutní souřadnice jsou vztaženy k počátečnímu bodu (0,0,0).
  • Stiskněte klávesu T nebo klikněte/odklikněte zaklikávací políčko Pokračovat. Je-li nastaven pokračovací mód, nástroj B-křivka bude po ukončení křivky restartován a připraven ke kreslení další křivky bez nutnosti znovu jej spouštět klikáním na tlačítko B-křivka.
  • Stiskněte při kreslení klávesu CTRL pro přichycení Vašeho bodu k nejbližšímu uchopovacímu místu, nezávisle na vzdálenosti od něho.
  • Stiskněte při kreslení klávesu SHIFT pro nastavení vazby Vašeho dalšího bodu vodorovně nebo svisle v relaci k předchozímu bodu.
  • Stiskněte klávesu W nebo stiskněte tlačítko Smaž pro odstranění existujících segmentů a začněte křivku z posledního bodu.
  • Stiskněte klávesy CTRL+Z nebo tlačítko Undo k návratu na poslední bod.
  • Stiskněte klávesu I nebo tlačítko Filled aby se křivka po jejím uzavření zobrazovala jako plocha. To jednoduše nastavuje Pohled->Vlastnost Drát na "Otevřené čáry" nebo "Drátový model", toto také může být snadno změněno později.
  • Stiskněte klávesu ESC nebo tlačítko Cancel pro ukončení aktuálního příkazu B-křivka.
  • B-křivky mohou v zobrazovacím módu "Jednoduché čáry" zobrazovat šrafovací vzory nastavením vlastnosti "Vzor" dole.

Vlastnosti

  • ÚdajeUzavřená: Specifikuje zda je křivka uzavřená nebo ne
  • PohledKoncová šipka: Ukazuje sumbol šipky na koncovém bodě křivky, takže ten může být použit jako linka pro vysvělivku
  • PohledVzor: Specifikuje šrafovací vzor pro vyplnění drátu
  • PohledRozměr vzoru: Specifikuje rozměr šrafovacího vzoru

A BSpline object shares most properties from a Draft Wire, however, most properties only make sense for a Wire.

Data

  • ÚdajeClosed: specifies if the spline is closed or not. If the spline is initially open, this value is false; setting it to true will draw a curve segment to close the spline. If the spline is initially closed, this value is true; setting it to false will remove the last curve segment, and make the spline open.
  • ÚdajeMake Face: specifies if the spline makes a face or not. If it is true a face is created, otherwise only the perimeter is considered part of the object. This property only works if ÚdajeClosed is true.
Note: do not set ÚdajeMake Face to true if the spline intersects itself, as it won't create a proper face.
  • ÚdajeParameterization: affects the shape of the BSpline.

View

  • PohledArrow Size: specifies the size of the symbol displayed at the end of the spline.
  • PohledArrow Type: specifies the type of symbol displayed at the end of the spline, which can be "Dot", "Circle", "Arrow", or "Tick".
  • PohledEnd Arrow: specifies whether to show a symbol at the last point of the spline, so it can be used as an annotation line.
  • PohledPattern: specifies a Draft Pattern with which to fill the face of a closed spline. This property only works if ÚdajeMake Face is true, and if PohledDisplay Mode is "Flat Lines".
  • PohledPattern Size: specifies the size of the Draft Pattern.

Skriptování

Nástroj B-křivka může být využit v makrech a z konzoly Pythonu použitím následující funkce:

The BSpline tool can be used in macros and from the Python console by using the following function:

BSpline = make_bspline(pointslist, closed=False, placement=None, face=None, support=None)
BSpline = make_bspline(Part.Wire, closed=False, placement=None, face=None, support=None)
  • Vytváří objekt B-křivka podle daného seznamu vektorů (pointslist).
  • Je-li closed True nebo jsou-li první a poslední bod identické, drát je uzavřen.
  • Je-li face (plocha) True (a křivka je uzavřena), bude se křivka jevit jako vyplněná plocha.
  • Místo seznamu bodů můžete vložit Drát (Part Wire) (lomená čára).
  • Vrací nově vytvořený objekt.

Příklad:

import FreeCAD as App
import Draft

doc = App.newDocument()

p1 = App.Vector(0, 0, 0)
p2 = App.Vector(1000, 1000, 0)
p3 = App.Vector(2000, 0, 0)

spline1 = Draft.make_bspline([p1, p2, p3], closed=False)
spline2 = Draft.make_bspline([p1, 2*p3, 1.3*p2], closed=False)
spline3 = Draft.make_bspline([1.3*p3, p1, -1.7*p2], closed=False)
doc.recompute()