Is there a way to Find and Replace for a batch of drawings and the find string is consistent XXXXX but the replacement string will be unique to each of the drawing?
I am working in Microstation Connect Edition Version 10.15.02.11.
You may be able to do something like that with a VBA routine. I don't know any other way to "batch" a unique string. Batch process doesn't have any intelligence about what file it is working on. It just issues commands. If you can't type your process into the command line (repeatedly, identically) it can't be done with a simple Batch Process. You can run a VBA THROUGH a Batch process. But I think the actual find-replacing would need some logic behind it.
MaryB
Power GeoPak 08.11.09.918Power InRoads 08.11.09.918OpenRoads Designer 2021 R2
MaryB said:You may be able to do something like that with a VBA routine
Here's a VBA Search & Replace freeware text tool. Unsurprisingly, it doesn't do exactly what Dan Murdoch wants (no-one ever asked that question before).
However, it includes the source code, so a VBA developer could modify it to add in the active DGN file name, or whatever is required.
Regards, Jon Summers LA Solutions
Awesome, that looks like it could be a great starting point. Thanks.
Mr. Summers is the best VBA resource I've ever seen!
I forgot about his freeware text replacement routine. It is indeed a good place to start. He has many other freeware tools and sample codes that are a great starting point for VBA projects, and some very informative articles. There are even a few routines that do cost, but are definitely worth the money if they apply to what your company does.
Dan Murdoch said: that looks like it could be a great starting point
On reviewing your request and the VBA, it's possible that it may already do what you want. It works with MicroStation configuration variables as a replacement; the screenshot above shows it extracting the name of the active DGN file...
$(basename(_dgnfile))
Lorys said:could you be a little more detailed are you using sheet models ( paper space) , title block ref files .. what is the unique to each drawing
Yes: what data do you need to extract from a DGN file to display as text?
As you're using MicroStation CONNECT, be aware that DGN file, model and element properties are available. You can add those properties to a text field, which updates automatically when, for example, you rename a file or model. Using that approach, you dispense altogether with the need for a VBA tool or batch processing.
Here's an example of a DGN file with text fields used to annotate various properties...
7041.MasterPlanner 01.dgn
The top-most plain text in that label is MasterPlanner. Immediately below that is a text field (text fields are shaded — that's a user preference setting) that displays the active DGN model name. If you save-as or copy the active model then that field automatically displays the new name.
The remaining text fields show Item instance data added using MasterPlanner.
Jon Summers said:Yes: what data do you need to extract from a DGN file to display as text?
Lorys said:Dan could you be a little more detailed are you using sheet models ( paper space) , title block ref files .. what is the unique to each drawing and more importantly how many drgs?
I am working in a large set of drawings exported from AutoCAD, about 700. The drawings were created with a titleblock space that will not be given a proper value/entry until the drawings are accepted by the client. Currently the value stored there is a placeholder of XXXXX. The replacement text will be unique to each of the drawings in the batch. The drawing replacement text will be more of a unique page identifier than a page number.
All drawings are drawn with a model space and paper space, the replacement text will go in the titleblock on the paperspace.
Jon Summers said:As you're using MicroStation CONNECT, be aware that DGN file, model and element properties are available. You can add those properties to a text field, which updates automatically when, for example, you rename a file or model. Using that approach, you dispense altogether with the need for a VBA tool or batch processing.
To change drawings to use the model/element properties, that would be a manual change required on each of the drawings text field?
Hi Dan autocad title blocks are usually attributed block which become or have tags in microstation , with vba you can harvest the drg file name and the tag place holder then export to excel edit change what needs changing and then with vba re import and replace the updated tag or place holder values for several 100's of files very fast... there are custom built vba or programs such as Flexitable by LA solutions UK and Caddpro by Adam Lambert from Australia that can do this for you probably easier and cheaper than your trial and error attempts at VBA...plus they come with heaps of other features and productive tools .
Lorys
Started msnt work 1990 - Retired Nov 2022 ( oh boy am I old )
But was long time user V8iss10 (8.11.09.919) dabbler CE update 16 (10.16.00.80)
MicroStation user since 1990 Melbourne Australia.click link to PM me