@@ -756,3 +756,153 @@ def test_split_body_by_face(modeler: Modeler):
756756 assert design .bodies [2 ].volume .m == pytest .approx (
757757 Quantity (0.5 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
758758 )
759+
760+
761+ def test_linear_pattern_on_imported_geometry_faces (modeler : Modeler ):
762+ """Test create a linear pattern on imported geometry"""
763+ design = modeler .open_file (FILES_DIR / "LinearPatterns.scdocx" )
764+ assert len (design .bodies ) == 1
765+ assert len (design .bodies [0 ].faces ) == 11
766+ assert design .bodies [0 ].volume .m == pytest .approx (
767+ Quantity (7.227e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
768+ )
769+ success = modeler .geometry_commands .create_linear_pattern (
770+ [
771+ design .bodies [0 ].faces [1 ],
772+ design .bodies [0 ].faces [2 ],
773+ design .bodies [0 ].faces [0 ],
774+ design .bodies [0 ].faces [4 ],
775+ design .bodies [0 ].faces [3 ],
776+ ],
777+ design .bodies [0 ].edges [12 ],
778+ 13 ,
779+ 0.004 ,
780+ True ,
781+ 7 ,
782+ 0.007 ,
783+ )
784+ assert len (design .bodies ) == 1
785+ assert len (design .bodies [0 ].faces ) == 266
786+ assert success
787+ assert design .bodies [0 ].volume .m == pytest .approx (
788+ Quantity (1.08992e-5 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
789+ )
790+
791+
792+ def test_modify_linear_pattern_on_imported_geometry_faces (modeler : Modeler ):
793+ """Test modifying a linear pattern on an imported geometry"""
794+ design = modeler .open_file (FILES_DIR / "LinearPatternsModify.scdocx" )
795+ assert len (design .bodies ) == 1
796+ assert len (design .bodies [0 ].faces ) == 266
797+ assert design .bodies [0 ].volume .m == pytest .approx (
798+ Quantity (1.08992e-5 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
799+ )
800+ success = modeler .geometry_commands .modify_linear_pattern (
801+ [
802+ design .bodies [0 ].faces [1 ],
803+ design .bodies [0 ].faces [2 ],
804+ design .bodies [0 ].faces [0 ],
805+ design .bodies [0 ].faces [4 ],
806+ design .bodies [0 ].faces [3 ],
807+ ],
808+ 10 ,
809+ 0.004 ,
810+ 3 ,
811+ 0.0105 ,
812+ 0 ,
813+ 0 ,
814+ )
815+ assert success
816+ assert len (design .bodies ) == 1
817+ assert len (design .bodies [0 ].faces ) == 156
818+ assert design .bodies [0 ].volume .m == pytest .approx (
819+ Quantity (9.3152e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
820+ )
821+
822+
823+ def test_circular_pattern_on_imported_geometry_faces (modeler : Modeler ):
824+ """Test creating a circular pattern out of imported geometry"""
825+ design = modeler .open_file (FILES_DIR / "Fan_OneBlade_CircularPatter.scdocx" )
826+ assert len (design .bodies ) == 1
827+ assert len (design .bodies [0 ].faces ) == 13
828+ assert design .bodies [0 ].volume .m == pytest .approx (
829+ Quantity (0.00019496 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
830+ )
831+ success = modeler .geometry_commands .create_circular_pattern (
832+ [
833+ design .bodies [0 ].faces [10 ],
834+ design .bodies [0 ].faces [11 ],
835+ design .bodies [0 ].faces [7 ],
836+ design .bodies [0 ].faces [9 ],
837+ design .bodies [0 ].faces [8 ],
838+ design .bodies [0 ].faces [12 ],
839+ ],
840+ design .bodies [0 ].edges [3 ],
841+ 8 ,
842+ np .pi * 2 ,
843+ False ,
844+ None ,
845+ None ,
846+ None ,
847+ )
848+ assert len (design .bodies ) == 1
849+ assert len (design .bodies [0 ].faces ) == 55
850+ assert success
851+ assert design .bodies [0 ].volume .m == pytest .approx (
852+ Quantity (0.0002373 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
853+ )
854+
855+
856+ def test_fill_pattern_on_imported_geometry_faces (modeler : Modeler ):
857+ """Test create a fill pattern on imported geometry"""
858+ design = modeler .open_file (FILES_DIR / "FillPattern.scdocx" )
859+ assert len (design .bodies ) == 1
860+ assert len (design .bodies [0 ].faces ) == 12
861+ assert design .bodies [0 ].volume .m == pytest .approx (
862+ Quantity (8.267e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
863+ )
864+ success = modeler .geometry_commands .create_fill_pattern (
865+ [
866+ design .bodies [0 ].faces [3 ],
867+ design .bodies [0 ].faces [4 ],
868+ design .bodies [0 ].faces [2 ],
869+ design .bodies [0 ].faces [5 ],
870+ design .bodies [0 ].faces [1 ],
871+ design .bodies [0 ].faces [0 ],
872+ ],
873+ design .bodies [0 ].edges [0 ],
874+ FillPatternType .GRID ,
875+ 0.0005 ,
876+ 0.00075 ,
877+ 0.001 ,
878+ )
879+ assert len (design .bodies ) == 1
880+ assert len (design .bodies [0 ].faces ) == 294
881+ assert success
882+ assert design .bodies [0 ].volume .m == pytest .approx (
883+ Quantity (4.40535e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
884+ )
885+
886+
887+ def test_update_fill_pattern_on_imported_geometry_faces (modeler : Modeler ):
888+ """Test modify a fill pattern on imported geometry"""
889+ design = modeler .open_file (FILES_DIR / "FillPatternUpdate.scdocx" )
890+ assert len (design .bodies ) == 1
891+ assert len (design .bodies [0 ].faces ) == 294
892+ assert design .bodies [0 ].volume .m == pytest .approx (
893+ Quantity (4.40535e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
894+ )
895+ face = design .bodies [0 ].faces [3 ]
896+ modeler .geometry_commands .extrude_faces (face , 0.001 , face .normal (0 , 0 ))
897+ assert len (design .bodies ) == 1
898+ assert len (design .bodies [0 ].faces ) == 294
899+ assert design .bodies [0 ].volume .m == pytest .approx (
900+ Quantity (5.2270374e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
901+ )
902+ success = modeler .geometry_commands .update_fill_pattern (design .bodies [0 ].faces [3 ])
903+ assert success
904+ assert len (design .bodies ) == 1
905+ assert len (design .bodies [0 ].faces ) == 342
906+ assert design .bodies [0 ].volume .m == pytest .approx (
907+ Quantity (4.70663693e-6 , UNITS .m ** 3 ).m , rel = 1e-6 , abs = 1e-8
908+ )
0 commit comments