Looks like they are stored in Autodesk.Revit.DB.ExtensibleStorage
, and they can be accessed like shown in this sample from the SDK called GenericStructuralConnection:
/// <summary>
/// Match properties for detailed structural connections.
/// </summary>
/// <param name="activeDoc">The active document.</param>
/// <param name="message">Set message on failure.</param>
/// <returns>Returns the status of the operation.</returns>
public static Result MatchPropertiesDetailedStructuralConnection(UIDocument activeDoc, ref string message)
{
Result ret = Result.Succeeded;
// Prompt to select a structural connection
StructuralConnectionHandler srcConn = StructuralConnectionSelectionUtils.SelectConnection(activeDoc);
StructuralConnectionHandler destConn = StructuralConnectionSelectionUtils.SelectConnection(activeDoc);
if (srcConn != null && destConn != null)
{
using (Transaction tran = new Transaction(activeDoc.Document, "Match properties"))
{
tran.Start();
// Do the properties match.
Schema masterSchema = GetSchema(activeDoc.Document, srcConn);
Entity masterEnt = srcConn.GetEntity(masterSchema);
// You could also access and modify the connection parameters.
IList<Field> fields = masterSchema.ListFields();
foreach (Field field in fields)
{
if (field.ValueType == typeof(string))
{
IList<string> parameters = masterEnt.Get<IList<string>>(field);
foreach (string str in parameters)
{
// Do something.
}
}
}
destConn.SetEntity(masterEnt);
TransactionStatus ts = tran.Commit();
if (ts != TransactionStatus.Committed)
{
message = "Failed to commit the current transaction !";
ret = Result.Failed;
}
}
}
else
{
message = "There must be two connections selected !";
ret = Result.Failed;
}
return ret;
}
You need this as well:
/// <summary>
/// Get the Extensible storage schema
/// </summary>
private static Schema GetSchema(Document doc, StructuralConnectionHandler connection)
{
Schema schema = null;
Guid guid = GetConnectionHandlerTypeGuid(connection, doc);
if (guid != null && guid != Guid.Empty)
schema = Schema.ListSchemas().Where(x => x.GUID == guid).FirstOrDefault();
return schema;
}
/// <summary>
/// Get the unique identifier of the structural steel connection type
/// </summary>
/// <param name="conn">structural connection</param>
/// <param name="doc">current document</param>
/// <returns>returns the unique identifier of the input connection type</returns>
private static Guid GetConnectionHandlerTypeGuid(StructuralConnectionHandler conn, Document doc)
{
if (conn == null || doc == null)
return Guid.Empty;
ElementId typeId = conn.GetTypeId();
if (typeId == ElementId.InvalidElementId)
return Guid.Empty;
StructuralConnectionHandlerType connType = (StructuralConnectionHandlerType)doc.GetElement(typeId);
if (connType == null || connType.ConnectionGuid == null)
return Guid.Empty;
return connType.ConnectionGuid;
}