220 likes | 584 Views
CP318-4 : Taking a Look at the Sheet Set Object With VB.NET. Lee Ambrosius Autodesk, Inc Sr. Technical Writer. Where Am I and Who Should Be Here. You are in session: CP318-4 - Taking a Look at the Sheet Set Object With VB.NET
E N D
CP318-4: Taking a Look at the Sheet Set Object With VB.NET Lee Ambrosius Autodesk, Inc Sr. Technical Writer
Where Am I and Who Should Be Here You are in session:CP318-4 - Taking a Look at the Sheet Set Object With VB.NET If you want to manipulate sheet sets through programming (not the Sheet Set Manager), you are in the right place. You should know or have the following to get the most out of this session: • Experience with AutoCAD 2010 (or AutoCAD 2008 and 2009) • Can create drawing templates and understand Sheet Sets • Know VB.NET (or C#)
Overview AutoCAD ships with a COM library that allows you to access and manipulate the objects stored in a Sheet Set (DST) file. In this session, you will learn how to: • Access the COM Sheet Set object • Manipulate sheet set files The COM Sheet Set object is a great way to: • Create custom properties • Insert or manage drawing layouts • Populate fields from an external data source
Who Am I? My name is Lee Ambrosius • Started with AutoCAD R12 DOS, over 15 years ago • Technical Writer at Autodesk for AutoCAD and AutoCAD LT (Worked on the Customization and .NET Developer’s Guides) • Author of AutoCAD related books and articles • AutoCAD 2009 and AutoCAD LT 2009 All-in-one Desk Reference for Dummies • AutoCAD 2008 3D Modeling Workbook for Dummies • AUGI World and AUGI Hotnews • White Papers for Autodesk
Session Rules A few rules for this session: • Turn off or set your cell phone to vibrate • If you have to leave at anytime, please do so quietly • I will allow time to ask questions during the session Thanks for Your Cooperation
What is Going to be Covered • What is the Sheet Set Object? • How to find and reference the Sheet Set Object • Create and access a sheet set • Work with subsets and sheets • Create custom properties for a sheet and sheet set • Work with events for the Sheet Set Object
What is the Sheet Set Object? The Sheet Set Object is a COM library which allow you to manipulate sheet sets. There are five objects you need to know: • AcSmSheetSetMgr – Open and create sheet set databases, and find out which ones are open • AcSmDatabase – Used to access the objects in a sheet set • AcSmSheetSet – Reference to the object that contains the subsets and sheets of a sheet set • AcSmSubset – Reference of a subset • AcSmSheet – Reference of a specific drawing layout
Finding the Sheet Set Object The Sheet Set Object is contained in AcSmComponents18.lib. • Located in C:\Program Files\Common Files\Autodesk Shared • The library that is used for AutoCAD 2010, is similar to the original library that shipped with AutoCAD 2005.
Referencing the Sheet Set Object To use the Sheet Set Object, you must add a reference to it in your Microsoft Visual Studio project. To reference the object, do the following: • Click Project menu >> Add Reference. • In the Add Reference dialog box, COM tab, select “AcSmComponents18 1.0 Type Library”. • Click OK.
Referencing the Sheet Set Object After you reference “AcSmComponents18 1.0 Type Library”, you need to use the Imports statement in order to use the Sheet Set object in your project. The Imports statement will look like: Imports ACSMCOMPONENTS18Lib
Working with the Sheet Set Manager The Sheet Set Manager Object allows you to: • Step through the open sheet set database (GetDatabaseEnumerator) • Open a sheet set database (OpenDatabase) • Find an open sheet set database (FindOpenDatabase) • Create a sheet set database (CreateDatabase) • Close a sheet set database (Close and CloseAll) • Setup event handlers (Register and Unregister)
Working with the Sheet Set Manager The following syntax shows how to reference the Sheet Set Manager object: ' Get a reference to the Sheet Set Manager object DimsheetSetManagerAsIAcSmSheetSetMgr sheetSetManager = NewAcSmSheetSetMgr
Working with a Sheet Set The Sheet Set object is a container for sheets, subsets, views, and properties. Before you learn how to work with the Sheet Set object, there are two important things you need to know: • A database must be locked before you edit it (Lockdb) • After editing, the database needs to be unlocked (Unlockdb) Prior to locking or unlocking a database, you should check its current lock status (GetLockStatus). Use the returned status to determine if the database is locked or unlocked.
Working with a Sheet Set Now that you know how to lock and unlock the sheet set, you can do the following with the Sheet Set object: • Add and remove a sheet (AddNewSheet and RemoveSheet) • Import a sheet (ImportSheet) • Add and remove a subset (CreateSubset and RemoveSubset) • Work with sheet set properties • Add new custom properties (GetCustomPropertyBag) • Modify standard properties (GetProjectName and SetProjectName) • Prompt for DWT file (GetPromptForDWT and SetPromptForDWT) • Setup event handlers (Register and Unregister)
Working with Subsets The Subset object references an organizational container in a Sheet Set. You can do the following with a Subset object: • Add and remove a sheet (AddNewSheet and RemoveSheet) • Import a sheet (ImportSheet) • Add and remove a subset (CreateSubset and RemoveSubset) • Step through the sheets in a subset (GetSheetEnumerator) • Work with the properties of the subset • Prompt for DWT (GetPromptForDwt and SetPromptForDwt) • New sheet location (GetNewSheetLocation and SetNewSheetLocation)
Working with Sheets The Sheet object references a single drawing layout. You can do the following with a Sheet object: • Change the referencing layout (GetLayout and SetLayout) • Set a sheet to be plotted (GetDoNotPlot and SetDoNotPlot) • Work with properties of the sheet • Add new custom properties (GetCustomPropertyBag) • Modify standard properties • Title (GetTitle and SetTitle) • Revision Date (GetRevisionDate and SetRevisionDate) Note: After adding a custom sheet property, it needs to be appended to all existing sheets in the sheet set
Other Objects to Know • AcSmResources – Drawing resources • AcSmAcDbLayoutReference – Drawing layout • AcSmCustomPropertyBag – Container for custom sheet and sheet set properties • AcSmFileReference – Resource file, drawing or drawing template • AcSmAcDbBlockRecordReference – Block contained in a drawing or drawing template • AcSmCalloutBlocks – Callout blocks collection • AcSmPublishOptions – Publish options • AcSmSheetSelSet and AcSmSheetSelSets – Sheet set selections
Where to Get More Information Learning a feature can be a challenge, but you do not have to go it alone. The following are only but only a few resources that you can use after leaving here: • Help system in AutoCAD • AUGI Forums (www.augi.com) • Autodesk Discussion Forums (www.autodesk.com) • Industry Events/Classes (AU, AUGI CAD Camp and ATCs)
Final Questions Questions Going Once… Going Twice…
Closing Remarks Thanks for choosing this session, and do not forget to fill out the evaluation for this session If you have any further questions, I will be around for the week and can be reached at: lee.ambrosius@autodesk.com Enjoy the rest of the conference.