I'm attempting to integrate the Sheet Set Manager into use at my company and I'm running into an issue. I have everything automated and ready for use (I've been using it for about a month now) and it all works great, however my boss and I agree that the setup process might not be easy to catch on to for our drafting team's skill level. I'd like to create a macro, LISP, or script that will automate the Sheet Set Wizard so that the only thing my drafters have to do is type in the project specific fields and be on their way. Here I run into an issue because the macro recorder doesn't work within the Sheet Set Wizard, and LISPs and Scripts tend to run on command line coding (you cannot create sheet sets simply from the command line, sadly - so that won't work either).
Any suggestions would be great - let me know what you folks think!
Have you used the _NEWSHEETSET command in your macro?
You can get the process going at least using that command from the command line.
Perhaps you could give a lunchtime seminar on creating and using Sheet Sets and raise your drafting team's skill level. There are so many things made available via employing Sheet Sets which a better understanding will open up to your team. They could also then help each other develop an even greater proficiency with them and the new features that they provide to achieve increased and long term benefits all around.
_NEWSHEETSET is as much a macro as it is a simple command... it doesn't blow my dress up anyways as far as making the setup more straightforward. My original idea was to do seminars, the main issue is that the draftsman here are all project managers as well and don't really have time for seminars. I would love to teach them how to use it, but after discussing this plan with my boss, I just don't think it's in the cards. Thanks for the suggestions though.
There is an API for the Sheet Set Manager that can be used to create a DST file, but will require you to know some VBA at a minimum as it can't be accessed from AutoLISP based on how it is designed. I do have a number of code samples that might be helpful to you to automate the setup process; create a DST file, add project name, setup default values, add/modify standard and custom properties. I also did a session at AU a few years ago that demonstrates how to use the API with VB.NET.
Here is the link to the AU session: http://au.autodesk.com/au-online/classes-on-demand/class-catalog/classes/year-2015/autocad/it10489#c...
A VBA code sample can be found installed with AutoCAD in the C:\Program Files\Autodesk\AutoCAD 2018\Sample\ActiveX\SheetSetVBA folder; replace 2018 with the version you have installed.
The current Sheet Set Object (SSO) documentation can be found at: http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-56F608AE-CEB3-471E-8A64-8C909B989F24
I'm very loosely familiar with VBA... that is, I looked at some tutorial videos the other day. I'm a fast learner though and willing to delve into it if it means accomplishing what I've set out to do. Could you send me some of your code samples? also - where can I find this API file? Thanks!
Basically what I would need this VBA to accomplish is the following...
Copy the source file (DST file to use as a template) to a user defined folder
Rename the file to a user defined name
automatically add predefined template layouts as sheets in the sheet set
It would also be beneficial to have one that automatically adds a copied layout (using the move/copy function) to the current sheet set
Let me know if these things are possible using the VBA method.
Yes, you can create a new DST file from a template (an existing) DST file with the API and specify the location in which the new DST file should be created.
With the API you can:
Here is a VBA example of how you could create a DST file named ABC 123.dst might look like using the IRD Addition.dst sample file as a template:
' Create a new sheet set
Public Sub CreateSheetSet()
' Get a reference to the Sheet Set Manager Object
Dim oSheetSetMgr As New AcSmSheetSetMgr
' Create a new sheet set file
Dim oSheetDb As AcSmDatabase
Set oSheetDb = oSheetSetMgr.CreateDatabase("C:\My Projects\ABC 123.dst", "C:\Program Files\Autodesk\AutoCAD 2018\Sample\Sheet Sets\Architectural\IRD Addition.dst", True)
' Continue if the database is unlocked
If oSheetDb.GetLockStatus() = AcSmLockStatus.AcSmLockStatus_UnLocked Then
' Lock the database
oSheetDb.LockDb oSheetDb
' Get the sheet set from the database
Dim oSheetSet As AcSmSheetSet
Set oSheetSet = oSheetDb.GetSheetSet()
' Set the name and description of the sheet set
oSheetSet.SetName "ABC 123"
oSheetSet.SetDesc "Example DST file created using the Sheet Set Object library."
' Unlock the database
oSheetDb.UnlockDb oSheetDb
End If
' Return the Sheet Set Name and Description
MsgBox "Sheet Set Name: " & oSheetDb.GetSheetSet().GetName & vbCrLf & _
"Sheet Set Description: " & oSheetDb.GetSheetSet().GetDesc
' Close the Sheet Set
oSheetSetMgr.Close oSheetDb
End Sub
Thanks! Is there a way to open the .tlb file in Visual Basic Editor? What I basically want to do is re-create the "create sheet set wizard" to make it more user friendly. Since I want our CAD drafters to only create sheet sets using the example sheet set and template I've created, they wouldn't need as many options as the current "create sheet set wizard" offers. I'd love to just teach them how to use the wizard, but I've been tasked with simplifying the process to accommodate certain skill levels.
I'd like to create a dialog box basically just with a "New sheet set location" text box and a "..." browser button for finding the location... that's really all I need at this point. The API should just create a new file with the user specified name in the user specified location using the existing sheet set I've created.
@bhuhn wrote:
I'd like to create a dialog box basically just with a "New sheet set location" text box and a "..." browser button for finding the location... that's really all I need at this point. The API should just create a new file with the user specified name in the user specified location using the existing sheet set I've created.
Browse for folder:
(defun Get_Folder ( / sObj cFold fobj oval) (setq sObj (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application" ) cFold (vlax-invoke-method sObj 'BrowseForFolder 0 "Select Folder" 254 ) ) (vlax-release-object sObj) (setq fObj (vlax-get-property cFold 'Self) oVal (vlax-get-property fObj 'Path) ) (vlax-release-object cFold) (vlax-release-object fObj) oval ) or simply (Defun c:ssmhere ()
(and (setq filename (lisped "----"))
(setq f (acet-ui-pickdir "Select Project Folder" "c:\\" )))
)
HTH
Yes, you can open the Sheet Set Manager Object TLB file in the Visual Basic Editor and see what classes and members are part of the library. The following explains how to reference the TLB file and view the members of the library file:
The previous code I posted will allow you to create a new sheet set and populate the basic values provided by the Create Sheet Set Wizard.
For browsing to a folder with VBA, you might want to see the functions/code samples defined in the following forum post:
Yes, you can open the Sheet Set Manager Object TLB file ...
ambrosl
What is the relation of TLB with sheet set? or is it a VBA component?
The previous code I posted will allow you to create a new sheet set and populate the basic values provided by the Create Sheet Set Wizard.
I'm familiar with that code at adndevblog website, I used the C# version, It helped me a lot to build a setup program, thank you for that. I used bits and pieces of the code to create Write to Sheet set custom properties. and another code from Fenton Webb and Kean Walmsley to write to sheet view.
One thing i noticed is , whenever the program ends, when i clicked an item on the sheet list , the help file pops up and the only way to get around it is to press refresh button at the model views tab, have you experienced that same behavior withVBA?
So... I'm attempting to make a form in which you can browse for a file path and type the name of the new file. When you click the button (btnCreateNewSheetSet) I need a new file to be created from an existing sheet set I designed to use as a template (I:\AG-Drafting\AG Drawing Templates\DWG STANDARD DETAILS\Library_SheetSets\ShopDrawing_Imperial_SheetSet.dst). The .dst file needs to be saved to the file path chosen (txtFileName.Text) and open up in the ACAD interface as well as have added sheets to the sheet set with predefined names and numbers.
So far this is the code I came up with based on the resources you've given me. For some reason the VBA groups everything after " 'set name" into the "General" object designation. Would you be able to tell if this syntax is up-to-date as well? I was having issues with getting this code to just create a new file without all the other qualities I'm trying to add.
Public Sub btnCreateNewSheetSet_Click()
'reference
Dim oSheetSetMgr As AcSmSheetSetMgr
Set oSheetSetMgr = New AcSmSheetSetMgr
'open a sheet set file (as template)
Dim oSheetDb As AcSmDatabase
Set oSheetSetMgr = oSheetSetMgr.CreateDatabase("I:\AG-Drafting\AG Drawing Templates\DWG STANDARD DETAILS\Library_SheetSets\ShopDrawing_Imperial_SheetSet.dst", "")
'lock database
Private Function LockDatabase(oSheetDb As AcSmDatabase) As Boolean
If oSheetDb.GetLockStatus = AcSmLockStatus_UnLocked Then
oSheetDb.LockDb oSheetDb
LockDatabase = True
Else
Lockdatabse = False
End If
End Function
'set name
oSheetDb.GetSheetSet().SetName "txtFileName.Text"
'unlock database
Private Function UnlockDatabse(oSheetDb As AcSmDatabase) As Boolean
If oSheetDb.GetLockStatus = AcSmLockStatus_Locked_Local Then
oSheetDb.UnlockDb oSheetDb
UnlockDatabase = True
Else
UnlockDatabse = False
End If
End Function
'close sheet set template
oSheetSetMgr.Close oSheetDb
'open new sheet set
Set oSheetDb = oSheetSetMgr.OpenDatabase(txtFileName.Text, False)
End Sub
Hi bhuhn,
I see you have taken the VBA path, good move. Lisp/Vlisp has reached its limit when it comes to API for Sheet set.
If you're going to pursue this with a non-lisp solution, I would request the ever so reliable admin to please move this discussion to Visual Basic
Customization forum.
Cheers
pBe
I am attaching a ZIP file that contains a VBA project (DVB file) which contains a form that allows you to browse to a location to create the new DST file from a template DST file and prompt the user for a sheet set name. I quickly tossed this together, but it should give you an idea how your code might look to get things working properly. The form controls are named slightly differently than what you have, but the concept should be similar. The folder browsing code is the same as the code found in the Inventor forum thread that I referenced earlier.
Wow - thanks. Will this be good code for 2018 as well? I'm currently in 2017. I replaced "strTemplateDSTFile" with the location of the template sheet set, however when I go to test out the macro I get this message:
Anything I can do about that? Thanks so much for all your help!
The project was built for AutoCAD 2018... You should only need to make one change to get it to work for AutoCAD 2017.
You might need to remove the check mark next to Microsoft Scripting Runtime as I didn't end up using it, and it might not be installed on your workstation if VB Scripting is disabled in your environment. That library will allow you to copy and work with files via the File System.
I wasn't sure what you meant by creating new sheets with default names and numbers, are those based on a specific DWT file. If so, I can help you once you get that far if you can't figure it out.
Mr. Abrosious,
Do you think it may be possible using the API for SSM to programmatically create new sheets and insert the named model space views complete with callout blocks? I know there are a lot of variables, but I'd like to know if the functions have been exposed to make this work. Thank you.
The Sheet Set Object library will allow you to create a new sheet set and add sheets to it. Inserting a model view and callout blocks will most likely require the use of the standard AutoCAD ActiveX API along with the Sheet Set Object library; additionally you may need to utilize Xdata and extension dictionaries, but I'm not completely sure though as I haven't tried to automate the workflow from end to end. I have only automated the setting up of a sheet set using the Sheet Set Object library.