The forum Bentley Systems francophone

Through this forum, we want to create a Francophone exchange place on Bentley Systems products.

Good humour and courtesy are of course to be given. We reserve the right to exclude members who would be contrary to the objectives pursued.

If a section does not exist and you wish to be present, ask us via the form at the bottom of the page.

Forum navigation
Breadcrumb of the forum – You are here:ForumCAD: MicroStation V8iType a command in the entry...
You need to identify yourself to create messages and topics.

Type a command in the keyboard input

Hello.

I want to create an order that will either be in the cell selector or a command in the Tasks menu of the "personalized" workspace.

This command is:

Select a level to assign it a new color or trait style of the genre:

select level 10;co=96; change color

Thank you in advance,

Regrettably,

Dominica

Hello, Dominique.

To my knowledge, there is no way of redefining the level symbology parameters via a keyboard command (key-in). However, the VBA can save you with a very simple code:

Sub ModifyLevel()
Dim strArgs() As String

' The arguments to provide will be: level name, color, style, thickness
strArgs = Split(KeyinArguments, ",")

If UBound(strArgs) <> 3 Then
MsgBox "Number of incorrect arguments!", vbExclamation, "Alert"
Else
Dim strLevel As String
Dim iColour As Integer
Dim strLineStyle As String
Thickness As Integer

strLevel = strArgs(0)
iColor = Cint(strArgs(1))
strLineStyle = strArgs(2)
iWidth = Cint(strArgs(3))

Application.ActiveDesignFile.Levels(strLevel).ElementColor = iColor
Application.ActiveDesignFile.Levels(strLevel).ElementLineStyle = Application.ActiveDesignFile.LineStyles(strLineStyle)
Application.ActiveDesignFile.Levels(strLevel).ElementLineWeight = iWidth
Application.ActiveDesignFile.Levels.Rewrite
End If

End Sub

To use the VBA macro, simply enter the following command:

VBA RUN ModifyLevel [Level Name],[Color],[Line Style],[Width]

For example: VBA RUN ModifyLevel 1, 3,( Border ), 4

I hope this can help you!

Philippe


Give us your opinion!