Macro using attach tag

Macro using attach tag

Post by Frenc » Wed, 22 Apr 1998 04:00:00



When I run the following macro it works as expected. When I close this
dgn file and open a new dgn file without exiting MicroStation and run
the macro again it waits for the user to input a tag value for fuseno.
When I exit MicroStation completely and enter MicroStation again the
macro works as expected.
Please HELP!

Macro:
Sub main
    Dim startPoint As MbePoint
    Dim point As MbePoint, point2 As MbePoint

'   Start a command
    MbeSendCommand "PLACE CIRCLE ICON "

'   Coordinates are in master units
    startPoint.x = 2038.750000#
    startPoint.y = -3704766.310000#
    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 + 55.240000#
    point.y = startPoint.y - 46.710000#
    point.z = startPoint.z
    MbeSendDataPoint point, 1%

    MbeSendCommand "Attach Tags "

'   Send a keyin that can be a command string

    MbeSendKeyin "TAGJOURNAL ATTACH SET fuseno"

    point.x = startPoint.x + 63.740000#
    point.y = startPoint.y - 33.970000#
    point.z = startPoint.z
    MbeSendDataPoint point, 1%

    point.x = startPoint.x + 293.200000#
    point.y = startPoint.y
    point.z = startPoint.z
    MbeSendDataPoint point, 1%

    MbeSendKeyin "TAGJOURNAL ATTACH TAG fuseno"

'   When a command brings up a modal dialog,
'   a later statement must close the dialog,
'   or the MbeState.modalDialogByUser property
'   should be set to 1 so that the user must close
'   the dialog when the macro is executed.
'   Also, you may not use the de* "Step"
'   commands while a modal dialog is displayed.

'   Opened modal dialog "Attach Tags [fuseno]"

    MbeSendKeyin "TAGJOURNAL ATTACH VALUE 1234"

    MbeSendKeyin "TAGJOURNAL ATTACH VALUE 1234"

'   Closed modal dialog "Attach Tags [fuseno]"

'   Following comment is the command to close a modal dialog
   MbeSendCommand "MBE1 CLOSEMODAL OK"

    point.x = startPoint.x + 118.980000#
    point.y = startPoint.y
    point.z = startPoint.z
    MbeSendDataPoint point, 1%
End Sub

 
 
 

Macro using attach tag

Post by Jerry Walte » Fri, 24 Apr 1998 04:00:00


I looked at it real quick. Just a few comments.

1. I would send a null command at the end of the macro. This will clear
out the command queue
2.I would also send a null command at the begining. This way I know what
state I am starting from.

HTH
Jerry


> When I run the following macro it works as expected. When I close this
> dgn file and open a new dgn file without exiting MicroStation and run
> the macro again it waits for the user to input a tag value for fuseno.
> When I exit MicroStation completely and enter MicroStation again the
> macro works as expected.
> Please HELP!

> Macro:
> Sub main
>     Dim startPoint As MbePoint
>     Dim point As MbePoint, point2 As MbePoint

> '   Start a command
>     MbeSendCommand "PLACE CIRCLE ICON "

> '   Coordinates are in master units
>     startPoint.x = 2038.750000#
>     startPoint.y = -3704766.310000#
>     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 + 55.240000#
>     point.y = startPoint.y - 46.710000#
>     point.z = startPoint.z
>     MbeSendDataPoint point, 1%

>     MbeSendCommand "Attach Tags "

> '   Send a keyin that can be a command string

>     MbeSendKeyin "TAGJOURNAL ATTACH SET fuseno"

>     point.x = startPoint.x + 63.740000#
>     point.y = startPoint.y - 33.970000#
>     point.z = startPoint.z
>     MbeSendDataPoint point, 1%

>     point.x = startPoint.x + 293.200000#
>     point.y = startPoint.y
>     point.z = startPoint.z
>     MbeSendDataPoint point, 1%

>     MbeSendKeyin "TAGJOURNAL ATTACH TAG fuseno"

> '   When a command brings up a modal dialog,
> '   a later statement must close the dialog,
> '   or the MbeState.modalDialogByUser property
> '   should be set to 1 so that the user must close
> '   the dialog when the macro is executed.
> '   Also, you may not use the de* "Step"
> '   commands while a modal dialog is displayed.

> '   Opened modal dialog "Attach Tags [fuseno]"

>     MbeSendKeyin "TAGJOURNAL ATTACH VALUE 1234"

>     MbeSendKeyin "TAGJOURNAL ATTACH VALUE 1234"

> '   Closed modal dialog "Attach Tags [fuseno]"

> '   Following comment is the command to close a modal dialog
>    MbeSendCommand "MBE1 CLOSEMODAL OK"

>     point.x = startPoint.x + 118.980000#
>     point.y = startPoint.y
>     point.z = startPoint.z
>     MbeSendDataPoint point, 1%
> End Sub


 
 
 

Macro using attach tag

Post by Cameron Eckma » Sat, 25 Apr 1998 04:00:00


This problem seems to be a bug with the MBE1 MDL application.  By using the
command "DMSG DIALOGDEBUG ON" I was able to watch what was happening.  When you
first open MicroStation and before you run a macro MBE1 is not loaded.  After
running a macro MBE1 may still be in memory, especially if you did work with
dialogs.  Ater closing and reopening the DGN I found MBE1 was still loaded but
no longer properly worked with the macro.

I was able to solve the problem by running "MDL UNLOAD MBE1" before running the
macro.  You could prefix it by doing  "MDL UNLOAD MBE1;MACRO TagTest".

Bentley?  This seems to be a bug that needs fixing.  Thanks.

I still would follow my other guidelines on the "MBE1 CLOSEMODAL OK" and order
of commands.

Disclaimer as before applies to the content of this message.


Thank you for replying to my question. I have tried your macro and it behaves
exactly the same as mine.

Here is what happens:-
When I go into Mstation for the first time and run the Macro,  it attaches the
tag and places the tag value(1234) automatically. I can now delete the tag value
and run the macro again and it will places the tag value(1234) automatically
again. I now close (not exit) the design file. I open the dgn file again and
delete the tag value and run the macro again. The user must now enter the tag
value.  I now exit Mstation and enter Mstation again with the dgn file. I delete
the tag value and run the macro again. It attach the tag and places the tag
value(1234) automatically again (as it should).

 
 
 

Macro using attach tag

Post by Matt Watkins [Bentley » Tue, 28 Apr 1998 04:00:00


This has been identified as a bug and a fix will be made available on
the Select Stream site in the near future.

--
 ============== One of "The People Behind MicroStation" ==============
 Matt Watkins                                    Phone: (610) 458-5000
 Bentley Systems                                   Fax: (610) 458-1060
 690 Pennsylvania Drive                        

 =====================================================================


> This problem seems to be a bug with the MBE1 MDL application.  By using the
> command "DMSG DIALOGDEBUG ON" I was able to watch what was happening.  When you
> first open MicroStation and before you run a macro MBE1 is not loaded.  After
> running a macro MBE1 may still be in memory, especially if you did work with
> dialogs.  Ater closing and reopening the DGN I found MBE1 was still loaded but
> no longer properly worked with the macro.

> I was able to solve the problem by running "MDL UNLOAD MBE1" before running the
> macro.  You could prefix it by doing  "MDL UNLOAD MBE1;MACRO TagTest".

> Bentley?  This seems to be a bug that needs fixing.  Thanks.

> I still would follow my other guidelines on the "MBE1 CLOSEMODAL OK" and order
> of commands.

> Disclaimer as before applies to the content of this message.



> Thank you for replying to my question. I have tried your macro and it behaves
> exactly the same as mine.

> Here is what happens:-
> When I go into Mstation for the first time and run the Macro,  it attaches the
> tag and places the tag value(1234) automatically. I can now delete the tag value
> and run the macro again and it will places the tag value(1234) automatically
> again. I now close (not exit) the design file. I open the dgn file again and
> delete the tag value and run the macro again. The user must now enter the tag
> value.  I now exit Mstation and enter Mstation again with the dgn file. I delete
> the tag value and run the macro again. It attach the tag and places the tag
> value(1234) automatically again (as it should).

 
 
 

1. Macro to attach a tag to an element

Want to add a new tag to a existing Element:
The following definitions exist:
        1. tagset = "Pkt"
        2. tagname = "PktNr"
I want to add a new Tag.value = "a001" to my identified element. This
macro doesn't works. I always recieve the error-message "stat=-126".
        -what does the error -126 means?
        -who can edit my macro, so that it work accordingly

Sub Main
 Dim Elem2Tag as New MbeElement
 Dim PNTag as new MbeTag
 dim PN as  string
 Dim TagPoint as MbePoint
 Dim endOfFilePos as Long

    Tbl = "pkt"
    PN  = "a001"

 MbeGetinput MBE_DataPointInput                
 status = MbeState.getInputDataPoint(TagPoint)

    endOfFilePos = MbeDgnInfo.endOfFile

    MbeSendKeyin "ac=11"
    MbeSendDataPoint TagPoint, 1%
    MbeSendReset

    PNTag.setName = "pkt"
    PNTag.name    = "pktnr"
    PNTag.value   = "PN"

    stat = Elem2Tag.fromFile(endOfFilePos)
    stat = Elem2Tag.attachTag(PNTag)

end sub

2. Trouble with modem in SBS

3. Attaching A Web Tag Using Imagevue

4. 2002 Deluxe - Wrong Balance

5. tags / how can you attach a tag to a cell so

6. 95 login Novell server by program, how?

7. Re-attaching Ref Files Using Macro

8. Nokia 6210 & Jordano 680

9. Updating existing tag values using a macro

10. Updating existing tag values using a macro - Again!?

11. Getting Tag name and Setname from Tag using Basic

12. attach tag

13. Attaching text as tags to elements