@@ -585,42 +585,13 @@ def add_midsurface_offset(self, offset: MidSurfaceOffsetType) -> None:
585585 @protect_grpc
586586 @check_input_types
587587 def imprint_curves (self , faces : List [Face ], sketch : Sketch ) -> Tuple [List [Edge ], List [Face ]]:
588- # Verify that each of the faces provided are part of this body
589- body_faces = self .faces
590- for provided_face in faces :
591- is_found = False
592- for body_face in body_faces :
593- if provided_face .id == body_face .id :
594- is_found = True
595- break
596- if not is_found :
597- raise ValueError (f"Face with id { provided_face .id } is not part of this body." )
598-
599- self ._grpc_client .log .debug (
600- f"Imprinting curves provided on { self .id } "
601- + f"for faces { [face .id for face in faces ]} ."
602- )
603-
604- imprint_response = self ._commands_stub .ImprintCurves (
605- ImprintCurvesRequest (
606- body = self ._id ,
607- curves = sketch_shapes_to_grpc_geometries (sketch ._plane , sketch .edges , sketch .faces ),
608- faces = [face ._id for face in faces ],
609- )
588+ raise NotImplementedError (
589+ """
590+ imprint_curves is not implemented at the TemplateBody level.
591+ Instead, call this method on a Body.
592+ """
610593 )
611594
612- new_edges = [
613- Edge (grpc_edge .id , grpc_edge .curve_type , self , self ._grpc_client )
614- for grpc_edge in imprint_response .edges
615- ]
616-
617- new_faces = [
618- Face (grpc_face .id , grpc_face .surface_type , self , self ._grpc_client )
619- for grpc_face in imprint_response .faces
620- ]
621-
622- return (new_edges , new_faces )
623-
624595 @protect_grpc
625596 @check_input_types
626597 def project_curves (
@@ -630,28 +601,13 @@ def project_curves(
630601 closest_face : bool ,
631602 only_one_curve : Optional [bool ] = False ,
632603 ) -> List [Face ]:
633- curves = sketch_shapes_to_grpc_geometries (
634- sketch ._plane , sketch .edges , sketch .faces , only_one_curve = only_one_curve
635- )
636-
637- self ._grpc_client .log .debug (f"Projecting provided curves on { self .id } ." )
638-
639- project_response = self ._commands_stub .ProjectCurves (
640- ProjectCurvesRequest (
641- body = self ._id ,
642- curves = curves ,
643- direction = unit_vector_to_grpc_direction (direction ),
644- closest_face = closest_face ,
645- )
604+ raise NotImplementedError (
605+ """
606+ project_curves is not implemented at the TemplateBody level.
607+ Instead, call this method on a Body.
608+ """
646609 )
647610
648- projected_faces = [
649- Face (grpc_face .id , grpc_face .surface_type , self , self ._grpc_client )
650- for grpc_face in project_response .faces
651- ]
652-
653- return projected_faces
654-
655611 @protect_grpc
656612 @check_input_types
657613 @reset_tessellation_cache
@@ -902,7 +858,41 @@ def add_midsurface_offset(self, offset: "MidSurfaceOffsetType") -> None:
902858 self ._template .add_midsurface_offset (offset )
903859
904860 def imprint_curves (self , faces : List [Face ], sketch : Sketch ) -> Tuple [List [Edge ], List [Face ]]:
905- return self ._template .imprint_curves (faces , sketch )
861+ # Verify that each of the faces provided are part of this body
862+ body_faces = self .faces
863+ for provided_face in faces :
864+ is_found = False
865+ for body_face in body_faces :
866+ if provided_face .id == body_face .id :
867+ is_found = True
868+ break
869+ if not is_found :
870+ raise ValueError (f"Face with id { provided_face .id } is not part of this body." )
871+
872+ self ._template ._grpc_client .log .debug (
873+ f"Imprinting curves provided on { self .id } "
874+ + f"for faces { [face .id for face in faces ]} ."
875+ )
876+
877+ imprint_response = self ._template ._commands_stub .ImprintCurves (
878+ ImprintCurvesRequest (
879+ body = self ._id ,
880+ curves = sketch_shapes_to_grpc_geometries (sketch ._plane , sketch .edges , sketch .faces ),
881+ faces = [face ._id for face in faces ],
882+ )
883+ )
884+
885+ new_edges = [
886+ Edge (grpc_edge .id , grpc_edge .curve_type , self , self ._template ._grpc_client )
887+ for grpc_edge in imprint_response .edges
888+ ]
889+
890+ new_faces = [
891+ Face (grpc_face .id , grpc_face .surface_type , self , self ._template ._grpc_client )
892+ for grpc_face in imprint_response .faces
893+ ]
894+
895+ return (new_edges , new_faces )
906896
907897 def project_curves (
908898 self ,
@@ -911,7 +901,26 @@ def project_curves(
911901 closest_face : bool ,
912902 only_one_curve : Optional [bool ] = False ,
913903 ) -> List [Face ]:
914- return self ._template .project_curves (direction , sketch , closest_face , only_one_curve )
904+ curves = sketch_shapes_to_grpc_geometries (
905+ sketch ._plane , sketch .edges , sketch .faces , only_one_curve = only_one_curve
906+ )
907+ self ._template ._grpc_client .log .debug (f"Projecting provided curves on { self .id } ." )
908+
909+ project_response = self ._template ._commands_stub .ProjectCurves (
910+ ProjectCurvesRequest (
911+ body = self ._id ,
912+ curves = curves ,
913+ direction = unit_vector_to_grpc_direction (direction ),
914+ closest_face = closest_face ,
915+ )
916+ )
917+
918+ projected_faces = [
919+ Face (grpc_face .id , grpc_face .surface_type , self , self ._template ._grpc_client )
920+ for grpc_face in project_response .faces
921+ ]
922+
923+ return projected_faces
915924
916925 def translate (self , direction : UnitVector3D , distance : Union [Quantity , Distance , Real ]) -> None :
917926 return self ._template .translate (direction , distance )
0 commit comments