RobotStudio event

get UCS coordinates

Options
Hi,
   I am developing an application (as an Add-In) with the following aim:
I have a CAD model imported in the workstation.
And then I click on a random point in that CAD model.
Based on the orientation of the CAD model, I want to draw a vector (Arrow) pointing perpendicular to the surface (lets not worry about which of the two directions that arrow is pointing).
How do I program this in C#. I mean, in robotstudio, I can see that whenever we click on the graphic view, there is a UCS coordinate information.
And there is a draw arrow sort of class in PC-SDK.
any feedback wil be appreciated.
Thanks.

Comments

  • Hi
    Sorry for late reply.
    Please find below some code that you might find useful. It's not a ready solution but perhaps a step in the right direction...An arrow will be drawn from the pick point on the box to WObj0 see image.

     

    public static void AddinMain()
    {
                GraphicPicker.GraphicPick += new GraphicPickEventHandler(GraphicPicker_GraphicPick);
    }

     

    static void GraphicPicker_GraphicPick(object sender, GraphicPickEventArgs e)
    {
                Part p = e.PickedObject as Part;
                if (p == null) return;
                DrawMarker(p, e.PickedPosition);
    }

    static void DrawMarker(Part p, Vector3 pos)
    {
                Station s = Project.ActiveProject as Station;
                TemporaryGraphic g = s.TemporaryGraphics.DrawArrow(new Vector3(0, 0, 0), pos, 1 / 100, 1 / 1000, Color.Blue);
    }

     

    image
    Lennart H