Access Visible Properties of a Mechanical Object and Modify their Internal Values

Options
George Tzortzopoulos
George Tzortzopoulos Member, Employee Posts: 12
First Anniversary First Comment Name Dropper Photogenic

How to access the visible properties of a Mechanical object and modify their internal values?

Comments

  • George Tzortzopoulos
    George Tzortzopoulos Member, Employee Posts: 12
    First Anniversary First Comment Name Dropper Photogenic
    Options

    Let a Surface Force Density object under a Harmonic Response analysis in Mechanical. Here is its Details window:

    In order to access this object via Mechanical scripting, the following command could be issued:

    sfd = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.ImportedSurfaceForceDensity)[0]

    Its properties, shown in the screenshot above, can be accessed using this command:

    sfd.VisibleProperties

    In order to modify the Source Frequency property from Worksheet to All, this command could be used:

    sfd.PropertyByName("PROPID_AnsoftTimeDefinition").InternalValue = 0 # 0: All, 1: Range, 2: Worksheet