Breadcrumbs

get_tool_shape_list()

기능

현재 안전 설정 파라미터 중 현재 등록된 모든 툴 shape 정보를 반환 합니다.

리턴

자료형

설명

ret

class.config_tool_shape_list

등록된 tool shape 정보

클래스

class.config_tool_shape_list

Field

자료형

설명

obj

list

해당 클래스의 object 정보

count

int

등록된 툴 갯수

tool_shape_list

class.config_tool_shape_symbol[50]

등록된 툴 shape 정보(최대 50개)

class.config_tool_shape_symbol

Field

자료형

설명

obj

list

해당 클래스의 object 정보

symbol

string

툴 이름

tool_shape

class.config_tool_shape

툴 세부 정보

class.config_tool_shape

Field

자료형

설명

obj

list

해당 클래스의 object 정보

validity

int[5]

유효성 검사(0, 1)

shape

class.safety_object[5]

상세 형상 정보

class.safety_object

Field

자료형

설명

obj

list

해당 클래스의 object 정보

target_ref

int

사용하지 않는 변수

object_type

int

툴 shape 타입

0: 구

1: 캡슐

2: 직육면체

object

class.safety_object_data

각 입체 형상 정보

class.safety_object_data

object_type

Field

자료형

설명

-

obj

list

해당 클래스의 object 정보

0

sphere

class.safety_object_sphere

구 형태 object 정보

1

capsule

class.safety_object_capsule

캡슐 모양 object 정보

2

cuboid

class.safety_object_cuboid

직육면체 모양 object 정보

알아두기

기존 cube가 cuboid(직육면체)로 변경되었습니다.

해당 매뉴얼을 기준으로 cube 및 cuboid 모두 사용 가능하지만, 추후 cuboid로 통합될 수 있으므로 cube 사용을 권장하지 않습니다.

class.safety_object_sphere

Field

자료형

설명

obj

list

해당 클래스의 object 정보

radius

float

반지름

target_pos

class.point_3d

툴 좌표

* class.point_3d 요소

- x 좌표 (float)

- y 좌표 (float)

- z 좌표 (float)

class.safety_object_capsule

Field

자료형

설명

obj

list

해당 클래스의 object 정보

radius

float

반지름

target_pos

class.point_3d[2]

툴 좌표

* class.point_3d 요소

- x 좌표 (float)

- y 좌표 (float)

- z 좌표 (float)

class.safety_object_cuboid

Field

자료형

설명

obj

list

해당 클래스의 object 정보

target_pos

class.point_3d[2]

툴 좌표

* class.point_3d 요소

- x 좌표 (float)

- y 좌표 (float)

- z 좌표 (float)

예제

Python
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
			# 기존 cube가 cuboid로 변경되었습니다 
			# 해당 매뉴얼 기준 cuboid 및 cube 모두 지원하나 추후 cuboid로 통합될 예정으로 cube 사용을 권장하지 않습니다 
			# target_pos = tool_shape.object.cube.target_pos
			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 ---------------------")