home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 January
/
Chip_1997-01_cd.bin
/
ms95
/
disk22
/
dir04
/
f000710.re_
/
f000710.re
Wrap
Text File
|
1996-04-02
|
5KB
|
131 lines
' BASIC macro which allows the user to place patterned blocks.
'--------------------------------------------------------------------
'
' Copyright (1995) Bentley Systems, Inc., All rights reserved.
'
' $Workfile: demo.bas $
' $Revision: 6.3 $
' $Date: 08 Dec 1995 14:47:38 $
'
' "MicroStation" is a registered trademark of Bentley Systems, Inc.
'
' Limited permission is hereby granted to reproduce and modify this
' copyrighted material provided that the resulting code is used only
' in conjunction with Bentley Systems products under the terms of the
' license agreement provided therein, and that this notice is retained
' in its entirety in any such reproduction or modification.
'
'--------------------------------------------------------------------
' Notes:
' This example requires the cell library SAMPLE2.CEL from the
' \ustation\wsmod\default\cell\ subdirectory. If the macro does
' not find this file, then an error is reported.
'
'---------------------------------------------------------------
'
' Main Entry point
'
'---------------------------------------------------------------
Sub main
Dim startPoint As MbePoint
Dim endPoint as MbePoint
Dim status%
Dim view%
Dim endOfFilePos as Long
Dim button As Integer
Dim fullCellFileName As String
Dim cmdString As String
' check if the cell library exists
If MbeFindFile (fullCellFileName, "SAMPLE2", "MS_CELL", ".cel") <> MBE_Success Then
button = mbeMessageBox ("Unable to find required cell library SAMPLE2.CEL in MS_CELL configuration variable",_
MBE_OKBox or MBE_CriticalIcon)
Exit Sub
End If
cmdString = "attach library " + fullCellFileName
' Attach the correct cell library
MbeSendKeyin cmdString
' continue placing patterned blocks until a RESET is entered
Do
' Locate the end of file. This file position is
' assumed to be the position of the block that
' will be added to the file.
endOfFilePos = MbeDgnInfo.endOfFile
' Start the PLACE BLOCK command
MbeSendCommand "PLACE BLOCK ICON "
' Wait for a data point or a reset
MbeGetInput MBE_DataPointInput, MBE_ResetInput
' if a reset was entered, exit the loop
if MbeState.inputType = MBE_ResetInput then Exit Do
' Extract the data point coordinates and view
status = MbeState.getInputDataPoint (startPoint,view)
' Send a data point to the current command
MbeSendDataPoint startPoint, view
' Wait for a data point or a reset
MbeGetInput MBE_DataPointInput, MBE_ResetInput
' if a reset was entered, exit the loop
if MbeState.inputType = MBE_ResetInput then Exit Do
' Extract the data point coordinates and view
status = MbeState.getInputDataPoint (endPoint,view)
' Send Data point and View to active command
MbeSendDataPoint endPoint, view
' Send command pattern area
MbeSendCommand "PATTERN AREA ICON "
' 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.
'
' In this case, the PATTERN AREA ICON command
' may open an alert box stating that a
' large number of patterns will be placed and
' the user is given the chance to cancel the
' operation. This macro needs to have the user
' handle that alert box, since this
' macro does not handle this event. This is done
' by setting the modalDialogByUser property of
' the State object to TRUE (1)
MbeState.modalDialogByUser = 1
' Set the active patternCell to cell from Library
MbeSettings.patternCell = "DECID"
' Locate the element at the file position stored in
' the endOfFilePos variable. This file position was
' stored BEFORE the place block command was executed and
' is the file position of the block.
' This locate causes a datapoint to be sent to the
' active command which is "pattern area" to select
' the element.
MbeLocateElement(endOfFilePos)
' Send a datapoint to confirm the selected element
MbeSendDataPoint startPoint, view
' Set the MbeState.modalDialogByUser value to zero so that
' the user does not have to respond to a modal dialog box
' that may open.
' Note: Be sure to set this value to a known state since
' its setting will affect other macros as long as the BASIC
' environment is running.
MbeState.modalDialogByUser = 0
Loop
End Sub