pycatia.dnb_human_modeling_interfaces.swk_segment

Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-09-25 14:34:21.593357

Warning

The notes denoted “CAA V5 Visual Basic Help” are to be used as reference only. They are there as a guide as to how the visual basic / catscript functions work and thus help debugging in pycatia.

class pycatia.dnb_human_modeling_interfaces.swk_segment.SWKSegment(com_object)

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)

System.IUnknown
System.IDispatch
System.CATBaseUnknown
System.CATBaseDispatch
System.AnyObject
DNBHumanModelingInterfaces.SWKBodyElement
SWKSegment

This interface deals with a segment of a manikin.
apply_position(pi_position_increment: tuple, pi_start_segment: str) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ApplyPosition(CATSafeArrayVariant piPositionIncrement,
CATBSTR piStartSegment)

Applies a new relative position for the segment.

Parameters:

piPositionIncrement
The new position to combine with the segment’s current
position.
This array must contain 12 numbers, and msut be initialized using
the four columns of a transformation matrix. The first nine components
represent the rotation matrix.
The last three components represent the translation
vector.
piStartSegment
The short name of the first segment of the kinematics chain. The
short name specified has to identify a valid segment, which is an ancestor of
the current one. For instance, is the segment to position is the right hand,
then that start segment might be “RSArCl” (right clavicular). If the string
“Default” is specified, then the start segment will be automatically chosen.


Example:

This example sets the segment to a 45-degree rotation
around
the x axis and at a (10, 20, 30) translation from the
origin.

Dim myPosition(11)
‘Rotation (45 degrees around the x axis)
myPosition(0) = 1.000
myPosition(1) = 0
myPosition(2) = 0
myPosition(3) = 0
myPosition(4) = 0.707
myPosition(5) = 0.707
myPosition(6) = 0
myPosition(7) = -0.707
myPosition(8) = 0.707
‘Translation vector (10,20,30)
myPosition(9) = 10.000
myPosition(10) = 20.000
myPosition(11) = 30.000
myManikin.Body.GetItem(“LSHaCPr”).ApplyPosition
myPosition
Parameters:
  • pi_position_increment (tuple) –

  • pi_start_segment (str) –

Return type:

None

attach(pi_object_to_attach: AnyObject) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Attach(AnyObject piObjectToAttach)

Attach a geometry to the segment.

Parameters:

piObjectToAttach
The object to attach. This object must be a movable object. Once
the attach relationship is made, the object’s postition will be updated every
time the segment moves.
Parameters:

pi_object_to_attach (AnyObject) –

Return type:

None

property attach_size: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property AttachSize() As long (Read Only)

Returns the number of objects currently attached to the
segment.
Return type:

int

create_reach_envelope() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub CreateReachEnvelope()

This method creates and displayed the reach envelope on the current
segment. This segment must be part of the hand, otherwise an error code is
returned.
Property IsOnHand can be used to check whether the segment is located on
the hand.
Return type:

None

destroy_reach_envelope() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub DestroyReachEnvelope()

This method destroys the reach envelope previously created for this
segment.
Return type:

None

detach(pi_object_to_detach: AnyObject) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Detach(AnyObject piObjectToDetach)

Detach a geometry previously attached to the segment.

Parameters:

piObjectToDetach
The object to detach. This object’s will no longer be driven by the
segment’s position.
Parameters:

pi_object_to_detach (AnyObject) –

Return type:

None

detach_all() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub DetachAll()

Detach all objects attached so far to the segment.
Return type:

None

property end_position_x: float

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property EndPositionX() As double (Read Only)

Returns the global x coordinate of the endpoint of the
segment.
Return type:

float

property end_position_y: float

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property EndPositionY() As double (Read Only)

Returns the global y coordinate of the endpoint of the
segment.
Return type:

float

property end_position_z: float

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property EndPositionZ() As double (Read Only)

Returns the global z coordinate of the endpoint of the
segment.
Return type:

float

get_attached_object(pi_index: int) AnyObject

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func GetAttachedObject(long piIndex) As AnyObject

Retrieve one object currently attached to the segment.

Parameters:

piIndex
The index of the object to retrieve. First attached object is at
index 0.
Parameters:

pi_index (int) –

Return type:

AnyObject

get_dof(pi_dof_number: int) SWKDOF

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func GetDOF(long piDOFNumber) As SWKDOF

Returns a specific degree of freedom of the segment.
A segment may have up to three degrees of freedom,
and these are numbered from 0 to 2.
However, the degrees of freedom do not always have
consecutive indices. For instance the forearm
has 2 DOFs, but these are numbered 0 and 2.
That is why the set of DOFs under a segment cannot
be properly accessed as if it was a collection.
To loop through the degrees of freedom of a segment,
one should test the value of properties IsDOFAt0, IsDOFAt1 or IsDOFAt2, and
work with the
DOF only if the value of one of the corresponding property
is
True.

Parameters:

piDOFNumber
The index of the DOF to retrieve.
This parameter must be either 0, 1 or 2.
Parameters:

pi_dof_number (int) –

Return type:

SWKDOF

get_ik_offset(po_offset: tuple) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub GetIKOffset(CATSafeArrayVariant poOffset)

Returns:
The IK offset for this segment.
Parameters:

po_offset (tuple) –

Return type:

None

get_ik_position(po_ik_position: tuple) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub GetIKPosition(CATSafeArrayVariant poIKPosition)

Returns:
The position used for IK on this segment.
Parameters:

po_ik_position (tuple) –

Return type:

None

is_attached(pi_object: AnyObject) bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func IsAttached(AnyObject piObject) As boolean

Returns:
true if the object passed in the parameter is attached to the segment,
false otherwise.
Parameters:

pi_object (AnyObject) –

Return type:

bool

property is_dof_at0: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsDOFAt0() As boolean (Read Only)

Returns True if there is a DOF at index 0, False otherwise.
Return type:

bool

property is_dof_at1: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsDOFAt1() As boolean (Read Only)

Returns True if there is a DOF at index 1, False otherwise.
Return type:

bool

property is_dof_at2: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsDOFAt2() As boolean (Read Only)

Returns True if there is a DOF at index 2, False otherwise.
Return type:

bool

is_object_reachable(pi_object: AnyObject) bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func IsObjectReachable(AnyObject piObject) As boolean

Reachability check.

Returns:
true if the object passed is reachable by the segment, false otherwise.
The position taken is that of the center of the object.
Parameters:

pi_object (AnyObject) –

Return type:

bool

property is_on_hand: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsOnHand() As boolean (Read Only)

This property is True if this segment belongs to the manikin’s hand.
Return type:

bool

property is_on_left_side: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsOnLeftSide() As boolean (Read Only)

This property is True if this segment is on the left side of the manikin.
Return type:

bool

property is_on_right_side: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsOnRightSide() As boolean (Read Only)

This property is True if this segment is on the right side of the manikin.
Return type:

bool

property is_on_spine: bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property IsOnSpine() As boolean (Read Only)

This property is True if this segment belongs to the manikin’s spine.
Return type:

bool

is_reachable(pi_x: float, pi_y: float, pi_z: float) bool

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Func IsReachable(double piX,
double piY,
double piZ) As boolean

Reachability check.

Returns:
true if the location expressed in the coordinates is reachable by the
segment, false otherwise.
Parameters:
  • pi_x (float) –

  • pi_y (float) –

  • pi_z (float) –

Return type:

bool

property length: float

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property Length() As double (Read Only)

Returns the length of the segment, in centimeters.
Return type:

float

lock_posture(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub LockPosture(long piDOFId)

Lock the posture of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

mirror_copy_angular_limitations(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub MirrorCopyAngularLimitations(long piDOFId)

Mirror copy the angular limitations of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

mirror_copy_posture() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub MirrorCopyPosture()

Copy the posture on the equivalent segment, on the other side of the
manikin. For instance, it copies the posture from the right leg to the left
leg.
Return type:

None

mirror_copy_pref_angles(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub MirrorCopyPrefAngles(long piDOFId)

Mirror copy the preferred angles of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

property mirror_segment: AnyObject

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property MirrorSegment() As CATBaseDispatch (Read Only)

This property returns the equivalent segment, but on the opposite side
(ex.: right leg <-> left leg).
Return type:

AnyObject

property nb_do_fs: int

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
o Property NbDOFs() As long (Read Only)

Returns the number of degrees of freedom on the current segment.
Each segment can have up to three degrees of freedom.
Therefore the value of this property will never be higher than 3.
Return type:

int

optimize(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub Optimize(long piDOFId)

Sets the limits to match the best PrefAngle for the DOF piDOFId
Parameters:

pi_dof_id (int) –

Return type:

None

remove_limits(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub RemoveLimits(long piDOFId)

Removes the angular limitations of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

reset_angular_limitations(pi_dof_id: int, pi_reset: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ResetAngularLimitations(long piDOFId,
long piReset)

Reset the angular limitations of the segment depending on piReset: 0 -> 2
OR 3 OR 4 depending of the first encountered. 1 -> 2 AND 3 AND 4 2 -> Unlock
the value 3 -> Restore the angular limitations if it is “No Limits” 4 -> Set
back the angular limitations to their default value (50.0%)
Parameters:
  • pi_dof_id (int) –

  • pi_reset (int) –

Return type:

None

reset_posture() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ResetPosture()

Set the segment’s posture back to its default position.
Return type:

None

reset_pref_angles(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub ResetPrefAngles(long piDOFId)

Reset the preferred angles of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

set_percentage(pi_percentage: float, pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub SetPercentage(double piPercentage,
long piDOFId)

Sets the angular limitations to a percentage for the DOF piDOFId
Parameters:
  • pi_percentage (float) –

  • pi_dof_id (int) –

Return type:

None

set_position(pi_new_position: tuple, pi_start_segment: str) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub SetPosition(CATSafeArrayVariant piNewPosition,
CATBSTR piStartSegment)

Sets a new absolute position for the segment.

Parameters:

piNewPosition
The new position to place the segment.
This array must contain 12 numbers, and msut be initialized using
the four columns of a transformation matrix. The first nine components
represent the rotation matrix.
The last three components represent the translation
vector.
piStartSegment
The short name of the first segment of the kinematics chain. The
short name specified has to identify a valid segment, which is an ancestor of
the current one. For instance, is the segment to position is the right hand,
then that start segment might be “RSArCl” (right clavicular). If the string
“Default” is specified, then the start segment will be automatically chosen.

Example:

This example sets the segment to a 45-degree rotation
around
the x axis and at a (10, 20, 30) translation from the
origin.

Dim myPosition(11)
‘Rotation (45 degrees around the x axis)
myPosition(0) = 1.000
myPosition(1) = 0
myPosition(2) = 0
myPosition(3) = 0
myPosition(4) = 0.707
myPosition(5) = 0.707
myPosition(6) = 0
myPosition(7) = -0.707
myPosition(8) = 0.707
‘Translation vector (10,20,30)
myPosition(9) = 10.000
myPosition(10) = 20.000
myPosition(11) = 30.000
myManikin.Body.GetItem(“LSHaCPr”).SetPosition myPosition,
“Default”
Parameters:
  • pi_new_position (tuple) –

  • pi_start_segment (str) –

Return type:

None

swap_angular_limitations(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub SwapAngularLimitations(long piDOFId)

Swap the angular limitations of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None

swap_posture() None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub SwapPosture()

Swap the posture with the equivalent segment, on the other side of the
manikin. For instance, the right leg takes the posture of the left leg, and
vice versa.
Return type:

None

swap_pref_angles(pi_dof_id: int) None

Note

CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
o Sub SwapPrefAngles(long piDOFId)

Swap the preferred angles of the segment.
Parameters:

pi_dof_id (int) –

Return type:

None