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 2023 toolset calls into when loading and applying the standard.
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.
using Autodesk.Aec.SpaceOffsetRulesManager;
using System; using System.Collections.Generic; using System.Text; using Autodesk.Aec.SpaceOffsetRulesManager; namespace AecSpaceOffsetStandardSample {public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard {}public AecSpaceOffsetStandardSample() { }}
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 2023 toolset.
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");}
public class AecSpaceOffsetStandardSample : AecSpaceOffsetStandard {public AecSpaceOffsetStandardSample () {}SetName("Basic");} protected override void InitRules() {// register rules}
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 2023 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());}
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...}