How to move the mouse pointer to a particular x,y coordinates using VBA

Looking for a piece of VBA code to move the mouse cursor to xy drawing coordinate (say 100,100) within Micro station. 

Microstation version: Power inroads V8i SS4

many thanks,

Vinoth Joseph

Parents
  • Hi Vinoth,

    I guess it's not possible in VBA. In fact it's not straightforward task, because as far as I know, cursor information are passed to MicroStation in screen coordinates and they are transformed to model coordinates using used view parameters (rotation, AccuDraw state, snap mode etc.). So to move cursor to a specific model coordinates requires to invert this process and at the last step to call Windows function to move the cursor.

    Can you provide more information what do you need to achieve?

    Regards,

      Jan

  • Many Thanks Jan.

    i'm working with Power Inroad and placing nodes and conduits.

    there is a predefined route to place conduit.

    in the first step script push the command to place conduit, I manually selected start and end nodes, and script will place conduit as a straight line. That part is OK.

    Now, I want to place the conduit through multiple points, I pushed ctrl key through script ( for accept multiple points between nodes)  i.e. after given the start point. its working fine; ctrl key invoked.

    There is a list of points from predefined routes. I just want to senddatapoint to those points, but, screen is not accepting the senddatapoint  command once ctrl key applied.

    at the same time, screen is accepting a datapoint at wherever the cursor is..!! something wrong.

    I hope, the above description will help to understand what i'm looking for.

    below the complete script for your ref.

    Function connectN (p0 as point3d, p00 as point3d) 'start and end Node points.

    Dim pt As Point3d, pt1 As Point3d, pt2 As Point3d 'reserved points from existing route
    pt.X = 254319.1331
    pt.y = 6140943.0693
    pt1.X = 254316.0514
    pt1.X = 6140947.0251
    pt2.X = 254316.9659
    pt2.X = 6140953.1046
    CadInputQueue.SendKeyin "set mark" 'working fine
    CadInputQueue.SendKeyin "subsurface connectnodes" 'working fine
    CadInputQueue.SendCommand "CIVILMSTN SETSNAP  'working fine
    CadInputQueue.SendKeyin p0 'working fine
    VBA.SendKeys "^", True  'working fine
    Sleep 1 'working fine

    CadInputQueue.SendDataPoint pt 'NOT sending datapoint at pt, sending a datapoint at current cursor position
    CadInputQueue.SendDataPoint pt1 'NOT sending datapoint at pt, sending a datapoint at current cursor position

    CadInputQueue.SendDataPoint pt2 'NOT sending datapoint at pt, sending a datapoint at current cursor position

    End function

    So, if i can move the cursor to pt1/pt2/pt3 coordinates, then my script will work ...!! something a different thought.

    many thanks,

    vinoth Joseph

     

    Vinoth Joseph

    ATKINS

    Bangalore, India

  • Unknown said:
    There is a list of points from predefined routes

    Where does that list come from?  What format is that list?

     
    Regards, Jon Summers
    LA Solutions

Reply Children