Saving a sheetset

Saving a sheetset

Anonymous
Not applicable
487 Views
1 Reply
Message 1 of 2

Saving a sheetset

Anonymous
Not applicable

Hello all,

 

working in my office automation again, and I was wondereing on the best way to duplicate/update a sheetset. My current routine is opening a sheetset by making a temporary file out of it. This temp file is then manipulated with the routine, and it seems to work quite well. When the user finishes, I want to be able to transfer the temporary sheetset object to the origional sheetset object and then save the origional sheetset object... unfortunatly I am having trouble understanding the AcSmSheetset.Save method with its arguments.

 

here is my code: (this ofcourse throws an error.

 

Private Function SaveSheetSet() As DialogResult
        ''Throw New NotImplementedException

        Dim mySS As AcSmSheetSet = mySSDB.GetSheetSet
        Dim mySSOrig As AcSmSheetSet = mySSDBOrig.GetSheetSet

        Dim result As DialogResult
        Dim save As Boolean = True


        If mySSOrig.GetIsDirty Then
            '' Sheet set has been edited outside of this owner
            result = MessageBox.Show("It seems that the Sheetset has been edited. Click Yes to overwrite and exit, No to not save and exit, Cancel to abort save and return to dialog.", "Save Sheetset", MessageBoxButtons.YesNoCancel)
            If result = DialogResult.Yes Then
                save = True
            Else
                save = False
            End If
        End If

        If save Then
            '' save the sheetset
            ToolStripStatusLabel1.Text = "Saving Sheetset..."
            LockSSM(mySSDBOrig)
            LockSSM(mySSDB)

            Dim pFiler As IAcSmFiler = Nothing

            mySSOrig = mySS
            pFiler.Init(mySSOrig, mySSOrig.GetDatabase, True)
            mySSOrig.Save(pFiler)

            UnlockSSM(mySSDB)
            UnlockSSM(mySSDBOrig)
            ToolStripStatusLabel1.Text = "Ready."
        End If

        Return result

    End Function

 

0 Likes
Accepted solutions (1)
488 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Worked it out (i hope).

 

the resultant code is:

 

Private Function SaveSheetSet() As DialogResult
        ''Throw New NotImplementedException

        Dim mySS As AcSmSheetSet = mySSDB.GetSheetSet
        Dim mySSOrig As AcSmSheetSet = mySSDBOrig.GetSheetSet

        Dim result As DialogResult
        Dim save As Boolean = True


        If mySSOrig.GetIsDirty Then
            '' Sheet set has been edited outside of this owner
            result = MessageBox.Show("It seems that the Sheetset has been edited. Click Yes to overwrite and exit, No to not save and exit, Cancel to abort save and return to dialog.", "Save Sheetset", MessageBoxButtons.YesNoCancel)
            If result = DialogResult.Yes Then
                save = True
            Else
                save = False
            End If
        End If

        If save Then
            '' save the sheetset
            ToolStripStatusLabel1.Text = "Saving Sheetset..."
            LockSSM(mySSDBOrig)
            LockSSM(mySSDB)

            mySSDBOrig = mySSDB

            UnlockSSM(mySSDB)
            UnlockSSM(mySSDBOrig)
            ToolStripStatusLabel1.Text = "Ready."
        End If

        Return result

    End Function

 

0 Likes