ArcFM Desktop Overview > Designer Overview > Export Assemblies to OHDA |
Out of the box, Overhead Design Analysis (OHDA) provides a user interface to export ArcFM assemblies for use in OHDA models. The default behavior is for the user to add an ASSEMBLYCODE field model name to a field in the geodatabase for OHDA to consume. You can programmatically create custom logic to change the field model name or control how assembly descriptions are processed. The code snippet below demonstrates how this works.
Export Assemblies |
Copy Code
|
---|---|
using System; using System.Collections.Generic; using System.Linq; using System.Text; using ESRI.ArcGIS.Geodatabase; using Miner.Geodatabase; using Miner.Interop; namespace Miner.Desktop.StructuralAnalysis.Model { internal class SampleGISAssemblyModel : IGISAssemblyModel { private const string DesignerFieldModelName = "ASSEMBLYCODE"; private const string UnknownAssemblyDescription = "Unknown Assembly"; /// <summary> /// The value returned from this method is passed to Overhead Design Analysis. /// In this example, the _foundModelName is unique in ArcMap, and the return from this method is the /// ArcGIS Matching code expected in Overhead Design Analysis to match to an existing assembly. /// </summary> /// <returns>The code expected by Overhead Design Analysis.</returns> public string GetAssemblyCode() { switch(_foundModelName) { case "VB-59": return "Vertical_Bracket_GIS_59"; case "SO-94": return "Standoff_Bracket_94"; case "Xarm-62": return "Crossarm_62"; case UnknownAssemblyDescription: return "Default_GIS_Assembly"; } //The default value was changed, and an unexpected GIS matching string was seen. //The _foundModelName could also simply be returned in this case, if the data is expected to always be valid. throw new Exception("Found GIS matching string with no known counterpart in Overhead Design Analysis:\n"+_foundModelName); } //If nothing is found, this should be the value. private String _foundModelName = UnknownAssemblyDescription; /// <summary> /// This example presumes that the assembly code, defined above as 'ASSEMBLYCODE', is a Designer Field Model Name that is /// attached to the FramingType field name. /// In the default ArcMap database Minerville, this appears as a related record under a Support Structure. /// </summary> /// <param name="iObject"></param> public void Hydrate(ESRI.ArcGIS.Geodatabase.IObject iObject) { IObjectClass objectClass = iObject.Class as IObjectClass; IMMModelNameManager modelNameManager = ModelNameManager.Instance; if (objectClass != null && modelNameManager != null) { IField assemblyCodeField = modelNameManager.FieldFromModelName(objectClass, DesignerFieldModelName); if (assemblyCodeField != null) { int assemblyNameFieldIndex = iObject.Class.FindField(assemblyCodeField.Name); ICodedValueDomain valueDomain = assemblyCodeField.Domain as ICodedValueDomain; object assemblyCodeFieldValue = iObject.get_Value(assemblyNameFieldIndex); if (valueDomain != null) { for (int i = 0; i < valueDomain.CodeCount; i++) { if (valueDomain.get_Value(i).Equals(assemblyCodeFieldValue)) { _foundModelName = valueDomain.get_Name(i); break; } } } } } } } } |