How to use deviation in Spaceclaim via API

Mike.Thompson
Mike.Thompson Member, Employee Posts: 239
First Anniversary First Comment 5 Likes Ansys Employee
edited June 2023 in 3D Design

How can I use the deviation tool in SC/Discovery and then save images to a file.

Best Answer

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 239
    First Anniversary First Comment 5 Likes Ansys Employee
    Answer ✓
    # Python Script for SpaceClaim API version V23
    # Importing the Command class from SpaceClaim API v23
    from SpaceClaim.Api.V23 import Command
    # Creating a selection of all bodies in the root part and setting it as active
    Selection.Create(GetRootPart().Bodies).SetActive()
    # Getting the command for Analysis Deviation
    c = Command.GetCommand("AnalysisDeviation")
    # Executing the Analysis Deviation command
    c.Execute()
    # Setting the active window to have a projection with the X-axis and Y-axis as the frame and a scale of 0.1
    Window.ActiveWindow.SetProjection(Frame.Create(Point.Create(0,0,0),Direction.DirX,Direction.DirY),0.1)
    # Saving the active document to a jpg image located at "D:\Design2.jpg"
    DocumentSave.Execute(r"D:\Design2.jpg")