Anyone played with the SSM objects for AutoCAD 2005 yet? I've tried to understand the API but have not yet got an understanding how it works. For example I would like to loop through all sheets and check the names. A sample for this is in the SheetSetVBA.dvb in C:\Program Files\AutoCAD 2005\Sample\ActiveX\SheetSetVBA. But now I want to rename the sheets based on some criterias using SetName, SetNumber and SetDescription methods. Somehow it doesn't work. I tried to experiment with the List Sub in the SeetSet Class Module. <snip> name = sheet.GetName desc = sheet.GetDesc sheet.SetNumber "" ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) <snip> sheet.SetNumber doesn't seem to work. What is missing or needed. I think it might be InitNew but don't know how to implement it. -- Best Regards, Jimmy Bergmark CAD and Database Developer Manager at www.pharmadule-emtunga.com Take a look at JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm or download some freeware at www.jtbworld.com More on AutoCAD 2005; www.jtbworld.com/autocad2005.htm
Good luck. The documentation is a skeleton help file that was generated from the type library, with nothing in it but the helpstrings for each method or property. That must've took a whole 16 seconds.... AcadX for AutoCAD 2004 Beta 1 http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip
Hi Jimmy, You need to use 'SetTitle' to change sheet name. Here is a code snip to change the name and number of all sheets in 'IRD Addition.dst' (AutoCAD sample). Thanks, Partha. Dim ssm As ACSMCOMPONENTS16Lib.AcSmSheetSetMgr Dim db As AcSmDatabase Dim ss As AcSmSheetSet Sub changeNameNumber() Set ssm = CreateObject("AcSmComponents.AcSmSheetSetMgr") ' open the database Set db = ssm.OpenDatabase("C:\Program Files\AutoCAD 2005\Sample\Sheet Sets\Architectural\IRD Addition.dst", True) ' lock the database Call db.LockDb(db) ' get the sheetset Set ss = db.GetSheetSet Dim compEnum As IAcSmEnumComponent ' get component enumerator Set compEnum = ss.GetSheetEnumerator Call LoopThroughSheets(compEnum) ' unlock the database Call db.UnlockDb(db, True) ' close Call ssm.Close(db) End Sub Private Sub LoopThroughSheets(ByVal compEnum As IAcSmEnumComponent) Dim comp As IAcSmComponent Set comp = compEnum.Next() ' loop through till the component is Nothing Do While Not comp Is Nothing On Error Resume Next Debug.Print comp.GetName & "," & comp.GetDesc On Error GoTo 0 ' if the component is a sheet, then... If comp.GetTypeName = "AcSmSheet" Then Dim s As AcSmSheet Set s = comp ' set the new number s.SetNumber "0000" ' set the new name s.SetTitle "MySheet" ' if the componnet is a subset then ... ElseIf comp.GetTypeName = "AcSmSubset" Then Dim sset As AcSmSubset Set sset = comp ' loop through all the sheets. Call LoopThroughSheets(sset.GetSheetEnumerator) End If ' next Set comp = compEnum.Next() Loop End Sub
Great! Thanks for the help! I'll take a thorough look at it to get the idea. -- Best Regards, Jimmy Bergmark CAD and Database Developer Manager at www.pharmadule-emtunga.com Take a look at JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm or download some freeware at www.jtbworld.com More on AutoCAD 2005; www.jtbworld.com/autocad2005.htm
Any idea on how to get the file name of a sheet? I guess it's by using GetFileName method but don't know how to implement it. -- Best Regards, Jimmy Bergmark CAD and Database Developer Manager at www.pharmadule-emtunga.com Take a look at JTB FlexReport (FLEXlm report tool) - www.jtbworld.com/jtbflexreport SmartPurger (Purges automatically) - www.jtbworld.com/?/smartpurger.htm or download some freeware at www.jtbworld.com More on AutoCAD 2005; www.jtbworld.com/autocad2005.htm
Get the LayoutRef object from the sheet first (sheet.GetLayout). Then call ResolveFileName on the LayoutRef object. That will not only return the file with full path but at the same time will resolve the location (by Sheet Set Manager internal resolve mechanism). This is the preferreed way. You can also call GetFileName to get the file but it'll not resolve the location of the file. Thanks, Partha.