UIUtilities
¶
A class bundling multiple RoboDK related utility functions.
get_or_add_color_tile(name, parent=None)
staticmethod
¶
Get a color tile item from the RoboDK item tree or create it if it doesn't exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the color tile |
required |
parent |
Optional[robolink.robolink.Item] |
parent of the color tile |
None |
Returns:
Type | Description |
---|---|
Item |
the color tile |
Source code in core/ui/ui_util.py
95 96 97 98 99 100 101 102 103 104 105 106 |
|
get_or_add_cube_segment(name, parent=None)
staticmethod
¶
Get a cube segment item from the RoboDK item tree or create it if it doesn't exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the cube segment |
required |
parent |
Optional[robolink.robolink.Item] |
parent of the cube segment |
None |
Returns:
Type | Description |
---|---|
Item |
the cube segment |
Source code in core/ui/ui_util.py
82 83 84 85 86 87 88 89 90 91 92 93 |
|
get_or_add_frame(name, parent=None)
staticmethod
¶
Get an frame item from the RoboDK item tree or create it if it doesn't exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the frame |
required |
parent |
Optional[robolink.robolink.Item] |
parent of the frame |
None |
Returns:
Type | Description |
---|---|
Item |
the frame |
Source code in core/ui/ui_util.py
55 56 57 58 59 60 61 62 63 64 65 66 |
|
get_or_add_item(name, itemtype, parent=None, file=None)
staticmethod
¶
Get an item from the RoboDK item tree or create it if it doesn't exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
the name of the item |
required |
itemtype |
int |
the type of the item |
required |
parent |
Optional[robolink.robolink.Item] |
the parent of the item |
None |
file |
Optional[str] |
the path to the file to read the object from (e.g. STL file); only applicable if |
None |
Returns:
Type | Description |
---|---|
Item |
the desired item |
Exceptions:
Type | Description |
---|---|
ValueError |
The RoboDK item could not be created. |
ValueError |
The retrieved RoboDK item is invalid. |
Source code in core/ui/ui_util.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
get_or_add_object(name, file, parent=None)
staticmethod
¶
Get an object item from the RoboDK item tree or create it if it doesn't exist yet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str |
name of the object |
required |
parent |
Optional[robolink.robolink.Item] |
parent of the object |
None |
file |
str |
the filepath of the object (e.g. STEP/STL/OBJ etc.) |
required |
Returns:
Type | Description |
---|---|
Item |
the object |
Source code in core/ui/ui_util.py
68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
set_pose(item, cs=None, x=0, y=0, z=0, rx=0, ry=0, rz=0, scaling=1)
staticmethod
¶
Set the pose of the specified RoboDK item using either a CoordinateSystem
cs or x, y, z, rx, ry and rz.
In the latter case a scaling factor can be set.
If the CoordinateSystem
cs is given all other parameters are ignored.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
Item |
the item to set the position for |
required |
cs |
Optional[core.spatial.CoordinateSystem.CoordinateSystem] |
coordinate system to read translation and rotation from |
None |
x |
float |
translation along the x axis |
0 |
y |
float |
translation along the y axis |
0 |
z |
float |
translation along the z axis |
0 |
rx |
float |
rotation around x axis |
0 |
ry |
float |
rotation around y axis |
0 |
rz |
float |
rotation around z axis |
0 |
scaling |
float |
factor to apply to the translation |
1 |
Source code in core/ui/ui_util.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|