Automated "copy view" macro help

Status
Not open for further replies.

Kenneth Dixon

Usenet Archive
Joined
Jan 8, 2002
Messages
3
Reaction score
0
I need some help with a macro im working on, so that window1 will follow window2 realtime.
sofar:

' Autocopyview

Sub main
do
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint

' Start a command
MbeSendCommand "COPY VIEW "

' Coordinates are in master units
startPoint.x = 1.595500#
startPoint.y = 11.546000#
startPoint.z = 0.000000#

' Send a data point to the current command
point.x = startPoint.x
point.y = startPoint.y
point.z = startPoint.z
MbeSendDataPoint point, 1%

point.x = startPoint.x - 4.795700#
point.y = startPoint.y - 0.805800#
point.z = startPoint.z
MbeSendDataPoint point, 2%

sleep(5000)
loop

End Sub

This works without the loop, but with the loop gets stuck in infinite. Is there anyway to refresh macro say every 5 sec, while releasing resorces back to ustation for the rest?(sleep dosnt work)
Thanks for any help.
 
Hi Kenneth,
One of the shortcomings of macros: they essentially "stop" MicroStation, run, then "release" MicroStation. During this interval, nothing can be done (or everything, as you discovered with the infinite loop). MDL will do this (not sure how), and Visual Basic can also send a command to MicroStation at a set interval (since it supports a timer control/function), albeit a bit less elegantly.

If you do try the VB method (OLE), remember that requests from the client (the VB app) to the server (MicroStation) can be considered disruptive, so where the mere copying of views maybe ok, copying dynamic rotation (say of a rendered view) might be disruptive (it'll interrupt the rotation commmand in MicroStation).

HTH,
Simon

Kenneth Dixon wrote:
I need some help with a macro im working on, so that window1 will follow window2 realtime.
sofar:

' Autocopyview

Sub main
do
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint

' Start a command
...
 
I don't think you can do this in a macro. I think you need an MDL application running in background.

Why not have your macro without the loop, and have it attached to a function key, then update the view when the key is pressed.

I can't see the benefit of what you are doing - can you explain in what circumstances you would use this, and maybe we can come up with an alternative solution.
 
Found the command i was looking for "MbeMacro.suspend 5000" has replaced "sleep(5000) which gives back control to ustation for 5sec, thank you Simon for pointing me in the right direction. this unfortunately has produced another problem, it interrupts whatever i am doing when it refreshes, and changes the original place place data point command(say place smartline) to "copy view". is there any way to retain the command i have picked when it refreshes, preferably even when I'm in mid flight of say placing a line? Dave, this macro is to be used in conjunction with a microstation add on called issd where window1 is a stereoscopic view, with "Roam" navigation, window2 is 2d (standard top down view) what i want is for the 2d view(window2) to roam synchronized with 3d view(window1) window2 is used to check that elements are not overlapping, or where they shouldn't be.
Thank you, Ken
 
If you issue the 'copy view' command manually whilst in the smartline command, you can Reset twice to continue with your command. If you do the same programmatically before your 'loop' line it should work :-

...
MbeSendReset
MbeSendReset
loop
 
perfect, thanks Dave
Here is the whole thing for anyone who wants it:

' Auto copy view

Sub main
do
Dim startPoint As MbePoint
Dim point As MbePoint, point2 As MbePoint

' Start a command
MbeSendCommand "COPY VIEW "

' Coordinates are in master units
startPoint.x = 1.595500#
startPoint.y = 11.546000#
startPoint.z = 0.000000#

' Send a data point to the current command
point.x = startPoint.x
point.y = startPoint.y
point.z = startPoint.z
MbeSendDataPoint point, 1%

point.x = startPoint.x - 4.795700#
point.y = startPoint.y - 0.805800#
point.z = startPoint.z
MbeSendDataPoint point, 2%

MbeSendReset
MbeSendReset

MbeMacro.suspend 5000
loop
end Sub

"Dave Preston" wrote:

If you issue the 'copy view' command manually whilst in the smartline command, you can Reset twice to continue with your command. If you do the same programmatically before your 'loop' line it should work :-

...
MbeSendReset
MbeSendReset
loop
 
try this:
Sub main
do
MbeSendCommand "COPY VIEW;SelView 1;SelView 2;reset;reset" MbeMacro.suspend 5000 loop end Sub

"Kenneth Dixon" wrote:
Found the command i was looking for "MbeMacro.suspend 5000" has replaced "sleep(5000) which gives back control to ustation for 5sec, thank you Simon for pointing me in the right direction. this unfortunately has produced another problem, it interrupts whatever i am doing when it refreshes, and changes the original place place data point command(say place smartline) to "copy view". is there any way to retain the command i have picked when it refreshes, preferably even when I'm in mid flight of say placing a line? Dave, this macro is to be used in conjunction with a microstation add on called ...
 
Status
Not open for further replies.

Latest threads

Back
Top