Results 1 to 3 of 3

Thread: Auto Synchronization to central file upon opening a local Revit file

  1. #1
    Member
    Join Date
    2014-02
    Posts
    4
    Login to Give a bone
    0

    Default Auto Synchronization to central file upon opening a local Revit file



    I work in C# .Net and I use Revit api for a plugin in Revit .

    I am currently using Revit Architecure 2012.

    i am able to synchronize a local file up on clicking the "Synchronize option" in Revit by implementing "Document.SynchronizeWithCentral method"


    I want to know is Can I invoke the method "Document.SynchronizeWithCentral method" on opening a local revit file ? (Autosynchronize while

    opening a local revit file to central)


    I want to do something like this

    private void oCtrlApplication_DocumentOpened(object sender, DocumentOpenedEventArgs e)
    {
    try
    {

    oCtrlApplication_DocumentSynchronizingWithCentral(sender, e);
    }
    catch { }
    }

    Invoke the DocumentSynchronizingWithCentral event, when I open a revit local file to synchronize with the central file.

    The above code will not work as I can not cast "DocumentOpenedEventArgs e" to the "DocumentSynchronizingWithCentralEventArgs e"

    in DocumentSynchronizingWithCentral event.

    Regards
    Manosh Jacob

  2. #2
    Member
    Join Date
    2012-09
    Posts
    34
    Login to Give a bone
    0

    Default Re: Auto Synchronization to central file upon opening a local Revit file

    In Revit 2012, there is no way to synchronize a document to central. This was only introduced in the Revit 2014 API.

    Additionally, you can't trigger a SynchronizingWithCentral event yourself. You need to actually synchronize the document in the Revit UI (or via code, as of 2014) for the event to be called.

    I'd recommend taking a look at some of the SDK Samples, and starting with some more simple addins, before you attempt to create an addin like this.

  3. #3
    Member
    Join Date
    2014-02
    Posts
    4
    Login to Give a bone
    0

    Default Re: Auto Synchronization to central file upon opening a local Revit file

    I found an alternative method by triggering the "Shorcut keys" for syncing after the document is opened though is is not a very effective way to do it

    As i dont have a direct method to achieve the same, I am gonna rely on it.

    Thank you for your help and support. If there are any other ways please do let me know

    For the sake of the others i am going paste my code here

    var tokenSource = new CancellationTokenSource();
    var token = tokenSource.Token;
    var task = Task.Factory.StartNew(() =>
    {
    token.WaitHandle.WaitOne(5000);
    token.ThrowIfCancellationRequested();
    Sync();
    });

    public static void Sync()
    {
    try
    {

    SendKeys.SendWait("{F10}");
    SendKeys.SendWait("3");
    SendKeys.SendWait("{ENTER}");
    }
    catch (Exception ex)
    {
    //System.Windows.Forms.MessageBox.Show(ex.Message);
    }
    }

Similar Threads

  1. Detached Revit Local File - (Anyway to reattach or copy worksets over to central file)
    By Reviting in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 2
    Last Post: 2014-05-23, 05:17 PM
  2. Creation of local file and synchronization error
    By wongkuanwei570223 in forum BIM Management - General
    Replies: 3
    Last Post: 2014-03-10, 09:44 PM
  3. 2014: Revit reporting Central File is not available, no one else is in file, can't save, won't create local file
    By patricks in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 3
    Last Post: 2013-10-03, 10:31 PM
  4. Local File Incompatible with Central File - Revit 2010 Error??
    By ekneer in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 4
    Last Post: 2010-02-18, 03:51 PM
  5. Recover backup of Revit Central or Local File
    By pbyrne in forum Revit - Worksharing/Worksets/Revit Server
    Replies: 2
    Last Post: 2006-10-21, 04:39 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •