|
1 | 1 | from typing import List |
2 | | -from cadwork import point_3d |
| 2 | +from cadwork.point_3d import point_3d |
3 | 3 | from cadwork.dimension_base_format import dimension_base_format |
| 4 | +from cadwork.api_types import * |
4 | 5 |
|
5 | | -def create_dimension(xl: point_3d, plane_normal: point_3d, distance: point_3d, dimension_points: List[point_3d]) -> int: |
6 | | - """creates a dimension element |
| 6 | +def create_dimension(xl: point_3d, plane_normal: point_3d, distance: point_3d, dimension_points: List[point_3d]) -> ElementId: |
| 7 | + """Creates a dimension element. |
7 | 8 |
|
8 | 9 | Parameters: |
9 | | - xl: xl |
10 | | - plane_normal: plane_normal |
11 | | - distance: distance |
12 | | - dimension_points: dimension_points |
| 10 | + xl: The x direction of the dimension. |
| 11 | + plane_normal: The normal vector of the dimension plane. |
| 12 | + distance: The distance vector from the anchor point to the dimension reference point. |
| 13 | + dimension_points: A list of dimension points. |
13 | 14 |
|
14 | 15 | Returns: |
15 | | - elementID of created dimension element |
| 16 | + The element id of the created dimension element. |
16 | 17 | """ |
17 | 18 |
|
18 | | -def set_orientation(elements: List[int], view_dir: point_3d, view_dir_up: point_3d) -> None: |
19 | | - """sets the orientation of a dimension element |
| 19 | +def set_orientation(element_id_list: List[ElementId], view_dir: point_3d, view_dir_up: point_3d) -> None: |
| 20 | + """Sets the orientation of dimension elements. |
20 | 21 |
|
21 | 22 | Parameters: |
22 | | - elements: elements |
23 | | - view_dir: view_dir |
24 | | - view_dir_up: view_dir_up |
25 | | -
|
26 | | - Returns: |
27 | | - None |
| 23 | + element_id_list: The element id list. |
| 24 | + view_dir: The view direction vector. |
| 25 | + view_dir_up: The view direction up vector. |
28 | 26 | """ |
29 | 27 |
|
30 | | -def add_segment(element: int, segment: point_3d) -> None: |
31 | | - """adds a segment to a dimension element |
| 28 | +def add_segment(element_id: ElementId, segment: point_3d) -> None: |
| 29 | + """Adds a segment to a dimension element. |
32 | 30 |
|
33 | 31 | Parameters: |
34 | | - element: element |
35 | | - segment: segment |
36 | | -
|
37 | | - Returns: |
38 | | - None |
| 32 | + element_id: The element id. |
| 33 | + segment: The segment to add. |
39 | 34 | """ |
40 | 35 |
|
41 | | -def set_precision(elements: List[int], precision: int) -> None: |
42 | | - """sets the precision/decimal places of a dimension element |
| 36 | +def set_precision(element_id_list: List[ElementId], precision: UnsignedInt) -> None: |
| 37 | + """Sets the precision/decimal places of a dimension element. |
43 | 38 |
|
44 | 39 | Parameters: |
45 | | - elements: elements |
46 | | - precision: precision |
47 | | -
|
48 | | - Returns: |
49 | | - None |
| 40 | + element_id_list: The element id list. |
| 41 | + precision: The precision/decimal places to set. |
50 | 42 | """ |
51 | 43 |
|
52 | | -def set_text_size(elements: List[int], text_size: float) -> None: |
53 | | - """sets the text size a dimension element |
| 44 | +def set_text_size(element_id_list: List[ElementId], text_size: float) -> None: |
| 45 | + """Sets the text size of a dimension element. |
54 | 46 |
|
55 | 47 | Parameters: |
56 | | - elements: elements |
57 | | - text_size: text_size |
58 | | -
|
59 | | - Returns: |
60 | | - None |
| 48 | + element_id_list: The element id list. |
| 49 | + text_size: The text size to set. |
61 | 50 | """ |
62 | 51 |
|
63 | | -def set_line_thickness(elements: List[int], thickness: float) -> None: |
64 | | - """sets the line thickness a dimension element |
| 52 | +def set_line_thickness(element_id_list: List[ElementId], thickness: float) -> None: |
| 53 | + """Sets the line thickness of a dimension element. |
65 | 54 |
|
66 | 55 | Parameters: |
67 | | - elements: elements |
68 | | - thickness: thickness |
69 | | -
|
70 | | - Returns: |
71 | | - None |
| 56 | + element_id_list: The element id list. |
| 57 | + thickness: The line thickness to set. |
72 | 58 | """ |
73 | 59 |
|
74 | | -def set_total_dimension(elements: List[int], total: bool) -> None: |
75 | | - """sets if the total dimension is shown in a dimension element |
| 60 | +def set_total_dimension(element_id_list: List[ElementId], total: bool) -> None: |
| 61 | + """Set whether the visualisation of the overall dimension is set for a dimension element. |
76 | 62 |
|
77 | 63 | Parameters: |
78 | | - elements: elements |
79 | | - total: total |
80 | | -
|
81 | | - Returns: |
82 | | - None |
| 64 | + element_id_list: The element id list. |
| 65 | + total: True if the visualisation is set, false otherwise. |
83 | 66 | """ |
84 | 67 |
|
85 | | -def set_text_color(elements: List[int], color_id: int) -> None: |
86 | | - """sets the text color a dimension element |
| 68 | +def set_text_color(element_id_list: List[ElementId], color_id: ColorId) -> None: |
| 69 | + """Sets the text color of a dimension element. |
87 | 70 |
|
88 | 71 | Parameters: |
89 | | - elements: elements |
90 | | - color_id: color_id |
91 | | -
|
92 | | - Returns: |
93 | | - None |
| 72 | + element_id_list: The element id list. |
| 73 | + color_id: The color id to set. |
94 | 74 | """ |
95 | 75 |
|
96 | | -def set_line_color(elements: List[int], color_id: int) -> None: |
97 | | - """sets the line color a dimension element |
| 76 | +def set_line_color(element_id_list: List[ElementId], color_id: ColorId) -> None: |
| 77 | + """Sets the line color of a dimension element. |
98 | 78 |
|
99 | 79 | Parameters: |
100 | | - elements: elements |
101 | | - color_id: color_id |
102 | | -
|
103 | | - Returns: |
104 | | - None |
105 | | - """ |
| 80 | + element_id_list: The element id list. |
| 81 | + color_id: The color id to set. |
| 82 | + """ |
106 | 83 |
|
107 | | -def set_default_anchor_length(elements: List[int], length: float) -> None: |
108 | | - """sets the default anchor length a dimension element |
| 84 | +def set_default_anchor_length(element_id_list: List[ElementId], length: float) -> None: |
| 85 | + """Sets the default anchor length of a dimension element. |
109 | 86 |
|
110 | 87 | Parameters: |
111 | | - elements: elements |
112 | | - length: length |
113 | | -
|
114 | | - Returns: |
115 | | - None |
| 88 | + element_id_list: The element id list. |
| 89 | + length: The default anchor length to set. |
116 | 90 | """ |
117 | 91 |
|
118 | | -def set_distance(elements: List[int], distance: point_3d) -> None: |
119 | | - """sets the distance vector between the points and the line |
| 92 | +def set_distance(element_id_list: List[ElementId], distance: point_3d) -> None: |
| 93 | + """Sets the distance vector between the points and the line. |
120 | 94 |
|
121 | 95 | Parameters: |
122 | | - elements: elements |
123 | | - distance: distance |
124 | | -
|
125 | | - Returns: |
126 | | - None |
| 96 | + element_id_list: The element id list. |
| 97 | + distance: The distance vector to set. |
127 | 98 | """ |
128 | 99 |
|
129 | | -def shift_distance_and_texts(elements: List[int], shifted: bool) -> None: |
130 | | - """sets if distance and texts are shifted |
| 100 | +def shift_distance_and_texts(element_id_list: List[ElementId], shifted: bool) -> None: |
| 101 | + """Sets if distance and texts are shifted. |
131 | 102 |
|
132 | 103 | Parameters: |
133 | | - elements: elements |
134 | | - shifted: shifted |
135 | | -
|
136 | | - Returns: |
137 | | - None |
| 104 | + element_id_list: The element id list. |
| 105 | + shifted: True if distance and texts are shifted, false otherwise. |
138 | 106 | """ |
139 | 107 |
|
140 | | -def get_dimension_points(element: int) -> List[point_3d]: |
141 | | - """gets all dimension points ordered by dimension direction |
| 108 | +def get_dimension_points(element_id: ElementId) -> List[point_3d]: |
| 109 | + """Gets all dimension points ordered by dimension direction. |
142 | 110 |
|
143 | 111 | Parameters: |
144 | | - element: element |
| 112 | + element_id: The element id. |
145 | 113 |
|
146 | 114 | Returns: |
147 | | - ICwAPI3DVertexList |
| 115 | + A list of dimension points. |
148 | 116 | """ |
149 | 117 |
|
150 | | -def get_default_anchor_length(element: int) -> float: |
151 | | - """gets the default anchor length |
| 118 | +def get_default_anchor_length(element_id: ElementId) -> float: |
| 119 | + """Gets the default anchor length. |
152 | 120 |
|
153 | 121 | Parameters: |
154 | | - element: element |
| 122 | + element_id: The element id. |
155 | 123 |
|
156 | 124 | Returns: |
157 | | - double |
| 125 | + The default anchor length. |
158 | 126 | """ |
159 | 127 |
|
160 | | -def get_distance(element: int) -> point_3d: |
| 128 | +def get_distance(element_id: ElementId) -> point_3d: |
161 | 129 | """Get the distance to the dimension reference point. The point is in the plane of the dimensioning. |
162 | 130 |
|
163 | 131 | Parameters: |
164 | | - element: element |
| 132 | + element_id: The element id. |
165 | 133 |
|
166 | 134 | Returns: |
167 | | - point_3d |
| 135 | + The distance vector. |
168 | 136 | """ |
169 | 137 |
|
170 | | -def get_plane_normal(element: int) -> point_3d: |
171 | | - """Get the plane normal |
| 138 | +def get_plane_normal(element_id: ElementId) -> point_3d: |
| 139 | + """Get the plane normal. |
172 | 140 |
|
173 | 141 | Parameters: |
174 | | - element: element |
| 142 | + element_id: The element id. |
175 | 143 |
|
176 | 144 | Returns: |
177 | | - normal |
| 145 | + The plane normal vector. |
178 | 146 | """ |
179 | 147 |
|
180 | | -def get_plane_xl(element: int) -> point_3d: |
181 | | - """Get the plane x direction |
| 148 | +def get_plane_xl(element_id: ElementId) -> point_3d: |
| 149 | + """Get the plane x direction. |
182 | 150 |
|
183 | 151 | Parameters: |
184 | | - element: element |
| 152 | + element_id: The element id. |
185 | 153 |
|
186 | 154 | Returns: |
187 | | - x direction |
| 155 | + The plane x direction vector. |
188 | 156 | """ |
189 | 157 |
|
190 | | -def get_segment_count(element: int) -> int: |
191 | | - """Get count of segments |
| 158 | +def get_segment_count(element_id: ElementId) -> int: |
| 159 | + """Get count of segments. |
192 | 160 |
|
193 | 161 | Parameters: |
194 | | - element: element |
| 162 | + element_id: The element id. |
195 | 163 |
|
196 | 164 | Returns: |
197 | | - segment count |
| 165 | + The number of segments. |
198 | 166 | """ |
199 | 167 |
|
200 | | -def get_segment_distance(element: int, segment_index: int) -> float: |
201 | | - """Get the distance from the anchor point to the dimension segment |
| 168 | +def get_segment_distance(element_id: ElementId, segment_index: int) -> float: |
| 169 | + """Get the distance from the anchor point to the dimension segment. |
202 | 170 |
|
203 | 171 | Parameters: |
204 | | - element: element |
205 | | - segment_index: segment_index |
| 172 | + element_id: The element id. |
| 173 | + segment_index: The segment index. |
206 | 174 |
|
207 | 175 | Returns: |
208 | | - distance |
| 176 | + The distance from the anchor point to the dimension segment. |
209 | 177 | """ |
210 | 178 |
|
211 | | -def get_segment_direction(element: int, segment_index: int) -> point_3d: |
212 | | - """get segment direction |
| 179 | +def get_segment_direction(element_id: ElementId, segment_index: int) -> point_3d: |
| 180 | + """Get the normalized direction from the anchor point to the point on the dimension. |
213 | 181 |
|
214 | 182 | Parameters: |
215 | | - element: element |
216 | | - segment_index: segment_index |
| 183 | + element_id: The element id. |
| 184 | + segment_index: The segment index. |
217 | 185 |
|
218 | 186 | Returns: |
219 | | - point_3d |
| 187 | + The segment direction vector. |
220 | 188 | """ |
221 | 189 |
|
222 | | -def get_total_dimension(element: int) ->bool: |
223 | | - """get total dimension |
| 190 | +def get_total_dimension(element_id: ElementId) -> bool: |
| 191 | + """Query whether the visualisation of the overall dimension is set for a dimension element. |
224 | 192 |
|
225 | 193 | Parameters: |
226 | | - element: element |
| 194 | + element_id: The element id. |
227 | 195 |
|
228 | 196 | Returns: |
229 | | - bool |
| 197 | + True if the visualisation is set, false otherwise. For elements that are not of type dimension, the return value is per default false. |
230 | 198 | """ |
231 | 199 |
|
232 | 200 |
|
233 | | -def get_dimension_base_format(element: int) -> dimension_base_format: |
234 | | - """get dimension base format |
| 201 | +def get_dimension_base_format(element_id: ElementId) -> dimension_base_format: |
| 202 | + """Get the dimension base format. |
235 | 203 |
|
236 | 204 | Parameters: |
237 | | - element: element |
| 205 | + element_id: The element id. |
238 | 206 |
|
239 | 207 | Returns: |
240 | | - dimension_base_format |
| 208 | + The format used for the dimension. Enum value `None` may indicate that something went wrong while retrieving the value due to e.g. the element not being a valid dimension. |
241 | 209 | """ |
0 commit comments