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
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
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
As the post heading stated this is a macro for V8i.Some users still use macros in their Batch Process routines.
<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.
Hi Carl,
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.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
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: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