I am trying to create a Section Plane in PyMechanical. The following code works when I run it in the Scripting window of standalone Mechanical. But when I run it via VS code, it keeps running for 20-30 min. It never showed any error, but I had to terminate it because it shouldn't take more than a few seconds to run it.
var_coordinate_system = 'Section Plane Coordinate System'
coord_sys = [cs for cs in Model.CoordinateSystems.Children if cs.Name == var_coordinate_system][0]
section_plane = Graphics.SectionPlanes.CreateSectionPlane(coord_sys)
# section_plane = Graphics.SectionPlanes.CreateSectionPlane(coord_sys,MechanicalEnums.Common.PlaneOrientation.PlaneOrientation_XZ)
section_plane.Direction = Vector3D(0,-1,0)
In the above code, I have tried both ways to define a section plane (one with only the coordinate system as an argument and one with a coordinate system and plane orientation as arguments). Both ways give the same issue: there's no error, but they keep running for 20-30 min.
Any help is appreciated. Thank you.