0

I am trying to write a script (any) that will go to ArcCatalog and then to a database and then to ArcFM XML Export to export the dataset in XML.

  • What have you tried so far, and where are you stuck? Posting the code you've tried and any error messages would help us help you. – lambertj Sep 11 '19 at 20:57
  • I am just trying to get an idea as to how I should proceed. I am trying to see if there is any library I can use to get to ArcFM XML Export. And I saw that Esri has - Export XML Workspace Document - function with arcpy, but I cannot find anything for ArcFM. Have you done anything regarding automating ArcFM XML Export tool instead of doing it manually? I have just been researching and wanted some clues or direction. Thank you :) – john Sep 11 '19 at 22:01
  • Has anybody used Wave.Extensions.Miner -Version 1.0.2 for automating this task? – john Oct 3 '19 at 16:41
0

The below C# ArcObjects code snippet has worked for me for exporting ArcFM configuration to an XML document from an SDE class. I believe these are the two ArcFM library references needed:

  • Miner.Interop.Geodatabase
  • Miner.Interop.msxml2
using ESRI.ArcGIS.Geodatabase;
using Miner.Interop;
using Miner.Interop.msxml2;
...

// get reference to workspace
string sdeConnectionFile = @"p:\ath\to\connection\file.sde";
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SDEWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
IWorkspace workspace = workspaceFactory.OpenFromFile(sdeConnectionFile, 0);

// reference to dataset from which ArcFM config is exported
IDataset targetDataset = (IDataset)((IFeatureWorkspace)workspace).OpenTable(datasetName);

IXMLDOMDocument xmlDoc = new DOMDocumentClass();

// manually add standard root and version elements
IXMLDOMElement rootEl = xmlDoc.createElement("GXXML");
IXMLDOMElement versionEl = xmlDoc.createElement("EXPORT_VERSION");
// don't know how to get version programatically, so setting manually
versionEl.text = "10.2.1b SP2";
rootEl.appendChild(versionEl);
xmlDoc.appendChild(rootEl);

// -- Export options from ArcCatalog ArcFM XML Export with corresponding export class --
// ArcFM Model Name Information:    MMModelNameIEClass
// ArcFM Properties:                MMFieldInfoIEClass
// ArcFM Relationship Class Info:   MMRelClassIEClass
// ArcFM Snapping Information:      MMSnappingIEClass
// Custom Object Types:             MMObjClassIEClass
// Designer Database Properties:    ?
// Domains:                         MMDomainsIEClass

// create desired config export class
IMMXMLImportExport4 importExport = new MMModelNameIEClass();
// export element and append to root
IXMLDOMElement fmConfigEl = importExport.Export(targetDataset);
rootEl.appendChild(fmConfigEl);

// write xml doc to file
xmlDoc.save(xmlFilePath);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.