Hi
As a part of a bigger VBA-project I'm having trouble with this part. I want a copy a sheet model a couple of times. But the elements included in my sourcemodel are only included in the first copy. All following sheet models are completely empty.
Sourcemodel looks like this:
Second and third copy looks like this:
Here's my code:
Sub testCopyModels() Dim sheetTemplate As ModelReference Dim CreateNewModel As ModelReference Dim inputModelToCopy As String inputModelToCopy = "K-20-1-0101" Set sheetTemplate = ActiveDesignFile.Models(inputModelToCopy) Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0103") Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0104") Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0105") End Sub
I noticed that if I add some command in between everything works as expected:
Sub testCopyModels() Dim sheetTemplate As ModelReference Dim CreateNewModel As ModelReference Dim inputModelToCopy As String inputModelToCopy = "K-20-1-0101" Set sheetTemplate = ActiveDesignFile.Models(inputModelToCopy) Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0103") CadInputQueue.SendKeyin ("place smartline; xy=0,0;xy=100,100") Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0104") CadInputQueue.SendKeyin ("place smartline; xy=0,0;xy=100,100") Set CreateNewModel = ActiveDesignFile.Models.copy(sheetTemplate, "K-20-1-0105") CadInputQueue.SendKeyin ("place smartline; xy=0,0;xy=100,100") End Sub
Is this expected behavior? Can anyone explain what I might be doing wrong here?
Running Openbuildings CE U7 (MicroStation U14)
The sheet in which I've run the code is attached.