How to create output parameters from SCDM (Spaceclaim)

Gabriel Messager
Gabriel Messager Member, Employee Posts: 45
First Anniversary Ansys Employee First Comment Photogenic
edited June 2023 in 3D Design

Only input parameters can be created in Spaceclaim.

Is there a way to create output parameters using scripting?

Tagged:

Answers

  • Gabriel Messager
    Gabriel Messager Member, Employee Posts: 45
    First Anniversary Ansys Employee First Comment Photogenic
    Answer ✓

    A workaround is to create input parameters, which act as output parameters.

    In this example, the "real" input parameter is "scale".

    The 3 others input parameters (length1, length2 and angle) are used as output parameters.

    # Python Script, API Version = V21
    from SpaceClaim.Api.V21 import Command
    
    scale = Parameters.scale
    
    ClearAll()
            
    # Create Box
    result = BlockBody.Create(Point.Create(MM(-20*scale), MM(-5), MM(0)), Point.Create(MM(20*scale), MM(10), MM(20*scale)), ExtrudeType.ForceAdd, Info1)
    # EndBlock
    
    #output parameters
    length1 = GetRootPart().Bodies[0].Edges[7].Shape.Length
    length2 = GetRootPart().Bodies[0].Edges[8].Shape.Length
    selection = Selection.Create([GetRootPart().Bodies[0].Faces[3],
        GetRootPart().Bodies[0].Faces[2]])
    angle = MeasureHelper.GetAngleBetweenObjectsInfo(selection).Angle
    
    dict_output = {"length1": length1, "length2": length2, "angle": angle}
    
    allgroups = GetActiveWindow().Groups
    for mygroup in allgroups:
        name = mygroup.GetName()
        if name in dict_output:
            mygroup.SetDimensionValue(dict_output[name])
    
    Command.Execute("Ansys.22.1.UpdateParameters")