19 Sep 2017
2D DGN support workaround to Visualize with Forge.
2D DGN’s are a bit problematic and actually not supported directly by Forge, but after some research, and with the help from our engineers in the Design Automation team, I have found a couple of workarounds that can help you solve this issue.
Let's start by stating this fact first, the Forge translator (Model Derivative) that takes care of this, uses the Navisworks translator and stated in the documentation of the product that 2D DGN’s is not supported by Navisworks and that applies to the last 3 versions of the product.
See more here: http://help.autodesk.com/view/NAV/2017/ENU/?guid=GUID-B756BB4B-8CAD-4865-9E4B-584B775E3293
But like I mentioned at the beginning of this post, I found a couple of workarounds to suggest a solution to be able to visualize 2D DGN's with the Forge Viewer.
--------------------------------------
The first one would be to use the NWC exporter for Microstation that generates a NWC instead of DGN.
https://www.autodesk.com/products/navisworks/3d-viewers
Translating this will work with the use of the Model Derivative API to become visible with the Forge Viewer.
--------------------------------------
The second option would be using Design Automation API to achieve the 2D DGN visualization on the Forge Viewer. Here is what you can do:
You can import a DGN file and save a DWG using Design Automation API (Forge Service formerly known as AutoCAD.IO). You should also be able to generate SVF content directly in DA API (or take the result DWG and feed it into the Model Derivative service).
If you are interested in doing the whole workflow on DA then I recommend you look at the sample here: https://github.com/Autodesk-Forge/design.automation-custom-data-viewer
Just keep in mind that the sample knows nothing about DGN. You'll need to modify it. The -DGNIMPORT command will need to be added to the script and you will also need to modify the Activity inputs to have template and DGN file.
Here is a sample on how the activity of the DGN2DWG will look.
DGN2DWG activity:
{
"RequiredEngineVersion": "22.0",
"Parameters": {
"InputParameters": [
{
"Name": "HostDwg",
"LocalFileName": "$(HostDwg)"
},
{
"Name": "Dgn",
"LocalFileName" : "input.dgn"
}
],
"OutputParameters": [
{
"Name": "Result",
"LocalFileName": "result.dwg"
}
]
},
"Instruction": {
"Script": "(command \"-dgnimport\" \"input.dgn\" \"\" \"\" \"\" \"save\" \"result.dwg\")\n"
},
"Id": "Dgn2Dwg"
}
Hope this helps with your development and unblocks you from the use of 2D DGN’s visualization.