
    .;j                         d Z ddlZddZ	  e        ej                  j	                  d       y# e$ r)Zej                  j	                  de d       Y dZ[ydZ[ww xY w)a  Auto-imported patch (when this dir is on PYTHONPATH): make build123d 0.11's
Compound.center() robust. TOM's gen_urdf calls .center() on custom build123d
parts whose Compound nesting trips a `_wrapped is None` AssertionError in 0.11;
the true centroid is still recoverable by collapsing to a solids-only Compound,
else the bbox center. Logs each fallback so we learn which parts are affected.
Scoped: only active when tom_build.sh puts this dir on PYTHONPATH.
    Nc                  l    ddl m}  t        | dd      ry | j                  fd}|| _        d| _        y )Nr   Compound_tom_center_patchedFc           	      D   	  | g|i |S # t         $ r}	 t        | j                               }n# t         $ r g }Y nw xY w|rx	 ddlm}   ||      j
                  |i |}t        j                  j                  dt        |       dt        |      j                   d       |cY d }~S # t         $ r Y nw xY w| j                         }t        j                  j                  dt        |      j                   d       |j                         cY d }~S d }~ww xY w)Nr   r   )childrenz0[tom_patch] center(): solids-collapse fallback (z solids) after 
z1[tom_patch] center(): bbox-center fallback after )	Exceptionlistsolids	build123dr   centersysstderrwritelentype__name__bounding_box)	selfargskwargsexcr   _Cvalbb_origs	           B/data/cameron/repos/smith300_para_stuff/tom_patch/sitecustomize.py_safe_centerz_patch.<locals>._safe_center   s   	//// 	dkkm, 
84"f-44dEfECJJ$$K=S	8J8J7K2O J  ""$BJJC9%%&b* 99;-	sZ    
D4DADADA"B0*D0	B<9D;B<<ADDDT)build123d.topology.compositer   getattrr   r   )r   r   r   s     @r   _patchr"      s5    5x.6OOE6 #HO#'H     z>[tom_patch] build123d Compound.center robustness patch active
z[tom_patch] patch failed: r	   )returnN)__doc__r   r"   r   r   r
   _exc r#   r   <module>r(      sa    #(L<
HJJVW <JJ1$r:;;<s   "/ AAA