Pen Table Macro Hook help?!?

We are trying to write our first Macro for use with our Pentable. What we want to do is have the pen table "Drop element" based on criteria established, the print the element then undo the "drop element" to return it to it original status. So we started with having our steps recorded, but are unable to figure out the "Pen Table Print Element Hook". The following is our macro called "Drop_element". Any help would be greatly appreciated as we trying to learn how to do this and this seemed to be easy, but apparently it is not.

' Drop elements and undo drop

Sub main

Dim startPoint As MbePoint

Dim point As MbePoint, point2 As MbePoint

' Start a command

MbeSendCommand "DROP ELEMENT "

' Set a variable associated with a dialog box

MbeSetAppVariable "DROP", "dropOptions.complex", -1&

MbeSetAppVariable "DROP", "dropOptions.strings", -1&

MbeSetAppVariable "DROP", "dropOptions.sharedCells", -1&

MbeSetAppVariable "DROP", "dropOptions.mlines", -1&

MbeSendCommand "CHOOSE ALL "

MbeSendCommand "DROP ELEMENT "

' Coordinates are in master units

startPoint.x = 120.583542#

startPoint.y = 130.883882#

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%

MbeSendCommand "CHOOSE ALL "

MbeSendCommand "DROP ELEMENT "

point.x = startPoint.x + 0.234617#

point.y = startPoint.y - 1.156249#

point.z = startPoint.z

MbeSendDataPoint point, 1%

MbeSendCommand "UNDO "

MbeSendCommand "UNDO "

End Sub

Parents
  • I could not figure out how to hook a VBA directly in my thread, Emulate Plot Hook Functions & AutoRun. Although it is possible with a BASIC macro.

    Add a section to a PenTable to call the BASIC Macro:

    BEGIN Splash_Draw_Order
        BASICFUNC     = SPLASH_PenTableHook.bas,PenTableHook
    END

    Create a BASIC macro to call your primary macro (my "SPLASH_PenTableHook.bas" macro):

    Function PenTableHook (inElem as MbeElement) As Long

        Dim PenTableHookPoint      As String

        PenTableHook = MBE_ElemNormal

    End Function

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

    '   Send a keyin that can be a command string
        MbeSendKeyin "macro Splash_Draw_Order"
    End Sub

    Note that the "SPLASH_PenTableHook.bas" calls the "Splash_Draw_Order.ba" macro, this could also call a VBA macro.
     

Reply
  • I could not figure out how to hook a VBA directly in my thread, Emulate Plot Hook Functions & AutoRun. Although it is possible with a BASIC macro.

    Add a section to a PenTable to call the BASIC Macro:

    BEGIN Splash_Draw_Order
        BASICFUNC     = SPLASH_PenTableHook.bas,PenTableHook
    END

    Create a BASIC macro to call your primary macro (my "SPLASH_PenTableHook.bas" macro):

    Function PenTableHook (inElem as MbeElement) As Long

        Dim PenTableHookPoint      As String

        PenTableHook = MBE_ElemNormal

    End Function

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

    '   Send a keyin that can be a command string
        MbeSendKeyin "macro Splash_Draw_Order"
    End Sub

    Note that the "SPLASH_PenTableHook.bas" calls the "Splash_Draw_Order.ba" macro, this could also call a VBA macro.
     

Children
No Data