About Bounding Openings

(SpaceOffsetRulesManager.AecBoundingOpeningRule Base Class)

A bounding opening rule can be used to define an offset at the openings in walls that are bounding a space, such as doors and windows. For example, the net offset profile cannot be defined by offsetting the profile only from the bounding walls. Usually, the wall is cut at doors and windows too. This rule type can be used to describe this in the offset profile calculated by the area calculation standard.

Implementation of a Bounding Opening Rule

To implement a bounding opening rule, you need to add a new class that is derived from SpaceOffsetRulesManager.AecBoundingOpeningRule. The new class needs to implement one or more of the Apply interfaces of the base class and register itself for the object types it should be called for in the constructor by calling the AecSpaceOffsetRuleBase.RegisterType() base method. Note that this rule can only be applied to the following classes:

Registering this rule for other object types will not have any result. The Apply method of that class that each rule needs to implement has the following syntax in AecBoundingOpeningRule:

public abstract AecSpaceOffsetOpeningInfo*
Apply(Autodesk.AutoCAD.DatabaseServices.ObjectId idSpace,
Autodesk.AutoCAD.DatabaseServices.ObjectId idAdjSpace,
Autodesk.AutoCAD.DatabaseServices.ObjectId idObject,
Autodesk.AutoCAD.DatabaseServices.ObjectId idOpening);

The first argument is the ObjectId of the current space for which the boundary offset is to be calculated. The second 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 third argument is the ObjectId of the object the opening is anchored to, which usually is a wall that bounds the space and owns the opening. The fourth parameter is the ObjectId of the opening that is under investigation. The following example shows the framework for a new opening rule called BoundingOpeningRuleNet:

namespace AecSpaceOffsetStandardSample
{
public class BoundingOpeningRuleNet : AecBoundingOpeningRule
{
public BoundingOpeningRuleNet ()
{
RegisterType(typeof(Door));
} public override AecSpaceOffsetInfo* Apply(ObjectId idSpace, ObjectId idAdjSpace, ObjectId idObject, ObjectId idOpening) { }
}
}

Sample Bounding Opening Rule BoundingOpeningRuleNet

The following example shows a simple bounding opening rule, where an offset is defined for doors. To make sure the rule is not applied to windows, it is only registered for the Door object, so that AutoCAD Architecture 2023 toolset will not call it for any other openings. This rule is used in the sample project AecSpaceOffsetStandardSample. The offset is defined to go to the inside of the door panel.

namespace AecSpaceOffsetStandardSample
{
public class BoundingOpeningRuleNet : AecBoundingOpeningRule
{
public BoundingOpeningRuleNet()
{
RegisterType(typeof(Door));
}
public override AecSpaceOffsetOpeningInfo* Apply(ObjectId idSpace, ObjectId idAdjSpace, ObjectId idObject, ObjectId idOpening)
{
return new AecSpaceOffsetOpeningInfo(AecSpaceOffsetOpeningType.PanelAdjacent);
} return new AecSpaceOffsetInfo(AecSpaceOffsetType.NoChange); }
}
}

Net boundary and net hatch are offset to the center of the door, but not offset at the wall opening