Is there a means of identifying the function that will create an object of a specific DataModelObjectCategory
?
From what I can tell, the function can frequently be identified by prepending "Add" to the beginning of the DataModelObjectCategory
. However, sometimes the function for a given object category (ObjectCategory
) is AddObjectCategory___()
. Other times, it is Add_____ObjectCategory()
. There are cases where the creation function is similar to but slightly different from the object category (e.g., AddContactTool()
creates a PreContactTool
object when the parent is the Connections branch in the tree and a PostContactTool
when it is the Solutions branch), and other cases where there is no connection whatsoever in the naming (e.g., AddInitialInformation()
creates a ContactDataTable
object. Furthermore, there are cases where two different creation functions can create different object categories (e.g., AddFluidSolidInterface()
and AddSystemCouplingRegion()
both create FluidSolidInterface
objects, but the properties are different and cannot be modified). Finally, there are cases where one creation function creates the object that you'd expect a different creation function to create (e.g., AddDirectionalDeformation()
creates a DirectionalDeformationTracker
, not AddDeformationPlotTracker()
).
The code I have now, tries to build the name of the creation function based on the DataModelObjectCategory
of the desired object, but that fails due to the above exceptions. As a result, I started going through all the different objects that can be possibly created in an effort to build a dictionary to lookup the creation function given the object category, but as I was going through that, I encountered several instances where different functions created the same object category depending on various different factors. Therefore, I thought I'd ask if anyone here is aware of a means of determining the function to create an object based on either the object category or some other property of the object itself.
The goal is to be able to write out all the properties of an object to a text file and be able to import the text file / create the object / set the properties in a new model.