mark's banner

Monday, February 21, 2005

Locked Models

Last week I had some trouble with locking models. As it turns out so were several others - see discussion.bentley.com. We are currently working with MicroStation 08.05.01.25 and in one of my programs I'm using a second model to store some information. And, I don't want any of my users to be able to delete, or modify data in this model.

Turns out though, that in this version at least it is possible to delete the model. Try this,

1) Create a design model.
2) Make the new model active and use the model lock command or do this programmatically with VBA. Something like,

ActiveModelReference.isLocked = True

The message center prompt says "Model deletable model locked" - suggesting that you can delete the model. If I click delete from the Models dialog I get an error message that says the model is read only - and this is what I want.

3) Make the default model active.

4) Highlight the new model and select delete from the Models dialog. Yes/No warning dialog displays, click yes and the model is deleted.

Thanks to Ken Suh, Bentley development support, who verified the problem, logged a TR and sent me this work around.

Using mdlCapability and passing one of these options along with true or false will allow you to prevent Models or Sheets from being deleted, but it pertains to all models.

Declare Function mdlCapability_set Lib "stdmdlbltin.dll" _
(ByVal lCapability As Long, ByVal bOnOff As Long) As Long

Sub mySub()
Dim status As Integer
' 186 for Design, 187 for Sheet. Set to False to disable deleting.
status = mdlCapability_set(186, False)
End Sub


Works great. My model stays locked.

0 Comments:

Post a Comment

<< Home