Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pdt_design.py « precision_drawing_tools - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ddb7fb3886f6ae24231ba938dc888cbda875fac2 (plain)
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
# SPDX-License-Identifier: GPL-2.0-or-later

# -----------------------------------------------------------------------
# Author: Alan Odom (Clockmender), Rune Morling (ermo) Copyright (c) 2019
# -----------------------------------------------------------------------
#
from bpy.types import Operator
from .pdt_msg_strings import (
    PDT_ERR_NON_VALID,
    PDT_LAB_ABS,
    PDT_LAB_DEL,
    PDT_LAB_DIR,
    PDT_LAB_INTERSECT,
    PDT_LAB_PERCENT,
)


class PDT_OT_PlacementAbs(Operator):
    """Use Absolute, or Global Placement"""

    bl_idname = "pdt.absolute"
    bl_label = "Absolute Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Absolute (World) Coordinates.

        Note:
            - Reads pg.operate from Operation Mode Selector as 'operation'
            - Reads pg.cartesian_coords scene variables to:
            -- set position of Cursor      (CU)
            -- set position of Pivot Point (PP)
            -- MoVe geometry/objects       (MV)
            -- Extrude Vertices            (EV)
            -- Split Edges                 (SE)
            -- add a New Vertex            (NV)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round

        if operation == "CU":
            # Cursor
            pg.command = (
                f"ca{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "PP":
            # Pivot Point
            pg.command = (
                f"pa{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "MV":
            # Move Entities
            pg.command = (
                f"ga{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "SE":
            # Split Edges
            pg.command = (
                f"sa{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "NV":
            # New Vertex
            pg.command = (
                f"na{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "EV":
            # Extrude Vertices
            pg.command = (
                f"va{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_ABS}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementDelta(Operator):
    """Use Delta, or Incremental Placement"""

    bl_idname = "pdt.delta"
    bl_label = "Delta Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Delta Offset (Increment).

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.select, pg.plane, pg.cartesian_coords scene variables to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- Split Edges                  (SE)
            -- add a New Vertex             (NV)
            -- Duplicate Geometry           (DG)
            -- Extrude Geometry             (EG)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round

        if operation == "CU":
            # Cursor
            pg.command = (
                f"cd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "PP":
            # Pivot Point
            pg.command = (
                f"pd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "MV":
            # Move Entities
            pg.command = (
                f"gd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "SE":
            # Split Edges
            pg.command = (
                f"sd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "NV":
            # New Vertex
            pg.command = (
                f"nd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "EV":
            # Extrude Vertices
            pg.command = (
                f"vd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "DG":
            # Duplicate Entities
            pg.command = (
                f"dd{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        elif operation == "EG":
            # Extrude Geometry
            pg.command = (
                f"ed{str(round(pg.cartesian_coords.x, decimal_places))}"
                f",{str(round(pg.cartesian_coords.y, decimal_places))}"
                f",{str(round(pg.cartesian_coords.z, decimal_places))}"
            )
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_DEL}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementDis(Operator):
    """Use Directional, or Distance @ Angle Placement"""

    bl_idname = "pdt.distance"
    bl_label = "Distance@Angle Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Distance at Angle (Direction).

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.select, pg.distance, pg.angle, pg.plane & pg.flip_angle scene variables to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- Split Edges                  (SE)
            -- add a New Vertex             (NV)
            -- Duplicate Geometry           (DG)
            -- Extrude Geometry             (EG)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round

        if operation == "CU":
            # Cursor
            pg.command = (
                f"ci{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "PP":
            # Pivot Point
            pg.command = (
                f"pi{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "MV":
            # Move Entities
            pg.command = (
                f"gi{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "SE":
            # Split Edges
            pg.command = (
                f"si{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
                )
        elif operation == "NV":
            # New Vertex
            pg.command = (
                f"ni{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "EV":
            # Extrude Vertices
            pg.command = (
                f"vi{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "DG":
            # Duplicate Geometry
            pg.command = (
                f"di{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        elif operation == "EG":
            # Extrude Geometry
            pg.command = (
                f"ei{str(round(pg.distance, decimal_places))}"
                f",{str(round(pg.angle, decimal_places))}"
            )
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_DIR}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementView(Operator):
    """Use Distance Input for View Normal Axis Operations"""

    bl_idname = "pdt.view_axis"
    bl_label = "View Normal Axis Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by View Normal Axis Offset (Increment).

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.select, pg.plane, pg.cartesian_coords scene variables to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- Split Edges                  (SE)
            -- add a New Vertex             (NV)
            -- Duplicate Geometry           (DG)
            -- Extrude Geometry             (EG)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round

        if operation == "CU":
            # Cursor
            pg.command = (
                f"cn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "PP":
            # Pivot Point
            pg.command = (
                f"pn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "MV":
            # Move Entities
            pg.command = (
                f"gn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "NV":
            # New Vertex
            pg.command = (
                f"nn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "EV":
            # Extrude Vertices
            pg.command = (
                f"vn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "DG":
            # Duplicate Entities
            pg.command = (
                f"dn{str(round(pg.distance, decimal_places))}"
            )
        elif operation == "EG":
            # Extrude Geometry
            pg.command = (
                f"en{str(round(pg.distance, decimal_places))}"
            )
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_DEL}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementPer(Operator):
    """Use Percentage Placement"""

    bl_idname = "pdt.percent"
    bl_label = "Percentage Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Percentage between 2 points.

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.percent, pg.extend & pg.flip_percent scene variables to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- Split Edges                  (SE)
            -- add a New Vertex             (NV)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round

        if operation == "CU":
            # Cursor
            pg.command = f"cp{str(round(pg.percent, decimal_places))}"
        elif operation == "PP":
            # Pivot Point
            pg.command = f"pp{str(round(pg.percent, decimal_places))}"
        elif operation == "MV":
            # Move Entities
            pg.command = f"gp{str(round(pg.percent, decimal_places))}"
        elif operation == "SE":
            # Split Edges
            pg.command = f"sp{str(round(pg.percent, decimal_places))}"
        elif operation == "NV":
            # New Vertex
            pg.command = f"np{str(round(pg.percent, decimal_places))}"
        elif operation == "EV":
            # Extrude Vertices
            pg.command = f"vp{str(round(pg.percent, decimal_places))}"
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_PERCENT}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementNormal(Operator):
    """Use Normal, or Perpendicular Placement"""

    bl_idname = "pdt.normal"
    bl_label = "Normal Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Normal Intersection between 3 points.

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.extend scene variable to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- Split Edges                  (SE)
            -- add a New Vertex             (NV)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        if operation == "CU":
            pg.command = f"cnml"
        elif operation == "PP":
            pg.command = f"pnml"
        elif operation == "MV":
            pg.command = f"gnml"
        elif operation == "EV":
            pg.command = f"vnml"
        elif operation == "SE":
            pg.command = f"snml"
        elif operation == "NV":
            pg.command = f"nnml"
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_INTERSECT}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementCen(Operator):
    """Use Placement at Arc Centre"""

    bl_idname = "pdt.centre"
    bl_label = "Centre Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects to an Arc Centre defined by 3 points on an Imaginary Arc.

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- add a New vertex             (NV)

            Invalid Options result in self.report Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        if operation == "CU":
            pg.command = f"ccen"
        elif operation == "PP":
            pg.command = f"pcen"
        elif operation == "MV":
            pg.command = f"gcen"
        elif operation == "EV":
            pg.command = f"vcen"
        elif operation == "NV":
            pg.command = f"ncen"
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_INTERSECT}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_PlacementInt(Operator):
    """Use Intersection, or Convergence Placement"""

    bl_idname = "pdt.intersect"
    bl_label = "Intersect Mode"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Manipulates Geometry, or Objects by Convergence Intersection between 4 points, or 2 Edges.

        Note:
            - Reads pg.operation from Operation Mode Selector as 'operation'
            - Reads pg.plane scene variable and operates in Working Plane to:
            -- set position of CUrsor       (CU)
            -- set position of Pivot Point  (PP)
            -- MoVe geometry/objects        (MV)
            -- Extrude Vertices             (EV)
            -- add a New vertex             (NV)

            Invalid Options result in "self.report" Error.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        operation = pg.operation
        if operation == "CU":
            pg.command = f"cint"
        elif operation == "PP":
            pg.command = f"pint"
        elif operation == "MV":
            pg.command = f"gint"
        elif operation == "EV":
            pg.command = f"vint"
        elif operation == "NV":
            pg.command = f"nint"
        else:
            error_message = f"{operation} {PDT_ERR_NON_VALID} {PDT_LAB_INTERSECT}"
            self.report({"ERROR"}, error_message)
        return {"FINISHED"}


class PDT_OT_JoinVerts(Operator):
    """Join 2 Free Vertices into an Edge"""

    bl_idname = "pdt.join"
    bl_label = "Join 2 Vertices"
    bl_options = {"REGISTER", "UNDO"}

    @classmethod
    def poll(cls, context):
        ob = context.object
        if ob is None:
            return False
        return all([bool(ob), ob.type == "MESH", ob.mode == "EDIT"])

    def execute(self, context):
        """Joins 2 Free Vertices that do not form part of a Face.

        Note:
            Joins two vertices that do not form part of a single face
            It is designed to close open Edge Loops, where a face is not required
            or to join two disconnected Edges.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        pg.command = f"j2v"
        return {"FINISHED"}


class PDT_OT_Fillet(Operator):
    """Fillet Edges by Vertex, Set Use Verts to False for Extruded Structure"""

    bl_idname = "pdt.fillet"
    bl_label = "Fillet"
    bl_options = {"REGISTER", "UNDO"}

    @classmethod
    def poll(cls, context):
        ob = context.object
        if ob is None:
            return False
        return all([bool(ob), ob.type == "MESH", ob.mode == "EDIT"])

    def execute(self, context):
        """Create Fillets by Vertex or by Geometry.

        Note:
            Fillets connected edges, or connected faces
        Uses:
            - pg.fillet_radius  ; Radius of fillet
            - pg.fillet_segments  ; Number of segments
            - pg.fillet_profile  ; Profile, values 0 to 1
            - pg.fillet_vertices_only ; Vertices (True), or Face/Edges
            - pg.fillet_intersect ; Intersect dges first (True), or not

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        decimal_places = context.preferences.addons[__package__].preferences.pdt_input_round
        if pg.fillet_intersect:
            pg.command = (
                f"fi{str(round(pg.fillet_radius, decimal_places))}"
                f",{str(round(pg.fillet_segments, decimal_places))}"
                f",{str(round(pg.fillet_profile, decimal_places))}"
            )
        elif pg.fillet_vertices_only:
            pg.command = (
                f"fv{str(round(pg.fillet_radius, decimal_places))}"
                f",{str(round(pg.fillet_segments, decimal_places))}"
                f",{str(round(pg.fillet_profile, decimal_places))}"
            )
        else:
            pg.command = (
                f"fe{str(round(pg.fillet_radius, decimal_places))}"
                f",{str(round(pg.fillet_segments, decimal_places))}"
                f",{str(round(pg.fillet_profile, decimal_places))}"
            )
        return {"FINISHED"}


class PDT_OT_Angle2(Operator):
    """Measure Distance and Angle in Working Plane, Also sets Deltas"""

    bl_idname = "pdt.angle2"
    bl_label = "Measure 2D"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Measures Angle and Offsets between 2 Points in View Plane.

        Note:
            Uses 2 Selected Vertices to set pg.angle and pg.distance scene variables
            also sets delta offset from these 2 points using standard Numpy Routines
            Works in Edit and Oject Modes.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        pg.command = f"ad2"
        return {"FINISHED"}


class PDT_OT_Angle3(Operator):
    """Measure Distance and Angle in 3D Space"""

    bl_idname = "pdt.angle3"
    bl_label = "Measure 3D"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Measures Angle and Offsets between 3 Points in World Space, Also sets Deltas.

        Note:
            Uses 3 Selected Vertices to set pg.angle and pg.distance scene variables
            also sets delta offset from these 3 points using standard Numpy Routines
            Works in Edit and Oject Modes.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        pg.command = f"ad3"
        return {"FINISHED"}


class PDT_OT_Origin(Operator):
    """Move Object Origin to Cursor Location"""

    bl_idname = "pdt.origin"
    bl_label = "Move Origin"
    bl_options = {"REGISTER", "UNDO"}

    def execute(self, context):
        """Sets Object Origin in Edit Mode to Cursor Location.

        Note:
            Keeps geometry static in World Space whilst moving Object Origin
            Requires cursor location
            Works in Edit and Object Modes.

        Args:
            context: Blender bpy.context instance.

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        pg.command = f"otc"
        return {"FINISHED"}


class PDT_OT_Taper(Operator):
    """Taper Vertices at Angle in Chosen Axis Mode"""

    bl_idname = "pdt.taper"
    bl_label = "Taper"
    bl_options = {"REGISTER", "UNDO"}

    @classmethod
    def poll(cls, context):
        ob = context.object
        if ob is None:
            return False
        return all([bool(ob), ob.type == "MESH", ob.mode == "EDIT"])

    def execute(self, context):
        """Taper Geometry along World Axes.

        Note:
            Similar to Blender Shear command except that it shears by angle rather than displacement.
            Rotates about World Axes and displaces along World Axes, angle must not exceed +-80 degrees.
            Rotation axis is centred on Active Vertex.
            Works only in Edit mode.

        Args:
            context: Blender bpy.context instance.

        Note:
            Uses pg.taper & pg.angle scene variables

        Returns:
            Status Set.
        """

        pg = context.scene.pdt_pg
        pg.command = f"tap"
        return {"FINISHED"}

#class PDT_Extrude_Modal(Operator):
#    """Extrude Modal Plane Along Normal Axis"""
#    bl_idname = "pdt.extrude_modal"
#    bl_label = "Extrude Modal Normal"
#    bl_options = {"REGISTER", "UNDO"}