(SpaceOffsetRulesManager.AecBoundingAdjacencyRule Base Class)
Bounding adjacency rules define an offset for segments of the space base profile depending on the space that is adjacent to this segment. A common use case for gross offset profiles is that bounding adjacency rules define that the boundary should be offset to the center of the bounding object at interior walls and to the outside of the bounding object at exterior walls.
To implement a bounding adjacency rule, you need to add a new class that is derived from SpaceOffsetRulesManager.AecBoundingAdjacencyRule. As with all previously described offset types, the new class needs to implement the Apply interface of this base class and register itself for the object types it should be called for in the constructor by calling the base method AecSpaceOffsetRuleBase.RegisterType(). The Apply method each rule needs to implement has the following form in AecBoundingAdjacencyRule:
public abstract bool Apply(Autodesk.AutoCAD.DatabaseServices.ObjectId idSpace, Autodesk.AutoCAD.DatabaseServices.ObjectId idObject, Autodesk.AutoCAD.DatabaseServices.ObjectId idAdjSpace);
The first ObjectId argument is the current space for which the offset boundary is to be calculated. The second ObjectId is the bounding object between the space from the first argument and the adjacent space. The third argument is the ObjectId of the adjacent space. When there is no adjacent space, which is the case at exterior walls, the value of this argument will be ObjectId.Null. The following example shows the frame for a new space rule called BoundingAdjacencyRuleGross:
namespace AecSpaceOffsetStandardSample {public class BoundingAdjacencyRuleGross : AecBoundingAdjacencyRule {}public BoundingAdjacencyRuleGross() { } public override AecSpaceOffsetInfo Apply(ObjectId idSpace, ObjectId idObject, ObjectId idAdjSpace) {}//}
The following example shows the implementation of a bounding adjacency rule that is used in the sample project. It defines an offset to the center of the bounding object for 2 spaces at interior walls and an offset to the outside of the wall if there is no adjacent space.
public class BoundingAdjacencyRuleGross : AecBoundingAdjacencyRule {public BoundingAdjacencyRuleGross() { } public override AecSpaceOffsetInfo Apply(ObjectId idSpace, ObjectId idObject, ObjectId idAdjSpace) {}if (idAdjSpace.IsNull) {}// If there is no adjacent space (exterior wall), keep the 'Opposite' offset return new AecSpaceOffsetInfo(AecSpaceOffsetType.Opposite);} else {// If there is an adjacent space (interior wall), its center return new AecSpaceOffsetInfo(AecSpaceOffsetType.Center);}