Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: Is it possible to make View Attribute changes using OpenDesignFileforProgram?

$
0
0

[quote user="Matt Ashby"]

Within an Excel file, I wrote the following VBA code and performed a test:

Case A ---- o.Visible = True

Case B ---- o.Visible = False

For Case A, the time was 8.1 seconds, for Case B the time was 7.5 seconds. This wasn't exactly the increased speed improvement I was hoping it would be. Nevertheless, it might have other advantages by starting a separate USTATION instance, and by running in the background (i.e., with o.Visible = False) so-to-speak.

[/quote]

Hi Matt,

I'm surprised your timings are so close but I guess it depends on the files and the operations you are doing.

[quote user="Matt Ashby"]

Anyway, in my MicroStation VBA program the user then selects the Excel file to process the different DGN files. A very small benefit to this approach is that I can then also make a note in the Excel file if the VBA  "succeeded", "failed" or if the DGN file was "Read Only", etc. This approach, while not related to my original post, is also useful if say I want to change the value of a Text object in each DGN file with a new value that is listed in the Excel worksheet. The value of the text would or could be unique to the filename/path listed in the Excel worksheet. To me using the Excel file is easier than trying to create an array or matrix that would be hard-coded in the VBA or say read from a TXT file.

[/quote]

Sounds similar to my Excel VBA Macro that I've been updating recently which I use to read and write Titleblock tags. Not sure I'm keen on the drag & drop to listbox idea personally as that involves opening an instance of an explorer window which is an extra step I'd prefer to do without, but to each their own.

My approach is a userform which I can browse and select DGN files I want to process and their filenames are extracted from the fullpath and loaded into Column A. I went with this approach because I recall years ago when I last worked on this macro using a For Each loop on a target folder meant I had to specify the type of file in code (which was notorious for DGN files having a different type name on different machines!) and it returned a collection of filenames in an unsorted order. Thankfully I don't have that issue with my new approach. I also just built in a toggle to switch been using the ApplicationObjectConnector or New MicroStationDGN.Application like so.

Anyway the reason I mention it is I did a test on 13 files with the following results:

Open File MethodImport TagsExport Tags
ApplicationObjectConnector 55.6657.15
New MicroStationDGN.Application15.0817.20

Definitely a much more noticeable speed difference. The only gotcha I need to remember with New MicroStationDGN.Application is to close down MS before Importing/Exporting.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>