Adding a cell to drawings via VBA

Hi,

Im new to coding in Microstation, have a bit of VBA AutoCAD experience. Im trying to insert a cell into a DGN via VBA (have many todo).

I have attached a cell library via "AttachCellLibrary". When trying to set the active cell I get "Unknown error"

CadInputQueue.SendCommand "PLACE CELL ICON"     'insert active cell

This has been cobbled together from a recorded macro and a bit of playing around. 

Sub AddRevBlock()
Dim startPoint As Point3d
Dim point As Point3d, point2 As Point3d
Dim CellLib As String
Dim DGNSize As String

CadInputQueue.SendCommand "AS=1" 'set active scale to 1
CadInputQueue.SendCommand "AA=0" 'set active rotation to 0

DGNSize = GetTitleSize 'get dgn size

' Start a command
CadInputQueue.SendCommand "DIALOG CELLMAINTENANCE TOGGLE" ' not sure what this is for, MS macro recording added it

'attach the standard cell lib
CellLib = "D:\Microstation\RevBlock.CEL"
AttachCellLibrary CellLib
'Call AttachedCellLib

ActiveSettings.CellName =  "REV Block"

CadInputQueue.SendCommand "PLACE CELL ICON" 'insert active cell

' Send a data point to the current command
point.X = startPoint.X
point.Y = startPoint.Y
point.Z = startPoint.Z
CadInputQueue.SendDataPoint point, 1

' Send a reset to the current command

CadInputQueue.SendReset
CommandState.StartDefaultCommand
End Sub

Parents Reply Children
No Data