@@ -2915,6 +2915,54 @@ def test_create_body_from_loft_profile(modeler: Modeler):
29152915 assert result .volume .m == 0
29162916
29172917
2918+ def test_create_body_from_loft_profile_with_guides (modeler : Modeler ):
2919+ """Test the ``create_body_from_loft_profile_with_guides()`` method to create a vase
2920+ shape.
2921+ """
2922+ design_sketch = modeler .create_design ("LoftProfileWithGuides" )
2923+
2924+ circle1 = Circle (origin = [0 , 0 , 0 ], radius = 8 )
2925+ circle2 = Circle (origin = [0 , 0 , 10 ], radius = 10 )
2926+
2927+ profile1 = circle1 .trim (Interval (0 , 2 * np .pi ))
2928+ profile2 = circle2 .trim (Interval (0 , 2 * np .pi ))
2929+
2930+ def circle_point (center , radius , angle_deg ):
2931+ # Returns a point on the circle at the given angle
2932+ angle_rad = np .deg2rad (angle_deg )
2933+ return Point3D (
2934+ [
2935+ center [0 ] + radius .m * np .cos (angle_rad ),
2936+ center [1 ] + radius .m * np .sin (angle_rad ),
2937+ center [2 ],
2938+ ]
2939+ )
2940+
2941+ angles = [0 , 90 , 180 , 270 ]
2942+ guide_curves = []
2943+
2944+ for angle in angles :
2945+ pt1 = circle_point (circle1 .origin , circle1 .radius , angle )
2946+ pt2 = circle_point (circle2 .origin , circle2 .radius , angle )
2947+
2948+ # Create a guide curve (e.g., a line or spline) between pt1 and pt2
2949+ guide_curve = NURBSCurve .fit_curve_from_points ([pt1 , pt2 ], 1 ).trim (Interval (0 , 1 ))
2950+ guide_curves .append (guide_curve )
2951+
2952+ # Call the method
2953+ result = design_sketch .create_body_from_loft_profiles_with_guides (
2954+ "vase" , [[profile1 ], [profile2 ]], guide_curves
2955+ )
2956+
2957+ # Assert that the resulting body has only one face.
2958+ assert len (result .faces ) == 1
2959+
2960+ # check volume of body
2961+ # expected is 0 since it's not a closed surface
2962+ assert result .volume .m == 0
2963+ assert result .is_surface is True
2964+
2965+
29182966def test_revolve_sketch (modeler : Modeler ):
29192967 """Test revolving a circular profile for a quarter donut."""
29202968 # Initialize the donut sketch design
0 commit comments