@@ -289,3 +289,39 @@ def test_issue_1807_translate_sketch_non_default_units():
289289 finally :
290290 # Reset the default units to meters
291291 DEFAULT_UNITS .LENGTH = UNITS .meter
292+
293+
294+ def test_issue_1813_edge_start_end_non_default_units (modeler : Modeler ):
295+ """Test that creating an edge with non-default units is handled properly.
296+
297+ Notes
298+ -----
299+ Apparently there are some issues on the start and end locations when
300+ using non-default units. This test is to verify that the issue has been
301+ resolved.
302+
303+ For more info see
304+ https://github.com/ansys/pyansys-geometry/issues/1813
305+ """
306+ try :
307+ # Create initial design and set default units to millimeters
308+ design = modeler .create_design ("MillimetersEdgeIssue" )
309+ DEFAULT_UNITS .LENGTH = UNITS .mm
310+
311+ # Sketch and extrude box
312+ box = design .extrude_sketch ("box" , Sketch ().box (Point2D ([0.5 , 0.5 ]), 1 , 1 ), 1 )
313+
314+ # Perform some assertions like...
315+ # 1) The edge lengths should be 1 mm
316+ for face in box .faces :
317+ for edge in face .edges :
318+ assert np .isclose (edge .length , 1 * UNITS .mm )
319+ length_vec = edge .start - edge .end
320+ assert np .isclose (np .linalg .norm (length_vec ) * length_vec .base_unit , 1 * UNITS .mm )
321+
322+ # 2) Verify the box volume
323+ assert np .isclose (box .volume , 1 * UNITS .mm * UNITS .mm * UNITS .mm )
324+
325+ finally :
326+ # Reset the default units to meters
327+ DEFAULT_UNITS .LENGTH = UNITS .meter
0 commit comments