public void SwitchDocuments() { var model = dynSettings.Controller.DynamoModel; //open the workflow and run the expression string testPath = Path.Combine(_testPath, @".\ReferencePoint\ReferencePoint.dyn"); model.Open(testPath); Assert.AreEqual(3, dynSettings.Controller.DynamoModel.Nodes.Count()); Assert.DoesNotThrow(() => dynSettings.Controller.RunExpression()); //verify we have a reference point var fec = new FilteredElementCollector((Autodesk.Revit.DB.Document)DocumentManager.Instance.CurrentDBDocument); fec.OfClass(typeof(ReferencePoint)); Assert.AreEqual(1, fec.ToElements().Count()); //open a new document and activate it var initialDoc = (UIDocument)DocumentManager.Instance.CurrentUIDocument; string shellPath = Path.Combine(_testPath, @".\empty1.rfa"); TransactionManager.Instance.ForceCloseTransaction(); ((UIApplication)DocumentManager.Instance.CurrentUIApplication).OpenAndActivateDocument(shellPath); initialDoc.Document.Close(false); ////assert that the doc is set on the controller Assert.IsNotNull((Document)DocumentManager.Instance.CurrentDBDocument); ////update the double node so the graph reevaluates var doubleNodes = dynSettings.Controller.DynamoModel.Nodes.Where(x => x is BasicInteractive <double>); BasicInteractive <double> node = doubleNodes.First() as BasicInteractive <double>; node.Value = node.Value + .1; ////run the expression again Assert.DoesNotThrow(() => dynSettings.Controller.RunExpression()); //fec = new FilteredElementCollector(dynRevitSettings.Doc.Document); //fec.OfClass(typeof(ReferencePoint)); //Assert.AreEqual(1, fec.ToElements().Count()); //finish out by restoring the original //initialDoc = DocumentManager.GetInstance().CurrentUIApplication.ActiveUIDocument; //shellPath = Path.Combine(_testPath, @"empty.rfa"); //DocumentManager.GetInstance().CurrentUIApplication.OpenAndActivateDocument(shellPath); //initialDoc.Document.Close(false); }
public void SwitchDocuments() { var model = dynSettings.Controller.DynamoModel; //open the workflow and run the expression string testPath = Path.Combine(_testPath, "ReferencePointTest.dyn"); model.Open(testPath); Assert.AreEqual(3, dynSettings.Controller.DynamoModel.Nodes.Count()); dynSettings.Controller.RunExpression(true); //verify we have a reference point FilteredElementCollector fec = new FilteredElementCollector(dynRevitSettings.Doc.Document); fec.OfClass(typeof(ReferencePoint)); Assert.AreEqual(1, fec.ToElements().Count()); //open a new document and activate it UIDocument initialDoc = dynRevitSettings.Revit.ActiveUIDocument; string shellPath = Path.Combine(_testPath, @"empty1.rfa"); dynRevitSettings.Revit.OpenAndActivateDocument(shellPath); initialDoc.Document.Close(false); //assert that the doc is set on the controller Assert.IsNotNull(dynRevitSettings.Doc.Document); //update the double node so the graph reevaluates var doubleNodes = dynSettings.Controller.DynamoModel.Nodes.Where(x => x is BasicInteractive <double>); BasicInteractive <double> node = doubleNodes.First() as BasicInteractive <double>; node.Value = node.Value + .1; //run the expression again dynSettings.Controller.RunExpression(true); fec = new FilteredElementCollector(dynRevitSettings.Doc.Document); fec.OfClass(typeof(ReferencePoint)); Assert.AreEqual(1, fec.ToElements().Count()); //finish out by restoring the original initialDoc = dynRevitSettings.Revit.ActiveUIDocument; shellPath = Path.Combine(_testPath, @"empty.rfa"); dynRevitSettings.Revit.OpenAndActivateDocument(shellPath); initialDoc.Document.Close(false); }
private void Start() { bi = GetComponent <BasicInteractive>(); ItemSystem.AllItemList.Add(new ItemSystem.ItemInBlank(itemName, subtitleInBlank, subtitleWhenAdded, sprite)); }