mark's banner

Monday, February 28, 2005

GetPicture

Check out the GetPicture method in the V8 object model. There is a decent example in the help file on how to use the method.

I've been using it to display CellElements in an image box. It's great visual feedback for my application placement tools. Most (maybe all) elements have this method, so I think there are several applications where you might use this tool. Cell library veiwer, search and display specific or groups of elements, or query and display tags. I'll try to post an example tomorrow.

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.

Monday, February 14, 2005

What Have I Learned Lately?

1 - We'll start with today. In reading an article on MSDN I discovered that sometimes those of us who think we know something like to use words that our readers might not. As is evident in the following statement, "The following definitions are more informative than they are normative..." And since I'm making fun, I'll leave out my learned colleague's name.

Normative: “adj 1: relating to or dealing with norms; "normative discipline"; "normative samples" 2: giving directives or rules” - Dictionary.com

My guess, definition 2 is intended.

2 - It's better to use MicroStation's built in features whenever possible. I recommend investigating Batch Processor interface. This tool will find files in sub folders - check out what happens when you add a folder specification like this one, c:\myfolder\*\*.dgn

3 - Don't stray from your feature list without customer collaboration. Seems obvious, but just because a feature would be really cool doesn't mean you should unilaterally include it in the application.

4 - User commands, re-write.

5 - There are many readers of C-A-D with really nice things to say about my articles. Thank you to everyone who sent me emails.

I will try to post more often.