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
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
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
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 routept.X = 254319.1331pt.y = 6140943.0693pt1.X = 254316.0514pt1.X = 6140947.0251pt2.X = 254316.9659pt2.X = 6140953.1046CadInputQueue.SendKeyin "set mark" 'working fineCadInputQueue.SendKeyin "subsurface connectnodes" 'working fineCadInputQueue.SendCommand "CIVILMSTN SETSNAP 'working fineCadInputQueue.SendKeyin p0 'working fineVBA.SendKeys "^", True 'working fine Sleep 1 'working fineCadInputQueue.SendDataPoint pt 'NOT sending datapoint at pt, sending a datapoint at current cursor positionCadInputQueue.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 positionEnd function
So, if i can move the cursor to pt1/pt2/pt3 coordinates, then my script will work ...!! something a different thought.
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
those points are the pt, pt1 and pt2 hard coded in the script.
correction in previous description:
So, if i can move the cursor to pt/pt1/pt2 coordinates, then my script will work ...!! something a different thought.
Unknown said:Sleep 1 'working fine
What is the intention of Sleep 1?
Sleep 1
What is the purpose of VBA.SendKeys "^", True?
VBA.SendKeys "^", True
sleep 1 - will pause the command action for 1 ms.
"^" push the ctrl key. which is required to enable multi point option while placing conduit.
Unknown said:sleep 1 - will pause the command action for 1 ms
I'm not asking you to explain VBA. I'm asking why that statement is there and what is its purpose.
Unknown said:"^" push the ctrl key
That probably doesn't do what you want. It's sending the caret symbol to a Windows input queue, not to MicroStation's input queue, which is where you want it to go.
CadInputQueue.SendKeyin has an optional parameter Qualifier. It's unodocumented, and there's no example of its use. Perhaps that is what you need?
CadInputQueue.SendKeyin
Qualifier
Unknown said:"^" push the ctrl key. which is required to enable multi point option
Try using this statement to send the Ctrl key to MicroStation...
Const ControlKey As Boolean = True CadInputQueue.SendKeyin p0, ControlKey
See this post for an explanation.
Error P0 not defined. what will be P0 variable and its value ?
Unknown said:CadInputQueue.SendKeyin p0
Try this statement. The final True places a Ctrl key in MicroStation's input queue...
True
CadInputQueue.SendKeyin p0, True