Select to view content in your preferred language

How to get DGN version using Python?

1249
1
Jump to solution
01-31-2012 06:42 AM
FilipJung
Frequent Contributor
Hi,
I'm currently dealing with problem how to effectively get DGN drawing dataset version. It is important to me to know that because after version check I call prepared ETL tool from Toolbox with DGN7 or DGN8 reader and GDB writer.
The way I'm doing it now is listing feature classes in given DGN dataset, getting the first feature class with more than 0 records, and importing one feature to temporal feature class. Then I'm reading value in "DocVer" field of imported feature. This works but it's painfully slow (eg. for 50 DGNs)!
I wonder if there is another way to do that. Best would be implementation into Describe object to call something like Describe("data.dgn").docVer. The version is very quickly accesible from DGN drawing Properties in ArcCatalog, so it couldn't be too hard to get it in Describe object.
Or am I missing something? Is there a way to do that in Spatial ETL Tool in Data Interoperability?
Thanks for any help!
Filip
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
FilipJung
Frequent Contributor
Hi,
I will share how I finally solved this problem.
I easily encapsulated calling of tools in try, except:

try: [INDENT]try: [INDENT]arcpy.importDgn7(...) arcpy.AddMessage(u"Data imported from DGN version 7.")[/INDENT] except: [INDENT]arcpy.importDgn8(...) arcpy.AddMessage(u"Data imported from DGN version 8.")[/INDENT][/INDENT] except:    arcpy.AddMessage(u"Import failed for both DGN versions.")


Maybe this will be helpful to someone.

Filip

View solution in original post

0 Kudos
1 Reply
FilipJung
Frequent Contributor
Hi,
I will share how I finally solved this problem.
I easily encapsulated calling of tools in try, except:

try: [INDENT]try: [INDENT]arcpy.importDgn7(...) arcpy.AddMessage(u"Data imported from DGN version 7.")[/INDENT] except: [INDENT]arcpy.importDgn8(...) arcpy.AddMessage(u"Data imported from DGN version 8.")[/INDENT][/INDENT] except:    arcpy.AddMessage(u"Import failed for both DGN versions.")


Maybe this will be helpful to someone.

Filip
0 Kudos