Sheet Set API question..

Sheet Set API question..

Anonymous
Not applicable
494 Views
6 Replies
Message 1 of 7

Sheet Set API question..

Anonymous
Not applicable
I've been trying to set a file path to the
"GetAltPageSetups.SetFileName" object in my sheet set file (it is for
the page setup overrides).

my problem is that if there is no path there to begin with my code fails
100% of the time giving me the error "SSM err: Object variable or With
block variable not set". I can't figure out what is wrong with it.

Anyone?

[code]
Sub Auto_DST_Paths(DSTPath As String)
Dim pathstart As String
Dim pathend As String
On Error GoTo whatsWrong
Set ssm = CreateObject("AcSmComponents.AcSmSheetSetMgr.17")

' open the database file
Set db = ssm.OpenDatabase(DSTPath, True)
' lock the database
Call db.LockDb(db)

' get the sheetset
Set ss = db.GetSheetSet

Dim TestinG As String
TestinG = "O:\Plotting\ACAD 2007 Setups\11x17 Metric.dwt"
ss.GetAltPageSetups.SetFileName (TestinG)

Dim oEnum As IAcSmEnumComponent
Set oEnum = ss.GetSheetEnumerator
Dim comp As IAcSmComponent
Set comp = oEnum.Next
Do While Not comp Is Nothing
If comp.GetTypeName = "AcSmSubset" Then
Dim subset As AcSmSubset
Set subset = comp
Call Sub_DST_Paths(subset)
End If

Set comp = oEnum.Next
Loop

' unlock the database
Call db.UnlockDb(db, True)

' close
Call ssm.Close(db)
exitHere:
Set ss = Nothing
Set ssm = Nothing
Set db = Nothing
Exit Sub

whatsWrong:
If Err Then
Debug.Print "SSM err: " & Err.Description
Err.Clear
End If
On Error GoTo 0
Call db.UnlockDb(db, True)
Resume exitHere
End Sub
[/code]
0 Likes
495 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
"C Witt" wrote in message
news:5343163@discussion.autodesk.com...
I've been trying to set a file path to the
"GetAltPageSetups.SetFileName" object in my sheet set file (it is for
the page setup overrides).



' get the sheetset
Set ss = db.GetSheetSet

I'm not familiar with sheetset but do you test
If ss is nothing then...
before going on to the rest of your code?


the other thing that looks unusual is...
ss.GetAltPageSetups.SetFileName (TestinG)

that looks like it needs a call statement
Call ss.GetAltPageSetups.SetFileName (TestinG)
or drop the parens
ss.GetAltPageSetups.SetFileName TestinG

maybe sheet set is different but that's normal vb syntax
hth
Mark
0 Likes
Message 3 of 7

Anonymous
Not applicable
yes. i dumb down the code to just this task. everything else i do
works.. (changing plot pathing and template drawing paths). It's only
this that is a problem.
0 Likes
Message 4 of 7

Anonymous
Not applicable
Why are you no using the Sheet Set's SetAltPageSetups method?

--
R. Robert Bell


"C Witt" wrote in message
news:5343163@discussion.autodesk.com...
I've been trying to set a file path to the
"GetAltPageSetups.SetFileName" object in my sheet set file (it is for
the page setup overrides).

my problem is that if there is no path there to begin with my code fails
100% of the time giving me the error "SSM err: Object variable or With
block variable not set". I can't figure out what is wrong with it.

Anyone?

[code]
Sub Auto_DST_Paths(DSTPath As String)
Dim pathstart As String
Dim pathend As String
On Error GoTo whatsWrong
Set ssm = CreateObject("AcSmComponents.AcSmSheetSetMgr.17")

' open the database file
Set db = ssm.OpenDatabase(DSTPath, True)
' lock the database
Call db.LockDb(db)

' get the sheetset
Set ss = db.GetSheetSet

Dim TestinG As String
TestinG = "O:\Plotting\ACAD 2007 Setups\11x17 Metric.dwt"
ss.GetAltPageSetups.SetFileName (TestinG)

Dim oEnum As IAcSmEnumComponent
Set oEnum = ss.GetSheetEnumerator
Dim comp As IAcSmComponent
Set comp = oEnum.Next
Do While Not comp Is Nothing
If comp.GetTypeName = "AcSmSubset" Then
Dim subset As AcSmSubset
Set subset = comp
Call Sub_DST_Paths(subset)
End If

Set comp = oEnum.Next
Loop

' unlock the database
Call db.UnlockDb(db, True)

' close
Call ssm.Close(db)
exitHere:
Set ss = Nothing
Set ssm = Nothing
Set db = Nothing
Exit Sub

whatsWrong:
If Err Then
Debug.Print "SSM err: " & Err.Description
Err.Clear
End If
On Error GoTo 0
Call db.UnlockDb(db, True)
Resume exitHere
End Sub
[/code]
0 Likes
Message 5 of 7

Anonymous
Not applicable
There is no documentation on how to use it.. If you could tell me how
to use it?

SetAltPageSetups(pDwtRef As IAcSmFileReference)

??
0 Likes
Message 6 of 7

Anonymous
Not applicable
Sub Test()
Dim mySSM As AcSmSheetSetMgr
Set mySSM = New AcSmSheetSetMgr

Dim myDb As AcSmDatabase
Set myDb = mySSM.OpenDatabase("C:\Temp\Test.dst", False)

Dim mySSet As AcSmSheetSet
Set mySSet = myDb.GetSheetSet

Dim myFile As AcSmFileReference
Set myFile = New AcSmFileReference
myFile.InitNew mySSet

If LockDatabase(myDb) Then
myFile.SetFileName "C:\Temp\Test.dwt"
mySSet.SetAltPageSetups myFile
UnlockDatabase myDb
End If
End Sub


--
R. Robert Bell


"C Witt" wrote in message
news:5343977@discussion.autodesk.com...
There is no documentation on how to use it.. If you could tell me how
to use it?

SetAltPageSetups(pDwtRef As IAcSmFileReference)

??
0 Likes
Message 7 of 7

Anonymous
Not applicable
Ah. Thank you very much.
0 Likes