All
Trying to put together a macro that will be run in a batch process mode to update "our design levels" in a dgn file. Basic idea of the macro is to run in batch mode through 100+ dgn files to update changes in our design levels. This project was started in 2014 put on hold and now is back alive. I have tried writing other forms of this macro BUT they lead back to use clicking the button to continue the process.
If there is a better way please advice.
Contents of the macro:
' Marco used to update MPS Eng dgn levels to a current status.' MbeDgnLevels Object found in MS Basic Guide train manual DAA010209-1' MbeDgnLevels.loadLevelsFromFile' Descr. MbeDgnLevels.loadLevelsFromFile loads only the level name definitions from the resource file specified by fileName. The full file specification is passed in fileName.'MbeDgnLevels.saveLevelsToFile' Descr. MbeDgnLevels.saveLevelsToFile saves only the level name definitions to the resource file specified by fileName. The full file specification is passed in fileName.Sub main Dim startPoint As MbePoint Dim point As MbePoint, point2 As MbePoint'MbeDgnLevels.loadLevelsFromFile'stat = MbeDgnLevels.loadLevelsFromFile(fileName As String) stat = MbeDgnLevels.loadLevelsFromFile("E:\ustn\data\Spychala-Levels.csv") If MBE_Success Then MbeMessageBox("Levels loaded!" [MBE_OKBox, type as long]) End If'MbeDgnLevels.saveLevelsToFile'stat = MbeDgnLevels.saveLevelsToFile(fileName As String)' If MbeDgnLevels.saveLevelsToFile("e:\ustn\data\spychala.lvl")' = MBE_Success Then' End If End Sub
Contents of CSV file:
Name,Number,Description,OverrideColor,OverrideStyle,OverrideWeight,ByLevelColor,ByLevelStyle,ByLevelWeight,OverridePriority,ByLevelPriority,GlobalDisplay,ElementAccess,Plot,OverrideStyleScale,OverrideStyleOriginWidth,OverrideStyleEndWidth,ByLevelStyleScale,ByLevelStyleOriginWidth,ByLevelStyleEndWidthDefault,0,Construction Lines - NON-PLOT,0,0,0,0,0,0,0,0,1,0,0,,,,,,POWER,1,Power,4,0,5,4,0,5,0,0,1,0,1,,,,,,ELEC-PANEL,2,Power Panels,0,0,0,4,0,5,0,0,1,0,1,,,,,,ELEC-PANEL-TAGS,3,Panel Tags,0,0,0,4,0,0,0,0,1,0,1,,,,,,LIGHT,4,Lighting,3,0,5,3,0,5,0,0,1,0,1,,,,,,LIGHT CTL,5,Existing Lighting,4,0,3,4,0,3,0,0,1,0,1,,,,,,COMM,6,Communications,2,0,5,2,0,5,0,0,1,0,1,,,,,,FIRE,7,Fire Alarm,7,0,5,7,0,5,0,0,1,0,1,,,,,,NURSE,8,Nurse - Emergency Call,5,0,5,5,0,5,0,0,1,0,1,,,,,,BORDER,9,Plot Shape No Plot,254,0,0,254,7,0,0,0,1,0,0,,,,,,CONDUIT,10,Conduit,1,0,3,1,0,3,0,0,1,0,1,,,,,,NOTES,11,Notes,102,0,1,102,0,1,0,0,1,0,1,,,,,,TITLE,12,Title Block - Sheet Title,102,0,1,102,0,1,0,0,1,0,1,,,,,,SEAL,13,Engineering Drawing Seals,0,0,0,0,0,0,0,0,1,0,1,,,,,,REMOVE,14,Cross-out Symbols,0,0,0,0,0,0,0,0,1,0,1,,,,,,ENG-NOTES,15,Engineering Notes - NON-PLOT,0,0,0,11,0,5,0,0,1,0,0,,,,,,SECTION-CUTS,19,AL-IL-NH Section Cuts - NON-PLOT,0,0,0,105,0,0,0,0,1,0,0,,,,,,BACKGROUND,30,Drawing Backgrounds,160,0,0,160,0,0,0,0,1,0,1,,,,,,DEMO,31,Demolition,160,3,0,15,3,0,0,0,1,0,1,,,,,,CLNG-GRID,32,Ceiling Grid,130,0,0,130,0,0,0,0,1,0,1,,,,,,FURN,33,Furniture,160,0,0,208,0,0,0,0,1,0,1,,,,,,HATCH,34,Hatch or Shade,9,0,0,208,0,0,0,0,1,0,1,,,,,,SITE,35,Sidewalks or Pavement,130,0,0,130,0,0,0,0,1,0,1,,,,,,BLDG,36,Bldg,160,0,0,160,0,1,0,0,1,0,1,,,,,,HVAC,37,Hvac,103,3,0,103,3,1,0,0,1,0,1,,,,,,EXIST,38,Existing,160,3,0,160,3,0,0,0,1,0,1,,,,,,MATCH,39,Match Line,160,6,2,15,6,2,0,0,1,0,1,,,,,,ROOM NAMES,40,Room Names,160,0,0,160,0,0,0,0,1,0,1,,,,,,ROOM NUMBERS,41,Room Numbers,160,0,0,160,0,0,0,0,1,0,1,,,,,,REV1,61,Revision Cloud 1,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV2,62,Revision Cloud 2,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV3,63,Revision Cloud 3,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV4,64,Revision Cloud 4,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV5,65,Revision Cloud 5,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV6,66,Revision Cloud 6,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV7,67,Revision Cloud 7,101,0,1,101,0,2,0,0,1,0,1,,,,,,REV8,68,Revision Cloud 8,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV9,69,Revision Cloud 9,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV10,70,Revision Cloud 10,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV11,71,Revision Cloud 11,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV12,72,Revision Cloud 12,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV13,73,Revision Cloud 13,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV14,74,Revision Cloud 14,0,0,0,101,0,2,0,0,1,0,1,,,,,,REV15,75,Revision Cloud 15,0,0,0,101,0,2,0,0,1,0,1,,,,,,
Hi Steven,
a couple of notes:
Unknown said:If there is a better way please advice.
Am I correct that dgnlib is not used, so levels in every design file have to be modified indivindually?
Can you further describe "update design level" process? Does it mean that there is CSV file with level definition and you want to set all level parameters accordingly to this file?
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Steven W.
CAD Manager
MPS Engineering Inc
813-855-2721
Unknown said:USTN version: 08.05.02.70
Well, it's quite old (and not supported by Bentley anymore) version, but still good enough ;-)
In my opinion it's better to use MicroStation VBA, its implementation in V8 2004 Edition is good and stable.
Unknown said:Our design process in a nut shell.
Do you have Excel installed? In general I don't like to use other software and libraries, because it creates extra dependencies and increases a threat something will not work correctly on another computer, but it seems to be good solution in your situation. Excel is able to read CVS files and MicroStation VBA can reference Excel and to use it's functions (and vice versa).
Unknown said:We use CSV files to remap & update levels in design files. Since 2014 we have updated our levels (name, color, style, weight, plot/not, etc...). So the 100+ files have to be updated to comply with new standards.
Does your Microstation Version already support the SAVE AS , remapping option?
You will find the remapping register when you click the SAVE AS OPTIONS
levelscolorsweighttext styles
IMHO it can be used by batch file converting, so you converting from DGN to DGN with a Excel/CSV remapping table.
You don't have to develop any code. It is built in function, IMHO since V8 2004
Regards
Frank
since 1985: GIS, CAD, Engineering (Civil) Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads, HHK Geograf, IBr DAVID] : Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML][direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)