scheme -- Annotation functionalities¶
This module provides annotation functions to quickly measure and show things on meshes
This is more to be considered as a rendering feature, rather than a proper measuring system.
Everything is built on the class Scheme that provide a very versatile way to structure and render simple but animated schematics
Those functions are designed to be very simple to use, (sometimes even minimalistic)
>>> mesh = brick(width=vec3(3,2,1))
>>> show([
... mesh,
... note_distance_planes(mesh.group(4), mesh.group(2)),
... note_leading(mesh.group(3), text='truc'),
... ])
Schematics system¶
Scheme(vertices=None, spaces=None, primitives=None, **kwargs)
¶
An object containing schematics.
This is a buffer object, it isnot intended to be useful to modify a scheme.
Attributes:
| Name | Type | Description |
|---|---|---|
spaces |
list
|
a space is any function giving a mat4 to position a point on the screen (openGL convensions as used) |
vertices |
list
|
a vertex is a tuple
|
primitives |
list
|
list of buffers (of point indices, edges, triangles, depending on the exact primitive type), associaded to each supported shader in the scheem currently supported shaders are:
|
components |
list
|
objects to display setting their local space to one of the spaces |
current |
dict
|
last vertex definition, implicitely reused for convenience |
Source code in madcad/scheme.py
90 91 92 93 94 95 96 97 98 | |
set(*args, **kwargs)
¶
Change the specified attributes in the current default vertex definition
Source code in madcad/scheme.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
add(obj, **kwargs)
¶
Add an object to the scheme. If it is a mesh, it's merged in the current buffers. Else it is added as a component to the current space.
Source code in madcad/scheme.py
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 | |
component(obj, **kwargs)
¶
Add an object as component associated to the current space
Source code in madcad/scheme.py
225 226 227 228 229 230 | |
__add__(other)
¶
Return the union of the two schemes.
The current settings are those from first scheme
Source code in madcad/scheme.py
124 125 126 127 128 129 130 131 | |
halo_world(position)
dataclass
¶
halo_view(position)
dataclass
¶
position
instance-attribute
¶
__call__(view)
¶
Source code in madcad/scheme.py
481 482 483 484 485 486 487 488 | |
halo_screen(position)
dataclass
¶
position
instance-attribute
¶
__call__(view)
¶
Source code in madcad/scheme.py
493 494 495 496 497 498 499 | |
scale_screen(center)
dataclass
¶
center
instance-attribute
¶
__call__(view)
¶
Source code in madcad/scheme.py
504 505 506 507 508 | |
scale_view(center)
dataclass
¶
center
instance-attribute
¶
__call__(view)
¶
Source code in madcad/scheme.py
513 514 515 516 517 | |
Annotation functions¶
note_leading(placement, offset=None, text='here')
¶
Place a leading note at given position

placement can be any of Mesh, Web, Wire, axis, vec3
Source code in madcad/scheme.py
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 | |
note_floating(position, text, align=(0, 0))
¶
place a floating note at given position

Source code in madcad/scheme.py
578 579 580 581 582 583 | |
note_distance(a, b, offset=0, project=None, d=None, tol=None, text=None, side=False)
¶
Place a distance quotation between 2 points,
the distance can be evaluated along vector project if specified

Source code in madcad/scheme.py
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 | |
note_distance_planes(s0, s1, offset=None, d=None, tol=None, text=None)
¶
Place a distance quotation between 2 meshes

s0 and s1 can be any of Mesh, Web, Wire
Source code in madcad/scheme.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | |
note_distance_set(s0, s1, offset=0, d=None, tol=None, text=None)
¶
Place a distance quotation between 2 objects. This is the distance between the closest elements of both sets

s0 and s1 can be any of Mesh, Web, Wire, vec3
Source code in madcad/scheme.py
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | |
note_bounds(obj)
¶
Create dimension annotations on the boundingbox of an object

Source code in madcad/scheme.py
909 910 911 912 913 914 915 916 917 918 919 920 921 | |
note_radius(mesh, offset=None, d=None, tol=None, text=None, propagate=2)
¶
Place a curvature radius quotation. This will be the minimal curvature radius observed in the mesh As a mesh is generally speaking an approximation of the desired shape, the radius may be approximative as well

Source code in madcad/scheme.py
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 | |
note_angle(a0, a1, offset=0, d=None, tol=None, text=None, unit='deg', side=False)
¶
Place an angle quotation between 2 axis

Source code in madcad/scheme.py
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 | |
note_angle_planes(s0, s1, offset=0, d=None, tol=None, text=None, unit='deg')
¶
Place an angle quotation between 2 meshes considered to be plane (surface) or straight (curve)
s0 and s1 can be any of Mesh, Web, Wire, Axis
Source code in madcad/scheme.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | |
note_angle_edge(part, edge, offset=0, d=None, tol=None, text=None, unit='deg')
¶
Place an angle quotation around a mesh edge

Source code in madcad/scheme.py
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | |
note_label(placement, offset=None, text='!', style='rect')
¶
Place a text label upon an object

placement can be any of Mesh, Web, Wire, axis, vec3
Source code in madcad/scheme.py
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | |
Measuring tools¶
mesh_curvature_radius(mesh, conn=None, normals=None, propagate=2)
¶
Find the minimum curvature radius of a mesh.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
the surface/line to search |
required | |
conn
|
a point-to-point connectivity (computed if not provided) |
None
|
|
normals
|
the vertex normals (computed if not provided) |
None
|
|
propagate
|
int
|
the maximum propagation rank for points to pick for the regression |
2
|
Return: (distance: float, point: int) where primitives varies according to the input mesh dimension
Source code in madcad/scheme.py
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | |
mesh_curvatures(mesh, conn=None, normals=None, propagate=2)
¶
Compute the curvature around a point in a mesh/web/wire
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mesh
|
the surface/line to search |
required | |
conn
|
a point-to-point connectivity (computed if not provided) |
None
|
|
normals
|
the vertex normals (computed if not provided) |
None
|
|
propagate
|
int
|
the maximum propagation rank for points to pick for the regression |
2
|
Return
[(tuple, mat3)]
where the tuple contains the curvature in each of the column directions in the mat3. The mat3 has the principal directions of curvature
Source code in madcad/scheme.py
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 | |