SSM Objects

SSM Objects

Anonymous
Not applicable
454 Views
5 Replies
Message 1 of 6

SSM Objects

Anonymous
Not applicable
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. name = sheet.GetName desc = sheet.GetDesc sheet.SetNumber "" ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) 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
0 Likes
455 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
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.... -- http://www.caddzone.com AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005 http://www.acadxtabs.com AcadX for AutoCAD 2004 Beta 1 http://mysite.verizon.net/~vze2vjds/acadx/AcadX16.zip "Jimmy Bergmark" wrote in message news:4072add6$1_2@newsprd01... > 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. > > > name = sheet.GetName > desc = sheet.GetDesc > sheet.SetNumber "" > ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) > ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) > > > 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 > > >
0 Likes
Message 3 of 6

Anonymous
Not applicable
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 "Jimmy Bergmark" wrote in message news:4072add6$1_2@newsprd01... > 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. > > > name = sheet.GetName > desc = sheet.GetDesc > sheet.SetNumber "" > ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) > ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) > > > 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 > > >
0 Likes
Message 4 of 6

Anonymous
Not applicable
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 "Partha Mitra" wrote in message news:40732c12$1_2@newsprd01... > 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 > > > > "Jimmy Bergmark" wrote in message > news:4072add6$1_2@newsprd01... > > 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. > > > > > > name = sheet.GetName > > desc = sheet.GetDesc > > sheet.SetNumber "" > > ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) > > ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) > > > > > > 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 > > > > > > > >
0 Likes
Message 5 of 6

Anonymous
Not applicable
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 "Jimmy Bergmark" wrote in message news:4073be13$1_2@newsprd01... > 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 > > > "Partha Mitra" wrote in message > news:40732c12$1_2@newsprd01... > > 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 > > > > > > > > "Jimmy Bergmark" wrote in message > > news:4072add6$1_2@newsprd01... > > > 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. > > > > > > > > > name = sheet.GetName > > > desc = sheet.GetDesc > > > sheet.SetNumber "" > > > ThisDrawing.Utility.Prompt ("sheet Name :" & name & vbCrLf) > > > ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & vbCrLf) > > > > > > > > > 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 > > > > > > > > > > > > > > >
0 Likes
Message 6 of 6

Anonymous
Not applicable
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. "Jimmy Bergmark" wrote in message news:4073c068$1_2@newsprd01... > 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 > > > "Jimmy Bergmark" wrote in message > news:4073be13$1_2@newsprd01... > > 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 > > > > > > "Partha Mitra" wrote in message > > news:40732c12$1_2@newsprd01... > > > 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 > > > > > > > > > > > > "Jimmy Bergmark" wrote in message > > > news:4072add6$1_2@newsprd01... > > > > 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. > > > > > > > > > > > > name = sheet.GetName > > > > desc = sheet.GetDesc > > > > sheet.SetNumber "" > > > > ThisDrawing.Utility.Prompt ("sheet Name :" & name & > vbCrLf) > > > > ThisDrawing.Utility.Prompt ("sheet Desc :" & desc & > vbCrLf) > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > >
0 Likes