<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bind and save in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480280#M70748</link>
    <description>Hi Tony, &lt;BR /&gt;
&lt;BR /&gt;
Most of the time, db.SaveAs command works fine, but sometimes, this command and the automatic saving commands produces some error : it always save my file at its opening state. That is to say that all my modifications are suppressed, and the drawing return to its opening state, Every update is lost !&lt;BR /&gt;
Do you have an idea of what is happening ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for all your help.</description>
    <pubDate>Mon, 21 Sep 2009 10:36:42 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-09-21T10:36:42Z</dc:date>
    <item>
      <title>Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480273#M70741</link>
      <description>Ok, I have put together a tool that goes through and batch binds, prints, PDF's and DWF's files (subject to user choice) everything works fine except once its finished with the drawing its publishing it closes and doesnt seem to save (none of the xrefs are bound when opened again) although if I watch the process I can see the refs being removed in the xref manager.&lt;BR /&gt;
&lt;BR /&gt;
here is a snippet of code but dont know if you would want to see the actual bind process, PUBpage has a number of process indicators that show the progress:&lt;BR /&gt;
&lt;BR /&gt;
Help please someone must know what im doing wrong.&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
Dim dwg&lt;BR /&gt;
dwg = Application.DocumentManager.Open(DestinationFile, False)&lt;BR /&gt;
Dim ThisDrawing As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
Using LockDB As DocumentLock = ThisDrawing.LockDocument()&lt;BR /&gt;
 '-----------secondary publish--------------&lt;BR /&gt;
 'Bind drawings&lt;BR /&gt;
If lines(2) = 1 Then&lt;BR /&gt;
'progress meter&lt;BR /&gt;
pubPage.BoundProgress.Value = ((ActionList.Items.Count * 100) - (j * 100))&lt;BR /&gt;
pubPage.BoundVal.Text = j&lt;BR /&gt;
bindAllDrawings()&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
If lines(5) = 1 Then&lt;BR /&gt;
'Print DWFs''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''&lt;BR /&gt;
PrintDWFFiles(lines, FinIsFolder.Text &amp;amp; "\" &amp;amp; Strings.Left(DWGNm, Len(DWGNm) - 4))&lt;BR /&gt;
'progress meter&lt;BR /&gt;
pubPage.DWFProgress.Value = ((ActionList.Items.Count * 100) - (j * 100))&lt;BR /&gt;
pubPage.DWFVal.Text = j&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
'Print PDFs&lt;BR /&gt;
If lines(6) = 1 Then&lt;BR /&gt;
PrintPDFFiles(lines, FinIsFolder.Text &amp;amp; "\" &amp;amp; Strings.Left(DWGNm, Len(DWGNm) - 4))&lt;BR /&gt;
'progress meter&lt;BR /&gt;
pubPage.PDFProgress.Value = ((ActionList.Items.Count * 100) - (j * 100))&lt;BR /&gt;
pubPage.PDFVal.Text = j&lt;BR /&gt;
End If&lt;BR /&gt;
'close and save the drawing&lt;BR /&gt;
&lt;BR /&gt;
Dim DB As Database = ThisDrawing.Database&lt;BR /&gt;
DB.SaveAs(DWGNm, DwgVersion.Current)&lt;BR /&gt;
&lt;BR /&gt;
End Using&lt;BR /&gt;
ThisDrawing.CloseAndSave(DWGNm)&lt;BR /&gt;
ThisDrawing.Dispose()&lt;BR /&gt;
&lt;BR /&gt;
Next&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
Daniel

Edited by: dheselwood on May 1, 2009 9:16 AM</description>
      <pubDate>Fri, 01 May 2009 09:16:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480273#M70741</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T09:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480274#M70742</link>
      <description>This will get the Xref list and bind the files. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    {code}&lt;BR /&gt;
    Public Sub QuickBind()&lt;BR /&gt;
        Dim dwg As Document&lt;BR /&gt;
        Dim DestinationFile As String = "c:\test\myFile.dwg"&lt;BR /&gt;
        dwg = Application.DocumentManager.Open(DestinationFile, False)&lt;BR /&gt;
        Dim ThisDrawing As Document = Application.DocumentManager.MdiActiveDocument&lt;BR /&gt;
        Using LockDB As DocumentLock = ThisDrawing.LockDocument()&lt;BR /&gt;
            Dim db As Database = dwg.Database&lt;BR /&gt;
            Dim transMan As DatabaseServices.TransactionManager = db.TransactionManager&lt;BR /&gt;
            Using trans As Transaction = transMan.StartTransaction&lt;BR /&gt;
                Dim iDColl As New ObjectIdCollection&lt;BR /&gt;
                ' get list of Xref's &lt;BR /&gt;
                getXref(db, iDColl)&lt;BR /&gt;
                If iDColl.Count &amp;gt; 0 Then&lt;BR /&gt;
                    db.BindXrefs(iDColl, False)&lt;BR /&gt;
                    trans.Commit()&lt;BR /&gt;
                    db.SaveAs(DestinationFile, DwgVersion.Current)&lt;BR /&gt;
                Else&lt;BR /&gt;
                    trans.Commit()&lt;BR /&gt;
                End If&lt;BR /&gt;
            End Using&lt;BR /&gt;
        End Using&lt;BR /&gt;
        ThisDrawing.CloseAndDiscard()&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub getXref(ByVal db As Database, ByRef idColl As ObjectIdCollection)&lt;BR /&gt;
&lt;BR /&gt;
        Dim transMan As DatabaseServices.TransactionManager = db.TransactionManager&lt;BR /&gt;
        Using trans As Transaction = transMan.StartTransaction&lt;BR /&gt;
            Dim xrgraph As XrefGraph = db.GetHostDwgXrefGraph(False)&lt;BR /&gt;
            ' look at all Nodes in the XrefGraph.  Skip 0 node since it is the drawing itself.&lt;BR /&gt;
            For i As Integer = 1 To (xrgraph.NumNodes - 1)&lt;BR /&gt;
                Dim xrNode As XrefGraphNode = xrgraph.GetXrefNode(i)&lt;BR /&gt;
                Dim btr As BlockTableRecord = DirectCast(trans.GetObject(xrNode.BlockTableRecordId, OpenMode.ForWrite), BlockTableRecord)&lt;BR /&gt;
                ' Add Xref's to Collection&lt;BR /&gt;
                idColl.Add(btr.ObjectId)&lt;BR /&gt;
            Next&lt;BR /&gt;
        End Using&lt;BR /&gt;
    End Sub&lt;BR /&gt;
    {code}</description>
      <pubDate>Fri, 01 May 2009 15:16:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480274#M70742</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2009-05-01T15:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480275#M70743</link>
      <description>The binding function works fine, If I (dare I say it) place in a sendCommandToExecute("qsave close ") and close the drawing that way, it saves all changes and when I open, all the references are saved, the problem I have is that I can seem to do it with the closeAndSave feature, just doesnt seem to save anything? Its Bizarre.</description>
      <pubDate>Fri, 01 May 2009 15:24:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480275#M70743</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T15:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480276#M70744</link>
      <description>Make sure you commit your transaction before saving</description>
      <pubDate>Fri, 01 May 2009 15:28:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480276#M70744</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2009-05-01T15:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480277#M70745</link>
      <description>DataBase.SaveAs() method is not implemeted, AFAIK. That is, it does nothing. You need to use different approach to save your changed drawing.</description>
      <pubDate>Fri, 01 May 2009 16:49:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480277#M70745</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2009-05-01T16:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480278#M70746</link>
      <description>Why do you say that? It works fine for me.</description>
      <pubDate>Fri, 01 May 2009 17:33:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480278#M70746</guid>
      <dc:creator>arcticad</dc:creator>
      <dc:date>2009-05-01T17:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480279#M70747</link>
      <description>SaveAs() works, it's Save() that doesn't do anything.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;ARCTICAD&gt; wrote in message news:6175104@discussion.autodesk.com...&lt;BR /&gt;
Why do you say that? It works fine for me.&lt;/ARCTICAD&gt;</description>
      <pubDate>Fri, 01 May 2009 19:14:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480279#M70747</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T19:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bind and save</title>
      <link>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480280#M70748</link>
      <description>Hi Tony, &lt;BR /&gt;
&lt;BR /&gt;
Most of the time, db.SaveAs command works fine, but sometimes, this command and the automatic saving commands produces some error : it always save my file at its opening state. That is to say that all my modifications are suppressed, and the drawing return to its opening state, Every update is lost !&lt;BR /&gt;
Do you have an idea of what is happening ?&lt;BR /&gt;
&lt;BR /&gt;
Thanks a lot for all your help.</description>
      <pubDate>Mon, 21 Sep 2009 10:36:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/bind-and-save/m-p/2480280#M70748</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-09-21T10:36:42Z</dc:date>
    </item>
  </channel>
</rss>

