Draft API/ja: Difference between revisions

From FreeCAD Documentation
(Created page with "これらの関数はDraftモジュールの一部であり、Draftモジュールをインポートすることでスクリプト、マクロ、Pythonインタプリタから...")
 
(Updating to match new version of source page)
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
これらの関数はDraftモジュールの一部であり、Draftモジュールをインポートすることでスクリプト、マクロ、Pythonインタプリタから使用することができます。
これらの関数はDraftモジュールの一部であり、Draftモジュールをインポートすることでスクリプト、マクロ、Pythonインタプリタから使用することができます。
</div>


These functions are part of the [[Draft Workbench|Draft Workbench]] and can be used in [[macros|macros]] and from the [[Python|Python]] console once the {{incode|Draft}} module has been imported.
Example:

例:
{{Code|code=
{{Code|code=
import FreeCAD
import FreeCAD, Draft

from Draft import *
myrect = makeRectangle(4,3)
myrect = Draft.makeRectangle(4, 3)
mydistance = FreeCAD.Vector(2,2,0)
mydistance = FreeCAD.Vector(2, 2, 0)
move(myrect,mydistance)
Draft.move(myrect, mydistance)
}}
}}


{{APIFunction/jp|cut|FreeCAD.Object, FreeCAD.Object|与えられた2つのオブジェクトの差分から作成されたカットオブジェクトを返します。元のオブジェクトは非表示になります。|新しく作成されたオブジェクト}}


{{APIFunction/jp|extrude|FreeCAD.Object, Vector|与えられたオブジェクトをベクトルによって指定された方向に押し出します。元のオブジェクトは非表示になります。|新しく作成されたオブジェクト}}
{{APIFunction|cut|FreeCAD.Object, FreeCAD.Object|Returns a cut object made from the difference of the 2 given objects. The original objects get hidden.|The newly created object}}
{{APIFunction|extrude|FreeCAD.Object, Vector|Extrudes the given object in the direction given by the vector. The original object gets hidden.|The newly created object}}
{{APIFunction|formatObject|FreeCAD.Object, [FreeCAD.Object]|This function applies to the given target object the current properties set on the Draft toolbar (line color and line width), or copies the properties of a second object if provided. It also places the object in construction group if the construction button is pressed.|Nothing}}
{{APIFunction|fuse|FreeCAD.Object, FreeCAD.Object|Returns an object made from the union of the 2 given objects. If the objects are coplanar, a special Draft Wire is used, otherwise the final object is a standard Part fuse.|The newly created object}}
{{APIFunction|getDraftPath|[string]|Returns the user or system path where the Draft module is running from. If a subpath or a filename is supplied, the full path to the subpath inside the Draft module is returned.|A file path}}
{{APIFunction|getGroupContents|list|Scans recursively the given list for groups. If groups are encountered, their contents are appended to the list.|A list of FreeCAD Objects}}
{{APIFunction|getRealName|string|Strips the trailing numbers from an object name.|The stripped object name}}
{{APIFunction|getSelection| |Returns the current FreeCAD selection.|The current FreeCAD selection.}}
{{APIFunction|makeCircle|radius, [placement], [facemode], [startangle], [endangle]|Creates a circle object with given radius. If a placement is given, it is used. If facemode is False, the circle is shown as a wireframe, otherwise as a face. If startangle AND endangle are given (in degrees), they are used and the object appears as an arc.|The newly created object.}}
{{APIFunction|makeDimension|Vector, Vector, [Vector] or FreeCAD.Object, int, int, [Vector]|Creates a Dimension object measuring distance between first and second vectors, with the dimension line passign through the third vector if provided. The current line width and color from the Draft toolbar will be used. Instead of 2 vectors, you can also pass a FreeCAD object, and two integers (and optionally a vector where the dimension line must pass). In that case, the dimension will be associated with the object, and measure two of its vertices, indicated by the two given indice numbers.|The newly created object.}}
{{APIFunction|makeLine|Vector, Vector|Creates a line between the two given vectors. The current line width and color from the Draft toolbar will be used.|The newly created object.}}
{{APIFunction|makeRectangle|length, width, [placement], [facemode]|Creates a Rectangle object with length in X direction and height in Y direction. If a placement is given, it is used. If facemode is False, the rectangle is shown as a wireframe, otherwise as a face. The current line width and color from the Draft toolbar will be used.|The newly created object.}}
{{APIFunction|makeText|string or list, [Vector], [screenmode]|Creates a Text object, at the given point if a vector is provided, containing the string or the strings given in the list, one string by line. The current color from the Draft toolbar and the text height and font specified in preferences are used. If screenmode is True, the text always faces the view direction, otherwise it lies on the XY plane.|The newly created object.}}
{{APIFunction|makeWire|list or Part.Wire, [closed], [placement], [facemode]|Creates a DWire object from the given list of vectors or from the given Wire. If closed is True or if first and last points are identical, the wire is closed. If facemode is True (and wire is closed), the wire will appear filled. The current line width and color from the Draft toolbar will be used.|A new Draft DWire (not a Part Wire).}}
{{APIFunction|move|FreeCAD.Object or list, Vector, [copymode]|Moves the given object or the objects contained in the given list in the direction and distance indicated by the given vector. If copymode is True, the actual objects are not moved, but copies are created instead.|The object(s) (or their copies if copymode was True).}}
{{APIFunction|precision| |Returns the precision value from Draft user settings.|An integer.}}
{{APIFunction|rotate|FreeCAD.Object or list, angle, [center], [axis] ,[copymode]|Rotates the given object or the objects contained in the given list with the given angle around the given center if provided, using axis as a rotation axis. If axis is omitted, the rotation will be around the vertical Z axis. If copymode is True, the actual objects are not moved, but copies are created instead.|The objects (or their copies).}}
{{APIFunction|scale|FreeCAD.Object or list, vector, [center], [copymode]|Scales the given object or the objects contained in the given list with a scale factors defined by the given vector (in X, Y and Z directions) around the given center if provided. If copymode is True, the actual objects are not moved, but copies are created instead.|The objects (or their copies).}}
{{APIFunction|select|FreeCAD.Object|Deselects everything and selects only the passed object|Nothing.}}
{{APIFunction|shapify|FreeCAD.Object|Transforms a parametric shape object into non-parametric.|The new object.}}
{{APIFunction|draftify|FreeCAD.Object or list|Turns the given object or each object of the given list into Draft parametric wires.|Nothing.}}
{{APIFunction|getSVG|FreeCAD.Object, [linemodifier], [textmodifier], [(u,v)]|Creates a SVG representation of the given object. The linemodifier attribute is a scale factor (in percents) for line width, and textmodifier for text size. You can also optionally provide a tuple of vectors to define a projection plane, otherwise the geometry will be projected on the XY plane.|a string containing a SVG representation of the given object.}}


{{APIFunction/jp|formatObject|FreeCAD.Object, [FreeCAD.Object]|与えられたターゲットオブジェクトに対してDraftツールバーに現在設定されているプロパティ(線の色と太さ)を適用します。ただし二番目のオブジェクトが与えられている場合はそのプロパティをコピーします。またコンストラクションボタンが押されている場合はオブジェクトをコンストラクショングループに配置します。|なし}}


{{APIFunction/jp|fuse|FreeCAD.Object, FreeCAD.Object|
与えられた2つのオブジェクトの結合から作成されたオブジェクトを返します。もしオブジェクトが同一平面上にある場合は特殊なDraftワイヤーが使用され、そうでない場合は最終的なオブジェクトは標準的なPartの結合物になります。|新しく作成されたオブジェクト}}

{{APIFunction/jp|getDraftPath|[string]|Draftモジュールが実行されているユーザーまたはシステムパスを返します。サブパス、またはファイル名が与えられた場合はDraftモザユール内部のサブパスのフルパスが返されます。|ファイルパス}}

{{APIFunction/jp|getGroupContents|list|グループに対して与えられたリストを再帰的にスキャンします。グループが見つかった場合、その内容がリストに追加されます。|FreeCADオブジェクトのリスト}}

{{APIFunction/jp|getRealName|string|オブジェクト名から末尾の数字を取り除きます。|取り除いた後のオブジェクト名}}

{{APIFunction/jp|getSelection| |現在のFreeCADで選択物を返します。|現在のFreeCADで選択物}}

{{APIFunction/jp|makeCircle|radius, [placement], [facemode], [startangle], [endangle]|与えられた半径(radius)の円オブジェクトを作成します。位置(placement)が指定された場合にはそれが使用されます。facemodeがFalseの場合には円はワイヤーフレームで表示されます。それ以外の場合は面として表示されます。startangleとendangleが(単位、°で)与えられた場合はそれが使用されオブジェクトは円弧となって表示されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|makeDimension|Vector, Vector, [Vector] または FreeCAD.Object, int, int, [Vector]|一つ目と二つ目のベクトル間の距離を測る寸法オブジェクトを作成します。三番目のベクトルが与えられた場合にはそこを通る寸法線が付与されます。Draftツールバーの現在の線の色と幅が使用されます。2つのベクトルの代わりにFreeCADオブジェクトと二つの整数(、さらにオプションで寸法線が通過するベクトル)を渡すことも可能です。その場合には寸法はオブジェクトに関連付けられ与えられた二つの数字で表される二頂点の間の距離が計測されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|makeLine|Vector, Vector|与えられた二つのベクトル間に引かれた線を作成します。Draftツールバーの現在の線の色と幅が使用されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|makeRectangle|length, width, [placement], [facemode]|X方向にlength、Y方向にheightの大きさの長方形オブジェクトを作成します。位置(placement)が指定された場合にはそれが使用されます。facemodeがFalseの場合には円はワイヤーフレームで表示されます。それ以外の場合は面として表示されます。Draftツールバーの現在の線の色と幅が使用されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|makeText|string または list, [Vector], [screenmode]|
テキストオブジェクトを作成します。ベクトルが与えられている場合にはその点に文字列またはリストで与えられた複数の文字列が一行に一文字列ずつ配置されます。Draftツールバーの現在の色とユーザー設定で指定されたテキストの高さ、フォントが使用されます。screenmodeがTrueの場合、テキストは常にビュー方向を向き、そうでない場合はXY平面上に配置されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|makeWire|list または Part.Wire, [closed], [placement], [facemode]|与えられたベクトルのリストまたは与えられたワイヤーからワイヤーオブジェクトを作成します。closedがTrue、または最初と最後の点が一致している場合はワイヤーが閉じます。facemodeがTrue(またはワイヤーが閉じている)の場合にはワイヤーは塗りつぶされた状態で表示されます。 Draftツールバーの現在の線の色と幅が使用されます。|新しく作成されたオブジェクト.}}

{{APIFunction/jp|move|FreeCAD.Object または list, Vector, [copymode]|与えられたオブジェクトまたは与えられたリストに入っているオブジェクトを与えられたベクトルによって表される方向と距離に移動させます。copymodeがTrueの場合、実際のオブジェクトは動かされず、代わりにコピーが作成されます。|オブジェクト(copymodeがTrueの場合はオブジェクトのコピー)}}

{{APIFunction/jp|precision| |Draftのユーザー設定から精度の値を返します|整数}}

{{APIFunction/jp|rotate|FreeCAD.Object または list, angle, [center], [axis] ,[copymode]|
与えられたオブジェクトまたは与えられたリストに入っているオブジェクトを与えられた角度だけ回転させます。centerが与えられている場合にはaxisを回転軸として使用してcenterを中心に回転させます。axisが省略されている場合にはZ軸垂直方向の周りに回転させます。copymodeがTrueの場合、実際のオブジェクトは動かされず、代わりにコピーが作成されます。|オブジェクト(またはそのコピー)}}

{{APIFunction/jp|scale|FreeCAD.Object または list, vector, [center], [copymode]|
与えられたオブジェクトまたは与えられたリストに入っているオブジェクトを与えられたベクトルで(X、Y、Z方向に)定義される拡大縮小率で拡大縮小します。centerが与えられている場合にはその周りに拡大縮小します。copymodeがTrueの場合、実際のオブジェクトは動かされず、代わりにコピーが作成されます。|オブジェクト(またはそのコピー)}}

{{APIFunction/jp|select|FreeCAD.Object|全ての選択を解除し、渡されたオブジェクトのみを選択します。|なし}}

{{APIFunction/jp|shapify|FreeCAD.Object|パラメトリックな形状オブジェクトを非パラメトリックなものに変換します。|新しいオブジェクト}}

{{APIFunction/jp|draftify|FreeCAD.Object または list|与えられたオブジェクトまたは与えられたリストの各オブジェクトをDraftのパラメトリックワイヤーに変えます。|なし}}

{{APIFunction/jp|getSVG|FreeCAD.Object, [linemodifier], [textmodifier], [(u,v)]|
与えられたオブジェクトのSVG表現を作成します。linemodifier属性はライン幅の(パーセント単位の)拡大縮小率で、textmodifierはテキストサイズ用です。またオプションで投影面を定義するベクトルのタプルを指定できますが、指定しない場合はジオメトリーはXY平面に投影されます。|与えられたオブジェクトのSVG表現が入った文字列}}

<div class="mw-translate-fuzzy">
[[Category:API]]
[[Category:API]]
[[Category:Poweruser Documentation]]
[[Category:Poweruser Documentation]]
</div>


[[Category:API]]
[[Category:Poweruser Documentation]]
{{clear}}
{{clear}}

Revision as of 20:11, 4 March 2019

これらの関数はDraftモジュールの一部であり、Draftモジュールをインポートすることでスクリプト、マクロ、Pythonインタプリタから使用することができます。

These functions are part of the Draft Workbench and can be used in macros and from the Python console once the Draft module has been imported.

例:

import FreeCAD, Draft

myrect = Draft.makeRectangle(4, 3)
mydistance = FreeCAD.Vector(2, 2, 0)
Draft.move(myrect, mydistance)

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp

Template:APIFunction/jp