Features
Returns all currently registered tool shape information for the current safety setting parameter.
Return
|
Value |
Data Types |
Description |
|---|---|---|
|
ret |
class.config_tool_shape_list |
Information about all registered tools shape |
Class
class.config_tool_shape_list
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
count |
int |
Number of registered tools |
|
tool_shape_list |
class.config_tool_shape_symbol[50] |
Registered tool shape information (up to 50) |
class.config_tool_shape_symbol
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
symbol |
string |
Tool name |
|
tool_shape |
class.config_shape_tool |
Tool details |
class.config_tool_shape
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
validity |
int[5] |
Validate (0, 1) |
|
shape |
class.safety_object[5] |
tool shape, shape information |
class.safety_object
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
target_ref |
int |
Unused variable |
|
object_type |
int |
Tool shape type 0: Sphere 1: Capsule 2: Cuboid |
|
object |
class.safety_object_data |
Tool shape type details 0: class.safety_object_sphere 1: class.safety_object_capsule 2: class.safety_object_cuboid |
Note
The previous name 'cube' is changed into 'cuboid'.
Can use either 'cube' or 'cuboid' based on the current version of the manual but usage of 'cube' will be deprecated. 'cube' is not recommended
class.safety_object_sphere
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
radius |
float |
radius |
|
target_pos |
class.point_3d |
Tool point * Elements the class.point_3d - X point (float) - Y point (float) - Z point (float) |
class.safety_object_capsule
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for this class |
|
radius |
float |
Radius |
|
target_pos |
class.point_3d[2] |
Tool point * Elements the class.point_3d - X point (float) - Y point (float) - Z point (float) |
class.safety_object_cuboid
|
||
|
Field |
Data Types |
Description |
|---|---|---|
|
obj |
list |
Object information for that class |
|
target_pos |
class.point_3d[2] |
Tool point * Elements the class.point_3d - X point (float) - Y point (float) - Z point (float) |
Example
tools = get_tool_shape_list()
tp_log("---------------- example start -------------------")
tp_log("tool count: {}".format( tools.count))
for i in range( tools.count ): # loop for tool count
tool = tools.tool_shape_list[i]
name = tool.symbol # get tool name
validity = tool.tool_shape.validity # get tool validity
indices = [i for i, x in enumerate(validity) if x] # make list of activated part indexs
tp_log("------------------------------------------------")
tp_log("tool{:d} name: {} validity: {}".format(i, name, validity))
for n in indices:
tp_log("> tool{:d} part{} datas".format(i, n))
tool_shape = tool.tool_shape.shape[n]
obj_type = tool_shape.object_type # get tool object type
if obj_type == 0: # obj type is Sphere
r = tool_shape.object.sphere.radius
target_pos = tool_shape.object.sphere.target_pos
target_pos = [ target_pos.x, target_pos.y, target_pos.z]
tp_log("type: sphere | radious: {:.2f} pos: {}".format(r, target_pos))
elif obj_type == 1: # obj type is Capsule
r = tool_shape.object.capsule.radius
target_pos = tool_shape.object.capsule.target_pos
target_pos = [[ target_pos[j].x, target_pos[j].y, target_pos[j].z] for j in range(2)]
tp_log("type: capsule | radious: {:.2f} pos: {}".format(r, target_pos))
elif obj_type == 2: # obj type is Cuboid
# the previous name 'cube' is changed into 'cuboid'
# can use either 'cube' or 'cuboid' based on the current version of the manual but usage of 'cube' will be deprecated. 'cube' is not recommended
target_pos = tool_shape.object.cuboid.target_pos
target_pos = [[ target_pos[j].x, target_pos[j].y, target_pos[j].z] for j in range(2)]
tp_log("type: cuboid | pos: {}".format(target_pos))
tp_log("---------------- example end ---------------------")