Adding new file location using Sheetset API

<?xml encoding=”UTF-8″>By Balaji Ramamoorthy

Here is a code snippet to add a new file location and to set it as the new sheet location using the Sheetset API :

 AcSmSheetSetMgr manager = <span>new</span><span>  AcSmSheetSetMgr();</span>
 
 AcSmDatabase sheetDb = 
         manager.FindOpenDatabase(<span>@"D:\Temp\MySheetset.dst"</span><span> );</span>
 sheetDb.LockDb(sheetDb);
 
 <span>// New sheet location</span><span> </span>
 AcSmResources resources 
             = sheetDb.GetSheetSet().GetResources();
 AcSmFileReference fileRef = <span>new</span><span>  AcSmFileReference();</span>
 fileRef.InitNew(resources);
 fileRef.SetFileName(<span>@"D:\Temp\SampleDrawings"</span><span> );</span>
 sheetDb.GetSheetSet().SetNewSheetLocation(fileRef);
 
 <span>// Add New location</span><span> </span>
 AcSmFileReference fileRef1 = <span>new</span><span>  AcSmFileReference();</span>
 fileRef1.InitNew(sheetDb);
 fileRef1.SetFileName(<span>@"D:\Temp\SampleDrawings"</span><span> );</span>
 resources.Add(fileRef1);
 
 sheetDb.UnlockDb(sheetDb);
 

After you run the code, the model views from all the drawings in the path should get listed under Model Views as shown in this screenshot :

Sheetset


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading