Message Boards Message Boards

Import lines and nodal coordinates from a microstation .dgn file?

Hello, I was wondering if anyone has experience importing a microstation file (or scraping the data from the microstation file) into Mathematica. I do a lot of finite element math in Mathematica, and more specifically, a lot of bridge truss analysis. The process involves gathering nodal coordinates (Node Number, x coord, y coord, z coord) and element connectivity (node 1 and node 2 connect, node 2 and node 3 connect, etc.). As of now, I type in nodal coords and element connectivity manually into Mathematica and it takes some time. I was hoping there was a way to streamline the process and have Mathematica scrape the needed data from a 3D or 2D microstation "stick model" file. That way, all I need to do is draw the truss in microstation and my Mathematica script will read and solve the rest. Thanks in advance!

POSTED BY: Mark Converse
3 Replies
Posted 3 years ago

Let me first explain my interest. Now in semi-retirement, I explore various technologies and continue developing ideas. I came across Wolfram (although I am no mathematician) and I have some longer term ideas on how Wolfram might be integrated into a technology stack I am developing.

If you are looking for a CAD/FEA expert it is not me, although I take an interest in visualisation and orchestrating multiple applications in toolchains.

I looked up MicroStation and DGN when you posted your question in this Wolfram community.

I explored MicroStation further, browsing the site, and saw the product as an ideal test case to try out ideas to integrate MicroStation with a cohort of open source tools .. and tools such as Wolfram Engine and others.

As I followed Bentley YouTube tutorials I realised how inefficient is this process of transferring knowledge. Readers have to follow screenshots which are difficult to read, let alone follow at the pace of the narrator. Narratives are distracting.

Now your opening question is typical of a case I would study. We have in DGN a format which is difficult to parse outside MicroStation.

It may be that Wolfram can parse DGN but there have been earlier questions on this topic. My approach is to use external parsing tools using scripts.

Exploring the MicroStation UI (I do not have a licence and so I can only follow manuals) I spotted SVG as an export option. Now here we do have an XML format which can be parsed by external tools and scripts.

I also found, separately, that your dummy_strut.DXF can be viewed using open source tools such as LibreCAD.

My approach in orchestrating your workflow would be to hold your 1000 or so node attributes in an Excel spreadsheet and then inject the data into an edited dummy_strut.svg.

Google search "import svg into Microstation" gives a few options.

Documentation for exporting svg

https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v15/en/GUID-5F7AB286-FFCE-D80F-FEDF-9EF2BDABD2D4.html

But MicroStation appears not offer an import svg method.

Now the question is if we have an svg file can we use this as a database then reimport using automation scripts or indeed MicroStation macro?

You write ...

The number of nodes depends on size of truss and if I'm about to undergo a 3D truss problem or a 2D truss problem. A simple 2D model might have as few as 3 nodal coordinates. But I'm working on a 3D continuous rail bridge truss (total length is 1575') right now that requires intense load demand computations. For that model, I have over 1000 nodes. It would take too long to manually input all the node numbers into my mathematica truss solving script, so I'm using commercial FEA software instead.

The process involves gathering nodal coordinates (Node Number, x coord, y coord, z coord) and element connectivity (node 1 and node 2 connect, node 2 and node 3 connect, etc.).

We can open the test svg file in Inkscape to view objects.

https://inkscape.org/doc/tutorials/advanced/tutorial-advanced.html

XML editor The ultimate power tool of Inkscape is the XML editor (Shift+Ctrl+X). It displays the entire XML tree of the document, always reflecting its current state. You can edit your drawing and watch the corresponding changes in the XML tree. Moreover, you can edit any text, element, or attribute nodes in the XML editor and see the result on your canvas. This is the best tool imaginable for learning SVG interactively, and it allows you to do tricks that would be impossible with regular editing tools.

If you open dummy_truss.svg in Inkscape and launch XML editor (Shift+Ctrl+X) you see all the objects (nodes) in your dummy_truss.svg

You have up and down arrows to walk up and down the tree structure.

Look at the options in the UI.

You can see node attributes in top tool bar. X: Y: W:

We can see how to manually edit nodes. But how can we do this with over 1000 nodes as you suggest for your workflow?

At this point I would use an automation script to actually "autodrive" the Inkscape GUI and enter data automatically from a file. Note: We could also automate data entry into Wolfram / Jupyter Notebook

That is, Inkscape is a UI being driven in batch mode.

Now I am in Ubuntu 20.04 (although I do have Windows 10). Presumably you are in Windows if you are using MicroStation UI.

The automation process entails running a desktop script which:

identifies Inkscape window
starts at top of tree
identify and focus X field and paste new value (from spreadsheet)
identify and focus Y field and paste new value (from spreadsheet)
identify and focus W field and paste new value (from spreadsheet)
repeat 1000 times or so to end of tree
save edited svg file.

But the question then arises, how to import the edited SVG back into MicroStation? I have found no such import SVG feature. Therefore, in this case, I would use the same automation methods I have tested to automate data entry directly into a MicroStation window. That is, transferring from Inkscape to MicroStation.

This final part I cannot test because I do not have a MicroStation licence. However I would be willing to send a script which does this, just as a collaborative experiment. You could bind Inkscape output to Mathematica, as a first thought.

Actually reading again your opening post I read:

That way, all I need to do is draw the truss in microstation and my Mathematica script will read and solve the rest.

So I guess the automation script might scrape data from Inkscape (as above) rather than editing svg, and then transfer 1000 node properties to your Mathematica script. Or perhaps better auto create a Jupyter Notebook since you can record design changes for audit purposes.

Another line of thought, search this Community forum .. "import SVG". There are some old posts.

Another interesting experiment I have in mind is to integrate Wolfram + Blender + MicroStation + plus some other tools. Orchestration of the workflow.

POSTED BY: David Law

First off, thank you for the reply. Secondly, sorry for the late response, this was the first post I've ever received a reply on, and I didn't get any notification that someone responded (not sure how to fix that either). As for your questions:

  1. The number of nodes depends on size of truss and if I'm about to undergo a 3D truss problem or a 2D truss problem. A simple 2D model might have as few as 3 nodal coordinates. But I'm working on a 3D continuous rail bridge truss (total length is 1575') right now that requires intense load demand computations. For that model, I have over 1000 nodes. It would take too long to manually input all the node numbers into my Mathematica truss solving script, so I'm using commercial FEA software instead.

  2. I attached a dummy truss model. The .dgn file type wasn't supported, so I attached as a .dxf

  3. I also attached as a SVG per your request.

Thanks!

Attachment

POSTED BY: Mark Converse
Posted 3 years ago

I am just another semi-retired learner, hoping to follow up on ideas from reading this forum. My interests as a developer are to orchestrate multiple tools in a pipeline to support development workflows.

In one scenario I plan to add Wolfram as a computation engine in an application stack. I have a free Developer Licence for testing ideas but do not yet have a full Mathematica licence. I develop largely in Ubuntu 20.04 although I can dual boot into Windows 10.

==================================================

Now from reading this thread I have only just learned about Microstation and DGN (I admit I confused DGN with DNG format). But my interest drops when I see the pricing. $2555 Practitioner Licence (renewable per annum). However I have found the Bentley learning channel with lots of short lectures.

I do not have access to the Microstation UI.

Since you have had no replies, here for starters is a dump of some initial ideas for workflows. These ideas have been tested .. but not yet with Microstation.

My first questions:

  1. Typically how many node sets do you have to type in manually in a session:

    Node Number, x coord, y coord, z coord
    
  2. Do you have a sample "stick model" (DGN) file to upload here to inspect, or can you create a dummy file for us to inspect its internal format?

  3. Is it possible to export SVG instead of DGN? Or both? SVG can be parsed easily.

More ideas can follow when I understand more about Microstation. It would also help if you upload some full screen size grabbed snapshots of the Microstation UI windows where you output/input data.

This is my reference site. https://docs.bentley.com/LiveContent/web/MicroStation%20V8i%20SS10%20Quick%20Start%20Guide/en/MicroStation%20Quick%20Start%20Guide.pdf

And here

https://www.bentley.com/en/learn https://education.bentley.com/

This learning channel explains the use of macros in Microstation.

https://learn.bentley.com/app/Public/ViewLearningPathDetails?lpId=108942&aftkn=2d7aa5bc-e637-48b2-8f51-ea376791f6d2

I envisage one scenario of a macro connecting to a parallel instance of Wolfram engine. However I have other ideas to share if macros do not work out.

POSTED BY: David Law
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract