-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy path__init__.pyi
More file actions
2327 lines (1797 loc) · 90.2 KB
/
__init__.pyi
File metadata and controls
2327 lines (1797 loc) · 90.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from typing import List, Dict
from cadwork.edge_list import edge_list
from cadwork.element_module_properties import element_module_properties
from cadwork.facet_list import facet_list
from cadwork.point_3d import point_3d
from cadwork.standard_element_type import standard_element_type
from cadwork.text_object_options import text_object_options
from cadwork.coordinate_system_data import coordinate_system_data
from cadwork.element_map_query import element_map_query
from cadwork.element_filter import element_filter
from cadwork.hit_result import hit_result
from cadwork.active_point_result import active_point_result
from cadwork.vertex_list import vertex_list
from cadwork.shoulder_options import shoulder_options
from cadwork.heel_shoulder_options import heel_shoulder_options
from cadwork.double_shoulder_options import double_shoulder_options
from cadwork.api_types import *
def delete_elements(element_id_list: List[ElementId]) -> None:
"""Deletes the specified elements.
Parameters:
element_id_list: The element id list.
"""
def join_elements(element_id_list: List[ElementId]) -> None:
"""Joins the specified elements together.
Parameters:
element_id_list: The element id list.
"""
def join_top_level_elements(element_id_list: List[ElementId]) -> None:
"""Joins the specified top-level elements together.
Parameters:
element_id_list: The element id list.
"""
def create_rectangular_beam_points(width: float, height: float, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a rectangular beam using points.
Parameters:
width: The width of the beam.
height: The height of the beam.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> beam_width = 200.
>>> beam_height = 400.
>>> beam_axis_start_pt = cadwork.point_3d(300., 0., 0.)
>>> beam_axis_end_pt = cadwork.point_3d(300., 0., 4000.)
>>> length_vector = (beam_axis_end_pt - beam_axis_start_pt).normalized()
>>> beam_axis_y = cadwork.point_3d(1., 0., 0.)
>>> beam_axis_z = length_vector.cross(beam_axis_y).normalized()
>>> beam_height_axis_pt = beam_axis_start_pt + beam_axis_z
>>> beam_id = ec.create_rectangular_beam_points(beam_width, beam_height, beam_axis_start_pt, beam_axis_end_pt, beam_height_axis_pt )
Returns:
The ID of the created rectangular beam.
"""
def create_circular_beam_points(diameter: float, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a circular beam using points.
Parameters:
diameter: The diameter of the beam.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> beam_diameter = 120.
>>> beam_axis_start_pt = cadwork.point_3d(0., 0., 0.)
>>> beam_axis_end_pt = cadwork.point_3d(0., 0., 3000.)
>>> length_vector = (beam_axis_end_pt - beam_axis_start_pt).normalized()
>>> beam_axis_y = cadwork.point_3d(1., 0., 0.)
>>> beam_axis_z = length_vector.cross(beam_axis_y).normalized()
>>> beam_orientation_pt = beam_axis_start_pt + beam_axis_z
>>> beam_id = ec.create_circular_beam_points(beam_diameter, beam_axis_start_pt, beam_axis_end_pt, beam_orientation_pt)
Returns:
The ID of the created circular beam.
"""
def create_square_beam_points(width: float, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a square beam using points.
Parameters:
width: The width of the beam.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> beam_width = 100.
>>> beam_axis_start_pt = cadwork.point_3d(500., 500., 0.)
>>> beam_axis_end_pt = cadwork.point_3d(500., 500., 2500.)
>>> length_vector = (beam_axis_end_pt - beam_axis_start_pt).normalized()
>>> reference_vector = cadwork.point_3d(0., 1., 0.)
>>> beam_axis_z = length_vector.cross(reference_vector).normalized()
>>> orientation_pt = beam_axis_start_pt + beam_axis_z
>>> beam_id = ec.create_square_beam_points(beam_width, beam_axis_start_pt, beam_axis_end_pt, orientation_pt)
Returns:
The ID of the created square beam.
"""
def create_rectangular_beam_vectors(width: float, height: float, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a rectangular beam using vectors.
Parameters:
width: The width of the beam.
height: The height of the beam.
length: The length of the beam.
starting_point: The starting point.
x_local_direction: The direction of the X-axis.
z_local_direction: The direction of the Z-axis.
Examples:
>>> beam_width = 150.
>>> beam_height = 300.
>>> beam_length = 4000.
>>> origin_point = cadwork.point_3d(0., 0., 0.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Direction along length
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Direction along height
>>> beam_id = ec.create_rectangular_beam_vectors(beam_width, beam_height, beam_length, origin_point, x_direction, z_direction)
Returns:
The ID of the created rectangular beam.
"""
def create_circular_beam_vectors(diameter: float, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a circular beam using vectors.
Parameters:
diameter: The diameter of the beam.
length: The length of the beam.
starting_point: The starting point of the beam.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> beam_diameter = 100.
>>> beam_length = 3500.
>>> origin_point = cadwork.point_3d(200., 200., 200.)
>>> x_direction = cadwork.point_3d(0., 1., 0.) # Beam aligned with Y axis
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Z orientation (arbitrary for circular beam)
>>> beam_id = ec.create_circular_beam_vectors(beam_diameter, beam_length, origin_point, x_direction, z_direction)
Returns:
The ID of the created circular beam.
"""
def create_square_beam_vectors(width: float, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a square beam using vectors.
Parameters:
width: The width of the beam.
length: The length of the beam.
starting_point: The starting point of the beam.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> beam_width = 120.
>>> beam_length = 2800.
>>> origin_point = cadwork.point_3d(0., 0., 500.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Direction along length
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Direction for orientation
>>> beam_id = ec.create_square_beam_vectors(beam_width, beam_length, origin_point, x_direction, z_direction)
Returns:
The ID of the created square beam.
"""
def create_rectangular_panel_points(width: float, thickness: float, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Create a rectangular panel using points.
Parameters:
width: The width of the panel.
thickness: The thickness of the panel.
first_point: The first corner point of the panel.
second_point: The second corner point of the panel.
third_point: The third corner point of the panel.
Examples:
>>> panel_width = 1200.
>>> panel_thickness = 27.
>>> panel_corner_pt = cadwork.point_3d(0., 0., 0.)
>>> panel_length_pt = cadwork.point_3d(0., 2400., 0.)
>>> # Calculate a point to define panel orientation
>>> normal_vector = cadwork.point_3d(0., 0., 1.) # Panel normal in Z direction
>>> orientation_pt = panel_corner_pt + normal_vector
>>> panel_id = ec.create_rectangular_panel_points(panel_width, panel_thickness, panel_corner_pt, panel_length_pt, orientation_pt)
Returns:
The ID of the created rectangular panel.
"""
def create_rectangular_panel_vectors(width: float, thickness: float, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Create a rectangular panel using vectors.
Parameters:
width: The width of the panel.
thickness: The thickness of the panel.
length: The length of the panel.
starting_point: The starting point of the panel.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> panel_width = 1000.
>>> panel_thickness = 20.
>>> panel_length = 2000.
>>> origin_point = cadwork.point_3d(0., 0., 100.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Direction along length
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Panel normal direction
>>> panel_id = ec.create_rectangular_panel_vectors(panel_width, panel_thickness, panel_length, origin_point, x_direction, z_direction)
Returns:
The ID of the created rectangular panel.
"""
def create_drilling_points(diameter: float, first_point: point_3d, second_point: point_3d) -> ElementId:
"""Creates drilling using points.
Parameters:
diameter: The diameter of the drilling.
first_point: The starting point of the drilling.
second_point: The ending point of the drilling.
Examples:
>>> drill_diameter = 30.
>>> drill_start_pt = cadwork.point_3d(100., 100., 0.)
>>> drill_end_pt = cadwork.point_3d(100., 100., 200.)
>>> drilling_id = ec.create_drilling_points(drill_diameter, drill_start_pt, drill_end_pt)
Returns:
The ID of the created drilling.
"""
def create_drilling_vectors(diameter: float, length: float, starting_point: point_3d, drilling_direction: point_3d) -> ElementId:
"""Creates drilling using vectors.
Parameters:
diameter: The diameter of the drilling.
length: The length of the drilling.
starting_point: The starting point of the drilling.
drilling_direction: The direction of the drilling.
Examples:
>>> drill_diameter = 12.
>>> drill_length = 180.
>>> drill_start_pt = cadwork.point_3d(200., 200., 50.)
>>> drill_direction = cadwork.point_3d(0., 0., 1.) # Drilling in Z direction
>>> drilling_id = ec.create_drilling_vectors(drill_diameter, drill_length, drill_start_pt, drill_direction)
Returns:
The ID of the created drilling.
"""
def create_line_points(first_point: point_3d, second_point: point_3d) -> ElementId:
"""Creates a line using points.
Parameters:
first_point: The first point of the line.
second_point: The second point of the line.
Examples:
>>> line_start_pt = cadwork.point_3d(0., 0., 0.)
>>> line_end_pt = cadwork.point_3d(500., 500., 0.)
>>> line_id = ec.create_line_points(line_start_pt, line_end_pt)
Returns:
The ID of the created line.
"""
def create_line_vectors(length: float, starting_point: point_3d, line_direction: point_3d) -> ElementId:
"""Creates a line using vectors.
Parameters:
length: The length of the line.
starting_point: The starting point of the line.
line_direction: The direction of the line.
Examples:
>>> line_length = 1000.
>>> line_start_pt = cadwork.point_3d(200., 0., 200.)
>>> line_direction = cadwork.point_3d(1., 1., 0.).normalized() # 45 degree line in XY plane
>>> line_id = ec.create_line_vectors(line_length, line_start_pt, line_direction)
Returns:
The ID of the created line.
"""
def create_node(node_position: point_3d) -> ElementId:
"""Creates a node.
Parameters:
node_position: The position of the node.
Examples:
>>> node_position = cadwork.point_3d(250., 250., 100.)
>>> node_id = ec.create_node(node_position)
Returns:
The ID of the created node.
"""
def solder_elements(element_id_list: List[ElementId]) -> List[ElementId]:
"""Solders elements together.
Parameters:
element_id_list: The element id list.
Returns:
The list of soldered element IDs.
"""
def convert_beam_to_panel(element_id_list: List[ElementId]) -> None:
"""Converts beams to panels.
Parameters:
element_id_list: The element id list.
"""
def convert_panel_to_beam(element_id_list: List[ElementId]) -> None:
"""Converts panels to beams.
Parameters:
element_id_list: The element id list.
"""
def delete_all_element_end_types(element_id_list: List[ElementId]) -> None:
"""Deletes all end types of the elements.
Parameters:
element_id_list: The element id list.
"""
def delete_all_element_processes(element_id_list: List[ElementId]) -> None:
"""Deletes all processes of the elements.
Parameters:
element_id_list: The element id list.
"""
def move_element(element_id_list: List[ElementId], move_vector: point_3d) -> None:
"""Moves the provided element by a specified vector.
Parameters:
element_id_list: The element id list.
move_vector: The vector by which to move the elements.
"""
def create_polygon_beam(polygon_vertices: vertex_list, thickness: float, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a polygon beam.
Parameters:
polygon_vertices: The vertices of the polygon.
thickness: The thickness of the beam.
x_local_direction: The x local direction of the beam.
z_local_direction: The z local direction of the beam.
Examples:
>>> # Create a triangular beam
>>> vertices = cadwork.vertex_list()
>>> vertices.append(cadwork.point_3d(0., 0., 0.))
>>> vertices.append(cadwork.point_3d(200., 0., 0.))
>>> vertices.append(cadwork.point_3d(100., 173.2, 0.)) # Equilateral triangle
>>> beam_thickness = 1000. # Length of the beam
>>> extrusion_vector = cadwork.point_3d(0., 0., 1.) # Direction of extrusion
>>> z_vector = cadwork.point_3d(1., 0., 0.) # Orientation vector
>>> polygon_beam_id = ec.create_polygon_beam(vertices, beam_thickness, extrusion_vector, z_vector)
Returns:
The ID of the created polygon beam.
"""
def create_text_object(text: str, position: point_3d, x_local_direction: point_3d, z_local_direction: point_3d, size: float) -> ElementId:
"""Creates a text object.
Parameters:
text: The text content.
position: The position of the text.
x_local_direction: The x local direction of the text.
z_local_direction: The z local direction of the text.
size: The size of the text.
Examples:
>>> text_content = "Cadwork API"
>>> text_position = cadwork.point_3d(0., 0., 0.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Text direction
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Text orientation
>>> text_height = 200.
>>> text_id = ec.create_text_object(text_content, text_position, x_direction, z_direction, text_height)
Returns:
The ID of the created text object.
"""
def copy_elements(element_id_list: List[ElementId], copy_vector: point_3d) -> List[int]:
"""Copy a list of elements.
Parameters:
element_id_list: The element id list.
copy_vector: The vector by which to copy the elements.
Returns:
The IDs of the copied elements.
"""
def rotate_elements(element_id_list: List[ElementId], origin: point_3d, rotation_axis: point_3d, rotation_angle: float) -> None:
"""Rotate the provided elements around a specified axis.
Parameters:
element_id_list: The element id list.
origin: The origin point of the rotation.
rotation_axis: The axis around which to rotate the elements.
rotation_angle: The angle by which to rotate the elements un degree.
"""
def subtract_elements(hard_elements: List[ElementId], soft_elements: List[ElementId]) -> List[ElementId]:
"""Subtracts a list of "soft" elements from a list of "hard" elements.
Parameters:
hard_elements: The list of "hard" elements.
soft_elements: The list of "soft" elements.
Returns:
The list of resulting elements.
"""
def check_element_id(element_id: ElementId) -> bool:
"""Check if the provided element ID exists.
Parameters:
element_id: The element id.
Returns:
True if the element ID exists, false otherwise.
"""
def start_element_module_calculation(covers: List[ElementId]) -> None:
"""Starts the calculation of the element module for a list of covers.
Parameters:
covers: The list of cover element IDs.
"""
def set_element_detail_path(path: str) -> None:
"""Sets the detail path for the element.
Parameters:
path: The detail path.
"""
def get_element_from_cadwork_guid(cadwork_guid: str) -> ElementId:
"""Gets element from cadwork guid.
Parameters:
cadwork_guid: The cadwork guid.
Returns:
The element ID.
"""
def add_elements_to_undo(element_id_list: List[ElementId], cmd: int) -> None:
"""Add elements to the undo stack.
Parameters:
element_id_list: The elements to add.
cmd: The command associated with the undo.
"""
def make_undo() -> None:
"""Performs an undo operation, reverting the last change made.
"""
def make_redo() -> None:
"""Performs a redo operation, reapplying the last undone change.
"""
def split_elements(element_id_list: List[ElementId]) -> None:
"""Splits elements.
Parameters:
element_id_list: The elements to split.
"""
def set_line_to_marking_line(element_id_list: List[ElementId]) -> None:
"""Sets the line to the marking line.
Parameters:
element_id_list: The elements to modify.
"""
def set_line_to_normal_line(element_id_list: List[ElementId]) -> None:
"""Sets the line to the normal line.
Parameters:
element_id_list: The elements to modify.
"""
def create_auto_export_solid_from_standard(element_id_list: List[ElementId], output_name: str, standard_element_name: str) -> ElementId:
"""Creates an auto export solid from a standard element.
Parameters:
element_id_list: The elements to use.
output_name: The output name.
standard_element_name: The standard element name.
Returns:
The element ID of the created solid.
"""
def set_element_module_properties_for_elements(element_id_list: List[ElementId], properties: element_module_properties) -> None:
"""Sets the element module properties for elements.
Parameters:
element_id_list: The elements to modify.
properties: The properties to set.
"""
def create_text_object_with_font(text: str, position: point_3d, x_local_direction: point_3d, z_local_direction: point_3d, size: float, font_name: str) -> ElementId:
"""Creates a text object with a specific font.
Parameters:
text: The text to be displayed in the text object.
position: The position of the text object.
x_local_direction: The X-axis direction of the text object.
z_local_direction: The Z-axis direction of the text object.
size: The size of the text object.
font_name: The font name.
Examples:
>>> text_content = "Custom Text"
>>> text_position = cadwork.point_3d(0., 0., 0.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Text direction
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Text orientation
>>> text_height = 150.
>>> font = "Arial"
>>> text_id = ec.create_text_object_with_font(text_content, text_position, x_direction, z_direction, text_height, font)
Returns:
The element ID of the created text object.
"""
def apply_transformation_coordinate(element_id_list: List[ElementId], old_point: point_3d, old_x_local_direction: point_3d, old_y_local_direction: point_3d, new_point: point_3d, new_x_local_direction: point_3d, new_y_local_direction: point_3d) -> None:
"""Apply transformation coordinate to elements.
Parameters:
element_id_list: The elements to modify.
old_point: The old point.
old_x_local_direction: The old X local direction.
old_y_local_direction: The old Y local direction.
new_point: The new point.
new_x_local_direction: The new X local direction.
new_y_local_direction: The new Y local direction.
"""
def delete_elements_with_undo(element_id_list: List[ElementId]) -> None:
"""Deletes the provided elements with undo functionality.
Parameters:
element_id_list: The elements to delete.
"""
def add_created_elements_to_undo(element_id_list: List[ElementId]) -> None:
"""Adds created elements to the undo stack.
Parameters:
element_id_list: The elements to add.
"""
def add_modified_elements_to_undo(element_id_list: List[ElementId]) -> None:
"""Adds modified elements to the undo stack.
Parameters:
element_id_list: The elements to add.
"""
def recreate_elements(element_id_list: List[ElementId]) -> None:
"""Recreate elements based on the provided list.
Parameters:
element_id_list: The elements to recreate.
"""
def create_multi_wall(element_id_list: List[ElementId]) -> None:
"""Creates a multi-wall structure.
Parameters:
element_id_list: The elements to use in the multi-wall structure.
"""
def get_user_element_ids() -> List[ElementId]:
"""Gets a list of user element IDs.
Returns:
The user element IDs.
"""
def get_user_element_ids_with_existing(element_id_list: List[ElementId]) -> List[ElementId]:
"""Retrieve a list of user element IDs that exist in the provided list.
Parameters:
element_id_list: The elements to check for existence.
Returns:
The list of existing user element IDs.
"""
def clear_errors() -> None:
"""Clears all errors.
"""
def glide_elements(element_id_list: List[ElementId], glide_origin_point: point_3d) -> None:
"""Glides elements to a specified point.
Parameters:
element_id_list: The elements to glide.
glide_origin_point: The glide origin point.
"""
def cut_elements_with_miter(first_id: ElementId, second_id: ElementId) -> bool:
"""Cut two elements with a miter joint.
Parameters:
first_id: The ID of the first element.
second_id: The ID of the second element.
Returns:
True if the cut operation was successful, false otherwise.
"""
def cut_element_with_plane(element_id: ElementId, cut_plane_normal_vector: point_3d, distance_from_global_origin: float) -> bool:
"""Cut an element with a plane.
Parameters:
element_id: The element id.
cut_plane_normal_vector: The normal vector of the cut plane.
distance_from_global_origin: The distance from the global origin to the cut plane.
Examples:
>>> import math
>>> beam_height = 240.
>>> beam_id = ec.create_rectangular_beam_vectors(120., beam_height, 3000., cadwork.point_3d(0., 0., 0.),
... cadwork.point_3d(0., 0., 1.), cadwork.point_3d(0., 1., 0.))
>>> # Define plane normal vector (30° from vertical in Y-Z plane)
>>> angle_rad = math.radians(30)
>>> plane_normal = cadwork.point_3d(0., -math.sin(angle_rad), math.cos(angle_rad)).normalized()
>>> # Calculate distance from origin to plane
>>> plane_point = cadwork.point_3d(0., beam_height * .5, 1500.) # Point for the cut plane
>>> distance = plane_point.dot(plane_normal) # Distance from origin to plane
>>> # To measure (check result) the distance correctly in cadwork, create a parallel plane to the cut plane
>>> # with the result of distance as the offset. This plane should hit through the origin (0, 0, 0).
>>> print(f"Plane normal: {plane_normal}, Distance: {distance}")
>>> result = ec.cut_element_with_plane(beam_id, plane_normal, distance)
>>> print(f"Cut operation successful: {result}")
Returns:
True if the cut operation was successful, false otherwise.
"""
def create_circular_mep(diameter: float, points: List[point_3d]) -> ElementId:
"""Create a circular MEP (Mechanical, Electrical, and Plumbing) element.
Parameters:
diameter: The diameter of the circular MEP.
points: The points defining the circular MEP.
Returns:
The ID of the created circular MEP element.
"""
def create_rectangular_mep(width: float, depth: float, points: List[point_3d]) -> ElementId:
"""Create a rectangular MEP (Mechanical, Electrical, and Plumbing) element.
Parameters:
width: The width of the rectangular MEP.
depth: The depth of the rectangular MEP.
points: The points defining the rectangular MEP.
Returns:
The ID of the created rectangular MEP element.
"""
def slice_element_with_plane(element_id: ElementId, cut_plane_normal_vector: point_3d, distance_from_global_origin: float) -> bool:
"""Slice an element with a plane.
Parameters:
element_id: The element id.
cut_plane_normal_vector: The normal vector of the cut plane.
distance_from_global_origin: The distance from the global origin to the slicing plane.
Examples:
>>> import math
>>> # Create a panel to slice
>>> panel_width = 1200.
>>> panel_thickness = 20.
>>> panel_length = 2400.
>>> panel_id = ec.create_rectangular_panel_vectors(panel_width, panel_thickness, panel_length,
... cadwork.point_3d(0., 0., 0.),
... cadwork.point_3d(1., 0., 0.),
... cadwork.point_3d(0., 0., 1.))
>>> # Define plane normal vector (45° in XY plane)
>>> angle_rad = math.radians(45)
>>> plane_normal = cadwork.point_3d(math.cos(angle_rad), math.sin(angle_rad), 0.).normalized()
>>> # Calculate distance from origin to plane - slice through center of panel
>>> panel_center = cadwork.point_3d(panel_length/2., panel_width/2., 0.)
>>> ec.create_node(panel_center) # Create a node at the center of the panel
>>> distance = panel_center.dot(plane_normal) # Distance from origin to plane
>>> # Verify plane equation: dot(point_on_plane, normal) = distance
>>> # Any point on the plane should satisfy this equation
>>> print(f"Plane normal: {plane_normal}, Distance: {distance}")
>>> # Slice the panel
>>> result = ec.slice_element_with_plane(panel_id, plane_normal, distance)
>>> print(f"Slice operation successful: {result}")
>>> # Note: slice_element_with_plane keeps both parts as a joined element
Returns:
True if the slicing operation was successful, false otherwise.
"""
def create_auto_container_from_standard(element_id_list: List[ElementId], output_name: str, standard_element_name: str) -> ElementId:
"""Create an auto container from a standard element.
Parameters:
element_id_list: The list of elements to be used in the auto container.
output_name: The name of the output.
standard_element_name: The name of the standard element.
Returns:
The id of the created auto container element.
"""
def create_auto_export_solid_from_standard_with_reference(element_id_list: List[ElementId], output_name: str, standard_element_name: str, reference_id: ElementId) -> ElementId:
"""Creates an auto export solid from a standard element with a reference.
Parameters:
element_id_list: The list of elements to be used in the export solid.
output_name: The name of the output.
standard_element_name: The name of the standard element.
reference_id: The ID of the reference element.
Returns:
The id of the created auto export solid element.
"""
def create_auto_container_from_standard_with_reference(element_id_list: List[ElementId], output_name: str, standard_element_name: str, reference_id: ElementId) -> ElementId:
"""Creates an auto container from a standard element with a reference.
Parameters:
element_id_list: The list of elements to be used in the auto container.
output_name: The name of the output.
standard_element_name: The name of the standard element.
reference_id: The ID of the reference element.
Returns:
The ID of the created auto container element.
"""
def create_surface(surface_vertices: vertex_list) -> ElementId:
"""Creates a surface from a list of vertices.
Parameters:
surface_vertices: The list of vertices defining the surface.
Examples:
>>> # Create a rectangular surface
>>> vertices = cadwork.vertex_list()
>>> vertices.append(cadwork.point_3d(0., 0., 0.))
>>> vertices.append(cadwork.point_3d(1000., 0., 0.))
>>> vertices.append(cadwork.point_3d(1000., 800., 0.))
>>> vertices.append(cadwork.point_3d(0., 800., 0.))
>>> surface_id = ec.create_surface(vertices)
Returns:
The ID of the created surface element.
"""
def stretch_start_facet(element_id_list: List[ElementId], stretch_vector: point_3d) -> None:
"""Stretch the start facet of the given elements.
Parameters:
element_id_list: The list of elements to be stretched.
stretch_vector: A vector that defines the stretch direction and distance.
"""
def stretch_end_facet(element_id_list: List[ElementId], stretch_vector: point_3d) -> None:
"""Stretch the end facet of the given elements.
Parameters:
element_id_list: The list of elements to be stretched.
stretch_vector: A vector that defines the stretch direction and distance.
"""
def set_export_solid_contents(export_solid_id: ElementId, element_id_list: List[ElementId]) -> None:
"""Sets the contents of an export solid.
Parameters:
export_solid_id: The ID of the export solid to set the contents for.
element_id_list: The list of element IDs to set as the contents of the export solid.
"""
def set_container_contents(container_id: ElementId, element_id_list: List[ElementId]) -> None:
"""Sets the contents of a container.
Parameters:
container_id: The ID of the container to set the contents for.
element_id_list: The list of element IDs to set as the contents of the container.
"""
def set_parent_opening_variants_opening_angle(element_id_list: List[ElementId], angle: float) -> None:
"""Sets the opening angle of the parent opening variants.
Parameters:
element_id_list: The list of element IDs to set the opening angle for.
angle: The opening angle to set.
"""
def mirror_move_elements(element_id_list: List[ElementId], plane: point_3d, plane_distance: float) -> None:
"""Mirrors and moves elements across a plane.
Parameters:
element_id_list: The list of element IDs to mirror and move.
plane: The plane to mirror across.
plane_distance: The distance from the plane.
"""
def mirror_copy_elements(element_id_list: List[ElementId], plane: point_3d, plane_distance: float) -> List[ElementId]:
"""Copies elements by mirroring them across a plane.
Parameters:
element_id_list: The ID of the element to copy.
plane: The plane to mirror across.
plane_distance: The distance from the plane.
Returns:
The list of IDs of the copied elements.
"""
def reset_element_cadwork_guid(element_id: ElementId) -> None:
"""Sets the Cadwork Guid of an element to NULL.
Parameters:
element_id: The element id.
"""
def create_standard_beam_points(standard_element_name: str, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a standard beam using points.
Parameters:
standard_element_name: The name of the standard element.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> std_beam_name = "Standard-Timber-120x240" # Name as found in standard elements library
>>> beam_start_pt = cadwork.point_3d(0., 0., 0.)
>>> beam_end_pt = cadwork.point_3d(0., 0., 3000.)
>>> # Calculate orientation point
>>> length_vector = (beam_end_pt - beam_start_pt).normalized()
>>> ref_vector = cadwork.point_3d(1., 0., 0.)
>>> orientation_vector = length_vector.cross(ref_vector).normalized()
>>> orientation_pt = beam_start_pt + orientation_vector
>>> std_beam_id = ec.create_standard_beam_points(std_beam_name, beam_start_pt, beam_end_pt, orientation_pt)
Returns:
The ID of the created standard beam.
"""
def create_standard_beam_vectors(standard_element_name: str, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a standard beam using vectors.
Parameters:
standard_element_name: The name of the standard element.
length: The length of the beam.
starting_point: The starting point of the beam.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> std_beam_name = "Standard-Timber-100x100" # Name as found in standard elements library
>>> beam_length = 2500.
>>> origin_point = cadwork.point_3d(100., 100., 100.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Direction along length
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Orientation vector
>>> std_beam_id = ec.create_standard_beam_vectors(std_beam_name, beam_length, origin_point, x_direction, z_direction)
Returns:
The ID of the created standard beam.
"""
def create_standard_panel_points(standard_element_name: str, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a standard panel using points.
Parameters:
standard_element_name: The name of the standard element.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> std_panel_name = "Standard-Panel-27mm" # Name as found in standard elements library
>>> panel_corner_pt = cadwork.point_3d(0., 0., 0.)
>>> panel_width_pt = cadwork.point_3d(1200., 0., 0.)
>>> # Calculate normal point for panel orientation (assuming Z is up)
>>> panel_normal = cadwork.point_3d(0., 0., 1.)
>>> orientation_pt = panel_corner_pt + panel_normal
>>> std_panel_id = ec.create_standard_panel_points(std_panel_name, panel_corner_pt, panel_width_pt, orientation_pt)
Returns:
The id of the created standard panel.
"""
def create_standard_panel_vectors(standard_element_name: str, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a standard panel using vectors.
Parameters:
standard_element_name: The name of the standard element.
length: The length of the panel.
starting_point: The starting point of the panel.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> std_panel_name = "Standard-Panel-20mm" # Name as found in standard elements library
>>> panel_length = 2400.
>>> origin_point = cadwork.point_3d(0., 0., 0.)
>>> x_direction = cadwork.point_3d(1., 0., 0.) # Direction along length
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Panel normal direction
>>> std_panel_id = ec.create_standard_panel_vectors(std_panel_name, panel_length, origin_point, x_direction, z_direction)
Returns:
The id of the created standard panel.
"""
def create_standard_steel_points(standard_element_name: str, first_point: point_3d, second_point: point_3d, third_point: point_3d) -> ElementId:
"""Creates a standard steel element using points.
Parameters:
standard_element_name: The name of the standard element.
first_point: The first point.
second_point: The second point.
third_point: The third point.
Examples:
>>> std_steel_name = "IPE 200" # Name of standard steel profile from library
>>> steel_start_pt = cadwork.point_3d(0., 0., 500.)
>>> steel_end_pt = cadwork.point_3d(3000., 0., 500.)
>>> # Calculate orientation point
>>> length_vector = (steel_end_pt - steel_start_pt).normalized()
>>> up_vector = cadwork.point_3d(0., 0., 1.)
>>> side_vector = length_vector.cross(up_vector).normalized()
>>> orientation_pt = steel_start_pt + up_vector
>>> steel_id = ec.create_standard_steel_points(std_steel_name, steel_start_pt, steel_end_pt, orientation_pt)
Returns:
The id of the created standard steel element.
"""
def create_standard_steel_vectors(standard_element_name: str, length: float, starting_point: point_3d, x_local_direction: point_3d, z_local_direction: point_3d) -> ElementId:
"""Creates a standard steel element using vectors.
Parameters:
standard_element_name: The name of the standard element.
length: The length of the element.
starting_point: The starting point of the element.
x_local_direction: The local X direction vector.
z_local_direction: The local Z direction vector.
Examples:
>>> std_steel_name = "HEA 220" # Name of standard steel profile from library
>>> steel_length = 4500.
>>> origin_point = cadwork.point_3d(200., 0., 200.)
>>> x_direction = cadwork.point_3d(0., 1., 0.) # Direction along Y axis
>>> z_direction = cadwork.point_3d(0., 0., 1.) # Up direction
>>> steel_id = ec.create_standard_steel_vectors(std_steel_name, steel_length, origin_point, x_direction, z_direction)
Returns:
The id of the created standard steel element.
"""
def move_element_with_undo(element_id_list: List[ElementId], vector: point_3d) -> None:
"""Moves an element with undo functionality.
Parameters:
element_id_list: The element id list.
vector: The vector to move the element.
"""
def create_normal_axis_points(first_point: point_3d, second_point: point_3d) -> ElementId: