Direction (hwx.inspire.Attributes)#

class Direction(default=(0, 0, 1), **kwds)#

Bases: HasReferenceFrame, Triple

Specify a direction relative to another entity.

Directions are get or set in global coordinates.

Directional components are [x,y,z].

Directions are not normalized, this is required to match Inspire behaviour of showing non normalized directions in Property Editor.

Method Table#

Name

Description

getGuiValue (self, obj, component=None, **kwds)

Example

from hwx.inspire import *

class Arrow(GeneralObject):
   part      = Reference(Part)
   direction = Direction((2,0,0), wrt=part)

model = newModel()
cyl = model.createSolidCylinder()
obj = Arrow(part=cyl)

# Directions aren't stored normalized
print(obj, "magnitude =", obj.direction.magnitude())

# Directions wrt a part rotate with it
cyl.position = cyl.position.rotz(180)
assert obj.direction.close((-2,0,0))
getGuiValue(obj, component=None, **kwds)#

Returns the formatted value, as shown in the Property Editor.