Can you write a script which retrieves the origin and
rotation of the currently active ACS and displays it.
from MSPyBentley import * from MSPyECObjects import * from MSPyBentleyGeom import * from MSPyDgnPlatform import * from MSPyDgnView import * from MSPyMstnPlatform import * def displayActiveACSInfo(): """ Retrieves and displays the origin and rotation matrix of the currently active ACS in the active view. """ # Get the active DGN model reference ACTIVEMODEL = ISessionMgr.ActiveDgnModelRef if ACTIVEMODEL is None: MessageCenter.ShowErrorMessage("Error", "No active DGN model found.", False) return # Get the active viewport (view) viewport = IViewManager.GetActiveViewSet().GetSelectedViewport() if viewport is None: MessageCenter.ShowErrorMessage("Error", "No active viewport found.", False) return # Get the active ACS for the given viewport activeACS = IACSManager.GetManager().GetActive(viewport) if activeACS is None: MessageCenter.ShowErrorMessage("Error", "No active ACS found.", False) return # Get the origin and rotation of the active ACS origin = DPoint3d() activeACS.GetOrigin(origin) rotation = RotMatrix() activeACS.GetRotation(rotation) # Display the origin and rotation MessageCenter.ShowInfoMessage( "Active ACS Info", f"Origin: ({origin.x}, {origin.y}, {origin.z})\nRotation Matrix:\n{rotation}", False ) def main(): displayActiveACSInfo() if __name__ == "__main__": main()
Python: Documentation | API Presentations | FAQs | GitHub | Samples | Wikis | Blogs