
    Zj              	          S r SrS rS r SS jrSS	 jr\S
:X  a  SSKr\R                  R                  \R                  R                  \R                  R                  \5      SS5      5      r\R                  " \SS9  \" SSSS9\" SSSS9\" SSSS9/r\" \S5       HW  u  rr\R                  R                  \S\ S35      r\" \SSS9 r\R/                  \" S0 \D65        SSS5        \" S\5        MY     gg! , (       d  f       N= f)a  Measuring beaker / cylinder SVG generator for AGS Math instruments.

generate(capacity, reading, unit, size) -> str  (self-contained SVG)

  - Glass/cream body (rounded-bottom cylinder) with an ink outline.
  - Steel-blue graduation ticks up the right side with numeric labels;
    long majors, short minors.
  - Crimson liquid fill from the bottom up to the `reading` level, with a
    flat liquid surface.
  - D0ACAC rounded border frame; CSS-var style block.

  capacity : full scale of the beaker (top graduation).
  reading  : liquid level (0..capacity); clamped to range.
  unit     : "ml" or "l" (label only; affects tick number formatting a touch).
z<style>svg{--crimson:#960000;--gold:#BF9237;--lime:#88C808;--steel:#4A6488;--cream:#FAF5EE;--ink:#2A2A2A;--border:#D0ACAC;}</style>c                 |    [        U [        U 5      -
  5      S:  a  [        [        [        U 5      5      5      $ SU -  $ )Ng&.>z%g)absroundstrint)vs    7C:\allgifted\mathapi11v2\tools\svg_generators\beaker.py_fmtr	      s4    
1uQx<43uQx=!!1H    c                 B    / SQnU S-  nU H  nX2:  d  M
  Us  $    U S-  $ )z2Pick a graduation step giving roughly 5-10 majors.)      g      @   
         2   d           i  g       @ )capacitytargetsrawts       r   
_nice_stepr      s0    FG
S.C8H  c>r
   Nc                 b   [        U5      n[        S[        U[        U5      5      5      nUS::  a  SOXe-  nXC-
  nUS-  nSR                  / SPUS PSPUS PSPUS PSPXM-
  S PS	PUS PSPUS PSPX-   S PSPUS PSPX-   U-
  S PSPUS PS	PX-   S PSPUS PSPX-   S PSPXM-
  S PSPX-   S PSPUS P5      nU R	                  S
U SU S35        U R	                  SU S35        XKU-  -
  nU R	                  SUS SUS SUS SXO-
  S SU S35        U R	                  SUS SUS SX-   S SUS SU S35        U R	                  SU S35        U R	                  SUS-
  S SUS SX-   S-   S SUS S3	5        [        U5      nU(       a  [        [        UU-  5      5      OSnX-   n[        US-   5       H  nUU-  nU(       a  UUU-  U-  -
  OUnUS-  S:H  =(       d    US:*  nU(       a  SOS nU R	                  SUU-
  S SUS SUS SUS S!3	5        U(       d  Mi  U R	                  S"US-   S SUS S#[        U5       S$35        M     U
c  US&-   n
U R	                  S"XS-  -   S SU
S S'U S$35        U	b-  U	S:w  a&  U R	                  S"XS-  -   S SU
S(-   S S)U	 S$35        g%g%g%)*aC  Draw ONE beaker (cream body, steel graduations, crimson fill, unit
label) into `parts` within the column [bx, bx+bw] / [top, bottom].

Each call defines its own clipPath (`clip_id` must be unique per beaker
in a shared SVG). Optionally draws `label` centred at `label_y`.
Returns nothing; appends SVG fragments to `parts`.
g            g
ףp=
? zM z.2f z L z Q z<defs><clipPath id="z"><path d="z Z"/></clipPath></defs>z	<path d="z%" fill="var(--cream)" stroke="none"/>z	<rect x="z" y="z	" width="
" height="z(" fill="var(--crimson)" clip-path="url(#z)"/>z
<line x1="z" y1="z" x2="z" y2="z9" stroke="var(--ink)" stroke-width="1.5" clip-path="url(#zL" fill="none" stroke="var(--ink)" stroke-width="3" stroke-linejoin="round"/>   z?" stroke="var(--ink)" stroke-width="3" stroke-linecap="round"/>r   r         z*" stroke="var(--steel)" stroke-width="2"/>z	<text x="zn" font-family="sans-serif" font-size="12" fill="var(--steel)" text-anchor="start" dominant-baseline="central">z</text>N   zd" font-family="sans-serif" font-size="16" font-weight="bold" fill="var(--ink)" text-anchor="middle">r   zd" font-family="sans-serif" font-size="15" font-weight="bold" fill="var(--ink)" text-anchor="middle">)
floatmaxminjoinappendr   r   r   ranger	   )partsbxbwtopbottomr   readingunitclip_idlabellabel_yfracbody_hrx_b	body_path
liquid_topstepntick_xivalyis_majortlens                           r   draw_beakerrC   '   s    XH#s8U7^45Ga-3W%7D\F9D	# 	#" 	#RH 	#A 	#c#Y 	#  	#H	#	#k#&	#'	#H	#	#S\	#!"	##%73-	#/0	#17	#=	# U4Z	# 	# %S\	#*	# U3K		# 		#  		# %&		# ')eC[		# 12		# 39+c1B		#C		#
 U3K	#
 	#
 S		#  
LL	 	 "; 	 
LL9YK'LMN -'J	LL
Bs85C 0	"S B$S) *")4	) 
LL
RHF:c"2&s D# ")4	) 
LL
I; 5 	6
 
LL
RT#JfSIVBE!GC=s3i PH 	I hD'+E(T/"#AWF1q5\$h2:FcHn..EQJ)16r1S)#wfVCL IS'CE	
 8LLF1HS>qg 6//3CykB " 2+	LL
B!tGC=gc] 3  $vW	. Ub[a4}E'"*S)9 :$$)7'3	
 )r
   r   ,  mlc                 >   UnUnUS-  nUS-  nUS-  nUS-  n	/ n
U
R                  SU SU SU SU S	3	5        U
R                  [        5        U
R                  S
US-
   SUS-
   S35        [        XXxXXSUS-  S9
  U
R                  S5        SR                  U
5      $ )Ng333333?g?g{Gz?gQ?z/<svg xmlns="http://www.w3.org/2000/svg" width="r!   z" viewBox="0 0 r    z">z<rect x="3" y="3" width="r"   zG" rx="18" ry="18" fill="none" stroke="var(--border)" stroke-width="4"/>
beakerClipgffffff?)r3   r5   z</svg>
)r*   STYLErC   r)   )r   r1   r2   sizewidthheightr-   r.   r/   r0   r,   s              r   generaterM      s    EF	B	B
4-Cd]FE	LL
9%
6( Swaxr	+ 
LL 
LL
#E!G9Jvaxj A@ 	A
 2Fg$ftm= 
LL99Ur
   __main__r   z..samplesT)exist_ok)r   r1   r2   r   g      ?lr   }   beaker_z.svgwzutf-8)encodingwrote)rG   NN)r   rD   rE   i@  r   )__doc__rI   r	   r   rC   rM   __name__ospathabspathr)   dirname__file__outmakedirsdictrO   	enumerater>   kwpopenfwriteprintr   r
   r   <module>rh      s  "O  ;?`
F8 z
''//"'',,rwwx'@$	R
SCKKd#c3T2aC0c3T2G
 7A&2GGLLs$/0!S7+qGGHNrN# ,gq	 '  ,+s   C==
D	