Beispiel #1
0
        // OnInstanceBegin marks the beginning of a family instance to be exported.
        public RenderNodeAction OnInstanceBegin(
            InstanceNode InInstanceNode             // family instance output node
            )
        {
            Element CurrentFamilySymbol = GetElement(InInstanceNode.GetSymbolId());

            if (CurrentFamilySymbol != null)
            {
                // Keep track of the world transform for the instance being processed.
                WorldTransformStack.Push(WorldTransformStack.Peek().Multiply(InInstanceNode.GetTransform()));

                ElementType CurrentInstanceType = CurrentFamilySymbol as ElementType;

                // Keep track of the instance being processed.
                if (CurrentInstanceType != null)
                {
                    PushInstance(CurrentInstanceType, WorldTransformStack.Peek(), "Instance Begin");
                }
                else
                {
                    CurrentElementSkipped = !PushElement(CurrentFamilySymbol, WorldTransformStack.Peek(), "Symbol Begin");
                }
            }

            // We always wanna proceed, because in certain cases where InInstanceNode is valid but CurrentInstance is not,
            // what follows is valid geometry related to the instance previously exported.
            return(CurrentElementSkipped ? RenderNodeAction.Skip : RenderNodeAction.Proceed);
        }
        RenderNodeAction IExportContext.OnInstanceBegin(InstanceNode node)
        {
            Transform t = node.GetTransform();

            MessageBox.Show(node.NodeName + ":" + t.Scale, "OnInstanceBegin");

            return(RenderNodeAction.Proceed);
        }
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            // This method marks the start of processing a family instance
            transformationStack.Push(transformationStack.Peek().Multiply(node.GetTransform()));

            // We can either skip this instance or proceed with rendering it.
            return(RenderNodeAction.Proceed);
        }
Beispiel #4
0
        /// <summary>
        /// This is called when family instances are encountered, before OnElementEnd.
        /// We're using it here to maintain the transform stack for that element's heirarchy.
        /// </summary>
        /// <param name="node"></param>
        public void OnInstanceEnd(InstanceNode node)
        {
            Debug.WriteLine(String.Format("{0}OnInstanceEnd", manager.formatDebugHeirarchy.Substring(0, manager.formatDebugHeirarchy.Count() - 2)));

            ElementId symId   = node.GetSymbolId();
            Element   symElem = _doc.GetElement(symId);

            manager.CloseNode(symElem, true);
        }
Beispiel #5
0
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            Debug.WriteLine("  OnInstanceBegin: " + node.NodeName + " symbol: " + node.GetSymbolId().IntegerValue);
            // This method marks the start of processing a family instance
            _transformationStack.Push(CurrentTransform.Multiply(node.GetTransform()));

            // We can either skip this instance or proceed with rendering it.
            return(RenderNodeAction.Proceed);
        }
        /// <summary>
        /// Resolves the database node reference.
        /// </summary>
        public override void ResolveNodeReferences()
        {
            base.ResolveNodeReferences();
            DatabaseSettingsNode databaseSettingsNode = Hierarchy.FindNodeByType(typeof(DatabaseSettingsNode)) as DatabaseSettingsNode;

            Debug.Assert(databaseSettingsNode != null, "How is it that the database settings are not there?");
            InstanceCollectionNode instanceCollectionNode = Hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;

            this.Database = Hierarchy.FindNodeByName(instanceCollectionNode, this.dbProfileProviderData.Database) as InstanceNode;
        }
Beispiel #7
0
        public void OnInstanceEnd(InstanceNode node)
        {
            Debug.WriteLine("  OnInstanceEnd: "
                            + node.NodeName);

            // Note: This method is invoked even
            // for instances that were skipped.

            _transformationStack.Pop();
        }
Beispiel #8
0
        /// <summary>
        /// This is called when family instances are encountered, immediately after OnElementBegin.
        /// We're using it here to maintain the transform stack for that element's heirarchy.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            Debug.WriteLine("  OnInstanceBegin");
            _transformStack.Push(
                CurrentTransform.Multiply(node.GetTransform())
                );

            // We can either skip this instance or proceed with rendering it.
            return(RenderNodeAction.Proceed);
        }
        public override void SetUp()
        {
            base.SetUp();
            DatabaseSettings     databaseSettings     = DatabaseSettingsBuilder.Create(Host);
            DatabaseSettingsNode databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);

            GeneratedApplicationNode.Nodes.Add(databaseSettingsNode);
            databaseSettingsNode.ResolveNodeReferences();
            InstanceCollectionNode collectionNode = GeneratedHierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;

            instanceNode = GeneratedHierarchy.FindNodeByName(collectionNode, name) as InstanceNode;
        }
Beispiel #10
0
        /// <summary>
        /// This method marks the start of processing a family instance
        /// https://www.revitapidocs.com/2018/2db35bdb-8d14-a015-9bfb-9283f503edab.htm
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            // We can get particular information about the family instance and its type if we need to
            ElementId    symbolId  = node.GetSymbolId();
            FamilySymbol famSymbol = doc.GetElement(symbolId) as FamilySymbol;

            // Typically, an export context has to manage a stack of transformation
            // for all nested objects, such as instances, lights, links, etc.
            // A combined transformation needs to be applied to the incoming geometry
            // (providing all geometry is to be flattened in the resultant format.)
            tfStack.Push(tfStack.Peek().Multiply(node.GetTransform()));
            return(RenderNodeAction.Proceed);
        }
Beispiel #11
0
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            Transform     t  = node.GetTransform();
            MessageBuffer mb = new MessageBuffer();

            mb.add(node.GetSymbolId().IntegerValue);
            mb.add(node.NodeName);
            mb.add(t.BasisX.Multiply(t.Scale));
            mb.add(t.BasisY.Multiply(t.Scale));
            mb.add(t.BasisZ.Multiply(t.Scale));
            mb.add(t.Origin);
            OpenCOVERPlugin.COVER.Instance.sendMessage(mb.buf, OpenCOVERPlugin.COVER.MessageTypes.NewInstance);
            return(RenderNodeAction.Proceed);
        }
Beispiel #12
0
        /// <summary>
        /// This is called when family instances are encountered, after OnElementBegin.
        /// We're using it here to maintain the transform stack for that element's heirarchy.
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            Debug.WriteLine(String.Format("{0}OnInstanceBegin", manager.formatDebugHeirarchy));

            ElementId symId   = node.GetSymbolId();
            Element   symElem = _doc.GetElement(symId);

            Debug.WriteLine(String.Format("{2}OnInstanceBegin: {0}-{1}", symId, symElem.Name, manager.formatDebugHeirarchy));

            var nodeXform = node.GetTransform();

            manager.OpenNode(symElem, nodeXform.IsIdentity ? null : nodeXform, true);

            return(RenderNodeAction.Proceed);
        }
        public void NewDatabaseTypeNodeTest()
        {
            IUIHierarchy               hierarchy                  = HierarchyService.SelectedHierarchy;
            InstanceCollectionNode     collectionNode             = hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;
            InstanceNode               localInstanceNode          = hierarchy.FindNodeByName(collectionNode, name) as InstanceNode;
            DatabaseTypeCollectionNode databaseTypeCollectionNode = hierarchy.FindNodeByType(typeof(DatabaseTypeCollectionNode)) as DatabaseTypeCollectionNode;
            DatabaseTypeNode           databaseTypeNode           = hierarchy.FindNodeByName(databaseTypeCollectionNode, "SqlServer") as DatabaseTypeNode;

            localInstanceNode.DatabaseTypeNode = databaseTypeNode;
            Assert.AreEqual(databaseTypeNode.Name, localInstanceNode.DatabaseTypeName);
            databaseTypeNode.Name = "newName";
            Assert.AreEqual(databaseTypeNode.Name, localInstanceNode.DatabaseTypeName);
            databaseTypeNode.Remove();
            Assert.IsNull(localInstanceNode.DatabaseTypeNode);
        }
        public void NewConnectionStringNodeTest()
        {
            IUIHierarchy                   hierarchy      = HierarchyService.SelectedHierarchy;
            InstanceCollectionNode         collectionNode = hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;
            InstanceNode                   node           = hierarchy.FindNodeByName(collectionNode, name) as InstanceNode;
            ConnectionStringCollectionNode connectionStringCollectionNode = hierarchy.FindNodeByType(typeof(ConnectionStringCollectionNode)) as ConnectionStringCollectionNode;
            ConnectionStringNode           connectionStringNode           = hierarchy.FindNodeByName(connectionStringCollectionNode, "Northwind") as ConnectionStringNode;

            Assert.IsNotNull(connectionStringNode);
            node.ConnectionStringNode = connectionStringNode;
            Assert.AreEqual(connectionStringNode.Name, node.ConnectionString);
            connectionStringNode.Name = "newName";
            Assert.AreEqual(connectionStringNode.Name, node.ConnectionString);
            connectionStringNode.Remove();
            Assert.IsNull(node.ConnectionStringNode);
        }
        public void NodeTest()
        {
            string       storedProcName = "psTest";
            InstanceNode instanceNode   = new InstanceNode();

            GeneratedApplicationNode.Nodes.Add(instanceNode);
            instanceNode.Name = "TestNode";

            DatabaseSinkNode node = new DatabaseSinkNode();

            GeneratedApplicationNode.Nodes.Add(node);
            node.StoredProcName = storedProcName;
            Assert.AreEqual(storedProcName, node.StoredProcName);

            node.DatabaseInstance = instanceNode;
            Assert.AreEqual(instanceNode.Name, node.DatabaseInstance.Name);
        }
        public void CreateFromRuntimeTest()
        {
            DatabaseSettings     databaseSettings     = DatabaseSettingsBuilder.Create(Host);
            DatabaseSettingsNode databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);
            IUIHierarchy         hierarchy            = CreateHierarchyAndAddToHierarchyService(databaseSettingsNode, CreateDefaultConfiguration());

            databaseSettingsNode.ResolveNodeReferences();
            InstanceData           data           = databaseSettings.Instances[name];
            InstanceCollectionNode collectionNode = hierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;
            InstanceNode           node           = hierarchy.FindNodeByName(collectionNode, name) as InstanceNode;

            Assert.AreEqual(data.Name, node.Name);
            Assert.AreEqual(data.DatabaseTypeName, node.DatabaseTypeName);
            ValidateNodeCommand cmd = new ValidateNodeCommand(Host);

            cmd.Execute(node);
            Assert.AreEqual(0, ValidationErrorsCount);
        }
        /// <summary>
        ///     This method marks the beginning of a family instance to be exported.
        /// </summary>
        /// <param name="node">The instance node.</param>
        /// <returns></returns>
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            try
            {
                Debug.WriteLine("  OnInstanceBegin: " + node.NodeName
                                + " symbol: " + node.GetSymbolId().IntegerValue);

                // This method marks the start of processing a family instance
                transformations.Push(transformations.Peek().Multiply(
                                         node.GetTransform()));
            }
            catch (Exception ex)
            {
                ProcessException(ex);
                return(RenderNodeAction.Skip);
            }

            return(RenderNodeAction.Proceed);
        }
Beispiel #18
0
        public RenderNodeAction OnInstanceBegin(
            InstanceNode node)
        {
            FamilySymbol symbol = _doc.GetElement(
                node.GetSymbolId()) as FamilySymbol;

            Debug.Assert(null != symbol,
                         "expected valid family symbol");

            Debug.Print("InstanceBegin "
                        + symbol.Category.Name + " : "
                        + symbol.Family.Name + " : "
                        + symbol.Name);

            _transformationStack.Push(CurrentTransform
                                      .Multiply(node.GetTransform()));

            return(RenderNodeAction.Proceed);
        }
        public void NodeTest()
        {
            string databaseInstanceName  = "dabaseInstanceName";
            string databasePartitionName = "databasePartitionName";

            InstanceNode databaseNode = new InstanceNode(new InstanceData(databaseInstanceName));

            DataCacheStorageNode node      = new DataCacheStorageNode();
            IUIHierarchy         hierarchy = CreateHierarchyAndAddToHierarchyService(node, CreateDefaultConfiguration());

            hierarchy.AddNode(databaseNode);
            node.DatabaseInstance = databaseNode;
            node.PartitionName    = databasePartitionName;
            Assert.AreEqual(databaseInstanceName, node.DatabaseInstance.Name);

            DataCacheStorageData nodeData = (DataCacheStorageData)node.CacheStorageData;

            Assert.AreEqual(databaseInstanceName, nodeData.DatabaseInstanceName);
        }
Beispiel #20
0
        // OnInstanceEnd marks the end of a family instance being exported.
        // This method is invoked even for family instances that were skipped.
        public void OnInstanceEnd(
            InstanceNode InInstanceNode             // family instance output node
            )
        {
            Element CurrentFamilySymbol = GetElement(InInstanceNode.GetSymbolId());

            if (CurrentFamilySymbol != null)
            {
                // Forget the current instance being exported.
                if (CurrentFamilySymbol as ElementType != null)
                {
                    PopInstance("Instance End");
                }
                else
                {
                    PopElement("Symbol End");
                }

                // Forget the current world transform.
                WorldTransformStack.Pop();
            }
        }
 public RenderNodeAction OnInstanceBegin(InstanceNode node)
 {
     return(RenderNodeAction.Proceed);
 }
 public void OnInstanceEnd(InstanceNode node)
 {
 }
Beispiel #23
0
 public void OnInstanceEnd(InstanceNode node)
 {
     Debug.WriteLine($"OnInstanceEnd:{node.NodeName}");
     tfStack.Pop();
 }
 public void OnInstanceEnd(InstanceNode node)
 {
     // Note: This method is invoked even for instances that were skipped.
     transformationStack.Pop();
 }
Beispiel #25
0
 public override void SetUp()
 {
     base.SetUp();
     DatabaseSettings databaseSettings = DatabaseSettingsBuilder.Create(Host);
     DatabaseSettingsNode databaseSettingsNode = new DatabaseSettingsNode(databaseSettings);
     GeneratedApplicationNode.Nodes.Add(databaseSettingsNode);
     databaseSettingsNode.ResolveNodeReferences();
     InstanceCollectionNode collectionNode = GeneratedHierarchy.FindNodeByType(typeof(InstanceCollectionNode)) as InstanceCollectionNode;
     instanceNode = GeneratedHierarchy.FindNodeByName(collectionNode, name) as InstanceNode;
 }
Beispiel #26
0
 public RenderNodeAction OnInstanceBegin(InstanceNode node)
 {
     throw new NotImplementedException();
 }
Beispiel #27
0
 public void OnInstanceEnd(InstanceNode node)
 {
     this.m_TransformationStack.Pop();
 }
 public RenderNodeAction OnInstanceBegin(InstanceNode inNode)
 {
     m_stackTransform.Push(m_stackTransform.Peek().Multiply(inNode.GetTransform()));
     m_Exporter.AddTransform(m_stackTransform.Peek());
     return RenderNodeAction.Proceed;
 }
Beispiel #29
0
 public RenderNodeAction OnInstanceBegin(InstanceNode node)
 {
     this.m_TransformationStack.Push(this.m_TransformationStack.Peek().Multiply(node.GetTransform()));
     return(0);
 }
Beispiel #30
0
 public void OnInstanceEnd(InstanceNode node)
 {
     MessageBuffer mb = new MessageBuffer();
     OpenCOVERPlugin.COVER.Instance.sendMessage(mb.buf, OpenCOVERPlugin.COVER.MessageTypes.EndInstance);
 }
 public void OnInstanceEnd(InstanceNode inNode)
 {
     m_stackTransform.Pop();
 }
Beispiel #32
0
 RenderNodeAction IExportContext.OnInstanceBegin(InstanceNode node)
 {
     throw new NotImplementedException();
 }
Beispiel #33
0
 public void OnInstanceEnd(InstanceNode node)
 {
     throw new NotImplementedException();
 }
Beispiel #34
0
 void IExportContext.OnInstanceEnd(InstanceNode node)
 {
     throw new NotImplementedException();
 }
Beispiel #35
0
        public RenderNodeAction OnInstanceBegin(InstanceNode node)
        {
            Transform t = node.GetTransform();
            MessageBuffer mb = new MessageBuffer();

            mb.add(node.GetSymbolId().IntegerValue);
            mb.add(node.NodeName);
            mb.add(t.BasisX.Multiply(t.Scale));
            mb.add(t.BasisY.Multiply(t.Scale));
            mb.add(t.BasisZ.Multiply(t.Scale));
            mb.add(t.Origin);
            OpenCOVERPlugin.COVER.Instance.sendMessage(mb.buf, OpenCOVERPlugin.COVER.MessageTypes.NewInstance);
            return RenderNodeAction.Proceed;
        }