PDA

View Full Version : Acad2005 Sheet Set name and path?



KevinBarnett
2004-06-29, 10:01 AM
Greetings,

How do you get the name and path of currently opened sheet sets?
I copied the example sheet set dvb provided with 2005 and appended the following code in a new sub.

Dim sheetset As New sheetset
Dim ssMgr As New AcSmSheetSetMgr
Dim dbIter As IAcSmEnumDatabase
Dim db As IAcSmDatabase

Set dbIter = ssMgr.GetDatabaseEnumerator
Set db = dbIter.Next

Do While Not db Is Nothing
frm1.ComboBox1.AddItem db.GetName 'this is wrong - results in an empty string!
Set db = Nothing
Set db = dbIter.Next
Loop

Thanks,

Kevin.

RobertB
2004-07-07, 07:37 PM
Give this code a shot. The Autodesk sample is pretty complicated when you just want a simple answer.


Sub Test()
Dim ssMgr As IAcSmSheetSetMgr
Set ssMgr = New AcSmSheetSetMgr

Dim mgrIter As IAcSmEnumDatabase
Set mgrIter = ssMgr.GetDatabaseEnumerator

Dim dbCur As IAcSmDatabase
Set dbCur = mgrIter.Next

Do While Not dbCur Is Nothing
ThisDrawing.Utility.Prompt vbCrLf & dbCur.GetFileName
Set dbCur = mgrIter.Next
Loop

Set mgrIter = Nothing
Set ssMgr = Nothing
End Sub

KevinBarnett
2004-07-08, 05:32 AM
Thanks Robert now I'm almost there...

I added this line in the do loop
ThisDrawing.Utility.Prompt vbCrLf & dbCur.GetName

It returns an empty string !?

I included an error check, but no error is returned.

Thanks again.

Cheers,

Kevin.

RobertB
2004-07-09, 04:33 PM
That is because you are trying to get the Name from the wrong object.


Sub Test()
Dim ssMgr As IAcSmSheetSetMgr
Set ssMgr = New AcSmSheetSetMgr

Dim mgrIter As IAcSmEnumDatabase
Set mgrIter = ssMgr.GetDatabaseEnumerator

Dim dbCur As IAcSmDatabase
Set dbCur = mgrIter.Next

Dim aSheetSet As IAcSmSheetSet

Do While Not dbCur Is Nothing
Set aSheetSet = dbCur.GetSheetSet
ThisDrawing.Utility.Prompt vbCrLf & aSheetSet.GetName
ThisDrawing.Utility.Prompt vbCrLf & dbCur.GetFileName
Set aSheetSet = Nothing
Set dbCur = mgrIter.Next
Loop

Set mgrIter = Nothing
Set ssMgr = Nothing
End Sub

KevinBarnett
2004-07-12, 09:40 AM
Ever felt like Homer Simpson? Thx. I was getting sheetset objects confused with the sheetset class defined in the example project. Doh!

Have a great day,

Cheers,

Kev.