To Create a Space Standard Class

You must define a new class derived from AecSpaceOffsetStandard. This class will be the framework that manages the individual rules and the entry point that AutoCAD Architecture 2022 toolset calls into when loading and applying the standard.

  1. If you have created a new project, the project will include one source file similar to this:
    using System;
    using System.Collections.Generic;
    using System.Text;
    namespace AecSpaceOffsetStandardSample
    {
    
    public class Class1
    {
    }
    
    }

    Add your standard class derived from the abstract base class Autodesk.Aec.SpaceOffsetRulesManager.AecSpaceOffsetStandard.

    Note: The Autodesk.Aec.SpaceOffsetRulesManager namespace is only available if you have correctly set up the reference to AecSpaceOffsetRuleManager.dll.
  2. To simplify the creation of the area calculation standard plug-in, it is recommended to add a namespace for all required classes. Add the following code line to your source file:
    using Autodesk.Aec.SpaceOffsetRulesManager;
    
  3. Rename Class1 to a name describing your standard (for example, AecSpaceOffsetStandardMyStandard) and make it a derivation of the AecSpaceOffsetStandard abstract base class.
  4. Add a parameterless default constructor to the class, which will be needed in the following steps:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Autodesk.Aec.SpaceOffsetRulesManager;
    namespace AecSpaceOffsetStandardSample
    {
    
    public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard
    {
    
    public AecSpaceOffsetStandardSample()
    {
    }
    
    }
    }
  5. When the new class is set up correctly in your source file, you can start implementing some of the methods that the base class AecSpaceOffsetStandard exposes and that AutoCAD Architecture 2022 toolset will call into.
  6. Add a call to the AecSpaceOffsetStandard.SetName(string name) method.

    The AecSpaceOffsetStandard.SetName() method is implemented in the base class and cannot be overridden. It needs to be called to register a name for the standard in the constructor of the class. This is the name that will show up in the list of available area calculation standards in AutoCAD Architecture 2022 toolset.

  7. Add the call to the SetName() method in the constructor of your class.

    The following example shows the call for the sample project AecSpaceOffsetStandardSample which registers itself in the software as the Basic area calculation standard.

    public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard
    {
    
    public AecSpaceOffsetStandardSample ()
    {
    
    SetName("Basic");
    
    }
    }
  8. After registering the area calculation standard plug-in name, you must add the new AecSpaceOffsetStandardSample.InitRules() method to your class. The method will override the abstract AecSpaceOffsetStandard.InitRules() interface. AutoCAD Architecture 2022 toolset will call that interface to register all individual offset rules you are going to implement. As this method is abstract, it must be implemented by your custom standard class. See the following example for instructions:
    public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard
    {
    
    public AecSpaceOffsetStandardSample ()
    {
    
    SetName("Basic");
    
    } protected override void InitRules() {
    // register rules
    
    }
    }
  9. The rule objects of the standard must be registered with the 3 different offset boundaries (net, usable, and gross). The AecSpaceOffsetStandard base class has 3 containers for these rule sets, which the derived class can add new rule instances to. These containers can be referenced with the following methods:
    • AecSpaceOffsetStandard.NetRules()
    • AecSpaceOffsetStandard.UsableRules()
    • AecSpaceOffsetStandard.GrossRules()

    Each of these calls will return a reference to an object of the Autodesk.Aec.SpaceOffsetRulesManager.AecSpaceOffsetRuleCollection class, which exposes functions to register the different rule types. These objects are maintained and used by AutoCAD Architecture 2022 toolset. The following example shows how to register rules with the 3 different offset types:

    public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard
    {
    
    public AecSpaceOffsetStandardSample ()
    {
    
    SetName("Basic");
    
    } protected override void InitRules() {
    // Register the rules with this standard, so the
    // offset calculation algorithm can call them
    // for the according boundary type
    NetRules().AppendBoundingOpeningRule(new BoundingOpeningRuleNet());
    // no usable boundary
    UsableRules().SetSpaceRule(new NullSpace());
    GrossRules().AppendBoundingObjectRule(new BoundingObjectRuleGross());
    GrossRules().AppendBoundingAdjacencyRule(new BoundingAdjacencyRuleGross());
    
    }
    }
  10. (Optional) AecSpaceOffsetStandard provides another virtual method that your own standard can implement: AecSpaceOffsetStandard.InitCurrentDatabase(). Since this is not an abstract method of the base class, it can be implemented, but is not mandatory, as opposed to the InitRules() method. It can be used by an area calculation standard to initialize the current drawing with additional data that the rules might require, such as classification definitions or zone styles. If implemented, AutoCAD Architecture 2022 toolset will call that implementation every time the standard is assigned to a drawing.
    public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard
    {
    
    public AecSpaceOffsetStandardSample ()
    {
    
    // set the name of the standard
    SetName("Basic");
    
    } // must be overriden protected override void InitRules() { } // can be overriden protected override void InitDatabase(Database* database) {
    // ...init database with classification definitions or zone styles, etc...
    
    }
    }