top of page

Bulk Creating Sheets in AutoCAD-Part 2

In my previous post, I had demonstrated a lisp for bulk creating sheets within AutoCAD Sheet Set Manager. However, I did not include a highly beneficial part of the sheet creation

process, applying titleblock values such as Drawn By and/or Checked By. Now, these values will need to be applied to all sheets but can be different depending on the associated discipline. Sheet set Manager can have these properties updated to each of the sheets within the database. Through the use of AutoCAD fields, these values will propagate to their respective sheets.

By default, you would have to right-click on each sheet inside the Sheet Set Manager and select properties. Once the dialog opens, the individual properties for that sheet only. This cycle would then be repeated for each additional sheet.

I can create a lisp function in c# that would allow you to find all the sheets within a subset and apply the specified value to the specified property to each.

        private static Document ACadDocument { get; set; }
        private static Editor CommandLine { get; set; }
        public static string Discipline { get; set; }
        public static string PropertyName { get; set; }
        public static string PropertyValue { get; set; }
        private static AcSmDatabase Database1 { get;  set; }
        private static AcSmSheetSet Set { get;  set; }
        public void UpdateSheetProperty(ResultBuffer rbArgs)
            if (rbArgs != null)
                int nCnt = 0;
                foreach (var typedValue in rbArgs)
                    if (typedValue.TypeCode == (int)LispDataType.Text)
                        switch (nCnt)
                            case 0:
                                Discipline = typedValue.Value.ToString();
                            case 1:
                                PropertyName = typedValue.Value.ToString();
                            case 2:
                                PropertyValue = typedValue.Value.ToString();

                        nCnt += 1;
                ACadDocument = Application.DocumentManager.MdiActiveDocument;
            CommandLine = ACadDocument.Editor;

            var sheetSetManager = new AcSmSheetSetMgr();
            Database1 = sheetSetManager.GetDatabaseEnumerator().Next();
            Set = Database1.GetSheetSet();
            var enumComponent =Set.GetSheetEnumerator();
        public void LoopThroughSheets(IAcSmEnumComponent componentEnum)
            var database = Database1;
            var sheetSetComponent = componentEnum.Next();

            while (sheetSetComponent != null)
                if (sheetSetComponent.GetTypeName() == "AcSmSheet")
                    if (LockDatabase(ref database, true))
                    LockDatabase(ref database, false);
                else if (sheetSetComponent.GetTypeName() == "AcSmSubset")
                    var subset = sheetSetComponent as AcSmSubset;
                    if (subset?.GetName() == Discipline)
                sheetSetComponent = componentEnum.Next();
        public static void SetCustomProperty(IAcSmPersist owner, string propertyName, object propertyValue, PropertyFlags sheetSetFlag)
            var customPropertyBag = AcSmCustomPropertyBag(owner);
            var customPropertyValue = new AcSmCustomPropertyValue();
            customPropertyBag?.SetProperty(propertyName, customPropertyValue);

        private static AcSmCustomPropertyBag AcSmCustomPropertyBag(IAcSmPersist owner)
            AcSmCustomPropertyBag customPropertyBag;
            if (owner.GetTypeName() == "AcSmSheet")
                var sheet = owner as AcSmSheet;
                customPropertyBag = sheet?.GetCustomPropertyBag();
                var sheetSet = owner as AcSmSheetSet;
                customPropertyBag = sheetSet?.GetCustomPropertyBag();
            return customPropertyBag;

The above code once compiled and using NETLOAD to import the dll into AutoCAD will allow the following lisp function that could be typed directly into the command line.

(SSMUpdateProperty"<Subset Name>" "<Property Name>" "<Property Value>")

This will run through all sheets in the specified subset and apply the property value to each. This function has the same limitation as the Sheet Create lisp function where it will only work on the first open sheet set in your palette.

Now building upon the Lisp routine that was created in part 1 we can improve upon it to get save more time in our project setup.

(defun c:CreateSheet()
 (setq drawnby (getstring T "Enter Drawn By: "))
 (setq checkby (getstring T "Enter Checked: "))
 (setq subsetname "MECHANICAL")
 (ssmcreateSheet subsetname "M001" "COVERSHEET")
 (ssmcreateSheet subsetname "M101" "FIRST FLOOR DUCTWORK PLAN")
 (ssmcreateSheet subsetname "M201" "FIRST FLOOR PIPING PLAN")
 (ssmcreateSheet subsetname "M701" "SCHEDULES")
 (ssmcreateSheet subsetname "M801" "DETAILS")
 (SSMUpdateProperty subsetname "Drawn By" drawnby)
 (SSMUpdateProperty subsetname "Checked By" checkby)

With some additional lines of code within the lisp, I can now have my sheets created and my titleblock information has been added as well.

Recent Posts

See All


bottom of page