AnalyticalToPhysicalAssociationManager.AddAssociation
Description:
Adds a new association between an analytical element and a physical element.
Adds a new association between an analytical element and a physical element.
Remarks:
The arguments must be ids of an analytical and of a physical element that don't have other associations, otherwise an exception is thrown. Physical element can have one of these categories:
The arguments must be ids of an analytical and of a physical element that don't have other associations, otherwise an exception is thrown. Physical element can have one of these categories:
- Columns
- Curtain Wall Panels
- Floors
- Generic Models
- Mass
- Parts
- Railings
- Ramps
- Roofs
- Stairs
- Structural Columns
- Structural Foundation
- Structural Framing
- Structural Trusses
- Structural Beam System
- Walls
- Analytical Member
- Analytical Panel
-
analyticalElementIdId of the analytical element.
-
physicalElementIdId of the physical element.
using (Transaction trans = new Transaction(doc, "AddAssociationBetweenPhysicalAndAnalyticalElements"))
{
trans.Start();
ElementId idAnalyticalElem = GetSelectedObject(activeDoc, "Please select analytical element");
ElementId idPhysicalElem = GetSelectedObject(activeDoc, "Please select physical element");
//gets the AnalyticalToPhysicalAssociationManager for the current document
AnalyticalToPhysicalAssociationManager analyticalToPhysicalManager = AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(doc);
if (analyticalToPhysicalManager == null)
return Result.Failed;
//creates a new association between physical and analytical selected elements
analyticalToPhysicalManager.AddAssociation(idAnalyticalElem, idPhysicalElem);
trans.Commit();
-
Analytical id is not valid or has already defined another association. -or- Physical id is not valid or has already defined another association.
-
A non-optional argument was null