<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sheet Set Manager API Basics in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352530#M672</link>
    <description>&lt;P&gt;I may have it figure out&lt;/P&gt;</description>
    <pubDate>Tue, 04 Mar 2025 23:13:38 GMT</pubDate>
    <dc:creator>john_stimacH3EQQ</dc:creator>
    <dc:date>2025-03-04T23:13:38Z</dc:date>
    <item>
      <title>Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13350311#M669</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new to this stuff, but after spending hours researching and troubleshooting I am still banging my head against the wall trying to get some pretty simple Sheet Set Manager API code to run correctly. Here are some of details of my setup:&lt;BR /&gt;- AutoCAD 2024 Full License&lt;/P&gt;&lt;P&gt;- Visual Studio 2022&lt;/P&gt;&lt;P&gt;- Windows 10&lt;BR /&gt;&lt;BR /&gt;These are steps I took:&lt;/P&gt;&lt;P&gt;Project Setup&lt;/P&gt;&lt;P&gt;- Create a new Class Library (.NET Framework) project in Visual Studio&lt;BR /&gt;- Target .NET Framework 4.8 (compatible with AutoCAD 2024, Yes, I know this changes for 2025)&lt;BR /&gt;- VS -&amp;gt; Build -&amp;gt; Configuration Manager -&amp;gt; Platform x64&lt;BR /&gt;Add references from the following:&lt;BR /&gt;- References:&lt;BR /&gt;1.&amp;nbsp;&amp;nbsp;AcSmComponents24.tlb From -&amp;gt;&amp;nbsp;C:\Program Files\Common Files\Autodesk Shared&lt;BR /&gt;2.&amp;nbsp;acmgd.dll From -&amp;gt; C:\Program Files\Autodesk\AutoCAD 2024&lt;BR /&gt;3.&amp;nbsp;acdbmgd.dll From -&amp;gt;&amp;nbsp;C:\Program Files\Autodesk\AutoCAD 2024&lt;BR /&gt;4. accoremgd.dll From -&amp;gt;&amp;nbsp;C:\Program Files\Autodesk\AutoCAD 2024&lt;BR /&gt;- I made the repos location a trusted location in AutoCAD&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;

// Register the assembly
[assembly: ExtensionApplication(typeof(SheetSetManagerExample.SheetSetManagerPlugin))]
[assembly: CommandClass(typeof(SheetSetManagerExample.SheetSetManagerCommands))]

namespace SheetSetManagerExample
{
    // Main plugin class
    public class SheetSetManagerPlugin : IExtensionApplication
    {
        public void Initialize()
        {
            // Initialization code when AutoCAD loads the plugin
            Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nSheet Set Manager plugin loaded.\n");
        }

        public void Terminate()
        {
            // Cleanup when AutoCAD unloads the plugin
        }
    }

    // Class containing AutoCAD commands
    public class SheetSetManagerCommands
    {
        // Define AutoCAD commands using the CommandMethod attribute
        [CommandMethod("SSMOpenSheetSet")]
        public void OpenSheetSet()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Get DST file path from user
                PromptOpenFileOptions opt = new PromptOpenFileOptions("Select a Sheet Set (DST file)")
                {
                    Filter = "Sheet Set Files (*.dst)|*.dst"
                };

                PromptFileNameResult res = ed.GetFileNameForOpen(opt);
                if (res.Status != PromptStatus.OK) return;

                string dstFilePath = res.StringResult;

                // Create a SheetSetManager helper to work with the Sheet Set
                using (SheetSetManager ssm = new SheetSetManager())
                {
                    ssm.OpenSheetSet(dstFilePath);
                    ssm.DisplaySheetSetInfo();
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: " + ex.Message);
            }
        }

        [CommandMethod("SSMCreateSheetSet")]
        public void CreateSheetSet()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Get DST file path from user for the new sheet set
                PromptSaveFileOptions opt = new PromptSaveFileOptions("Specify location for new Sheet Set (DST file)")
                {
                    Filter = "Sheet Set Files (*.dst)|*.dst"
                };

                PromptFileNameResult res = ed.GetFileNameForSave(opt);
                if (res.Status != PromptStatus.OK) return;

                string dstFilePath = res.StringResult;

                // Create a SheetSetManager helper to work with the Sheet Set
                using (SheetSetManager ssm = new SheetSetManager())
                {
                    ssm.CreateSheetSet(dstFilePath, "New Sheet Set", "New sheet set created via API");
                    ssm.DisplaySheetSetInfo();
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: " + ex.Message);
            }
        }

        [CommandMethod("SSMAddSheet")]
        public void AddSheet()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Get DST file path from user
                PromptOpenFileOptions dstOpt = new PromptOpenFileOptions("Select a Sheet Set (DST file)")
                {
                    Filter = "Sheet Set Files (*.dst)|*.dst"
                };

                PromptFileNameResult dstRes = ed.GetFileNameForOpen(dstOpt);
                if (dstRes.Status != PromptStatus.OK) return;

                string dstFilePath = dstRes.StringResult;

                // Get DWG file path from user
                PromptOpenFileOptions dwgOpt = new PromptOpenFileOptions("Select a Drawing (DWG file)")
                {
                    Filter = "Drawing Files (*.dwg)|*.dwg"
                };

                PromptFileNameResult dwgRes = ed.GetFileNameForOpen(dwgOpt);
                if (dwgRes.Status != PromptStatus.OK) return;

                string dwgFilePath = dwgRes.StringResult;

                // Get the layout name
                PromptStringOptions layoutOpt = new PromptStringOptions("\nEnter layout name: ")
                {
                    AllowSpaces = true,
                    DefaultValue = "Layout1"
                };

                PromptResult layoutRes = ed.GetString(layoutOpt);
                if (layoutRes.Status != PromptStatus.OK) return;

                string layoutName = layoutRes.StringResult;

                // Create a SheetSetManager helper
                using (SheetSetManager ssm = new SheetSetManager())
                {
                    ssm.OpenSheetSet(dstFilePath);
                    ssm.AddSheet(dwgFilePath, layoutName, "Sheet " + DateTime.Now.ToString("yyyyMMdd"), "New sheet added via API");
                    ssm.DisplaySheetSetInfo();
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: " + ex.Message);
            }
        }

        [CommandMethod("SSMAddCustomProperty")]
        public void AddCustomProperty()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Get DST file path from user
                PromptOpenFileOptions opt = new PromptOpenFileOptions("Select a Sheet Set (DST file)")
                {
                    Filter = "Sheet Set Files (*.dst)|*.dst"
                };

                PromptFileNameResult res = ed.GetFileNameForOpen(opt);
                if (res.Status != PromptStatus.OK) return;

                string dstFilePath = res.StringResult;

                // Get property name
                PromptStringOptions propNameOpt = new PromptStringOptions("\nEnter property name: ")
                {
                    AllowSpaces = false
                };

                PromptResult propNameRes = ed.GetString(propNameOpt);
                if (propNameRes.Status != PromptStatus.OK) return;

                string propName = propNameRes.StringResult;

                // Get property value
                PromptStringOptions propValueOpt = new PromptStringOptions("\nEnter property value: ")
                {
                    AllowSpaces = true
                };

                PromptResult propValueRes = ed.GetString(propValueOpt);
                if (propValueRes.Status != PromptStatus.OK) return;

                string propValue = propValueRes.StringResult;

                // Create a SheetSetManager helper
                using (SheetSetManager ssm = new SheetSetManager())
                {
                    ssm.OpenSheetSet(dstFilePath);
                    ssm.AddCustomPropertyToSheetSet(propName, propValue);
                    ssm.DisplaySheetSetInfo();
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: " + ex.Message);
            }
        }

        [CommandMethod("SSMCreateSubset")]
        public void CreateSubset()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                // Get DST file path from user
                PromptOpenFileOptions opt = new PromptOpenFileOptions("Select a Sheet Set (DST file)")
                {
                    Filter = "Sheet Set Files (*.dst)|*.dst"
                };

                PromptFileNameResult res = ed.GetFileNameForOpen(opt);
                if (res.Status != PromptStatus.OK) return;

                string dstFilePath = res.StringResult;

                // Get subset name
                PromptStringOptions nameOpt = new PromptStringOptions("\nEnter subset name: ")
                {
                    AllowSpaces = true
                };

                PromptResult nameRes = ed.GetString(nameOpt);
                if (nameRes.Status != PromptStatus.OK) return;

                string subsetName = nameRes.StringResult;

                // Get subset description
                PromptStringOptions descOpt = new PromptStringOptions("\nEnter subset description: ")
                {
                    AllowSpaces = true
                };

                PromptResult descRes = ed.GetString(descOpt);
                if (descRes.Status != PromptStatus.OK) return;

                string subsetDesc = descRes.StringResult;

                // Create a SheetSetManager helper
                using (SheetSetManager ssm = new SheetSetManager())
                {
                    ssm.OpenSheetSet(dstFilePath);
                    ssm.CreateSubset(subsetName, subsetDesc);
                    ssm.DisplaySheetSetInfo();
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nError: " + ex.Message);
            }
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No errors when I rebuild it in VS. There are these two warnings:&lt;BR /&gt;1.&amp;nbsp;warning MSB3305: Processing COM reference "AXDBLib" from path "C:\Program Files\Common Files\Autodesk Shared\axdb24enu.tlb". Interface 'IAcadShadowDisplay' is marked as [dual], but does not derive from IDispatch. It will be converted as an IUnknown-derived interface.&lt;BR /&gt;2.&amp;nbsp;warning MSB3305: Processing COM reference "ACSMCOMPONENTS24Lib" from path "C:\Program Files\Common Files\Autodesk Shared\AcSmComponents24.tlb". At least one of the arguments for 'IAcSmFiler.ReadRawData' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.&lt;BR /&gt;&lt;BR /&gt;But what I found online is saying these wont be an issue.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I can load the plugin in AutoCAD and run some of the commands. It lets me select the .dst file and will return some of it's values. I see this error a bunch: "&lt;SPAN&gt;Warning checking for open database: Error HRESULT E_FAIL has been returned from a call to a COM component." and this one too: " Object reference not set to an instance of an object."&lt;BR /&gt;&lt;BR /&gt;I feel like there must be something simple I'm missing but can't be sure. Any help would be appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 00:22:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13350311#M669</guid>
      <dc:creator>john_stimacH3EQQ</dc:creator>
      <dc:date>2025-03-04T00:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13350550#M670</link>
      <description>&lt;P&gt;you might have a look at this for guidance&lt;/P&gt;&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2013/09/using-sheetset-manager-api-in-vbnet.html" target="_blank"&gt;https://adndevblog.typepad.com/autocad/2013/09/using-sheetset-manager-api-in-vbnet.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used it for this&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.theswamp.org/index.php?topic=59643.0" target="_blank"&gt;http://www.theswamp.org/index.php?topic=59643.0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 03:49:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13350550#M670</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2025-03-04T03:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352404#M671</link>
      <description>&lt;P&gt;Thanks this does help. But, I am still struggling with COM issues. AutoCAD keep crashing and I see this all the time in the error report: "&lt;SPAN&gt;Class not registered at ACSMCOMPONENTS24Lib". I have tried each of the following separately:&lt;BR /&gt;- Adding the reference -&amp;gt; COM -&amp;gt; Type Libraries -&amp;gt; AcSmComponents24 1.0 Type Library&lt;BR /&gt;- Adding the reference -&amp;gt; Browse -&amp;gt;&amp;nbsp;"C:\Program Files\Autodesk\AutoCAD 2024\AcSmComponents.dll"&lt;BR /&gt;- Adding the reference -&amp;gt; Browse -&amp;gt; "C:\Program Files\Autodesk\AutoCAD 2024\AcSmComponents.Interop.dll"&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;-&amp;nbsp;Adding the reference -&amp;gt; Browse -&amp;gt; "C:\Program Files\Common Files\Autodesk Shared\AcSmComponents24.tlb"&lt;BR /&gt;&lt;BR /&gt;Also, when I try to register these references I get this error consistently:&lt;BR /&gt;regsvr32 "C:\Program Files\Autodesk\AutoCAD 2024\AcSmComponents.dll"&lt;BR /&gt;regsvr32 "C:\Program Files\Common Files\Autodesk Shared\AcSmComponents24.tlb"&lt;BR /&gt;regsvr32 "C:\Autodesk\ObjectARX_for_AutoCAD_2024_Win_64bit_dlm\inc-x64\acsmcomponents24.tlb"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"The module "C:\Program Files\#########\###########\AcSmComponents.dll" was loaded but the entry-point DIIRegisterServer was not found. Make sure that "C:\Program Files\#########\#######\AcSmComponents.dll" is a valid DLL or OCX file then try again."&lt;BR /&gt;&lt;BR /&gt;There is an error in VS which seems related but my IDE is saying these wont be an issue:&lt;BR /&gt;"warning MSB3305: Processing COM reference "ACSMCOMPONENTS24Lib" from path "C:\Program Files\Common Files\Autodesk Shared\AcSmComponents24.tlb". At least one of the arguments for 'IAcSmFiler.ReadBytes' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 21:36:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352404#M671</guid>
      <dc:creator>john_stimacH3EQQ</dc:creator>
      <dc:date>2025-03-04T21:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352530#M672</link>
      <description>&lt;P&gt;I may have it figure out&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 23:13:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352530#M672</guid>
      <dc:creator>john_stimacH3EQQ</dc:creator>
      <dc:date>2025-03-04T23:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352600#M673</link>
      <description>&lt;P&gt;I think using regsvr32 is wrong, AutoCAD installer should do this&lt;/P&gt;&lt;P&gt;Also "warning MSB3305:” is not an error, it’s a warning that IAcSmFiler may require special handling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking in my python wrappers, I import acax24ENU.tlb and acsmcomponents24.tlb&lt;/P&gt;&lt;P&gt;Maybe someone more familiar with .NET can chime in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 00:23:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13352600#M673</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2025-03-05T00:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13357333#M674</link>
      <description>&lt;P&gt;The DLLs your project is registering do not have to be registered and shouldn't be registered again, which could corrupt the installation. AutoCAD registers those components on installation and there is no need for your app to do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AcSmComponents is not an ActiveX server (hence the&amp;nbsp;&lt;SPAN&gt;MSB3305 warning). ActiveX servers and COM servers are two different things. The warning about the argument to&amp;nbsp;IAcSmFiler.ReadBytes is because IAcSmFiler is not an ActiveX server, it's COM server, but your project sees them as ActiveX server.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To use the SheetSet API, you only need to do what I do in this screen clip (this is for AutoCAD 2025)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="devenv_Jubs3VifRF.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1474914i9091D6D5329003A5/image-size/large?v=v2&amp;amp;px=999" role="button" title="devenv_Jubs3VifRF.gif" alt="devenv_Jubs3VifRF.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you've added the COM reference, you can use the SSM components in code by adding this to your usings:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using ACSMCOMPONENTS25Lib;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 22:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13357333#M674</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-03-06T22:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sheet Set Manager API Basics</title>
      <link>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13358156#M675</link>
      <description>&lt;P&gt;IAcSmAcDbDatabase can return IAcadDatabase, must be why I added a reference to acax&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 07:43:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/sheet-set-manager-api-basics/m-p/13358156#M675</guid>
      <dc:creator>daniel_cadext</dc:creator>
      <dc:date>2025-03-07T07:43:28Z</dc:date>
    </item>
  </channel>
</rss>

