This macro will change the View Attributes settings for a 2D design file.Copy and paste into your text editor, modify as needed.
'====================================================' Created by Carl Kastner' 20180913' MicroStation V8i SS4 | Win 7'====================================================
' Turns off/on (False/True) attributes on the View Attributes dialog.
Sub main Dim startPoint As MbePoint Dim point As MbePoint, point2 As MbePoint
' Send a keyin that can be a command string MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 ACSTriad True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Background False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 BoundaryDisplay False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 ClipVolume True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Constructions True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 DefaultLighting False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Dimensions True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 DataFields True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Displayset False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 FastCells False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Fill True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Grid False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 LevelOverrides False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 LinesStyles True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 LineWeights True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETHUDMARKERVISIBILITY ON 0 ""\"""
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Patterns True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Tags True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Text True"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 TextNodes False"
MbeSendKeyin "MDL KEYIN BENTLEY.VIEWATTRIBUTESDIALOG,VAD VIEWATTRIBUTESDIALOG SETATTRIBUTE 0 Transparency True"End Sub
Carl Kastner said:Imagine stepping into an organization and dealing...
I do not have to imagine it, after 25 years with MicroStation I have seen plenty of "data quality" disasters ;-)
Carl Kastner said:...dealing with elements/objects from ACAD and/or Building Designer/TriForma, and on it goes.
Add "great features" like different cells with same names, MicroStation fonts with same numbers spread over several .rsc files or qually named line styles nobodoy knows whether they are the same or not.
Carl Kastner said:Oh, the horror and what a challenge!
I agree, it's never ending fight. The only solution is to force people to accept standardization (dgnlib is just a tool, the standardization and data quality are more general concept covering wider area). Without data quality in mind from very early beginning, nothing can be enhanced and solved and such fight cannot be won.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Carl,
Carl Kastner said:The purpose of the other post was, again, stated in the heading: List of Keyins and VBA Strings for Design File Settings (in V8i).
the format you used (list of key-ins) is a wiki style and it's not suitable for forum, because it's not question.
Because it's not possible to create wiki article (I guess a special access s required), in my opinion the best solution is to post own blog, which can be done by anybody. In such case there will be no complains (at least from my side ;-), because blog can be subjective, but at the same time it's also included in search, so it can be found by anybody easily.
With regards,
Jan,
Thank you for the info/history.
Imagine stepping into an organization and dealing with thousands of design files where they do not use dgnlib files, no Cell/Text/Dimension Libraries, arrowheads are created with many small lines instead of fills, when once there were cells they are now dropped to elements, dealing with elements/objects from ACAD and/or Building Designer/TriForma, and on it goes.
And I am tasked with standardizing it all. Its a combination of: Oh, the horror and what a challenge!
Carl Kastner said:Thank you, that is good to know as we have not switched over.
to don't MicroStation BASIC (and switch to VBA) has been recommended by Bentley in MicroStation documentation from (at least) V8 2004 Edition, so it's nearly 15 years ago! Surprisingly there are still many users that when they start to think about migration to CE, also realized they have still some MicroStation BASIC (and in CE useless) that should be removed and replaced by VBA years ago.
< simply bad today>
Well, my bad then (not!) as the reader was informed in the post heading.
The purpose of the other post was, again, stated in the heading: List of Keyins and VBA Strings for Design File Settings (in V8i).
If a user performs a search for design file keyins/vba strings they, hopefully, would land on that post for one, some, or all of their needs as it is mostly all there in one post versus having to spend additional search time.
Kind of like: One post shopping. ;-)
<MicroStation BASIC is absent from MicroStation CONNECT.>
Thank you, that is good to know as we have not switched over.
<VBA is the way to go! >
Agreed.
As the post heading stated this is a macro for V8i.Some users still use macros in their Batch Process routines.
in addition to Mary's and Jon's comment about MicroStation BASIC (to provide any advice based on BASIC is simply bad today), I do nto quite understand what is a purpose and aim of your post (and also the previous one). They are not question, so they should be posted to wiki, not to forum, with a proper explanation.
Personally I do not understand why quite complicated script should be used when standard key-ins are available to change View Attributes. Moreover, in my opinion much better approach, when View Attributes should be set to a predefined configuration(s), it's to use Saved Views.
MaryB said:I'd suggest figuring it out in VBA instead of MicroStation BASIC
Also, MicroStation BASIC is absent from MicroStation CONNECT.
MaryB said: any solutions programmed that way may not work for much longer
VBA is the way to go!
Regards, Jon Summers LA Solutions
Nice, but I'd suggest figuring it out in VBA instead of MicroStation BASIC. MSTN BASIC hasn't been supported for a number of years now. While it can still work, it's not as reliable, and any solutions programmed that way may not work for much longer.
This also might be better off posted to the Programming forum.
MaryB
Power GeoPak 08.11.09.918Power InRoads 08.11.09.918OpenRoads Designer 2021 R2