Exemple #1
0
        virtual public bool OpenDocument(string fileName)
        {
            if (isDocumentModified && documentFileName != string.Empty)
            {
                if (OnOpenDocumentPrompt != null)
                {
                    ProjectOpenPromptEventArgs args = new ProjectOpenPromptEventArgs();

                    OnOpenDocumentPrompt(this, args);
                }
            }

            if (OnOpenDocument != null)
            {
                DocumentOpenEventArgs args = new DocumentOpenEventArgs();

                OnOpenDocument(this, args);

                DocumentFileName   = fileName;
                IsDocumentModified = false;

                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// OnEndOpenDocument event handler.
 /// </summary>
 void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     // By the time we get here, our user data has been read from the document
     // (if there was any). So, call Refresh() to notify anyone watching for
     // this event.
     SampleCsStringTableHelpers.Refresh();
 }
Exemple #3
0
        private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e)
        {
            if (e.Merge) // this is a paste or import event
            {
                // get incoming streams
                var incomingStreams = e.Document.Strings.GetEntryNames(SpeckleKey);

                // remove any that don't already exist in the current active doc
                foreach (var incomingStream in incomingStreams)
                {
                    if (!ExistingStreams.Contains(incomingStream))
                    {
                        RhinoDoc.ActiveDoc.Strings.Delete(SpeckleKey, incomingStream);
                    }
                }

                // skip binding
                return;
            }

            var bindings = new ConnectorBindingsRhino();

            if (bindings.GetStreamsInFile().Count > 0)
            {
                SpeckleCommand.Instance.StartOrShowPanel();
            }
        }
Exemple #4
0
 private void RhinoDoc_BeginOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     if (e.Merge) // this is a paste or import event
     {
         // get existing streams in doc before a paste or import operation to use for cleanup
         ExistingStreams = RhinoDoc.ActiveDoc.Strings.GetEntryNames(SpeckleKey).ToList();
     }
 }
 void BeginOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     if (Instances.ActiveCanvas?.Document is GH_Document definition)
     {
         activeDefinitionWasEnabled = definition.Enabled;
         definition.Enabled         = false;
     }
 }
 void EndOpenDocumentInitialViewUpdate(object sender, DocumentOpenEventArgs e)
 {
     if (Instances.ActiveCanvas?.Document is GH_Document definition)
     {
         definition.Enabled = activeDefinitionWasEnabled;
         definition.NewSolution(false);
     }
 }
Exemple #7
0
 private static void On_EndOpenDocumentInitialiViewUpdate(object sender, DocumentOpenEventArgs e)
 {
     if (DEBUG)
     {
         log.debug(g._RhinoDoc, "On_EndOpenDocumentInitialiViewUpdate");
     }
     OnIdleEnabled = true;
     stopwatch_Idle10timesOnSecond.Restart();
     if (EndOpenDocumentInitialiViewUpdate == null)
     {
         return;
     }
     Shared.TryCatchAction(() => EndOpenDocumentInitialiViewUpdate(sender, e), g._RhinoDoc, "exception in EndOpenDocumentInitialiViewUpdate event");
 }
Exemple #8
0
 private static void On_EndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     if (DEBUG)
     {
         log.debug(g._RhinoDoc, "On_EndOpenDocument");
     }
     IsSelectionMayHaveChangedSinceLastOnIdle = true;
     IsSelectionMayHaveChangedSinceLastOnIdle10timesOnSecond = true;
     if (EndOpenDocument == null)
     {
         return;
     }
     Shared.TryCatchAction(() => EndOpenDocument(sender, e), g._RhinoDoc, "exception in EndOpenDocument event");
 }
Exemple #9
0
 private void EndOpen(object sender, DocumentOpenEventArgs e)
 {
     //Add shapes to the world after open the saved file
     for (int i = 0; i < RigidBodyRhinoPlugIn.WorldCount; i++)
     {
         RigidBody currentRigidBody = RigidBodyManager.RigidBodies[i];
         RigidBodyManager.World.AddBody(currentRigidBody);
         TimePanel.Instance.DrawGeometry(i, currentRigidBody);
     }
     for (int i = 0; i < RigidBodyManager.GuidList.Count; i++)
     {
         RhinoDoc.ActiveDoc.Objects.Unlock(RigidBodyManager.GuidList[i], true);
     }
 }
Exemple #10
0
 private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     Debug.WriteLine("END OPEN DOC");
     // this seems to cover the copy paste issues
     if (e.Merge)
     {
         return;
     }
     // purge clients from ui
     NotifySpeckleFrame("client-purge", "", "");
     // purge clients from here
     RemoveAllClients();
     // read clients from document strings
     InstantiateFileClients();
 }
 private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     //Check if object is copied
     if (e.FileName.EndsWith("tmp") && e.Merge)
     {
         //this is a copy/paste action
         this._isObjectCopied = true;
         this._mergedCounts   = e.Document.Objects.Count - this._mergedCounts;
         Rhino.RhinoApp.WriteLine($"Total {this._mergedCounts} objects merged");
     }
     else
     {
         //reset flags
         this._isObjectCopied = false;
         this._mergedCounts   = 0;
     }
 }
Exemple #12
0
        /// <summary>
        /// This gets called when Rhino is finished loading all data from a 3dm file,
        /// so we can go ahead and recreate all custom objects from their geometry and userdata
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RhinoDoc_EndOpenDocument(object sender, DocumentOpenEventArgs e)
        {
            RhinoDoc doc = e.Document;

            foreach (var docObject in doc.Objects)
            {
                // try to find our user data on a given doc object
                var data = docObject.Attributes.UserData.Find(typeof(RectangleData)) as RectangleData;
                if (data is null)
                {
                    continue;
                }

                // Update data to restore auto implemented properties
                data.Update();

                // create a shiny new custom Object from the stored data
                var customObject = data.CreateCustomObject();

                // replace original object in doc
                doc.Objects.Replace(new ObjRef(docObject), customObject);
            }
        }
Exemple #13
0
        virtual public bool OpenDocument()
        {
            if (isDocumentModified && documentFileName != string.Empty)
            {
                if (OnOpenDocumentPrompt != null)
                {
                    ProjectOpenPromptEventArgs args = new ProjectOpenPromptEventArgs();

                    OnOpenDocumentPrompt(this, args);

                    if (!args.IsHandled)
                    {
                        return(false);
                    }
                }
            }

            if (OnOpenDocument != null)
            {
                DocumentOpenEventArgs args = new DocumentOpenEventArgs();
                args.isHandled = false;

                OnOpenDocument(this, args);
                if (args.isHandled)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #14
0
 /// <summary>
 /// Called when Rhino finishes opening a new document
 /// </summary>
 public static void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     DebugWriteMethod();
     //update layer table info
     //RhinoEventListeners.g_instance.WriteLayers();
 }
Exemple #15
0
 /// <summary>
 /// Called when Rhino begins to open a new document
 /// </summary>
 public static void OnBeginOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     DebugWriteMethod();
 }
Exemple #16
0
 /// <summary>
 /// RhinoDoc.EndOpenDocument event handler
 /// </summary>
 private void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     m_current_event = LayoutEvent.Open;
     m_text.Text     = "";
     RhinoApp.Idle  += OnIdle;
 }
 /// <summary>
 /// Called when Rhino finishes opening a new document
 /// </summary>
 public static void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     RhinoApp.WriteLine("** EVENT: End Open Document **");
 }
 private void RhinoDoc_BeginOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     this._mergedCounts = e.Document.Objects.Count;
 }
Exemple #19
0
 private static void On_BeginOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     UpdateIndexes(e.Document);
 }
 private void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
 {
     //FillList();
     RhinoApp.Idle += OnIdle;
 }