EM FHNode: Difference between revisions
(Inital page - work in progress) |
No edit summary |
||
Line 35: | Line 35: | ||
==Properties== |
==Properties== |
||
* {{PropertyData| |
* {{PropertyData|X}}: the X coordinate of the node |
||
* {{PropertyData| |
* {{PropertyData|Y}}: the Y coordinate of the node |
||
* {{PropertyData| |
* {{PropertyData|Z}}: the Z coordinate of the node |
||
* {{PropertyData|String}}: specifies the text string to display; unlike the [[Draft Text]] tool, the [[Draft ShapeString]] can only display a single line. |
|||
* {{PropertyData|Size}}: specifies the general height of the letters. |
|||
* {{PropertyData|Tracking}}: specifies the additional inter-character spacing in the string. |
|||
* {{PropertyData|Font File}}: specifies the full path of the font file used to draw the string. |
|||
==Scripting== |
==Scripting== |
||
Line 50: | Line 46: | ||
{{Code|code= |
{{Code|code= |
||
node = makeFHNode( |
node = makeFHNode(baseobj=None, X=0.0, Y=0.0, Z=0.0, color=None, size=None, name='FHNode') |
||
}} |
}} |
||
* Creates a {{incode|FHNode}} object. |
|||
* Creates a {{incode|ShapeString}} compound shape using the specified {{incode|String}} and the full path of a supported {{incode|FontFile}}. |
|||
* {{incode|baseobj}} is the Draft Point object whose position can be used as base for the FNNode. It has priority over {{incode|X}}, {{incode|Y}}, {{incode|Z}}. If no {{incode|baseobj}} is given, {{incode|X}},{{incode|Y}},{{incode|Z}} are used as coordinates. |
|||
⚫ | |||
* {{incode| |
* {{incode|X}} x coordinate of the node, in absolute coordinate system. |
||
* {{incode|Y}} y coordinate of the node, in absolute coordinate system. |
|||
* {{incode|Z}} z coordinate of the node, in absolute coordinate system. |
|||
* {{incode|color}} is the node color, e.g. a tuple (1.0,0.0,0.0). Defaults to {{incode|EMFHNODE_DEF_NODECOLOR}}. |
|||
* {{incode|size}} is the node size. Defaults to {{incode|EMFHNODE_DEF_NODESIZE}}. |
|||
⚫ | |||
The placement of the |
The placement of the FHNode can be changed by modifying its {{incode|Placement}} property, or changing the {{incode|X}},{{incode|Y}},{{incode|Z}} properties individually. Changing {{incode|X}},{{incode|Y}},{{incode|Z}} modifies the node position in the relative coordinate system of the {{incode|Placement}}. |
||
Example: |
Example: |
Revision as of 08:14, 4 January 2019
EM FHNode |
Menu location |
---|
EM → FHNode |
Workbenches |
EM |
Default shortcut |
E N |
Introduced in version |
0.17 (Add-on) |
See also |
EM FHSegment, EM FHPath, EM FHPlane, EM FHPlane Add/Remove Node/Hole, EM FHEquiv, EM FHPort |
Description
The FHNode tool inserts a FastHenry node object.
FastHenry FHNode
How to use
The FHNode object can be based on the position of a Draft Point object, or you can select the 3D location of the FHNode.
- Press the EM FHNode button, or press E then N keys.
- Click a point on the 3D view, or type a coordinate and press the add point button.
Alternatively, you can also:
- Select a Draft Point object
- Press the EM FHNode button, or press E then N keys. A FHNode will be created at the same coordinates of the Draft Point.
Options
- To enter coordinates manually, simply enter the numbers, then press Enter between each X, Y and Z component. You can press the add point button when you have the desired values to insert the point.
- Press Esc or the Close button to abort the current command.
Properties
- DataX: the X coordinate of the node
- DataY: the Y coordinate of the node
- DataZ: the Z coordinate of the node
Scripting
See also: FreeCAD Scripting Basics.
The FHNode object can be used in macros and from the Python console by using the following function:
node = makeFHNode(baseobj=None, X=0.0, Y=0.0, Z=0.0, color=None, size=None, name='FHNode')
- Creates a
FHNode
object. baseobj
is the Draft Point object whose position can be used as base for the FNNode. It has priority overX
,Y
,Z
. If nobaseobj
is given,X
,Y
,Z
are used as coordinates.X
x coordinate of the node, in absolute coordinate system.Y
y coordinate of the node, in absolute coordinate system.Z
z coordinate of the node, in absolute coordinate system.color
is the node color, e.g. a tuple (1.0,0.0,0.0). Defaults toEMFHNODE_DEF_NODECOLOR
.size
is the node size. Defaults toEMFHNODE_DEF_NODESIZE
.name
is the name of the object
The placement of the FHNode can be changed by modifying its Placement
property, or changing the X
,Y
,Z
properties individually. Changing X
,Y
,Z
modifies the node position in the relative coordinate system of the Placement
.
Example:
import FreeCAD, Draft
font1 = "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf"
font2 = "/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf"
font3 = "/usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf"
S1 = Draft.makeShapeString("This is a sample text", font1, 200)
S2 = Draft.makeShapeString("Inclined text", font2, 200, 10)
ZAxis = FreeCAD.Vector(0, 0, 1)
p2 = FreeCAD.Vector(-1000, 500, 0)
place2 = FreeCAD.Placement(p2, FreeCAD.Rotation(ZAxis, 45))
S2.Placement = place2
S3 = Draft.makeShapeString("Upside-down text", font3, 200, 10)
S3.Placement.Base = FreeCAD.Vector(0, -1000, 0)
S3.Placement.Rotation = FreeCAD.Rotation(ZAxis, 180)