Ë
    Ûvžjfõ  ã                    ó  — d dl Z d dlmZ d dlmZmZmZmZmZm	Z	 d dl
mZmZmZmZmZmZ d dlmZmZ d dl­ d dlmZmZmZmZ d dl­ dZd	Zd
ZdZdZdZ eZ!e!Z"eZ#eZ$eZ%ee!   Z&ee!   Z'eZ(e!Z)e!Z*e	e+e!f   Z,e	e-e!f   Z.e	e/ee0   e1f   Z2 G d„ d«      Z3de+de	e/df   de/de/fd„Z4de+de/fd„Z5de/de/fd„Z6de	e+ee+   e,ee,   f   de	e+ee+   f   fd„Z7de+de/fd„Z8 G d„ d«      Z9dddddddddddddœde	e,e"e#eee%ef   d e	ee	e/df      df   d!e	ee	e2df      df   d"e	ee	e0df      df   d#e:d$e:d%e0d&e	e2df   d'e:d(e:d)e)d*e	e3df   d+e:deeee   f   fd,„Z;	 	 	 d:d-ed.ee+   d/e	edf   d*e	e3df   d0e:deeeeef   fd1„Z<dddddddddddd2œde	e,e"e#eee%ef   d e	ee	e/df      df   d!e	ee	e2df      df   d"e	ee	e0df      df   d#e:d$e:d%e0d&e	e2df   d'e:d(e:d)e)d*e	e3df   deeee   f   fd3„Z=d4„ Z>d5„ Z?d6„ Z@d dlAZAd dlBZBd dlCZDd;d7„ZEddd8œd9„ZFy)<é    N)Úsha256)ÚAnyÚDictÚIterableÚListÚTupleÚUnion)Ú	CoordAxisÚCoordSystemÚOcpGroupÚ	OcpObjectÚ
OcpWrapperÚOcpInstancesGroup)Úget_defaultÚpreset)Ú*)Úcompute_qualityÚconvert_verticesÚdiscretize_edgesÚ
tessellateé   é   ÚSilverÚMediumOrchidÚVioletc                   ó   — e Zd Zd„ Zy)ÚProgressc                 ó    — t        |dd¬«       y )NÚ T©ÚendÚflush)Úprint)ÚselfÚmarks     úg/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/ocp_tessellate/convert.pyÚupdatezProgress.update;   s   € Üˆd˜ $Ö'ó    N)Ú__name__Ú
__module__Ú__qualname__r'   © r(   r&   r   r   :   s   „ ó(r(   r   ÚobjÚnameÚdefaultÚreturnc                 óâ   — |€lt        | d«      r)| j                  �| j                  dk7  r| j                  }|S t        | d«      r)| j                  �| j                  dk7  r| j                  }|S |}|S )aD  
    Get the name of the object. If the name is None, use the default name.
    If the object has a name or label attribute, use that.

    @param obj: The object of type TopoDS_Shape or a subclass
    @param name: The name of the object
    @param default: The default name

    @return: The derived name of the object
    r.   r   Úlabel)Úhasattrr.   r2   )r-   r.   r/   s      r&   Úget_namer4   ?   sq   € ð €|Ü�3˜Ô C§H¡HÐ$8¸S¿X¹XÈº^Ø—8‘8ˆDð
 €Kô	 �S˜'Ô" s§y¡yÐ'<ÀÇÁÈbÂØ—9‘9ˆDð €Kð ˆDØ€Kr(   c                 ó€   — ddddddddœ}|j                  t        | «      «      }|€t        dt        | «      › �«      ‚|S )	z¡
    Get the type of the object based on its TopoDS type

    @param obj: The object of type TopoDS_Shape or a subclass

    @return: The type of the object
    ÚVertexÚEdgeÚWireÚFaceÚShellÚSolid)ÚTopoDS_VertexÚTopoDS_EdgeÚTopoDS_WireÚTopoDS_FaceÚTopoDS_ShellÚTopoDS_SolidÚTopoDS_CompSolidúUnknown type: )ÚgetÚ
class_nameÚ
ValueErrorÚtype)r-   ÚkindsÚtyps      r&   Úget_typerJ   T   sT   € ð "ØØØØØØ#ñ€Eð �)‰)”J˜s“OÓ
$€CØ
€{Ü˜>¬$¨s«)¨Ð5Ó6Ð6Ø€Jr(   rI   c                 ó\   — ddddddddœ}|j                  | «      }|€t        d| › �«      ‚|S )zÿ
    Get the kind of the object based on its type.
    The kinds "edge", "face", "solid", "vertex" are used for selecting the right
    tessellation algorithm

    @param typ: The type of the object (see get_type)

    @return: The kind of the object
    ÚvertexÚedgeÚfaceÚsolid)r6   r7   r8   r9   r:   r;   Ú	CompSolidrC   )rD   rF   )rI   rH   Úkinds      r&   Úget_kindrR   k   sK   € ð ØØØØØØñ€Eð �9‰9�S‹>€DØ€|Ü˜>¨#¨Ð/Ó0Ð0Ø€Kr(   c                 óì  — t        | d«      r| j                  S t        | t        t        f«      rÅg }| D ]¼  }t        |d«      r�t        |j                  «      r%|j                  t        |j                  «      «       ŒIt        |«      r<|j                  t        |j                  |j                  |j                  f«      «       Œ�|j                  |j                  «       Œ¬|j                  |«       Œ¾ |S | S )z¨
    Unwrap the object or objects in a list  if it is wrapped.

    @param obj: The object or list of objects

    @return: The unwrapped object or list of objects
    Úwrapped)r3   rT   Ú
isinstanceÚlistÚtupleÚis_topods_compoundÚextendÚlist_topods_compoundÚ	is_vectorÚappendrL   ÚXÚYÚZ)r-   ÚresultÚxs      r&   Úunwraprb   „   s³   € ô ˆs�IÔØ�{‰{ÐÜ	�Cœ$¤˜Ô	'ØˆÛˆAÜ�q˜)Ô$Ü% a§i¡iÔ0Ø—M‘MÔ"6°q·y±yÓ"AÕBÜ˜q”\Ø—M‘M¤&¨!¯#©#¨q¯s©s°A·C±C¨Ó"9Õ:à—M‘M !§)¡)Õ,à—‘˜aÕ ð ð ˆØ€Jr(   c                 óÜ   — t        «       }t        | t        t        f«      s| gn| }|D ]3  }|j	                  t        t        |«      r|j                  n|«      «       Œ5 |j                  «       S )a	  
    The TopoDS_Shape objects are serialized and hashed to create a unique id.
    The current approach is to use the sha256 hash of the serialized object.

    @param obj: The object of type TopoDS_Shape or a subclass

    @return: The unique id of the object
    )	r   rU   rW   rV   r'   Ú	serializeÚ
is_wrappedrT   Ú	hexdigest)r-   ÚshaÚobjsÚos       r&   Úcreate_cache_idrj   ¡   sV   € ô ‹(€CÜ" 3¬´¨Ô6ˆC‰5¸C€DÛˆØ�
‰
”9¬*°Q¬-˜QŸYšY¸QÓ?Õ@ð ð �=‰=‹?Ðr(   c                   ó´  — e Zd ZdZd8deedf   defd„Zd9d„Zde	d	e
d
e
deeef   fd„Zdee	ee	   f   de
d
e
deeeeeef   df   dedefd„Z	 	 	 d:de	deeeeeef   df   deedf   dee
df   deeeeeef   f   f
d„Zdeeee
df   eeee   ee
ef   f   f      dee
df   deedf   dededededefd„Zdeeee   f   dee
df   deedf   dededededefd„Zdee
ef   dee
df   deedf   dededededefd„Zdedee
df   deedf   dededededefd„Zdedee
df   deedf   dededededefd„Z de!dee
df   deedf   dededededefd„Z"deeee#ef   dedee   fd „Z$de%dee
df   dededef
d!„Z&d"„ Z'de#dee
df   deedf   ded#ededeeef   fd$„Z(de)dee
df   deedf   ded#ededeeef   fd%„Z*deeef   dee
df   ded#edeedf   dededeeef   fd&„Z+de,dee
df   deedf   dededededefd'„Z-de.dee
df   deedf   dededefd(„Z/de0dee
df   dededef
d)„Z1de2dee
df   deedf   dededefd*„Z3de4dee
df   defd+„Z5dee6eef   dedefd,„Z7ddddddd-ddddd.d/œd0eeee#eee!e4f   d1eeee
df      df   d2eeeedf      df   d3eeeedf      df   d4e0dededed5eedf   d#eded6ededefd7„Z8y);ÚOcpConverterzSThe class to filter obejcts and convert them to OcpObject and OcpGroup hierarchies.NFÚprogressÚdebugc                 ó\   — g | _         d| _        || _        || _        t	        d«      | _        y)z‚The initializer of the OcpConverter.
        @param progress: The progress class to provide updates during the conversion
        NÚdefault_color)Ú	instancesÚocprm   rn   r   rp   )r$   rm   rn   s      r&   Ú__init__zOcpConverter.__init__µ   s-   € ð .0ˆŒØˆŒØ ˆŒØˆŒ
Ü(¨Ó9ˆÕr(   c                 ón   — | j                   r)d|z  |z   }|�d|› d�nd}t        |› d|› d|› �|d¬«       y y )Nú  z ('z')r   Ú Tr    )rn   r#   )r$   ÚlevelÚmsgr.   Úprefixr!   Úsuffixs          r&   Ú_debugzOcpConverter._debug¿   sM   € Ø�:Š:Ø˜E‘\ FÑ*ˆFØ'+Ð'7�s˜4˜& ‘^¸RˆFÜ�V�H˜A˜c˜U ! F 8Ð,°#¸TÖBð r(   r-   Úcache_idr.   r0   c                 óÂ  — d}|j                  «       }t        |j                  |j                  «       «      «      }t	        | j
                  «      D ]T  \  }}|d   j                  «       |j                  «       k(  sŒ+|}| j                  �| j                  j                  d«        n |€4t        | j
                  «      }| j
                  j                  |||dœ«       ||fS )a´  
        Identify if the object is already available in the instances list based on
        comparing their TShapes.
        If not, create a new instance and add it to the list.

        @param obj: The object of type TopoDS_Shape or a subclass
        @param cache_id: The unique id of the object
        @param name: The name of the object

        @return: The reference to the object in the instances list and the location
        Nr-   Ú-)r-   r|   r.   )ÚLocationÚdowncastÚMovedÚInvertedÚ	enumeraterq   ÚTShaperm   r'   Úlenr\   )	r$   r-   r|   r.   ÚrefÚlocÚobj2ÚiÚinstances	            r&   Úget_instancezOcpConverter.get_instanceÇ   s¾   € ð ˆð �l‰l‹nˆÜ˜Ÿ	™	 #§,¡,£.Ó1Ó2ˆô % T§^¡^Ö4‰KˆAˆxØ˜‰×%Ñ%Ó'¨4¯;©;«=Ó8Ø�à—=‘=Ð,Ø—M‘M×(Ñ(¨Ô-áð 5ð ˆ;ä�d—n‘nÓ%ˆCØ�N‰N×!Ñ!¨$¸HÈdÑ"SÔTà�Cˆxˆr(   rh   rQ   ÚcolorÚalphac                 óÚ  — t        |«      dk(  rH|d   }t        |«      rJt        t        |«      «      }t        |«      dk(  rt	        |d   «      }n|dv r|}n|dv rt        |«      }n|}| j                  t        |t        «      r|d   n||||¬«      }|dv r2t        |«      }| j                  |||«      \  }	}
t        ||	||
||¬«      S t        |||||dk(  rt        ¬«      S t        ¬«      S )	a°  
        Unify the objects in a list to a single TopoDS_Shape or a TopoDS_Compound for
        solids, shells and faces or to a list of edges or vertices.

        @param objs: The list of objects
        @param kind: The kind of the objects
        @param name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the object

        @return: The unified OcpObject
        é   r   )rM   rL   )rO   rN   Úshell©rQ   )r†   r.   r‡   rŒ   r|   rM   ©r-   r.   rŒ   Úwidth)r…   rX   rV   rZ   r€   Úmake_compoundÚget_color_for_objectrU   rj   r‹   r   Ú
LINE_WIDTHÚ
POINT_SIZE)r$   rh   rQ   r.   rŒ   r�   Úocp_objÚocp_objsr|   r†   r‡   s              r&   ÚunifyzOcpConverter.unifyì   s$  € ô* ˆt‹9˜Š>Ø˜1‘gˆGä! 'Ô*ÜÔ 4°WÓ =Ó>�Ü�x“= AÒ%Ü& x°¡{Ó3‘GØÐ/Ñ/Ø&‘Gð Ð/Ñ/Ü# DÓ)‰Gð ˆGà×)Ñ)Ü$ W¬dÔ3ˆG�AŠJ¸ØØØð	 *ó 
ˆð Ð-Ñ-Ü& tÓ,ˆHØ×(Ñ(¨°(¸DÓA‰HˆC�ÜØØØØØØ!ôð ô ØØØØØ$(¨F¢N”jôð ô
 9Côð r(   c                 ó°  — t         t        t        | j                  | j                  t        t         t         t         t        t        | j                  t        dœ}|�^t	        |t
        «      rBt	        |d   t        t        f«      s)t        |d   «      t        |d   «      t        |d   «      fS t        |«      }nmt        |d«      r"|j                  �t        |j                  «      }n?|€|�t        ||   «      }n,t        |j                  t        t        |«      «      «      «      }t        |d«      r|j                  �|j                  |_        |�||_        |S )aY  
        Get the color of the object based on the object type and the default colors.

        @param obj: The object of type TopoDS_Shape or a subclass
        @param color: The color of the object
        @param alpha: The alpha value of the object
        @param kind: The kind of the object

        @return: The color of the object
        )r=   r?   r@   rA   rB   r<   r>   rM   ÚwirerN   r�   rO   rL   r   r�   r   rŒ   r�   )ÚTHICK_EDGE_COLORÚ
FACE_COLORrp   ÚVERTEX_COLORrU   rW   ÚintÚfloatÚColorr3   rŒ   rD   rE   rb   r�   Úa)r$   r-   rŒ   r�   rQ   Údefault_colorsÚcol_as          r&   r•   z!OcpConverter.get_color_for_object.  s%  € ô& ,Ü%Ü&Ø ×.Ñ.Ø $× 2Ñ 2Ü)Ü+ä$Ü$ÜÜØ×'Ñ'Ü"ñ
ˆð$ ÐÜ˜%¤Ô'´
¸5À¹8ÄcÌ5À\Ô0Rä˜e A™h›¬¨u°Q©x«¼%ÀÀaÁ»/ÐJÐJä˜e›‘ä�S˜'Ô" s§y¡yÐ'<Ü˜#Ÿ)™)Ó$‰Eð ˆ]˜tÐ/Ü˜.¨Ñ.Ó/‰Eô ˜.×,Ñ,¬Z¼¸s»Ó-DÓEÓFˆEô �3˜Ô  S§Y¡YÐ%:Ø—i‘iˆEŒGð ÐØˆEŒGàˆr(   Úobj_nameÚsketch_localÚhelper_scalerw   c                 óè   — t        |¬«      }|D ]R  \  }	}
| j                  |
|	g|g|g|||dz   ¬«      }|j                  dkD  sŒ4|j                  |j	                  «       «       ŒT |j                  «       S )aþ  
        Unroll the objects in an iterable and convert them to OcpObject and OcpGroup hierarchies.

        @param objs: The list of objects
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param sketch_local: The flag to render the sketch local
        @param helper_scale: The scale of the helper objects
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        ©r.   r�   )ÚnamesÚcolorsÚalphasr§   r¨   rw   r   )r   Úto_ocpÚlengthÚaddÚcleanupÚmake_unique_names)r$   rh   r¦   rŒ   r�   r§   r¨   rw   r˜   r.   r-   r`   s               r&   Ú_unroll_iterablezOcpConverter._unroll_iterableo  s€   € ô8 %¨(Ô3ˆÛ‰IˆD�#à—[‘[ØØ�fØ�wØ�wØ)Ø)Ø˜a‘ið !ó ˆFð �}‰}˜qÓ Ø—‘˜FŸN™NÓ,Õ-ð ð ×(Ñ(Ó*Ð*r(   Úcad_objc           	      óš   — | j                  |d|«       | j                  t        dgt        |«      z  |«      t	        ||d«      |||||«      S )aÔ  
        Handle lists and tuples of objects.

        @param cad_obj: The list or tuple of objects
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param sketch_local: The flag to render the sketch_local
        @param helper_scale: The scale of the helper objects
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        Úhandle_list_tupleNr   )r{   r³   Úzipr…   r4   ©r$   r´   r¦   rŒ   r�   r§   r¨   rw   s           r&   r¶   zOcpConverter.handle_list_tupleœ  sX   € ð. 	�‰�EÐ.°Ô9Ø×$Ñ$Ü��œ˜W›Ñ% wÓ/Ü�W˜h¨Ó/ØØØØØó
ð 	
r(   c           	      óˆ   — | j                  |d|«       | j                  |j                  «       t        ||d«      |||||«      S )aœ  
        Handle dictionaries of objects.

        @param cad_obj: The dictionary of objects
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param sketch_local: The flag to render the sketch_local
        @param helper_scale: The scale of the helper objects

        @return: The OcpGroup hierarchy
        Úhandle_dictr   )r{   r³   Úitemsr4   r¸   s           r&   rº   zOcpConverter.handle_dict¾  sK   € ð, 	�‰�E˜=¨(Ô3à×$Ñ$Ø�M‰M‹OÜ�W˜h¨Ó/ØØØØØó
ð 	
r(   c           	      óŒ  — | j                  |d|«       t        |«      st        |«      rt        t	        |j
                  «      «      }n*t        |«      st        |«      rt        t	        |«      «      }d}	t        |«      st        |«      rd}	| j                  t        dgt        «      z  |«      t        |||	«      |||||«      S )aÚ  
        Handle compounds and topods_compounds.

        @param cad_obj: The compound or topods_compound
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param sketch_local: The flag to render the sketch_local
        @param helper_scale: The scale of the helper objects
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        Úhandle_compoundÚCompoundrP   N)r{   Úis_compoundÚis_compsolidrV   rZ   rT   rX   Úis_topods_compsolidr³   r·   r…   r4   )
r$   r´   r¦   rŒ   r�   r§   r¨   rw   Úcad_objsÚdefault_names
             r&   r½   zOcpConverter.handle_compoundà  s´   € ð. 	�‰�E˜_¨xÔ8ä�wÔ¤<°Ô#8ÜÔ0°·±ÓAÓB‰HÜ Ô(Ô,?ÀÔ,HÜÔ0°Ó9Ó:ˆHà!ˆÜ˜Ô Ô$7¸Ô$@Ø&ˆLà×$Ñ$Ü��œ˜X›Ñ&¨Ó1Ü�W˜h¨Ó5ØØØØØó
ð 	
r(   Úrender_jointsc                 óÖ  — | j                  |d|«       t        ||d«      }t        |d¬«      }	t        ||	¬«      }
|j                  D ]   }| j                  ||j                  dk(  rdn|j                  g|€|j                  n|g|g|||dz   ¬	«      }|j                  dk(  r7t        |j                  «      d
k(  r|
j                  |j                  d
   «       Œ�|
j                  |«       Œ¢ |rêt        |d«      rÞt        |j                  «      d
kD  rÆ | j
                  |j                  j                  «       D �cg c]  }|j                  ‘Œ c}t!        |j                  j#                  «       «      |dz   dœŽ}|› d�|_        |j&                  €|	j)                  «       |_        n"|	j)                  «       |j&                  z  |_        |
j                  |«       |
j+                  «       S c c}w )aÛ  
        Handle build123d assemblies.

        @param cad_obj: The build123d assembly (Compound with children)
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param render_joints: The flag to render the joints
        @param helper_scale: The scale of the helper objects
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        Úhandle_build123d_assemblyÚAssemblyF©Úas_none©r.   r‡   r   Nr�   )r«   r¬   r­   r¨   rÄ   rw   r   Újoints©r«   rw   Ú_joints)r{   r4   Úget_locationr   Úchildrenr®   r2   rŒ   r¯   r…   r°   Úobjectsr3   rË   ÚvaluesÚsymbolrV   Úkeysr.   r‡   r‚   r²   )r$   r´   r¦   rŒ   r�   rÄ   r¨   rw   r.   Úlocationr˜   ÚchildÚsub_objÚjrË   s                  r&   rÆ   z&OcpConverter.handle_build123d_assembly  s®  € ð. 	�‰�EÐ6¸ÔAä˜ ¨:Ó6ˆÜ °Ô7ˆÜ ¨(Ô3ˆà×%Ô%ˆEØ—k‘kØØ$Ÿ{™{¨bÒ0‘t°e·k±kÐBØ', }˜Ÿš¸%Ð@Ø�wØ)Ø+Ø˜a‘ið "ó ˆGð �~‰~ Ò"¤s¨5¯>©>Ó':¸aÒ'?Ø—‘˜GŸO™O¨AÑ.Õ/à—‘˜GÕ$ð &ñ œW W¨hÔ7¼CÀÇÁÓ<OÐRSÒ<SØ �T—[‘[Ø$+§N¡N×$9Ñ$9Ô$;Ó<Ñ$;˜q�!—(“(Ð$;Ñ<Ü˜7Ÿ>™>×.Ñ.Ó0Ó1Ø˜a‘iòˆFð
 "˜F 'Ð*ˆFŒKð �z‰zÐ!Ø%×.Ñ.Ó0�•
à%×.Ñ.Ó0°6·:±:Ñ=�”
Ø�K‰K˜Ôà×(Ñ(Ó*Ð*ùò =s   Ä8G&Úrender_matesc                 óV  — | j                  |d|«       t        ||d«      }t        |t        |d¬«      ¬«      }	|j                  �]| j                  |j                  |j                  g|€|j                  n|g||||dz   ¬«      }
|	j                  |
j                  d   «       |�r8|}|j                  �|j                  }|j                  �Œt        |d	«      �r|j                  �øt        |j                  j                  «       D ��cg c]ˆ  \  }}|j                  |k(  rtt        |t!        |j"                  j$                  «      t!        |j"                  j&                  «      t!        |j"                  j(                  «      |«      j                  «       ‘ŒŠ c}}|j                  › d
�t+        «       ¬«      }t-        |j                  «      dkD  r|	j                  |«       |j.                  D ]7  }| j                  ||j                  g|||dz   ¬«      }
|	j                  |
«       Œ9 |	S c c}}w )a¾  
        Handle cadquery assemblies.

        @param cad_obj: The cadquery assembly
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param render_mates: The flag to render the mates
        @param helper_scale: The scale of the helper objects
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        Úhandle_cadquery_assemblyrÇ   FrÈ   rÊ   r�   )r«   r¬   r­   r¨   rØ   rw   r   ÚmatesÚ_mates)r«   r¨   rØ   rw   )r{   r4   r   rÎ   r-   r®   r.   rŒ   r°   rÐ   Úparentr3   rÛ   r»   Úassemblyr   Ú	get_tupleÚmateÚoriginÚx_dirÚz_dirÚidentity_locationr…   rÏ   )r$   r´   r¦   rŒ   r�   rØ   r¨   rw   r.   r˜   rÖ   ÚtopÚmate_defrÛ   rÕ   s                  r&   rÚ   z%OcpConverter.handle_cadquery_assemblyL  sø  € ð. 	�‰�EÐ5°xÔ@Ü˜ ¨:Ó6ˆä ¬,°wÈÔ*NÔOˆØ�;‰;Ð"Ø—k‘kØ—‘Ø—|‘|�nØ).¨˜Ÿš¸EÐBØØ)Ø)Ø˜a‘ið "ó ˆGð �K‰K˜Ÿ™¨Ñ*Ô+âØˆCØ—*‘*Ð(Ø—j‘j�ð —*‘*Ñ(ä�s˜GÕ$¨¯©Ð)>Ü ð /2¯i©i¯o©oÔ.?ô
ñ /@™N˜D (Ø#×,Ñ,°Ò7ô $Ø Ü% h§m¡m×&:Ñ&:Ó;Ü% h§m¡m×&9Ñ&9Ó:Ü% h§m¡m×&9Ñ&9Ó:Ø(ó÷ !™&›(ñ#ð /@ò
ð $ŸL™L˜>¨Ð0Ü)Ó+ô�ô �u—}‘}Ó%¨Ò)Ø—K‘K Ô&à×%Ô%ˆEØ—k‘kØØ—z‘z�lØ)Ø)Ø˜a‘ið "ó ˆGð �K‰K˜Õ ð &ð ˆùó7
s   ÄBH%
c                 óŠ  — d}t        |d«      r|j                  �|j                  }d}not        |d«      r|j                  �|j                  }d}nHt        |t        «      r8t        |«      dkD  r*t        |d   d«      r|D �cg c]  }|j                  ‘Œ }}d}d}g }|��|dk(  rdnd|› d	�}| j                  t        |t        «      rt        t        |«      «      n||gd|d
z   ¬«      }	|	j                  D ]0  }
|
j                  dk(  rd|
_        Œ|
j                  dk(  sŒ*d|
_        Œ2 |j                  d|	«       t        |t        «      rUt        t        |D �cg c]&  }t        |d«      r|j                  �|j                  ‘Œ( c}«      «      }t        |«      dk(  rd}nr|j                  nd}|d
z  }|��Œ|S c c}w c c}w )aL  
        Handle the parent of an objects.

        @param cad_obj: The object or objects
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        NrÝ   FÚtopo_parentTr   Ú_parentz_parent(Ú)r�   )r«   r¬   rw   rO   rN   )r3   rÝ   rè   rU   r   r…   r®   rV   ÚsetrÐ   rQ   Ústate_facesÚstate_edgesÚinsert)r$   r´   rw   rÝ   ÚtopoÚcÚindÚparentsÚpnameÚpri   s              r&   Úhandle_parentzOcpConverter.handle_parent˜  sÊ  € ð  ˆÜ�7˜HÔ%¨'¯.©.Ð*DØ—^‘^ˆFØ‰DÜ�W˜mÔ,°×1DÑ1DÐ1PØ×(Ñ(ˆFØ‰Dä�w¤Ô%Ü�G“˜qÒ Ü˜ ™
 MÔ2á-4Ó5©W¨�a—m“m¨WˆFÐ5ØˆDàˆØ#%ˆØÑ Ø!$¨¢‘I°¸#¸¸aÐ/@ˆEØ—‘Ü%/°¼Ô%=””S˜“[Ô!À6Ø�gØØ˜a‘ið	 ó ˆAð —Y”Y�Ø—6‘6˜WÒ$Ø$%�A•MØ—V‘V˜vÓ%Ø$%�A•Mð	 ð
 �N‰N˜1˜aÔ Ü˜&¤$Ô'ÜÜñ &,óá%+ Ü& q¨-Ô8¸Q¿]¹]Ð=Vð ŸM›MØ%+ñóó�ô �v“; !Ò#Ø!‘Fá/3˜×+Ò+¸�Ø�1‰HˆCð9 Ò ð< ˆùòG 6ùò,s   ÂF;Å+G c           
      óÖ   — | j                  |d|«       t        t        ||d«      ¬«      }|D ])  }|j                  | j	                  |d||dz   ¬«      «       Œ+ |j                  «        |S )zñ
        Handle build123d location lists.

        @param cad_obj: The build123d location list
        @param obj_name: The name of the object
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        z-handle_location_list (build123d LocationList)ÚLocationListrª   r   r�   )rw   )r{   r   r4   r°   Úhandle_locations_planesr²   )r$   r´   r¦   r¨   rw   Úgroupr‡   s          r&   Úhandle_location_listz!OcpConverter.handle_location_listÙ  sq   € ð  	�‰�EÐJÈHÔUÜœh w°¸.ÓIÔJˆÛˆCØ�I‰IØ×,Ñ,Ø˜ \¸À¹ð -ó õð ð 	×ÑÔ!Øˆr(   c                 ó�  — t        |«      dkD  �rEt        |d   «      �r6g }|D �]+  }t        |j                  «       t        t
        f«      r8|j                  |j                  «       D �cg c]  }|j                  ‘Œ c}«       Œ`t        |j                  «       j                  «      r*|j                  |j                  «       j                  «       Œ­t        |j                  «       j                  «      rB|j                  t	        |j                  «       «      D �cg c]  }|j                  ‘Œ c}«       �Œt        d|j                  «       › �«      ‚ d}	nt        |«      }t        |d   «      }	t        |	«      }
| j                  |d   |«      }|�||_        | j#                  ||
t%        |||› d|	› d�«      ||¬«      S c c}w c c}w )zinternal methodr   zUnknown edge type: r8   Ú(rê   ©rQ   r.   rŒ   r�   )r…   Úis_wirerU   ÚedgesrV   rW   rY   rT   Úis_topods_edger\   rX   rF   rb   rJ   rR   r•   r£   rš   r4   )r$   r´   r.   r¦   rŒ   r�   rh   r-   ÚerI   rQ   Úrgbas               r&   Ú_handle_listzOcpConverter._handle_listô  s}  € ô ˆw‹<˜!Ó¤¨°©
Õ 3ØˆDÜ�Ü˜cŸi™i›k¬D´%¨=Ô9Ø—K‘K°C·I±I´KÓ @±K¨q §£°KÑ @ÕAô & c§i¡i£k×&9Ñ&9Ô:ØŸ™ C§I¡I£K×$7Ñ$7Õ8Ü+¨C¯I©I«K×,?Ñ,?Ô@ØŸ™¼¸S¿Y¹Y»[Ô8IÓ$JÑ8I°1 Q§Y£YÐ8IÑ$JÖKä(Ð+>¸s¿y¹y»{¸mÐ)LÓMÐMð ð ‰Cô ˜'“?ˆDÜ˜4 ™7Ó#ˆCä˜‹}ˆØ×(Ñ(¨¨a©°%Ó8ˆØÐØˆDŒFØ�z‰zØØÜ˜' 8°¨v°Q°s°e¸1Ð-=Ó>ØØð ó 
ð 	
ùò) !Aùò %Ks   Á(F>
ÄG
Úshow_parentc                 óä  — |}| j                  |d|«       d}|j                  «       }t        |«      dkD  r^t        |d   «      r#t	        |D �	cg c]  }	t        |	«      ‘Œ c}	«      }n-t        |d   «      r| j                  |«      j                  «       S | j                  |||||«      }
|r@| j                  ||«      }|d   j                  d   g}t        ||
gz   |
j                  ¬«      S |
S c c}	w )a  
        Handle cadquery Workplane.

        @param cad_obj: The cadquery Workplane
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param show_parent: The flag to show the parent
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        z%handle_workplane (cadquery Workplane)Ú	Workplaner   rª   )r{   Úvalsr…   r¿   ÚflattenrV   Úis_cadquery_sketchr®   r±   r  rõ   rÐ   r   r.   )r$   r´   r¦   rŒ   r�   r  rw   Ú
parent_objr.   r-   r˜   rò   s               r&   Úhandle_workplanezOcpConverter.handle_workplane  sì   € ð* ˆ
à�‰�EÐBÀHÔMØˆð —,‘,“.ˆÜˆw‹<˜!ÒÜ˜7 1™:Ô&Ü!¹Ó"@¹°¤4¨¥9¸Ñ"@ÓA‘Ü# G¨A¡JÔ/Ø—{‘{ 7Ó+×3Ñ3Ó5Ð5à×#Ñ# G¨T°8¸UÀEÓJˆáØ×(Ñ(¨°UÓ;ˆGØ˜q‘z×)Ñ)¨!Ñ,Ð-ˆGä˜G w iÑ/°g·l±lÔCÐCàˆNùò #As   ÁC-c                 ó¼   — |}| j                  |d|«       d}| j                  |||||«      }	|r-| j                  ||«      }
t        |
|	gz   |	j                  ¬«      S |	S )aƒ  
        Handle build123d shape lists.

        @param cad_obj: The build123d ShapeList
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param show_parent: The flag to show the parent
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        z&handle_shapelist (build123d ShapeList)Ú	ShapeListrª   )r{   r  rõ   r   r.   )r$   r´   r¦   rŒ   r�   r  rw   r
  r.   r˜   rò   s              r&   Úhandle_shape_listzOcpConverter.handle_shape_listC  si   € ð* ˆ
à�‰�EÐCÀXÔNØˆà×#Ñ# G¨T°8¸UÀEÓJˆáØ×(Ñ(¨°UÓ;ˆGÜ˜G w iÑ/°g·l±lÔCÐCàˆNr(   c           	      ó¶  — t        |«      rdt        |«      }	}nBt        |«      rd|j                  }	}n(t	        |«      rd|j                  }	}nt        d|› �«      ‚| j                  |d|› dt        |	«      › d�|«       d}
t        |	«      rd	t        t        |	«      «      }
}n@t        |	«      r*t        |	«      }|d	k(  s|d
k(  r t        t        |	«      «      }
nt        |	«      }t        |||«      }| j                  |||t!        |«      ¬«      }| j#                  |
€|	gn|
t!        |«      |||¬«      }|r¨t%        |d«      rœt'        |j(                  «      dkD  r„ | j*                  |j(                  j-                  «       D �cg c]  }|j.                  ‘Œ c}t        |j(                  j1                  «       «      |dz   dœŽ}d|_        d|_        t5        ||g|¬«      S |rvt%        |d«      r|j6                  €t%        |d«      rR|j8                  �F| j;                  t=        |t        t>        f«      r|n|g|«      }t5        ||gz   |j2                  ¬«      S |S c c}w )aŠ  
        Handle build123d or Cadquery shapes.

        @param cad_obj: The shape or shapes
        @param obj_name: The name of the object
        @param render_joints: The flag to render the joints
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        ÚTopoDS_Shapezbuild123d Shapezcadquery ShapezUnknown shape type: zhandle_shapes (z) (rê   Nr8   r7   r‘   rý   rË   r   r�   rÌ   Úshaperª   rÝ   rè   ) Úis_topods_shaper€   Úis_build123d_shaperT   Úis_cadquery_shaperF   r{   rE   Úis_topods_wirerV   Ú	get_edgesrX   Úget_compound_typeÚ	type_namer4   r•   rR   rš   r3   r…   rË   r®   rÑ   rÒ   rÓ   r.   r   rÝ   rè   rõ   rU   rW   )r$   r´   r¦   rÄ   r  rŒ   r�   rw   Útr-   rÿ   rI   r.   r˜   r×   rË   rò   s                    r&   Úhandle_shapeszOcpConverter.handle_shapese  s0  € ô, ˜7Ô#Ø#¤X¨gÓ%6ˆs‰AÜ Ô(Ø&¨¯©ˆs‰AÜ˜wÔ'Ø% w§¡ˆs‰AäÐ3°G°9Ð=Ó>Ð>à�‰�E˜_¨Q¨C¨s´:¸c³?Ð2CÀ1ÐEÀxÔPàˆÜ˜#ÔØ¤¤i°£nÓ!5�‰CÜ Ô$Ü# CÓ(ˆCØ�fŠ}  v¢ÜœY s›^Ó,‘ä˜C“.ˆCä˜ ¨3Ó/ˆà×)Ñ)¨'°5¸%ÄhÈsÃmÐ)ÓTˆà—*‘*Ø�]ˆS‰E¨Ü˜#“ØØØð ó 
ˆñ œW W¨hÔ7¼CÀÇÁÓ<OÐRSÒ<SØ �T—[‘[Ø$+§N¡N×$9Ñ$9Ô$;Ó<Ñ$;˜q�!—(“(Ð$;Ñ<Ü˜7Ÿ>™>×.Ñ.Ó0Ó1Ø˜a‘iòˆFð
 #ˆFŒKØ"ˆGŒLÜ˜W fÐ-°DÔ9Ð9áÜ�W˜hÔ'¨G¯N©NÐ,FÜ˜ Ô/°G×4GÑ4GÐ4Sà×(Ñ(Ü% g´´e¨}Ô=‘ÀGÀ9ÈeóˆGô ˜G w iÑ/°g·l±lÔCÐCàˆùò# =s   Æ Ic           	      óL  — | j                  |d|j                  › �|«       t        |«      r|j                  }t	        ||d«      }n[t        |«      r(|j                  j                  «       }t	        ||d«      }n(t        |«      r|j                  «       }t	        ||d«      }| j                  |g|€t        |d«      r|j                  n|g|€t        |d«      r|j                  n|g||dz   ¬«      }	|r¢t        |d	«      r–|j                  j                  «       }|	j                  d
   j                   |	_        d|	j                  d
   _        | j                  |d	g|g||dz   ¬«      j                  d
   }
d|
j                  _        |	j%                  |
«       |	j'                  «       S )aÑ  
        Handle build123d Builder objects.

        @param cad_obj: The build123d Builder object
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param sketch_local: The flag to render the sketch_local
        @param render_joints: The flag to render the joints
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        zhandle_build123d_builder r;   r9   r7   rŒ   r�   r�   )r«   r¬   r­   rÄ   rw   r§   r   Úsketch)r«   r¬   rÄ   rw   gš™™™™™É?)r{   Ú	_obj_nameÚis_build123d_partÚpartr4   Úis_build123d_sketchr  ÚfacesÚis_build123d_linerÿ   r®   r3   rŒ   r�   r§   rÐ   r.   r£   r°   r±   )r$   r´   r¦   rŒ   r�   r§   rÄ   rw   r-   r˜   Úocp_obj_locals              r&   Úhandle_build123d_builderz%OcpConverter.handle_build123d_builder±  s�  € ð. 	�‰�EÐ6°w×7HÑ7HÐ6IÐJÈHÔUô ˜WÔ%Ø—,‘,ˆCÜ ¨°7Ó;‰Hô ! Ô)Ø—.‘.×&Ñ&Ó(ˆCÜ ¨°6Ó:‰Hô ˜wÔ'Ø—-‘-“/ˆCÜ ¨°6Ó:ˆHà—+‘+ØØ�*à!& ´7¸7ÀGÔ3L�—’ÐRWðð "' ´7¸7ÀGÔ3L�—’ÐRWðð (Ø˜!‘)ð ó 
ˆñ œG G¨^Ô<Ø×&Ñ&×,Ñ,Ó.ˆCØ"Ÿ?™?¨1Ñ-×2Ñ2ˆGŒLØ&.ˆG�O‰O˜AÑÔ#Ø ŸK™KØØ%Ð&Ø�wØ+Ø˜a‘ið (ó ÷ ‰g�añˆMð %(ˆM×ÑÔ!Ø�K‰K˜Ô&à�‰Ó Ð r(   c                 óz  — | j                  |d|«       t        |j                  «      sg |_        t        |j                  t        t        f«      s|j                  g|_        g }g }t        «       }d}	dt        |j                  «      dfdt        |j                  «      dfd|j                  €g nt        |j                  «      dffD ]ò  \  }
}}|sŒ
t        |d   «      rD|j                  D ��cg c],  }|j                  D ]  }|j                  |j                  z  ‘Œ Œ. }}}nXt        |D ��cg c]A  }|j                  D ]0  }t        |j                  j                  |j                  «      «      ‘Œ2 ŒC c}}«      }|j                  |«       |j                  |
«       |sŒÙ|j                  t        |«      «       Œô t!        |j"                  |j$                  |j&                  d	«      }	t)        ||d
«      } | j*                  |||gt-        |«      z  |gt-        |«      z  ||	dz  dœŽ}||_        |S c c}}w c c}}w )aC  
        Handle cadquery sketches.

        @param cad_obj: The cadquery sketch
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param level: The level of the hierarchy

        @return: The OcpGroup hierarchy
        zcadquery Sketché   r9   Tr7   Ú	SelectionFr   çš™™™™™¹?ÚSketché   )r«   r¬   r­   rw   r¨   )r{   rV   Ú_facesrU   rW   ÚBoundingBoxÚ_edgesÚ
_selectionÚis_locationÚlocsrT   r”   r€   r�   r\   r'   ÚmaxÚxsizeÚysizeÚzsizer4   r®   r…   r.   )r$   r´   r¦   rŒ   r�   rw   rÂ   r«   ÚbbÚsizerI   rh   Úcalc_bbr-   r‡   Úcompoundr.   r`   s                     r&   Úhandle_cadquery_sketchz#OcpConverter.handle_cadquery_sketchö  s  € ð& 	�‰�EÐ,¨hÔ7ä�G—N‘NÔ#ØˆGŒNä˜'Ÿ.™.¬4´¨-Ô8Ø%Ÿn™nÐ-ˆGŒNàˆØ"$ˆÜ‹]ˆØˆà”T˜'Ÿ.™.Ó)¨4Ð0Ø”T˜'Ÿ.™.Ó)¨4Ð0àØ×(Ñ(Ð0‘´d¸7×;MÑ;MÓ6NØðó#
ÑˆC��wò Ü˜t A™wÔ'ð $+×#5Ò#5ô á#5˜CØ#*§<¤<˜Cð Ÿ™ c§k¡kÓ1à#/ð 2Ø#5ð ò  ô  -ñ (,ôá'+ Ø'.§|¤| ô % S§[¡[×%6Ñ%6°s·{±{Ó%CÕDà'3ð EØ'+òó �Hð —‘ Ô)Ø—‘˜SÔ!âØ—I‘Iœk¨(Ó3Õ4ð9#
ô< �2—8‘8˜RŸX™X r§x¡x°Ó5ˆä˜ ¨8Ó4ˆØ�—‘ØØØ�7œS ›]Ñ*Ø�7œS ›]Ñ*ØØ ™ò
ˆð ˆŒØˆùó? ùós   Ã.1H1Ä-AH7c                 óx  — t        |«      st        |«      r| j                  |d|«       nTt        |«      rt	        |d«      st        |«      r| j                  |d|«       nt        |«      r| j                  |d|«       t        |«      rt	        |d«      r|j                  }d}n?t        |«      rd}t        |«      }n&t        |«      rd}|j                  j                  }nd}t        t        |«      r|j                  n|«      }t        |||«      }t        ||d   |d	   |d
   |¬«      j                  «       }|S )a½  
        Handle locations and planes.

        @param cad_obj: The location or plane
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param helper_scale: The scale of the helper objects
        @param sketch_local: The flag to render the sketch_local
        @param level: The level of the hierarchy

        @return: The OcpObject
        z%build123d Location or TopLoc_LocationrÔ   zbuild123d Plane or gp_Plnzcadquery WorkplaneÚPlaner  r   rá   râ   rã   ©r6  )Úis_build123d_locationÚis_toploc_locationr{   Úis_build123d_planer3   Úis_gp_planeÚis_cadquery_empty_workplanerÔ   Úloc_from_gp_plnÚplaneÚget_location_coordrT   r4   r   r®   )	r$   r´   r¦   r¨   rw   Údef_nameÚcoordr.   r˜   s	            r&   rø   z$OcpConverter.handle_locations_planesA  s(  € ô( ! Ô)Ô-?ÀÔ-HØ�K‰K˜ÐFÈÕQô ˜wÔ'Ü˜ Ô,Ü˜7Ô#à�K‰K˜Ð:¸HÕEä(¨Ô1Ø�K‰K˜Ð3°XÔ>ä˜gÔ&¬7°7¸JÔ+GØ×&Ñ&ˆGØ‰Hä˜Ô!ØˆHÜ% gÓ.‰Gä(¨Ô1Ø"ˆHØ—m‘m×,Ñ,‰Gð "ˆHä"Ü4°WÔ=ˆG�OŠOÀ7ó
ˆô ˜ ¨8Ó4ˆÜØØ�(‰OØ�'‰NØ�'‰NØô
÷ ‰&‹(ð 	ð ˆr(   c                 óÒ   — | j                  |d|«       t        |«      r|j                  }t        |«      }t	        ||d«      }t        ||d   |d   ||¬«      j                  «       }|S )a´  
        Handle build123d Axis.

        @param cad_obj: The build123d Axis
        @param obj_name: The name of the object
        @param color: The color of the object
        @param alpha: The alpha value of the color
        @param helper_scale: The scale of the helper objects
        @param sketch_local: The flag to render the sketch_local
        @param level: The level of the hierarchy

        @return: The OcpObject
        zbuild123d AxisÚAxisrá   rã   r<  )r{   re   rT   Úget_axis_coordr4   r
   r®   )	r$   r´   r¦   rŒ   r¨   rw   rF  r.   r˜   s	            r&   Úhandle_axiszOcpConverter.handle_axis~  sr   € ð* 	�‰�EÐ+¨XÔ6ä�gÔØ—o‘oˆGÜ˜wÓ'ˆÜ˜ ¨6Ó2ˆÜØØ�(‰OØ�'‰NØØô
÷ ‰&‹(ð 	ð ˆr(   c                 ó   — t        ||d«      }|j                  «       }||_        |j                  dv r[| j	                  |j
                  d   t        |j
                  d   «      |«      \  }}|j                  |z  |_        ||_        d|_	        |S )z«
        Handle OcpWrapper objects.

        @param cad_obj: The OcpWrapper object
        @param obj_name: The name of the object

        @return: The OcpObject
        Ú	ImageFace)rO   Ú	imagefacerN   r�   r   N)
r4   r®   r.   rQ   r‹   rh   rj   r‡   r†   r-   )r$   r´   r¦   r.   r˜   r†   r‡   s          r&   Úhandle_ocp_wrapperzOcpConverter.handle_ocp_wrapper¢  s‡   € ô ˜ ¨;Ó7ˆØ—.‘.Ó"ˆØˆŒØ�<‰<ÐBÑBØ×(Ñ(Ø—‘˜Q‘¤°·±¸a±Ó!AÀ4ó‰HˆC�ð "Ÿ+™+¨Ñ+ˆGŒKØˆGŒKØˆGŒKØˆr(   c                 ó|   — | j                  |d«       |€dn|}t        dt        d«      |› d�t        d«      d¬«      S )	z©
        Handle empty objects.

        @param obj_name: The name of the object
        @param level: The level of the hierarchy

        @return: The OcpObject
        zEmpty objectÚObjectrL   )r   r   r   z (empty))r   r   r   g{®Gáz„?r(  r’   )r{   r   rL   r¢   )r$   r¦   rw   r.   s       r&   Úhandle_empty_iterablesz#OcpConverter.handle_empty_iterables»  sK   € ð 	�‰�E˜>Ô*Ø#Ð+‰x°ˆÜØÜ�yÓ!Ø�6˜Ð"Ü˜Ó(Øô
ð 	
r(   ç      ð?r   )r«   r¬   r­   r‡   rØ   rÄ   r¨   rp   r  r§   Úunroll_compoundsrw   rÂ   r«   r¬   r­   r‡   rp   rS  c          
      ó>  ‡— |€
t        «       }t        |¬«      }|€dgt        |«      z  }n\t        |t        t
        f«      r.t        |«      t        |«      k7  rt        d«      ‚t        |«      }nt        dt        |«      › d�«      ‚|€dgt        |«      z  }nPt        |t        t
        f«      r"t        |«      t        |«      k7  r#t        d«      ‚t        dt        |«      › d�«      ‚|€dgt        |«      z  }nPt        |t        t
        f«      r"t        |«      t        |«      k7  r#t        d«      ‚t        dt        |«      › d	�«      ‚|�|| _	        t        ||||«      D �]e  \  Š}}}t        ‰t        j                  «      sIt        ‰«      s>t        ‰t        t        t         t"        t$        j&                  t$        j(                  f«      rŒmt+        ‰«      st-        ‰«      rbt        ‰t.        «      rt        ‰«      }n;t1        ‰d
«      r‰j3                  «       }n‰j5                  «       j7                  «       }t9        |«      Št;        ‰«      sht=        ‰«      s]t?        ‰«      r‰j@                  �2t        ‰t.        «      r6t        t        ‰«      «      dk(  stC        ‰«      r| jE                  ||«      }�n¾t        ‰t
        t        f«      rŽtG        ‰«      r9tI        ˆfd„‰D «       «      r%tK        ‰D �cg c]  }tM        |«      dk(  ‘Œ c}«      rJ| jO                  ‰||||
||«      }|jP                  dk(  �r=|jS                  | jE                  ||«      «       �ntU        ‰«      r7tW        ‰j@                  «      s|r tY        ‰«      st[        ‰j@                  «      r.t]        ‰«      r<tW        ‰«      s|r/tY        ‰«      s$t[        ‰«      s| j_                  ‰||||
||«      }�n‘t        ‰t`        «      r| jc                  ‰||||
||«      }�nhtY        ‰«      r| je                  ‰||||||«      }�nDtg        ‰«      r| ji                  ‰||||||«      }�n t        ‰tj        «      rQ‰jm                  t        | jn                  «      «       ‰jp                  }| xjn                  ‰jn                  z  c_7        �n¿t        ‰tr        «      r| ju                  ‰|«      }�n›tG        ‰«      r| jw                  ‰||||	|«      }�nxty        ‰«      r#t{        ‰«      s| j}                  ‰||||	|«      }�nJt        ‰«      r| j�                  ‰|||«      }�n)tƒ        ‰«      r| j…                  ‰||||
||«      }�nt‡        ‰«      st‰        ‰«      st‹        ‰«      r| j�                  ‰|||	|||«      }nÌt;        ‰«      r| j�                  ‰||||«      }n«t‘        ‰«      s,t“        ‰«      s!t•        ‰«      st—        ‰«      st{        ‰«      r| j™                  ‰|||«      }n_t›        ‰«      st�        ‰«      r| jŸ                  ‰||||«      }n3| j                   r%t£        d|€dnd|› d�z   dt        ‰«      › �z   «       �Œ| j                   rt£        d|z  › d�|«       t        |t        «      r|jP                  dk(  r�ŒU|jS                  |«       �Œh |j¥                  «        |jP                  dk(  r-t        |j¦                  d   t        «      r|j©                  «       }|S c c}w )ar  
        Convert a list of objects to an OcpObject or OcpGroup hierarchy.

        @param cad_objs: The list of objects
        @param names: The list of names for the objects
        @param colors: The list of colors for the objects
        @param alphas: The list of alpha values for the objects
        @param loc: The location of the objects
        @param render_mates: The flag to render the mates
        @param render_joints: The flag to render the joints
        @param helper_scale: The scale of the helper objects
        @param default_color: The default color of the objects
        @param show_parent: The flag to show the parent
        @param sketch_local: The flag to render the sketch local
        @param unroll_compounds: The flag to unroll compounds
        @param level: The level of the hierarchy

        @return: The OcpObject or OcpGroup hierarchy
        N)r‡   z4Length of names does not match the number of objectszInvalid type z
 for namesz5Length of alphas does not match the number of objectsz for alphasz5Length of colors does not match the number of objectsz for colorsÚtoTupler   c              3   óR   •K  — | ]  }t        ‰d    «      t        |«      k(  –— Œ  y­w)r   N)rG   )Ú.0ri   r´   s     €r&   Ú	<genexpr>z&OcpConverter.to_ocp.<locals>.<genexpr>L  s$   øè ø€ ÐIÁ¸AœD ¨¡Ó,´°Q³Õ7Áùs   ƒ$'r¾   zUnknown objectr   z 'Ú'z	 of type ru   z=>r�   )Urä   r   r…   rU   rW   rV   rF   Úmake_uniquerG   rp   r·   ÚenumÚEnumÚis_ocp_colorr    r¡   ÚboolÚstrÚnpÚnumberÚndarrayr[   Ú	is_gp_vecr   r3   rU  ÚXYZÚCoordrL   r	  Ú	is_vertexre   rT   Úis_empty_compoundrQ  Úis_build123d_shapelistÚallÚanyrE   r¶   r¯   r°   r¿   Úis_mixed_compoundÚis_build123d_assemblyrÀ   rX   r½   Údictrº   rÆ   Úis_cadquery_assemblyrÚ   r   Úapply_offsetrq   Úocpgrpr   rN  r  Úis_cadqueryrA  r  Úis_build123d_locationlistrú   Úis_build123dr$  r  r  r  r  r9  r=  r>  r?  r@  rø   Úis_build123d_axisÚ
is_gp_axisrJ  rn   r#   r²   rÐ   r±   )r$   r«   r¬   r­   r‡   rØ   rÄ   r¨   rp   r  r§   rS  rw   rÂ   rù   r¦   rŒ   r�   Útargetr˜   ri   r´   s                        @r&   r®   zOcpConverter.to_ocpÒ  sz  ø€ ðJ ˆ;Ü#Ó%ˆCÜ˜SÔ!ˆð ˆ=Ø�FœS ›]Ñ*‰EÜ˜¤¤t˜}Ô-Ü�5‹zœS ›]Ò*Ü Ð!WÓXÐXÜ Ó&‰Eä˜}¬T°%«[¨M¸ÐDÓEÐEàˆ>Ø�Vœc (›mÑ+‰FÜ˜¤¬ Ô.Ü�6‹{œc (›mÒ+Ü ØKóð ô ˜}¬T°&«\¨N¸+ÐFÓGÐGàˆ>Ø�Vœc (›mÑ+‰FÜ˜¤¬ Ô.Ü�6‹{œc (›mÒ+Ü ØKóð ô ˜}¬T°&«\¨N¸+ÐFÓGÐGàÐ$Ø!.ˆDÔô 03°8¸UÀFÈF×/SÑ+ˆG�X˜u eô ˜7¤D§I¡IÔ.Ü Ô(Ü˜g¬¬U´D¼#¼r¿y¹yÌ"Ï*É*Ð'UÔVàô ˜Ô!¤Y¨wÔ%7Ü˜g¤xÔ0Ü! '›]‘FÜ˜W iÔ0Ø$Ÿ_™_Ó.‘Fà$Ÿ[™[›]×0Ñ0Ó2�Fä  ›.�ô
 ' wÔ/Ü! 'Ô*ä Ô(¨W¯_©_Ð-Dä" 7¬HÔ5Ü ¤ g£Ó/°1Ò4Ô8IÈ'Ô8Rð 7;×6QÑ6QØ˜eó7’ô ˜G¤d¬E ]Ô3ä*¨7Ô3ÜÓIÁÓIÔIäÁ'ÓJÁ'¸QœZ¨›]¨jÓ8À'ÑJÔKà×0Ñ0Ø˜X u¨e°\À<ÐQVó�ð —>‘> QÓ&Ø—K‘K × ;Ñ ;¸HÀeÓ LÖMô ˜GÔ$Ü& w§¡Ô7Ñ;KÜ-¨gÔ6Ü$ W§_¡_Ô5ä" 7Ô+Ü& wÔ/Ñ3CÜ-¨gÔ6Ü$ WÔ-à×.Ñ.Ø˜X u¨e°\À<ÐQVó’ô
 ˜G¤TÔ*Ø×*Ñ*Ø˜X u¨e°\À<ÐQVó’ô ' wÔ/Ø×8Ñ8ØØØØØ!Ø Øó’ô & gÔ.Ø×7Ñ7ØØØØØ Ø Øó’ô ˜GÔ%6Ô7Ø×$Ñ$¤S¨¯©Ó%8Ô9Ø!Ÿ.™.�Ø—’ '×"3Ñ"3Ñ3—ô ˜G¤ZÔ0Ø×1Ñ1°'¸8ÓD’ô (¨Ô0Ø×0Ñ0Ø˜X u¨e°[À%ó’ô
 ˜WÔ%Ô.IÈ'Ô.RØ×/Ñ/Ø˜X u¨e°[À%ó’ô
 +¨7Ô3Ø×3Ñ3Ø˜X |°Uó’ô
 ˜gÔ&Ø×7Ñ7Ø˜X u¨e°\À=ÐRWó’ô   Ô(Ü% gÔ.Ü$ WÔ-à×,Ñ,ØØØ!ØØØØó‘ô $ GÔ,Ø×5Ñ5Ø˜X u¨e°Uó‘ô & gÔ.Ü% gÔ.Ü% gÔ.Ü˜wÔ'Ü.¨wÔ7à×6Ñ6Ø˜X |°Uó‘ô
 # 7Ô+¬z¸'Ô/BØ×*Ñ*Ø˜X u¨l¸Eó‘ð
 —:’:ÜØ(Ø!)Ð!1™2¸¸H¸:ÀQÐ7GñIà%¤d¨7£m _Ð5ñ6ôñ
 à�zŠzÜ˜˜e™˜ BÐ'¨Ô1ä˜w¬Ô1°g·n±nÈÔ6IØ—	‘	˜'Ö"ðA 0TðD 	×ÑÔ!à�<‰<˜1Ò¤¨E¯M©M¸!Ñ,<¼hÔ!GØ—M‘M“OˆEàˆùòq Ks   Ë9\
)NF)Nzdebug:Ú
)NNN)9r)   r*   r+   Ú__doc__r	   r   r^  rs   r{   r  r_  r   r    ÚTopLoc_Locationr‹   r   Ú	ColorLiker¡   r   rš   r¢   r•   r   Ú	ShapeLiker   r   r³   r¶   rº   ÚCompoundLiker½   r¾   rÆ   rÇ   rÚ   r  rõ   r÷   rú   r  r  r  r  r  ÚBuilderObjectr$  ÚCadquerySketchr9  ÚLocationLikerø   rH  rJ  r   rN  ÚWrappedrQ  r®   r,   r(   r&   rl   rl   ²   s¢  „ Ù]ñ:  x° ~Ñ!6ð :Àdó :óCð#Øð#Ø+.ð#Ø69ð#à	ˆs�OÐ#Ñ	$ó#ðJ@à�L $ |Ñ"4Ð4Ñ5ð@ð ð@ð ð	@ð
 �Y  i°¸IÐ&EÑ FÈÐLÑMð@ð ð@ð 
ó@ðJ QUØ$(Ø!%ñ=àð=ð �Y  i°¸IÐ&EÑ FÈÐLÑMð=ð �U˜D�[Ñ!ð	=ð
 �C˜�IÑð=ð 
ˆu�e˜I y°)Ð;Ñ<Ð<Ñ	=ó=ðB++àØØ�c˜4�iÑ Ø�i  i¡°$°s¸I°~Ñ2FÐFÑGðIññ
ð++ð ˜˜T˜	Ñ"ð++ð �Y �_Ñ%ð++ð ð++ð ð++ð ð++ð ð++ð 
ó++ðZ 
à�y $ y¡/Ð1Ñ2ð 
ð ˜˜T˜	Ñ"ð 
ð �Y �_Ñ%ð	 
ð
 ð 
ð ð 
ð ð 
ð ð 
ð 
ó 
ðD 
à�c˜9�nÑ%ð 
ð ˜˜T˜	Ñ"ð 
ð �Y �_Ñ%ð	 
ð
 ð 
ð ð 
ð ð 
ð ð 
ð 
ó 
ðD*
àð*
ð ˜˜T˜	Ñ"ð*
ð �Y �_Ñ%ð	*
ð
 ð*
ð ð*
ð ð*
ð ð*
ð 
ó*
ð\<+àð<+ð ˜˜T˜	Ñ"ð<+ð �Y �_Ñ%ð	<+ð
 ð<+ð ð<+ð ð<+ð ð<+ð 
ó<+ð|HàðHð ˜˜T˜	Ñ"ðHð �Y �_Ñ%ð	Hð
 ðHð ðHð ðHð ðHð 
óHðX?à�y (¨I°tÐ;Ñ<ð?ð ð?ð 
ˆi‰ó	?ðBàðð ˜˜T˜	Ñ"ðð ð	ð
 ðð 
óò6!
ðF*àð*ð ˜˜T˜	Ñ"ð*ð �Y �_Ñ%ð	*ð
 ð*ð ð*ð ð*ð 
ˆx˜Ð"Ñ	#ó*ðX àð ð ˜˜T˜	Ñ"ð ð �Y �_Ñ%ð	 ð
 ð ð ð ð ð ð 
ˆx˜Ð"Ñ	#ó ðDJà�y (Ð*Ñ+ðJð ˜˜T˜	Ñ"ðJð ð	Jð
 ðJð �Y �_Ñ%ðJð ðJð ðJð 
ˆx˜Ð"Ñ	#óJðXC!àðC!ð ˜˜T˜	Ñ"ðC!ð �Y �_Ñ%ð	C!ð
 ðC!ð ðC!ð ðC!ð ðC!ð 
óC!ðJIàðIð ˜˜T˜	Ñ"ðIð �Y �_Ñ%ð	Ið
 ðIð ðIð 
óIðV;àð;ð ˜˜T˜	Ñ"ð;ð ð	;ð
 ð;ð 
ó;ðz"àð"ð ˜˜T˜	Ñ"ð"ð �Y �_Ñ%ð	"ð
 ð"ð ð"ð 
ó"ðHØ!ðØ-2°3¸°9Ñ-=ðà	óð2
Ø˜g x°Ð5Ñ6ð
Ø?Bð
à	ó
ð8 6:Ø<@Ø8<Ø Ø"Ø#Ø!Ø04Ø!Ø"Ø!&Øò!TàØ�x ¨D°$¸À*ÐLñ
ðTð
 �T˜%  T 	Ñ*Ñ+¨TÐ1Ñ2ðTð �d˜5 ¨D Ñ1Ñ2°DÐ8Ñ9ðTð �d˜5 ¨ Ñ-Ñ.°Ð4Ñ5ðTð ðTð ðTð ðTð ðTð ˜Y¨˜_Ñ-ðTð ðTð ðTð ðTð  ð!Tð" 
ô#Tr(   rl   FrR  T)r«   r¬   r­   rØ   rÄ   r¨   rp   r  Úshow_sketch_localr‡   rm   rn   rÂ   r«   r¬   r­   rØ   rÄ   r¨   rp   r  r�  r‡   rm   rn   c                 ón   — t        |
|¬«      } |j                  || |||	||||||dœ
Ž}||j                  fS )aù  
    Central converter routine to convert a list of objects to an OcpGroup hierarchy.

    @param cad_objs: The list of objects
    @param names: The list of names for the objects
    @param colors: The list of colors for the objects
    @param alphas: The list of alpha values for the objects
    @param render_mates: The flag to render the mates
    @param render_joints: The flag to render the joints
    @param helper_scale: The scale of the helper objects
    @param default_color: The default color of the objects
    @param show_parent: The flag to show the parent
    @param show_sketch_local: The flag to render the sketch local
    @param loc: The location of the objects
    @param progress: The progress bar

    @return: The OcpGroup hierarchy
    )rm   rn   )
r«   r¬   r­   r‡   rØ   rÄ   r¨   rp   r  r§   )rl   r®   rq   )r«   r¬   r­   rØ   rÄ   r¨   rp   r  r�  r‡   rm   rn   rÂ   Ú	converterÚ	ocp_groups                  r&   Úto_ocpgroupr…  î  sW   € ôB  h°eÔ<€IØ �	× Ñ Ø	ØØØØØ!Ø#Ø!Ø#ØØ&ò€Ið �i×)Ñ)Ð)Ð)r(   rù   rq   ÚkwargsÚtimeitc                 óæ  ‡‡‡— d$ˆfd„	Šˆˆfd„}d„ }‰€i Š| j                  d|d||«      \  }}g }	t        d‰j                  d«      «      }
t        d‰j                  d«      «      }t        d‰j                  d«      «      }t        d	‰j                  d	«      «      }d
}t        |«      D ]³  \  }}t	        ‰d|› d�dd«      5 }|d   }t        |dd¬«      }t        ||
¬«      }t        |«      |_        ||kD  r|}ddd«       t	        ‰d|› d|d   › �dd«      5 }t        |d   |
|‰|‰rdn|d¬«	      }|	j                  |«       d|d›d|d›d�|_        ddd«       Œµ |r||
z  dz  nd|d <   t	        ‰dd!d«      5 }|d"   €
t        «       n
t        |d"   Ž } ‰||	|«      |d#<   t        t        |d#   «      «      |_        ddd«       |	||fS # 1 sw Y   ŒÕxY w# 1 sw Y   �Œ:xY w# 1 sw Y   Œ'xY w)%a[  
    Tessellate a OcpGroup and instances as converted by to_ocp_group.

    @param group: The OcpGroup
    @param instances: The instances of the group
    @param kwargs: The keyword arguments
    @param progress: The progress bar
    @param timeit: The flag to measure the time

    @return: The meshed instances, the shapes, and the mapping
    Nc                 ó\  •— | d   D ]æ  }|d   €|n|t        |d   Ž z  }|j                  d«      €³|d   dk(  r&|d   d   }||   d   }t        |gt        |«      ¢­Ž }n|d   j	                  «       }|d= |€|}Œrt        |d	   |d	   «      t        |d
   |d
   «      t        |d   |d   «      t        |d   |d   «      t        |d   |d   «      t        |d   |d   «      dœ}ŒÜ ‰
||||«      }Œè dD ]7  }	||	› d�   ||	› d�   z
  dk  sŒ||	› d�xx   dz  cc<   ||	› d�xx   dz  cc<   Œ9 |S )NÚpartsr‡   rG   Úshapesr  r†   Úverticesr5  ÚxminÚxmaxÚyminÚymaxÚzminÚzmax)r�  rŽ  r�  r�  r‘  r’  )ra   ÚyÚzr1  Úming�íµ ÷Æ°>r(  )Ú	tq_to_locrD   Únp_bboxÚ	loc_to_tqÚto_dictr•  r1  )r‹  Úmeshed_instancesr‡   Úbboxr  Únew_locrñ   rŒ  r5  r£   Ú
get_bb_maxs             €r&   r�  z$tessellate_group.<locals>.get_bb_max4  s†  ø€ Ø˜G”_ˆEØ" 5™\Ð1‘c°s¼YÈÈeÉÐ=UÑ7UˆGØ�y‰y˜Ó!Ð)Ø˜‘= HÒ,ð   ™.¨Ñ/�CØ/°Ñ4°ZÑ@�HÜ  Ð?¬I°gÓ,>Ò?‘Bð ˜t™×,Ñ,Ó.�Bà˜d˜à�<Ø‘Dô !$ D¨¡L°"°V±*Ó =Ü # D¨¡L°"°V±*Ó =Ü # D¨¡L°"°V±*Ó =Ü # D¨¡L°"°V±*Ó =Ü # D¨¡L°"°V±*Ó =Ü # D¨¡L°"°V±*Ó =ñ‘Dñ " %Ð)9¸7ÀDÓI‘ð7 %ó> !ˆAØ�q�c˜�I‰ ¨¨¨3 i¡Ñ0°4Ó7Ø˜�s˜#�Y“ 3Ñ&“Ø˜�s˜#�Y“ 3Ñ&”ð !ð
 ˆr(   c                 ó   •— t        ‰|dd«      5 }t        d‰
j                  d«      «      }t        d‰
j                  d«      «      }t        | «      }t	        ||¬«      }|€|dz  n|}t        |«      |_        d d d «       t        ‰|dd«      5 }d› d	› �|_        t        | ||«      }	d d d «       |	fS # 1 sw Y   Œ>xY w# 1 sw Y   	fS xY w)
Nzbounding box:r   Ú	deviationÚedge_accuracy©rŸ  é
   zdiscretize:  z	quality: z, deflection: )ÚTimerr   rD   Úbounding_boxr   r_  Úinfor   )r-   r.   Úid_r  rŸ  r   r5  ÚqualityÚ
deflectionÚ
disc_edgesr†  r‡  s             €€r&   Ú_discretize_edgesz+tessellate_group.<locals>._discretize_edges[  sÓ   ø€ Ü�6˜4 °!Ô4¸Ü˜{¨F¯J©J°{Ó,CÓDˆIÜ" ?°F·J±J¸Ó4OÓPˆMä˜cÓ"ˆBÜ% b°IÔ>ˆGØ)6Ð)>˜ 2šÀMˆJÜ˜“WˆAŒF÷ 5ô �6˜4 °!Ô4¸Ø   	¨¸
°|ÐDˆAŒFÜ)¨#¨z¸3Ó?ˆJ÷ 5ð ˜2ˆ~Ð÷ 5Ð4ú÷ 5ð ˜2ˆ~Ðús   �A(B5ÂCÂ5B>ÃCc                 ó8   — t        | «      }t        | |«      }||fS ©N)r¤  r   )r-   Ú_namer¦  r5  rŒ  s        r&   Ú_convert_verticesz+tessellate_group.<locals>._convert_verticesk  s"   € Ü˜#ÓˆÜ# C¨Ó-ˆà˜ˆ|Ðr(   r   rŸ  Úangular_toleranceÚrender_edgesÚrender_normalsg        z	instance(rê   zcompute quality:r   r-   F)r‡   Úoptimalr¡  z):r.   ztessellate:     r|   zn/a)rŸ  r§  r¯  rn   Úcompute_edgesrm   Úshape_idz	{quality:z.4fz, angular_tolerance:z.2fÚ}é   r   Ú
normal_lenzcompute bounding box:r‡   r5  )NN)Úcollectr   rD   rƒ   r£  r¤  r   r_  r¥  r   r\   rä   r–  r,  )rù   rq   r†  rm   r‡  rª  r®  Úmappingr‹  rš  rŸ  r¯  r°  r±  Úmax_accuracyr‰   rŠ   r  r  r5  r§  ÚmeshÚtop_locr�  s     ` `                  @r&   Útessellate_groupr½  !  sS  ú€ õ&%õNò ð €~Øˆà—m‘mØ
ˆI�tÐ.Ð0Aó�O€GˆVð Ðä�{ F§J¡J¨{Ó$;Ó<€IÜÐ2°F·J±JÐ?RÓ4SÓTÐä˜.¨&¯*©*°^Ó*DÓE€LÜÐ,¨f¯j©jÐ9IÓ.JÓK€Nà€Lä  Ö+‰ˆˆ8Ü�6˜Y q c¨Ð+Ð-?ÀÔCÀqØ˜U‘OˆEô ˜e¨°uÔ=ˆBÜ% b°IÔ>ˆGÜ˜“WˆAŒFà˜Ò%Ø&�÷ Dô Ø�i ˜s " X¨fÑ%5Ð$6Ð7Ð9KÈQô
àÜØØ˜Ñ$Ø#ØØ"3ØØ*Ù!'™¨XØô
ˆDð ×#Ñ# DÔ)à˜W S˜MÐ)=Ð>OÐPSÐ=TÐTVÐWð ŒF÷
ð 
ð ,ñ@ <J˜<¨)Ñ3°aÒ7Èq€Fˆ<ÑÜ	ˆv�rÐ2°AÔ	6¸!à#)¨%¡=Ð#8ÔÔ¼iÈÐPUÉÐ>Wð 	ñ " &Ð*:¸GÓDˆˆt‰ä”[ ¨¡Ó.Ó/ˆŒ÷ 
7ð ˜V WÐ,Ð,÷Q DÐCú÷
ñ 
ú÷( 
7Ð	6ús%   Ã8GÄ=GÅ=AG'ÇG	ÇG$	Ç'G0©r«   r¬   r­   rØ   rÄ   r¨   rp   r  r�  r‡   rm   c                 óB   — t        d«       t        || |||||||||	|
dœŽS )a  
    Compatibility wrapper for the converter routine to convert a list of
    objects to an OcpGroup hierarchy.

    @param cad_objs: The list of objects
    @param names: The list of names for the objects
    @param colors: The list of colors for the objects
    @param alphas: The list of alpha values for the objects
    @param render_mates: The flag to render the mates
    @param render_joints: The flag to render the joints
    @param helper_scale: The scale of the helper objects
    @param default_color: The default color of the objects
    @param show_parent: The flag to show the parent
    @param show_sketch_local: The flag to render the sketch local
    @param loc: The location of the objects
    @param progress: The progress bar

    @return: The OcpGroup hierarchy
    z(to_assembly is obsolete, use to_ocpgroupr¾  )Úwarnr…  )r«   r¬   r­   rØ   rÄ   r¨   rp   r  r�  r‡   rm   rÂ   s               r&   Úto_assemblyrÁ  ³  s?   € ôB 	Ð	3Ô4ÜØ	ØØØØ!Ø#Ø!Ø#ØØ+ØØòð r(   c                 ó   — t        | d   «      S )Nr5  )r,  )r‹  s    r&   Úcombined_bbrÃ  æ  s   € Ü�v˜d‘|Ó$Ð$r(   c                 ó   — |d   S )Nr·  r,   )r±  r‹  rŸ  s      r&   Úget_normal_lenrÅ  ë  s   € Ø�,ÑÐr(   c                  ó   — t        d«      ‚)Nz conv is not implemented any more)ÚNotImplementedErrorr,   r(   r&   ÚconvrÈ  ð  s   € Ü
Ð@Ó
AÐAr(   c                 ó„   ‡—  G ˆfd„dt         j                  «      Št        j                  |‰|¬«      }| €|S d| › d|› d�S )Nc                   ó"   •‡ — e Zd Zˆˆ fd„Zˆ xZS )ú&numpy_to_js.<locals>.NumpyArrayEncoderc                 ó
  •— t        |t        j                  «      rt        |«      S t        |t        j                  «      rt        |«      S t        |t        j                  «      r|j                  «       S t        ‰| �'  |«      S r¬  )
rU   r`  Úintegerr    Úfloatingr¡   rb  ÚtolistÚsuperr/   )r$   ri   ÚNumpyArrayEncoderÚ	__class__s     €€r&   r/   z.numpy_to_js.<locals>.NumpyArrayEncoder.default   s^   ø€ Ü˜!œRŸZ™ZÔ(Ü˜1“v�Ü˜!œRŸ[™[Ô)Ü˜Q“x�Ü˜!œRŸZ™ZÔ(Ø—x‘x“zÐ!äÐ*¨DÑ9¸!Ó<Ð<r(   )r)   r*   r+   r/   Ú__classcell__)rÒ  rÑ  s   @€r&   rÑ  rË  ÿ  s   ù„ ÷	=ñ 	=r(   rÑ  )ÚclsÚindentzvar z = Ú;)ÚjsonÚJSONEncoderÚdumps)Úvarr-   rÕ  r`   rÑ  s       @r&   Únumpy_to_jsrÛ  þ  sK   ø€ ö	=œD×,Ñ,ô 	=ô �Z‰Z˜Ð!2¸6ÔB€Fð €{Øˆà�c�U˜#˜f˜X QÐ'Ð'r(   )r«   Úfilenamec                ó  — d„ }t        |d|iŽ\  }}t        ||«      \  }}} |||«       t        | |«      }	|€|	S t        |d«      5 }
|
j	                  |	«       d d d «       t        j                  d|i«      S # 1 sw Y   Œ xY w)Nc                 ó$   ‡ ‡— ˆ ˆfd„Š ‰|«       y )Nc                 óÜ   •— d }| j                  «       D ]V  }|dk(  r| d   D ]
  } ‰|«       Œ Œ|dk(  r| d   }Œ&|dk(  sŒ,|dk(  sŒ2| d   j                  d«      €ŒG| d   d   }‰|   | d<   ŒX y )NrŠ  rG   r  r‹  r†   )rÓ   rD   )r-   rI   Úattrr  rñ   rq   Úwalks        €€r&   rá  z8export_three_cad_viewer_js.<locals>.decode.<locals>.walk"  s„   ø€ ØˆCØŸ™ž
�Ø˜7’?Ø # G¤˜Ù˜T�
ñ !-ð ˜V’^Ø˜f™+‘Cà˜W“_Ø˜h“Ø˜w™<×+Ñ+¨EÓ2Ñ>Ø"% g¡,¨uÑ"5˜CØ+4°S©>˜C šLñ #r(   r,   )rq   r‹  rá  s   ` @r&   Údecodez*export_three_cad_viewer_js.<locals>.decode!  s   ù€ õ	:ñ  	ˆV�r(   r«   ÚwÚexported)r…  r½  rÛ  ÚopenÚwriter×  rÙ  )rÚ  r«   rÜ  rh   râ  Ú
part_grouprq   r‹  Úmapr×   Úfds              r&   Úexport_three_cad_viewer_jsrê     sŠ   € òô& (¨Ð;°UÑ;Ñ€J�	Ü-¨j¸)ÓDÑ€Iˆv�sÙ
ˆ9�fÔä�C˜Ó €AØÐØˆä�(˜CÔ  BØ�H‰H�QŒK÷ !ä�z‰z˜: xÐ0Ó1Ð1÷ !Ð ús   ÁA8Á8B)NNFr¬  )Gr[  Úhashlibr   Útypingr   r   r   r   r   r	   Úocp_tessellate.cad_objectsr
   r   r   r   r   r   Úocp_tessellate.defaultsr   r   Úocp_tessellate.ocp_utilsÚocp_tessellate.tessellatorr   r   r   r   Úocp_tessellate.utilsr–   r—   Ú
EDGE_COLORr�   rŸ   rž   r€  r¾   r  r~  rÇ   r  r÷   r}  r  rH  r  r{  ÚTopoDS_Compoundr|  r_  r¡   r¢   rz  r   r4   rJ   rR   rb   rj   rl   r^  r…  r½  rÁ  rÃ  rÅ  rÈ  r×  ÚreÚnumpyr`  rÛ  rê  r,   r(   r&   Ú<module>rö     sj  ðÛ Ý ß :× :÷÷ ÷ 8Ü &÷ó ô #à€
Ø€
à€
Ø!Ð Ø€Ø€
ð €à€à€	à€à€à�‰M€	à�G‰}€à€à€à€à�, Ð'Ñ(€	Ø�_ gÐ-Ñ.€à�#�t˜E‘{ EÐ)Ñ*€	÷(ñ (ð
�,ð  e¨C°¨IÑ&6ð Àð Èó ð*�,ð  3ó ð.�#ð ˜#ó ð2Ø	ˆ|˜T ,Ñ/°¸DÀ¹OÐKÑ	Lðà
ˆ<˜˜lÑ+Ð+Ñ,óð:˜ð ¨#ó ÷"tñ tð|) 26Ø8<Ø48ØØØØ,0ØØ"ØØ&*Øò0*Ø�Y ¨)°T¸4ÀÈ:ÐUÑVð0*à��e˜C ˜IÑ&Ñ'¨Ð-Ñ.ð0*ð �$�u˜Y¨˜_Ñ-Ñ.°Ð4Ñ5ð0*ð �$�u˜U D˜[Ñ)Ñ*¨DÐ0Ñ1ð	0*ð
 ð0*ð ð0*ð ð0*ð ˜ D˜Ñ)ð0*ð ð0*ð ð0*ð 
ð0*ð �H˜d�NÑ#ð0*ð ð0*ð ˆ8�T˜#‘YÐÑó0*ðl !%Ø&*ØñJ-ØðJ-à�LÑ!ðJ-ð �$˜�*ÑðJ-ð �H˜d�NÑ#ð	J-ð
 ðJ-ð ˆ4��t˜TÐ!Ñ"óJ-ðh 26Ø8<Ø48ØØØØ,0ØØ"ØØ&*ò/Ø�Y ¨)°T¸4ÀÈ:ÐUÑVð/à��e˜C ˜IÑ&Ñ'¨Ð-Ñ.ð/ð �$�u˜Y¨˜_Ñ-Ñ.°Ð4Ñ5ð/ð �$�u˜U D˜[Ñ)Ñ*¨DÐ0Ñ1ð	/ð
 ð/ð ð/ð ð/ð ˜ D˜Ñ)ð/ð ð/ð ð/ð 
ð/ð �H˜d�NÑ#ð/ð ˆ8�T˜#‘YÐÑó/òf%ò
 ò
Bó Û 	ã ó(ðD 26Àõ 2r(   