Question

How can I check if a DGN file is 2D or 3D?

  • 13 April 2017
  • 7 replies
  • 24 views

Badge +1

Hi, I have numerous DGN files and I want to set up a workflow that checks whether they are 2D or 3D files. I know I can use the DimensionExtractor to check individual features but I want to do a check on the actual file type itself. Is there an IGDS attribute I can expose to do this?

I have both FME Desktop 2016 and FME Desktop 2017.

Thanks


7 replies

Badge +16

I have my doubts if its possible to do the way you intend, since FME needs to read the features to be able to define the schema.

Userlevel 2
Badge +12

What you could do is loop through the files (using the "Directory and File Path" reader and a WorkspaceRunner) and read only the first feature (Set max features to read). Combining the fme_basename and the result of the DimensionExtractor to add the information to a report (in Excel or CSV or Text or any format of your choice).

Badge +16

What you could do is loop through the files (using the "Directory and File Path" reader and a WorkspaceRunner) and read only the first feature (Set max features to read). Combining the fme_basename and the result of the DimensionExtractor to add the information to a report (in Excel or CSV or Text or any format of your choice).

I dont pretend to be a big Bentley connoisseur, but is it not possible to have features that are both 2D and 3D in the same file?

 

 

Userlevel 3
Badge +13

Okay, I couldn't resist this one. I presume you are looking at V7 (IGDS) Design files. V8 files (to my knowledge) do not have a 2 or 3 D concept -- anything goes in them. But the old V7 files were physically a different layout if they were going to contain 2D or 3D data.

I know there is a flag byte early in the file that tells the diff, and one could read that with Python in FME and figure things out from there. I leave that option as an exercise for others.

But...FME knows when it opens a V7 file what the dimensionality is. And it logs it.

Sadly, that info is not returned anywhere in a normal workflow.

But...

A few years ago we added a little used transformer called the LogMessageStreamer. This brings into FME's feature flow each line of the log file that is generated.

So...

Let's feed in all the DGN files we're interested in into a FeatureReader. Have it read at most 1 feature. And do nothing with the output.

That causes a bunch of logging for each file we read. Great.

Then let's use a LogMessageStreamer to capture those messages and fish out the dimensionality and filename. A wee bit of Regexp magic and Bob's Yer Uncle.

Workspace attached (and screenshot for those only mildly curious).

determine2or3ddgn.fmw

Badge +16

Okay, I couldn't resist this one. I presume you are looking at V7 (IGDS) Design files. V8 files (to my knowledge) do not have a 2 or 3 D concept -- anything goes in them. But the old V7 files were physically a different layout if they were going to contain 2D or 3D data.

I know there is a flag byte early in the file that tells the diff, and one could read that with Python in FME and figure things out from there. I leave that option as an exercise for others.

But...FME knows when it opens a V7 file what the dimensionality is. And it logs it.

Sadly, that info is not returned anywhere in a normal workflow.

But...

A few years ago we added a little used transformer called the LogMessageStreamer. This brings into FME's feature flow each line of the log file that is generated.

So...

Let's feed in all the DGN files we're interested in into a FeatureReader. Have it read at most 1 feature. And do nothing with the output.

That causes a bunch of logging for each file we read. Great.

Then let's use a LogMessageStreamer to capture those messages and fish out the dimensionality and filename. A wee bit of Regexp magic and Bob's Yer Uncle.

Workspace attached (and screenshot for those only mildly curious).

determine2or3ddgn.fmw

Very nice!

 

 

Badge +1

Okay, I couldn't resist this one. I presume you are looking at V7 (IGDS) Design files. V8 files (to my knowledge) do not have a 2 or 3 D concept -- anything goes in them. But the old V7 files were physically a different layout if they were going to contain 2D or 3D data.

I know there is a flag byte early in the file that tells the diff, and one could read that with Python in FME and figure things out from there. I leave that option as an exercise for others.

But...FME knows when it opens a V7 file what the dimensionality is. And it logs it.

Sadly, that info is not returned anywhere in a normal workflow.

But...

A few years ago we added a little used transformer called the LogMessageStreamer. This brings into FME's feature flow each line of the log file that is generated.

So...

Let's feed in all the DGN files we're interested in into a FeatureReader. Have it read at most 1 feature. And do nothing with the output.

That causes a bunch of logging for each file we read. Great.

Then let's use a LogMessageStreamer to capture those messages and fish out the dimensionality and filename. A wee bit of Regexp magic and Bob's Yer Uncle.

Workspace attached (and screenshot for those only mildly curious).

determine2or3ddgn.fmw

Thank you Dale, I will give this method a go.

 

 

Badge +1

Okay, I couldn't resist this one. I presume you are looking at V7 (IGDS) Design files. V8 files (to my knowledge) do not have a 2 or 3 D concept -- anything goes in them. But the old V7 files were physically a different layout if they were going to contain 2D or 3D data.

I know there is a flag byte early in the file that tells the diff, and one could read that with Python in FME and figure things out from there. I leave that option as an exercise for others.

But...FME knows when it opens a V7 file what the dimensionality is. And it logs it.

Sadly, that info is not returned anywhere in a normal workflow.

But...

A few years ago we added a little used transformer called the LogMessageStreamer. This brings into FME's feature flow each line of the log file that is generated.

So...

Let's feed in all the DGN files we're interested in into a FeatureReader. Have it read at most 1 feature. And do nothing with the output.

That causes a bunch of logging for each file we read. Great.

Then let's use a LogMessageStreamer to capture those messages and fish out the dimensionality and filename. A wee bit of Regexp magic and Bob's Yer Uncle.

Workspace attached (and screenshot for those only mildly curious).

determine2or3ddgn.fmw

Hi Dale,

 

 

Thank you for your workflow, I have got it working on my machine. However my DGN file is actually V8 and as you indicated there is no message in the LogMessageStreamer_LogFile output that mentions 2D or 3D.

 

 

I know that when I open a DGN V8 in Microstation itself, it says "[3D - V8 DGN] - MicroStation V8i (SELECTseries 2)" across the top of the screen after the filepath. Because of this I thought there may be some way of accessing the part of the file that is allowing the "3D" property to be displayed....

 

 

Thanks,

 

 

Reply