Hiding automatic properties "Definition" and "Result" from a result object

Nick Ramseyer
Nick Ramseyer Member Posts: 25
Name Dropper 10 Comments
**

I am currently writing an ACT result extension that uses a result object in the tree. By default a result object comes with the "Definition" and "Results" properties shown to the user.

Is there a way to hide these properties so the user cannot modify them? So far investigating the object these properties do not appear easily accessible.

For clarity I am looking to hide these properties as I do not want the user to be able to swap to "Minimum Over Time" or any of the other options for definition (I'd like to only have the object work in its default "Time" option).

Tagged:

Answers

  • Chris Harrold
    Chris Harrold Member, Administrator, Employee Posts: 183
    5 Answers 100 Comments Photogenic Name Dropper
    admin

    @AKD-Scripting-Team - can someone offer some guidance here?

  • Abel Ramos
    Abel Ramos Member, Employee Posts: 40
    First Answer 5 Likes 10 Comments Photogenic
    ✭✭✭✭

    Hello,

    You should be able to add the tag: readonly="true" in the XML of the property

    Best Regards,

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 442
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭

    @Nick Ramseyer I ran into the same issue some time back and couldn't find any way to hide the default ones. Would Python Result work as a substitute for ACT result object in your case? There you can define and control all the properties by your code.

  • Nick Ramseyer
    Nick Ramseyer Member Posts: 25
    Name Dropper 10 Comments
    **

    Hey Ayush! Unfortunately, Python Results are not an option as the primary business value we are adding is to create extensions that are Revision Controlled and Compiled using ACT. Most of our users are not python experts or APDL experts, so having them use Python Results is too intimidating and has too high of a barrier to entry for new users without extensive training. By using ACT we can create the extensions with the GUI elements necessary to deploy our custom scripts while keeping the barrier to entry low.

    Essentially the easier it is for us to manipulate ACT objects, the more business value we can drive through deployment and the less user errors through Revision Control.

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭

    It has been a while, but I think there is a hack to hide the default inputs. I believe you determine the internal name of the properties, redefine them in xml, and set visible='False'. Or maybe set visible='False' in a callback, such as onAdd.

  • John C
    John C Member Posts: 5
    First Comment Name Dropper
    **

    Hello, has anybody been able to make this work?

    The suggested approach by @Landon Mitchell Kanner definitely works for own created properties. I.e. use the "isvisible" callback in the xml and point to a function in the python script that returns "False" (or "True" if you want it visible). The 'visible="False"' option can also be used in the xml property definition if you want the initial state to be hidden.

    However, I've not managed to succeed with the default properties. My attempts have been with the "Identifier" property. I figured this should be simpler to play with compared to the "By" property (internal name "SetDriver"), which is then linked to the "DisplayTime", "SetNumber", etc properties. The Identifer property shouldn't be linked to any others.

    Code below was used to redefine the property in the xml file:

    <property name="Identifier" caption= "Identifier" control="text" visible="False">
        <callbacks>
            <isvisible>isIdentifierVisible</isvisible>
        </callbacks>
    </property>
    

    with the below in the py script:

    def isIdentifierVisible(obj, property):
        return False
    

    As noted above, this approach works fine for your own created properties.

    The Identifier property however remains visible, but does enter the callback (checked through use of MessageBox.Show inside the callback function).

    I also had a play with accessing the "property" object inside the callback to see if I could find the "visible" flag. This included trying to view/set many of the "property.<properties/methods>" with the word "visible" in them. Strangely, trying to view "property.Visible" crashes Mechanical.

    Note that accessing the Result object and then Identifier property by finding it in the tree, appears to only gives access to a ".Visible" property that is read-only.

    Apologies for the long post, but I'm hoping the detail might inspire someone else to a solution (if there is one...).

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭

    Best I recall, it only works for hiding the geometry scoping. I do not think it is possible to hide the "By", "DisplayTime", "SetNumber", etc properties. Can you use a Post Object instead of a Result?

  • John C
    John C Member Posts: 5
    First Comment Name Dropper
    **

    Ok, thanks @Landon Mitchell Kanner. Yes, it appears that it may not be possible to hide those properties. I'll seek an alternative route. Thanks for the prompt reply.

    FYI I'm using the result object as it is needed to display contour results. Is it possible to display contour results with a post object? I didn't think that could be done?

  • Landon Mitchell Kanner
    Landon Mitchell Kanner Member, Employee Posts: 287
    100 Comments 25 Answers 25 Likes Photogenic
    ✭✭✭✭

    _Is it possible to display contour results with a post object? _
    Maybe not. I can't remember. I suggest you create a new Thread to ask this question.