Showing results for 
Search instead for 
Did you mean: 

Get point coords on me please

Valued Contributor
Valued Contributor

Hello programmers, I'm new entry in this forum (and sorry for my poor english)


I use .NET now and ST3.


My problem is get coordinates point on a draft, on muose click SE event....


I see this post:


But I didn't resolved....


This is my poor creation, i try to put coords on Label4:


Imports System.Runtime.InteropServices

Imports SolidEdgeConstants

Imports System

Imports System.IO


Public Class Principale


    Dim WithEvents oComm As SolidEdgeFramework.Command

    Dim WithEvents oMouse As SolidEdgeFramework.Mouse


    Private Sub Principale_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        Dim objApp As SolidEdgeFramework.Application = Nothing

        Dim objType As Type

        Dim oSE As SolidEdgeFramework.Application

        Dim oDFT As SolidEdgeDraft.DraftDocument




            objApp = Marshal.GetActiveObject("SolidEdge.Application")


        Catch ex As Exception

            'New Visual Basic.NET Syntax ' Get the type from the Solid Edge ProgID

            objType = Type.GetTypeFromProgID("SolidEdge.Application")

            ' Start Solid Edge

            objApp = Activator.CreateInstance(objType)

            ' Make Solid Edge visible

            objApp.Visible = True




            If Not (objApp Is Nothing) Then


                objApp = Nothing

            End If

        End Try


        oSE = Marshal.GetActiveObject("SolidEdge.Application")

        oDFT = oSE.ActiveDocument

        oComm = oSE.CreateCommand(2)

        oMouse = oComm.Mouse



End Sub



Private Sub oMouse_MouseUp(ByVal sButton As Integer, ByVal sShift As Integer, ByVal dX As Double, ByVal dY As Double, ByVal dZ As Double, ByVal pWindowDispatch As Object, ByVal lKeyPointType As Long, ByVal pGraphicDispatch As Object)

        If sButton = 1 Then

            'left mouse button. get coordinates.

            Label4.Text = ("X=" & Format(dX * 1000, "0.00") & vbTab & "Y=" & Format(dY * 1000, "0.00"))


            'finish. Right mouse button


        End If


    End Sub


End Class



Please help me with an example


Regards, Fabiano




Posted by: metalworld metalworld
Post date: 12/20/2010 7:54:14 PM


RE: Get point coords on me please

Valued Contributor
Valued Contributor

I solved!!!



Posted by: metalworld metalworld
Post date: 12/21/2010 12:51:26 AM

RE: Get point coords on me please

Valued Contributor
Valued Contributor

Posted By metalworld on 21 Dec 2010 06:51 AM

I solved!!!



How did u solve this?

Could you please send the sample code for this?


I am  trying this example to get mouse coordinates. But I am not able to get the coordinates.

Is this the correct way to get the coordinate.


My code


        private void button1_Click_1(object sender, EventArgs e)


            SolidEdgeDraft.DraftDocument document = null;



                document = (SolidEdgeDraft.DraftDocument)m_application.ActiveDocument;

                SolidEdgeFramework.Layer layer = (SolidEdgeFramework.Layer) document.ActiveSheet.Layers.ActiveLayer;

                SolidEdgeDraft.Sheet activeSheet = (SolidEdgeDraft.Sheet)document.ActiveSheet;


                SolidEdgeFramework.Command oComm = m_application.CreateCommand(2);

                SolidEdgeFramework.Mouse oMouse = oComm.Mouse;



            catch (System.Exception ex)


                MessageBox.Show(ex.Message, "Invalid unit");




                if (document != null)



                    document = null;





        private void oMouse_MouseUp(int sButton, int sShift, double dX, double dY, double dZ, object pWindowDispatch, long lKeyPointType, object pGraphicDispatch)



            if(sButton == 1)


                //left mouse button. get coordinates.

                MessageBox.Show("X=" + dX * 1000 + " Y=" + dY * 1000);










Posted by: Amit Wadekar
Post date: 7/28/2011 2:39:46 AM