how to get screen position of user click ?

Bhavik Sheth_21143
Bhavik Sheth_21143 Altair Community Member
edited December 2023 in Community Q&A

Hello Team,

I am adding a few details of components when the user selects an element from that component.

So, I am using *titlecreate  to create notes.

How to get the screen position value (x and y) when user clicks any location on the screen.

Or is there any other way to create note in model?

*titlecreate name entities id pointindex color font anchorpoint x y

Answers

  • AndreasAltmann
    AndreasAltmann Altair Community Member
    edited December 2023

    Hello @Bhavik Sheth ,

    have you tried to work with a "Tag"?

    *tagcreate nodes $nodeId $label $body $colorId

    or

    *createentity tag type=nodes entity=$nodeId label=$label body=$body color=$colorId

    You can attach the Tag directly to a node/element etc.

     

    BR

    Andreas

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited December 2023

    Hello @Bhavik Sheth ,

    have you tried to work with a "Tag"?

    *tagcreate nodes $nodeId $label $body $colorId

    or

    *createentity tag type=nodes entity=$nodeId label=$label body=$body color=$colorId

    You can attach the Tag directly to a node/element etc.

     

    BR

    Andreas

    Hello @Andreas Altmann,

    I didn't check the option that you mentioned.

    I will check.

    Thank you for the suggestion.

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited December 2023

    Hello @Bhavik Sheth ,

    have you tried to work with a "Tag"?

    *tagcreate nodes $nodeId $label $body $colorId

    or

    *createentity tag type=nodes entity=$nodeId label=$label body=$body color=$colorId

    You can attach the Tag directly to a node/element etc.

     

    BR

    Andreas

    Hello,

    I tried to create a tag but it was creating a tag exact at the selected node.

    I want to have it with a pointed arrow at some distance from the selected node as shown in below image. 

    Text in white box is created with title and text in blue is created with tag.

    image

    Can we specify location on the screen while creating a tag?

  • AndreasAltmann
    AndreasAltmann Altair Community Member
    edited December 2023

    Hello @Bhavik Sheth ,

    I would do it this way:

    The user selects one node (Node1), where the Tag should be connected.
    Copy this Node1 (=> Node2) and move the Node2 automatically xx mm in x,y,z direction
    Create a tag at Node2
    Then the user can move the tag with the move tool at the positon
    Connect Node1 and Node2 with a line

    The problem is, that the line gets not updated, when Node2 is moved again. To catch this you can add Metadata to the line (or tag) and store the information what should be connected. But then you need a script that updates the lines...

    It's not a very comfortable way but the only way I know :)

     

    EDIT: you can also connect Node1 and Node2 with a bar/rod element, then the position gets updated automatically, when you change the position of Node2

  • Bhavik Sheth_21143
    Bhavik Sheth_21143 Altair Community Member
    edited December 2023

    Hello @Bhavik Sheth ,

    I would do it this way:

    The user selects one node (Node1), where the Tag should be connected.
    Copy this Node1 (=> Node2) and move the Node2 automatically xx mm in x,y,z direction
    Create a tag at Node2
    Then the user can move the tag with the move tool at the positon
    Connect Node1 and Node2 with a line

    The problem is, that the line gets not updated, when Node2 is moved again. To catch this you can add Metadata to the line (or tag) and store the information what should be connected. But then you need a script that updates the lines...

    It's not a very comfortable way but the only way I know :)

     

    EDIT: you can also connect Node1 and Node2 with a bar/rod element, then the position gets updated automatically, when you change the position of Node2

    Thank you @Andreas Altmann ,

    I will check the method that you suggested.