Point

Point

Class Point()

Point(parent='MODEL', name='Point_n', label='Point_n', 
active=True, x=1.0, y=1.0, z=1.0)

Points are 3d coordinates used for positioning and orienting objects.

Method:

along, delete, distanceTo

Keyword Arguments

Argument Data Type Description Default
name String The variable name. Point_n, for next available integer n.
label String The descriptive label. Point_n, for next available integer n.
parent Object The parent. MODEL
active Bool Used to activate or deactivate this entity. True
x Double The x coordinate. 0
y Double The y coordinate. 0
z Double The z coordinate. 0

Notes

1. The parent parameter can only be initialized by the constructor and should not be modified directly.

2. Only parent can be used as a positional argument in the constructor.

Methods

along(vec='V_Global_X', dist=1.0)

Create a point along vector vec at a distance of dist from self.

Parameters:

       
vec Vector Full Varname of the vector along which point needs to be created. 'V_Global_X'
dist double Distance of other point from self. 1

Returns:

Point object created along vector vec at a distance of dist from self.

Return type:

Point

delete()

Deletes the point.

distanceTo(other, mRef='Global_Frame')

Calculates distance of this point from other point.

Parameters:

       
other str Name of the second point. Can also be the python object. Defaults to

Returns:

Returns distance between self and other point.

Return type:

Double

Point Pair

Class PointPair()

PointPair(parent='MODEL', name='Point_n', label='Point_n', active=True, sym='LEFT')

PointPair specifies the location of a pair of points in 3D Cartesian space. PointPairs are composed of 2 single Point instances - left ('l') and right ('r').

Keyword Arguments

Argument Data Type Description Default
name String The variable name. PointPair_n, for next available integer n.
label String The descriptive label. PointPair_n, for next available integer n.
parent Object The parent. MODEL
active Bool Defines if entity is activated when True or deactivated when False. True
sym Enum The symmetry of pair entity. Takes values "LEFT" for left entity as master, "RIGHT" for right entity as master or "NONE" when it is not symmetric. LEFT

Instances

Instance Type Description
l Point The left point.
r Point The right point.

Notes

Instance is a reference to an entity. You cannot modify an instance, but can modify its properties.

Examples

========
Create and modify attributes for a point.
>>> from hw import mview
>>> p1 = mview.Point(name="p_1", label="Point1")
>>> p1.x = 2
>>> p1.x
2
>>> #Set multiple values at a time
>>> p1.setValues(y=4, z=5)
>>> p2 = mview.Point(name="p_2", label="Point2", x=2, y=6)
>>> p1.distanceTo(p2)
5.385164807134504
>>> #Create a point on global z vector at a distance of 3 from p
>>> p3 = p1.along(vec="the_model.V_Global_Z", dist=3)
>>> s1 = mview.System(name = "sys_0")
>>> #Create a point in sys_0. You could pass the handle or variable name in the parent.
>>> p4 = mview.Point(parent = s1)
>>> p4.parent.name
'sys_0'
>>> #Create a point pair and modify its attributes.
>>> p1 = mview.PointPair(name="p_1", label="Point1")
>>> #By default sym if LEFT. i.e left side is the master
>>> p1.sym
'LEFT'
>>> #Modify the left side's values
>>> p1.l.y = 2
>>> p1.l.y
2
>>> #The slave side y value is negative
>>> p1.r.y
-2.0
>>> #Set symmetry to NONE
>>> p1.sym = 'NONE'
>>> #The slave side values are reverted to the original values
>>> p1.r.y
>>> 0