Ejemplo n.º 1
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Geometry.Transform",
                                                  "*****@*****.**");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            return(migrationData);
        }
Ejemplo n.º 2
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Autodesk.DesignScript.Geometry.Solid.BySweep",
                                                  "Autodesk.DesignScript.Geometry.Solid.BySweep@" +
                                                  "Autodesk.DesignScript.Geometry.Curve,Autodesk.DesignScript.Geometry.Curve");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            PortId oldInPort3 = new PortId(newNodeId, 3, PortType.INPUT);

            PortId newInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId newInPort1 = new PortId(newNodeId, 1, PortType.INPUT);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            data.RemoveFirstConnector(oldInPort1);

            //connector1.RemoveAll();
            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector3, newInPort0);

            return(migrationData);
        }
Ejemplo n.º 3
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Plane.ByOriginNormal", "Plane.ByOriginNormal@Point,Vector");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");

            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            PortId     pToV       = new PortId(pointAsVector0Id, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector0, pToV);
            data.ReconnectToPort(connector1, oldInPort0);
            data.CreateConnector(pointAsVector0, 0, newNode, 1);

            return(migrationData);
        }
Ejemplo n.º 4
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll", 
                "FamilyInstance.ByPoint", "FamilyInstance.ByPoint@FamilySymbol,Point");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            return migratedData;
        }
Ejemplo n.º 5
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                                                  "FamilyInstance.ByPoint", "FamilyInstance.ByPoint@FamilySymbol,Point");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            return(migratedData);
        }
Ejemplo n.º 6
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Plane.ByOriginNormal", "Plane.ByOriginNormal@Point,Vector");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId pToV = new PortId(pointAsVector0Id, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            data.ReconnectToPort(connector0, pToV);
            data.ReconnectToPort(connector1, oldInPort0);
            data.CreateConnector(pointAsVector0, 0, newNode, 1);

            return migrationData;
        }
Ejemplo n.º 7
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            // Create nodes
            XmlElement referencePoint = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(referencePoint,
                "RevitNodes.dll", "ReferencePoint.ByPoint",
                "ReferencePoint.ByPoint@Point");
            migrationData.AppendNode(referencePoint);
            string referencePointId = MigrationManager.GetGuidFromXmlElement(referencePoint);

            XmlElement pointAtParameter = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "Surface.PointAtParameter", "Surface.PointAtParameter@double,double");
            migrationData.AppendNode(pointAtParameter);
            string pointAtParameterId = MigrationManager.GetGuidFromXmlElement(pointAtParameter);

            XmlElement uvU = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll", "UV.U", "UV.U");
            migrationData.AppendNode(uvU);
            string uvUId = MigrationManager.GetGuidFromXmlElement(uvU);

            XmlElement uvV = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "ProtoGeometry.dll", "UV.V", "UV.V");
            migrationData.AppendNode(uvV);
            string uvVId = MigrationManager.GetGuidFromXmlElement(uvV);

            // Update connectors
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            PortId papInPort0 = new PortId(pointAtParameterId, 0, PortType.Input);
            PortId uvUInPort0 = new PortId(uvUId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connectorUv = null;
            
            if (connector1 != null)
            {
                connectorUv = MigrationManager.CreateFunctionNodeFrom(connector1);
                data.CreateConnector(connectorUv);
            }

            if (connectorUv != null)
            {
                PortId uvVInPort0 = new PortId(uvVId, 0, PortType.Input);
                data.ReconnectToPort(connectorUv, uvVInPort0);
            }

            data.ReconnectToPort(connector0, papInPort0);
            data.ReconnectToPort(connector1, uvUInPort0);
            data.CreateConnector(uvU, 0, pointAtParameter, 1);
            data.CreateConnector(uvV, 0, pointAtParameter, 2);
            data.CreateConnector(pointAtParameter, 0, referencePoint, 0);

            return migrationData;
        }
Ejemplo n.º 8
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            // This migration assumes that the first input of the old node is
            // always an XYZ and never a Transform.

            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Arc.ByCenterPointRadiusAngle", "Arc.ByCenterPointRadiusAngle@Point,double,double,double,Vector");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement zAxisNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll", "Vector.ZAxis", "Vector.ZAxis");

            migrationData.AppendNode(zAxisNode);
            string zAxisNodeId = MigrationManager.GetGuidFromXmlElement(zAxisNode);

            XmlElement toDegreeNodeStart = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");

            migrationData.AppendNode(toDegreeNodeStart);
            string toDegreeNodeStartId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeStart);

            XmlElement toDegreeNodeEnd = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");

            migrationData.AppendNode(toDegreeNodeEnd);
            string toDegreeNodeEndId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeEnd);

            PortId     oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId     oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId toDegreeNodeStartPort = new PortId(toDegreeNodeStartId, 0, PortType.Input);
            PortId toDegreeNodeEndPort   = new PortId(toDegreeNodeEndId, 0, PortType.Input);

            // Update connectors
            data.ReconnectToPort(connector2, toDegreeNodeStartPort);
            data.ReconnectToPort(connector3, toDegreeNodeEndPort);
            data.CreateConnector(toDegreeNodeStart, 0, newNode, 2);
            data.CreateConnector(toDegreeNodeEnd, 0, newNode, 3);
            data.CreateConnector(zAxisNode, 0, newNode, 4);

            return(migrationData);
        }
Ejemplo n.º 9
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
                                                  "ReferencePoint.ByPointVectorDistance",
                                                  "ReferencePoint.ByPointVectorDistance@Point,Vector,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement refptAsPoint = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "RevitNodes.dll",
                "ReferencePoint.Point", "ReferencePoint.Point");

            migrationData.AppendNode(refptAsPoint);
            string refptAsPointId = MigrationManager.GetGuidFromXmlElement(refptAsPoint);

            XmlElement pointAsVector = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");

            migrationData.AppendNode(pointAsVector);
            string pointAsVectorId = MigrationManager.GetGuidFromXmlElement(pointAsVector);

            XmlElement vectorNormalized = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "ProtoGeometry.dll",
                "Vector.Normalized", "Vector.Normalized");

            migrationData.AppendNode(vectorNormalized);
            string vectorNormalizedId = MigrationManager.GetGuidFromXmlElement(vectorNormalized);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            PortId     oldInPort2 = new PortId(newNodeId, 2, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId refptAsPointInPort0  = new PortId(refptAsPointId, 0, PortType.INPUT);
            PortId pointAsVectorInPort0 = new PortId(pointAsVectorId, 0, PortType.INPUT);

            data.ReconnectToPort(connector0, refptAsPointInPort0);
            data.ReconnectToPort(connector1, pointAsVectorInPort0);
            data.CreateConnector(refptAsPoint, 0, newNode, 0);
            data.CreateConnector(pointAsVector, 0, vectorNormalized, 0);
            data.CreateConnector(vectorNormalized, 0, newNode, 1);

            return(migrationData);
        }
Ejemplo n.º 10
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                                                  "FaceAnalysisDisplay.ByViewFacePointsAndValues",
                                                  "FaceAnalysisDisplay.ByViewFacePointsAndValues@var,FaceReference,double[][],double[]");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            XmlElement documentNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "RevitNodes.dll",
                "Document.Current", "Document.Current");

            migratedData.AppendNode(documentNode);

            XmlElement activeViewNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "RevitNodes.dll",
                "Document.ActiveView", "Document.ActiveView");

            migratedData.AppendNode(activeViewNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);

            PortId     oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);

            data.ReconnectToPort(connector0, newInPort3);
            data.ReconnectToPort(connector1, newInPort2);
            data.ReconnectToPort(connector3, newInPort1);

            data.RemoveFirstConnector(oldInPort2);
            data.CreateConnector(documentNode, 0, activeViewNode, 0);
            data.CreateConnector(activeViewNode, 0, dsRevitNode, 0);

            return(migratedData);
        }
Ejemplo n.º 11
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            // This migration assumes that the first input of the old node is
            // always an XYZ and never a Transform.

            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Arc.ByCenterPointRadiusAngle", "Arc.ByCenterPointRadiusAngle@Point,double,double,double,Vector");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement zAxisNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll", "Vector.ZAxis", "Vector.ZAxis");
            migrationData.AppendNode(zAxisNode);
            string zAxisNodeId = MigrationManager.GetGuidFromXmlElement(zAxisNode);

            XmlElement toDegreeNodeStart = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll", 
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(toDegreeNodeStart);
            string toDegreeNodeStartId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeStart);

            XmlElement toDegreeNodeEnd = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(toDegreeNodeEnd);
            string toDegreeNodeEndId = MigrationManager.GetGuidFromXmlElement(toDegreeNodeEnd);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId toDegreeNodeStartPort = new PortId(toDegreeNodeStartId, 0, PortType.Input);
            PortId toDegreeNodeEndPort = new PortId(toDegreeNodeEndId, 0, PortType.Input);

            // Update connectors
            data.ReconnectToPort(connector2, toDegreeNodeStartPort);
            data.ReconnectToPort(connector3, toDegreeNodeEndPort);
            data.CreateConnector(toDegreeNodeStart, 0, newNode, 2);
            data.CreateConnector(toDegreeNodeEnd, 0, newNode, 3);
            data.CreateConnector(zAxisNode, 0, newNode, 4);

            return migrationData;
        }
Ejemplo n.º 12
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            var    migratedData = new NodeMigrationData(data.Document);
            var    oldNode      = data.MigratedNodes.ElementAt(0);
            string oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            var codeBlockNode = MigrationManager.CreateCodeBlockNodeFrom(oldNode);

            codeBlockNode.SetAttribute("CodeText",
                                       "p=Plane.ByOriginNormal(origin,axis.AsVector());\n" +
                                       "cs=CoordinateSystem.ByPlane(p);\n" +
                                       "Cylinder.ByRadiusHeight(cs,r,h);");
            migratedData.AppendNode(codeBlockNode);

            //create and reconnect the connecters
            var        oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            var        oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            var        oldInPort2 = new PortId(oldNodeId, 2, PortType.INPUT);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            var        oldInPort3 = new PortId(oldNodeId, 3, PortType.INPUT);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            var oldOutPort0      = new PortId(oldNodeId, 0, PortType.OUTPUT);
            var oldOutConnectors = data.FindConnectors(oldOutPort0);

            var newInPort0  = new PortId(oldNodeId, 0, PortType.INPUT);
            var newInPort1  = new PortId(oldNodeId, 1, PortType.INPUT);
            var newInPort2  = new PortId(oldNodeId, 2, PortType.INPUT);
            var newInPort3  = new PortId(oldNodeId, 3, PortType.INPUT);
            var newOutPort2 = new PortId(oldNodeId, 2, PortType.OUTPUT);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);
            data.ReconnectToPort(connector2, newInPort2);
            data.ReconnectToPort(connector3, newInPort3);

            if (oldOutConnectors.Any())
            {
                foreach (var connector in oldOutConnectors)
                {
                    //connect anything that previously was connected to output port 0
                    //to output port 2
                    data.ReconnectToPort(connector, newOutPort2);
                }
            }

            return(migratedData);
        }
Ejemplo n.º 13
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement        oldNode       = data.MigratedNodes.ElementAt(0);
            string            oldNodeId     = MigrationManager.GetGuidFromXmlElement(oldNode);

            // Create DSFunction node
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
                                                  "StructuralFraming.ByCurveLevelUpVectorAndType",
                                                  "StructuralFraming.ByCurveLevelUpVectorAndType@Curve,Level,Vector,StructuralType,FamilySymbol");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement one = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0, "1");

            migrationData.AppendNode(one);
            string oneId = MigrationManager.GetGuidFromXmlElement(one);

            XmlElement level = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "RevitNodes.dll",
                "Level.ByElevation", "Level.ByElevation@double");

            migrationData.AppendNode(level);
            string levelId = MigrationManager.GetGuidFromXmlElement(level);

            // Assume that structural framing created by 0.6.3 is always Beam
            XmlElement beam = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "RevitNodes.dll",
                "StructuralType.Beam", "StructuralType.Beam");

            migrationData.AppendNode(beam);
            string beamId = MigrationManager.GetGuidFromXmlElement(beam);

            // Update connectors
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            PortId     newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId     newInPort4 = new PortId(newNodeId, 4, PortType.Input);

            data.CreateConnector(one, 0, level, 0);
            data.CreateConnector(level, 0, newNode, 1);
            data.CreateConnector(beam, 0, newNode, 3);
            data.ReconnectToPort(connector0, newInPort4);
            data.ReconnectToPort(connector1, newInPort0);

            return(migrationData);
        }
Ejemplo n.º 14
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                "FaceAnalysisDisplay.ByViewFacePointsAndValues",
                "FaceAnalysisDisplay.ByViewFacePointsAndValues@var,FaceReference,double[][],double[]");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            XmlElement documentNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "RevitNodes.dll",
                "Document.Current", "Document.Current");
            migratedData.AppendNode(documentNode);

            XmlElement activeViewNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "RevitNodes.dll",
                "Document.ActiveView", "Document.ActiveView");
            migratedData.AppendNode(activeViewNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            
            PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);

            data.ReconnectToPort(connector0, newInPort3);
            data.ReconnectToPort(connector1, newInPort2);
            data.ReconnectToPort(connector3, newInPort1);

            data.RemoveFirstConnector(oldInPort2);
            data.CreateConnector(documentNode, 0, activeViewNode, 0);
            data.CreateConnector(activeViewNode, 0, dsRevitNode, 0);

            return migratedData;
        }
Ejemplo n.º 15
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create nodes
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Curve.ParameterTrim", "Autodesk.DesignScript.Geometry.Curve.ParameterTrim@double,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            XmlElement startParam = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "Curve.ParameterAtPoint", "Curve.ParameterAtPoint@Point");

            migrationData.AppendNode(startParam);
            string startParamId = MigrationManager.GetGuidFromXmlElement(startParam);

            XmlElement endParam = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Curve.ParameterAtPoint", "Curve.ParameterAtPoint@Point");

            migrationData.AppendNode(endParam);
            string endParamId = MigrationManager.GetGuidFromXmlElement(endParam);

            // Update connectors
            PortId     oldInPort0       = new PortId(newNodeId, 0, PortType.INPUT);
            PortId     oldInPort1       = new PortId(newNodeId, 1, PortType.INPUT);
            PortId     oldInPort2       = new PortId(newNodeId, 2, PortType.INPUT);
            PortId     startParamInPort = new PortId(startParamId, 1, PortType.INPUT);
            PortId     endParamInPort   = new PortId(endParamId, 1, PortType.INPUT);
            XmlElement connector0       = data.FindFirstConnector(oldInPort0);
            XmlElement connector1       = data.FindFirstConnector(oldInPort1);
            XmlElement connector2       = data.FindFirstConnector(oldInPort2);

            data.ReconnectToPort(connector1, startParamInPort);
            data.ReconnectToPort(connector2, endParamInPort);
            data.CreateConnector(startParam, 0, newNode, 1);
            data.CreateConnector(endParam, 0, newNode, 2);

            if (connector0 != null)
            {
                string curveInputId = connector0.GetAttribute("start").ToString();
                data.CreateConnectorFromId(curveInputId, 0, startParamId, 0);
                data.CreateConnectorFromId(curveInputId, 0, endParamId, 0);
            }

            return(migrationData);
        }
Ejemplo n.º 16
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement        oldNode       = data.MigratedNodes.ElementAt(0);

            // Create DSFunction node
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
                                                  "ReferencePoint.ByLengthOnCurveReference",
                                                  "ReferencePoint.ByLengthOnCurveReference@CurveReference,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new adapter node
            XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0,
                "// Convert ModelCurve into CurveReference\n" +
                "curve.CurveReference;\n\n" +
                "// Convert normalized length into actual length\n" +
                "// and flip the evaluation if 'beginning' is set to false\n" +
                "len * (normalized ? curve.Curve.Length : 1)\n" +
                "* (beginning ? 1 : -1) + (beginning ? 0 : curve.Curve.Length);");

            migrationData.AppendNode(codeBlockNode);
            string cbnId = MigrationManager.GetGuidFromXmlElement(codeBlockNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            PortId     oldInPort2 = new PortId(newNodeId, 2, PortType.INPUT);
            PortId     oldInPort3 = new PortId(newNodeId, 3, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);
            PortId     cbnInPort0 = new PortId(cbnId, 0, PortType.INPUT);
            PortId     cbnInPort1 = new PortId(cbnId, 1, PortType.INPUT);
            PortId     cbnInPort2 = new PortId(cbnId, 2, PortType.INPUT);
            PortId     cbnInPort3 = new PortId(cbnId, 3, PortType.INPUT);

            data.ReconnectToPort(connector0, cbnInPort0);
            data.ReconnectToPort(connector1, cbnInPort1);
            data.ReconnectToPort(connector2, cbnInPort2);
            data.ReconnectToPort(connector3, cbnInPort3);
            data.CreateConnector(codeBlockNode, 0, newNode, 0);
            data.CreateConnector(codeBlockNode, 1, newNode, 1);

            return(migrationData);
        }
Ejemplo n.º 17
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0,
                "domain[0][0]..domain[1][0]..#ucount+1;\n" +
                "domain[0][1]..domain[1][1]..#vcount+1;");

            migrationData.AppendNode(codeBlockNode);
            string codeBlockNodeId = MigrationManager.GetGuidFromXmlElement(codeBlockNode);

            XmlElement uvNode = MigrationManager.CreateFunctionNode(data.Document, oldNode, 1,
                                                                    "ProtoGeometry.dll", "UV.ByCoordinates", "UV.ByCoordinates@double,double");

            uvNode.SetAttribute("lacing", "CrossProduct");
            migrationData.AppendNode(uvNode);

            XmlElement flattenNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(flattenNode, "",
                                                  "Flatten", "Flatten");
            flattenNode.SetAttribute("lacing", "Shortest");
            migrationData.AppendNode(flattenNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            PortId     oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            PortId     newInPort0 = new PortId(codeBlockNodeId, 0, PortType.Input);
            PortId     newInPort1 = new PortId(codeBlockNodeId, 1, PortType.Input);
            PortId     newInPort2 = new PortId(codeBlockNodeId, 2, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);
            data.ReconnectToPort(connector2, newInPort2);

            data.CreateConnector(codeBlockNode, 0, uvNode, 0);
            data.CreateConnector(codeBlockNode, 1, uvNode, 1);
            data.CreateConnector(uvNode, 0, flattenNode, 0);

            return(migrationData);
        }
Ejemplo n.º 18
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            // Create DSFunction node
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
                "StructuralFraming.ByCurveLevelUpVectorAndType",
                "StructuralFraming.ByCurveLevelUpVectorAndType@Curve,Level,Vector,StructuralType,FamilySymbol");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement one = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0, "1");
            migrationData.AppendNode(one);
            string oneId = MigrationManager.GetGuidFromXmlElement(one);

            XmlElement level = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "RevitNodes.dll",
                "Level.ByElevation", "Level.ByElevation@double");
            migrationData.AppendNode(level);
            string levelId = MigrationManager.GetGuidFromXmlElement(level);

            // Assume that structural framing created by 0.6.3 is always Beam
            XmlElement beam = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "RevitNodes.dll",
                "StructuralType.Beam", "StructuralType.Beam");
            migrationData.AppendNode(beam);
            string beamId = MigrationManager.GetGuidFromXmlElement(beam);

            // Update connectors
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId newInPort4 = new PortId(newNodeId, 4, PortType.Input);

            data.CreateConnector(one, 0, level, 0);
            data.CreateConnector(level, 0, newNode, 1);
            data.CreateConnector(beam, 0, newNode, 3);
            data.ReconnectToPort(connector0, newInPort4);
            data.ReconnectToPort(connector1, newInPort0);

            return migrationData;
        }
Ejemplo n.º 19
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Surface.NormalAtParameter", "Surface.NormalAtParameter@double,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, newInPort0);

            if (connector0 != null)
            {
                // Create new nodes only when the old node is connected to a UV node
                XmlElement nodeU = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll", "UV.U", "UV.U");
                migrationData.AppendNode(nodeU);
                string nodeUId = MigrationManager.GetGuidFromXmlElement(nodeU);

                XmlElement nodeV = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 1, "ProtoGeometry.dll", "UV.V", "UV.V");
                migrationData.AppendNode(nodeV);
                string nodeVId = MigrationManager.GetGuidFromXmlElement(nodeV);

                // Update connectors
                PortId newInPortNodeU = new PortId(nodeUId, 0, PortType.Input);

                string nodeUVId = connector0.GetAttribute("start").ToString();
                data.ReconnectToPort(connector0, newInPortNodeU);
                data.CreateConnector(nodeU, 0, newNode, 1);
                data.CreateConnector(nodeV, 0, newNode, 2);
                data.CreateConnectorFromId(nodeUVId, 0, nodeVId, 0);
            }

            return(migrationData);
        }
Ejemplo n.º 20
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                                                  "Form.ByLoftingCurveElements",
                                                  "Form.ByLoftingCurveElements@CurveElement[],bool");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.INPUT);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.INPUT);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            // Add default values
            foreach (XmlNode child in oldNode.ChildNodes)
            {
                var newChild = child.Clone() as XmlElement;

                switch (newChild.GetAttribute("index"))
                {
                case "0":
                    newChild.SetAttribute("index", "1");
                    dsRevitNode.AppendChild(newChild);
                    break;

                default:
                    break;
                }
            }

            return(migratedData);
        }
Ejemplo n.º 21
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "PolySurface.LocateSurfacesByLine", "PolySurface.LocateSurfacesByLine@Line");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement polySurface = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "PolySurface.BySolid", "*****@*****.**");

            migrationData.AppendNode(polySurface);
            string polySurfaceId = MigrationManager.GetGuidFromXmlElement(polySurface);

            // Update connectors
            PortId     oldInPort0         = new PortId(newNodeId, 0, PortType.INPUT);
            XmlElement connector0         = data.FindFirstConnector(oldInPort0);
            PortId     polySurfaceInPort0 = new PortId(polySurfaceId, 0, PortType.INPUT);

            data.ReconnectToPort(connector0, polySurfaceInPort0);
            data.CreateConnector(polySurface, 0, newNode, 0);

            return(migrationData);
        }
Ejemplo n.º 22
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Geometry.Transform", "Geometry.Transform@CoordinateSystem,CoordinateSystem");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");
            migrationData.AppendNode(identityCoordinateSystem);

            // Update connectors
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(newNodeId, 2, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            
            data.ReconnectToPort(connector1, newInPort2);
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 1);

            return migrationData;
        }
Ejemplo n.º 23
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Vector.AsPoint", "Vector.AsPoint");
            migrationData.AppendNode(newNode);

            XmlElement axisNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.ZAxis", "CoordinateSystem.ZAxis");

            migrationData.AppendNode(axisNode);
            string axisNodeId = MigrationManager.GetGuidFromXmlElement(axisNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId newInPort0 = new PortId(axisNodeId, 0, PortType.Input);

            data.ReconnectToPort(connector0, newInPort0);
            data.CreateConnector(axisNode, 0, newNode, 0);

            return(migrationData);
        }
Ejemplo n.º 24
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Geometry.Transform", "Geometry.Transform@CoordinateSystem,CoordinateSystem");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");

            migrationData.AppendNode(identityCoordinateSystem);

            // Update connectors
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            PortId     newInPort2 = new PortId(newNodeId, 2, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, newInPort2);
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 1);

            return(migrationData);
        }
Ejemplo n.º 25
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Surface.ByLoft",
                "[email protected][]");

            migratedData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);


            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            data.RemoveFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            data.ReconnectToPort(connector1, newInPort0);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            data.RemoveFirstConnector(oldInPort2);

            return migratedData;
        }
Ejemplo n.º 26
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Curve.ExtrudeAsSolid",
                                                  "[email protected],double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");

            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            PortId pToV0      = new PortId(pointAsVector0Id, 0, PortType.INPUT);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);

            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, pToV0);
            data.CreateConnector(pointAsVector0, 0, newNode, 1);

            return(migrationData);
        }
Ejemplo n.º 27
0
        public void TestReconnectToPort()
        {
            //At the beginning this the port setup
            //connector1 start="dcd9c6c6-6350-4292-a553-c57a764504b4" start_index="0" end="67f40bd6-cdee-470a-9aa5-2c9d6f6c87bc"
            //connector2 start="c1d6f9b4-3f45-4502-b4b8-27fd03491388" start_index="0" end="dcd9c6c6-6350-4292-a553-c57a764504b4"

            //Arrange
            NodeMigrationData migrationDataTest = null;
            string documentDynPath = Path.Combine(TestDirectory, @"core\Angle.dyn");
            XmlDocument xmlDoc = new XmlDocument();
            string endGuidFind = "67f40bd6-cdee-470a-9aa5-2c9d6f6c87bc";
           
            PortId portIdFind = new PortId(endGuidFind, 0, PortType.Input);
            string endGuidReconnect = "c1d6f9b4-3f45-4502-b4b8-27fd03491388";
            PortId portIdReconnect = new PortId(endGuidReconnect, 0, PortType.Input);

            //Act
            xmlDoc.Load(documentDynPath);
            migrationDataTest = new NodeMigrationData(xmlDoc);
            //We have to search for the connector1 end="67f40bd6-cdee-470a-9aa5-2c9d6f6c87bc", inside de xml file.
            var xmlNodeConnector = migrationDataTest.FindFirstConnector(portIdFind);

            //The function will reconnect the connector1 from end-67f40bd6-cdee-470a-9aa5-2c9d6f6c87bc to end-c1d6f9b4-3f45-4502-b4b8-27fd03491388
            migrationDataTest.ReconnectToPort(xmlNodeConnector, portIdReconnect);

            //After the port reconnection this the port setup
            //connector1 start="dcd9c6c6-6350-4292-a553-c57a764504b4" start_index="0" end="c1d6f9b4-3f45-4502-b4b8-27fd03491388"
            //connector2 start="c1d6f9b4-3f45-4502-b4b8-27fd03491388" start_index="0" end="dcd9c6c6-6350-4292-a553-c57a764504b4"

            //Assert 
            //The connector1 (xmlNodeConnector) should have now as end = c1d6f9b4-3f45-4502-b4b8-27fd03491388
            Assert.AreEqual(xmlNodeConnector.GetAttribute("end"), "c1d6f9b4-3f45-4502-b4b8-27fd03491388");
        }
Ejemplo n.º 28
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "PolyCurve.ByThickeningCurve", "PolyCurve.ByThickeningCurve@Curve,double,Vector");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement pointAsVector = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");

            migrationData.AppendNode(pointAsVector);
            string pointAsVectorId = MigrationManager.GetGuidFromXmlElement(pointAsVector);

            PortId pToV0      = new PortId(pointAsVectorId, 0, PortType.INPUT);
            PortId oldInPort2 = new PortId(newNodeId, 2, PortType.INPUT);

            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            data.ReconnectToPort(connector2, pToV0);
            data.CreateConnector(pointAsVector, 0, newNode, 2);

            return(migrationData);
        }
Ejemplo n.º 29
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Surface.ByLoft",
                                                  "[email protected][]");

            migratedData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);


            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);

            data.RemoveFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            PortId     newInPort0 = new PortId(newNodeId, 0, PortType.INPUT);

            data.ReconnectToPort(connector1, newInPort0);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.INPUT);

            data.RemoveFirstConnector(oldInPort2);

            return(migratedData);
        }
Ejemplo n.º 30
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0,
                "dom[0][0]+Math.RandomList\n" +
                "(ucount*vcount)\n" +
                "*(dom[1][0]-dom[0][0]);\n" +
                "dom[0][1]+Math.RandomList\n" +
                "(ucount*vcount)\n" +
                "*(dom[1][1]-dom[0][1]);");

            codeBlockNode.SetAttribute("nickname", "Random UV");
            migrationData.AppendNode(codeBlockNode);
            string codeBlockNodeId = MigrationManager.GetGuidFromXmlElement(codeBlockNode);

            XmlElement uvNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(uvNode, "ProtoGeometry.dll",
                                                  "UV.ByCoordinates", "UV.ByCoordinates@double,double");
            uvNode.SetAttribute("lacing", "Longest");
            migrationData.AppendNode(uvNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            PortId     oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            PortId     newInPort0 = new PortId(codeBlockNodeId, 0, PortType.Input);
            PortId     newInPort1 = new PortId(codeBlockNodeId, 1, PortType.Input);
            PortId     newInPort2 = new PortId(codeBlockNodeId, 2, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);
            data.ReconnectToPort(connector2, newInPort2);

            data.CreateConnector(codeBlockNode, 0, uvNode, 0);
            data.CreateConnector(codeBlockNode, 1, uvNode, 1);

            return(migrationData);
        }
Ejemplo n.º 31
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement distanceToPoint = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(distanceToPoint, "ProtoGeometry.dll",
                                                  "Geometry.DistanceTo",
                                                  "*****@*****.**");
            migratedData.AppendNode(distanceToPoint);
            string distanceToPointId = MigrationManager.GetGuidFromXmlElement(distanceToPoint);

            XmlElement point1 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "RevitNodes.dll",
                "ReferencePoint.Point", "ReferencePoint.Point");

            migratedData.AppendNode(point1);
            string point1Id = MigrationManager.GetGuidFromXmlElement(point1);

            XmlElement point2 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "RevitNodes.dll",
                "ReferencePoint.Point", "ReferencePoint.Point");

            migratedData.AppendNode(point2);
            string point2Id = MigrationManager.GetGuidFromXmlElement(point2);


            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(point1Id, 0, PortType.INPUT);
            PortId newInPort1 = new PortId(point2Id, 0, PortType.INPUT);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);

            data.CreateConnector(point1, 0, distanceToPoint, 0);
            data.CreateConnector(point2, 0, distanceToPoint, 1);

            return(migratedData);
        }
Ejemplo n.º 32
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            if (data.FindFirstConnector(new PortId(oldNodeId, 1, PortType.Output)) != null)
            {
                // If the second output port is utilized, migrate to CBN
                XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeFrom(oldNode);
                codeBlockNode.SetAttribute("CodeText",
                                           "Line.ByBestFitThroughPoints(XYZs)\n" +
                                           ".Direction.Normalized().AsPoint();\n" +
                                           "Point.ByCoordinates(Math.Average(XYZs.X),\n" +
                                           "Math.Average(XYZs.Y), Math.Average(XYZs.Z));");
                codeBlockNode.SetAttribute("nickname", "Best Fit Line");
                migrationData.AppendNode(codeBlockNode);
            }
            else
            {
                // When only the first output port is utilized, migrate to a chain of nodes

                var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
                MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                      "Vector.AsPoint", "Vector.AsPoint");

                var lineNode = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll",
                    "Line.ByBestFitThroughPoints",
                    "Line.ByBestFitThroughPoints@Point[]");
                string lineNodeId = MigrationManager.GetGuidFromXmlElement(lineNode);

                var directionNode = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 1, "ProtoGeometry.dll",
                    "Line.Direction", "Line.Direction");

                var normalizedNode = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 2, "ProtoGeometry.dll",
                    "Vector.Normalized", "Vector.Normalized");

                migrationData.AppendNode(newNode);
                migrationData.AppendNode(lineNode);
                migrationData.AppendNode(directionNode);
                migrationData.AppendNode(normalizedNode);

                // Update connectors
                PortId     oldInPort0  = new PortId(oldNodeId, 0, PortType.Input);
                PortId     lineInPort0 = new PortId(lineNodeId, 0, PortType.Input);
                XmlElement connector0  = data.FindFirstConnector(oldInPort0);

                data.ReconnectToPort(connector0, lineInPort0);
                data.CreateConnector(lineNode, 0, directionNode, 0);
                data.CreateConnector(directionNode, 0, normalizedNode, 0);
                data.CreateConnector(normalizedNode, 0, newNode, 0);
            }

            return(migrationData);
        }
Ejemplo n.º 33
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Point.ByCylindricalCoordinates", "Point.ByCylindricalCoordinates@CoordinateSystem,double,double,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");
            migrationData.AppendNode(identityCoordinateSystem);

            XmlElement converterNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(converterNode);
            string converterNodeId = MigrationManager.GetGuidFromXmlElement(converterNode);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);

            PortId newInPort3 = new PortId(newNodeId, 3, PortType.Input);
            PortId converterInPort = new PortId(converterNodeId, 0, PortType.Input);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector0, newInPort3);
            data.ReconnectToPort(connector1, converterInPort);
            data.CreateConnector(converterNode, 0, newNode, 1);
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 0);

            // Add default values
            foreach (XmlNode child in oldNode.ChildNodes)
                newNode.AppendChild(child.Clone());

            return migrationData;
        }
Ejemplo n.º 34
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                                                  "PerspectiveView.ByEyePointAndTarget",
                                                  "PerspectiveView.ByEyePointAndTarget@Point,Point,var,string,bool");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId     oldInPort2 = new PortId(oldNodeId, 2, PortType.INPUT);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId     oldInPort3 = new PortId(oldNodeId, 3, PortType.INPUT);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId     oldInPort4 = new PortId(oldNodeId, 4, PortType.INPUT);
            XmlElement connector4 = data.FindFirstConnector(oldInPort4);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.INPUT);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.INPUT);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.INPUT);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.INPUT);
            PortId newInPort4 = new PortId(dsRevitNodeId, 4, PortType.INPUT);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);
            data.ReconnectToPort(connector2, newInPort3);
            data.ReconnectToPort(connector3, newInPort2);
            data.ReconnectToPort(connector4, newInPort4);

            return(migratedData);
        }
Ejemplo n.º 35
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll", 
                "AxonometricView.ByEyePointAndTarget", 
                "AxonometricView.ByEyePointAndTarget@Point,Point,var,string,bool");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId oldInPort4 = new PortId(oldNodeId, 4, PortType.Input);
            XmlElement connector4 = data.FindFirstConnector(oldInPort4);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);
            PortId newInPort4 = new PortId(dsRevitNodeId, 4, PortType.Input);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);
            data.ReconnectToPort(connector2, newInPort3);
            data.ReconnectToPort(connector3, newInPort2);
            data.ReconnectToPort(connector4, newInPort4);

            return migratedData;
        }
Ejemplo n.º 36
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Line.ByStartPointEndPoint", "Line.ByStartPointEndPoint@Point,Point");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId     newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, newInPort0);

            if (connector1 != null)
            {
                // Create new node only when the old node is connected to a normal vector
                XmlElement translateNode = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll", "Geometry.Translate",
                    "*****@*****.**");
                migrationData.AppendNode(translateNode);
                string translateNodeId = MigrationManager.GetGuidFromXmlElement(translateNode);

                // Update connectors
                PortId newInPortTranslate1 = new PortId(translateNodeId, 1, PortType.Input);

                string nodeOriginId = connector1.GetAttribute("start").ToString();
                data.CreateConnector(translateNode, 0, newNode, 1);
                data.CreateConnectorFromId(nodeOriginId, 0, translateNodeId, 0);
                data.ReconnectToPort(connector0, newInPortTranslate1);
            }

            return(migrationData);
        }
Ejemplo n.º 37
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll",
                                                  "Wall.ByCurveAndHeight",
                                                  "Wall.ByCurveAndHeight@Curve,double,Level,WallType");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId     oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId     oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort2);
            data.ReconnectToPort(connector2, newInPort3);
            data.ReconnectToPort(connector3, newInPort1);

            return(migratedData);
        }
Ejemplo n.º 38
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsRevitNode, "RevitNodes.dll", 
                "Wall.ByCurveAndHeight", 
                "Wall.ByCurveAndHeight@Curve,double,Level,WallType");

            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId oldInPort3 = new PortId(oldNodeId, 3, PortType.Input);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);

            PortId newInPort0 = new PortId(dsRevitNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsRevitNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(dsRevitNodeId, 2, PortType.Input);
            PortId newInPort3 = new PortId(dsRevitNodeId, 3, PortType.Input);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort2);
            data.ReconnectToPort(connector2, newInPort3);
            data.ReconnectToPort(connector3, newInPort1);

            return migratedData;
        }
Ejemplo n.º 39
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var        newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "Curve.CoordinateSystemAtParameter", "Curve.CoordinateSystemAtParameter@double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.INPUT);
            PortId     oldInPort1 = new PortId(newNodeId, 1, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector0, oldInPort1);
            data.ReconnectToPort(connector1, oldInPort0);

            return(migrationData);
        }
Ejemplo n.º 40
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement        oldNode      = data.MigratedNodes.ElementAt(0);
            string            oldNodeId    = MigrationManager.GetGuidFromXmlElement(oldNode);

            XmlElement dsRevitNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(dsRevitNode, "ProtoGeometry.dll",
                                                  "Solid.ByLoft", "Solid.ByLoft@Curve[]");
            migratedData.AppendNode(dsRevitNode);
            string dsRevitNodeId = MigrationManager.GetGuidFromXmlElement(dsRevitNode);

            XmlElement createListNode = MigrationManager.CreateNode(data.Document,
                                                                    oldNode, 0, "DSCoreNodesUI.CreateList", "Create List");

            migratedData.AppendNode(createListNode);
            createListNode.SetAttribute("inputcount", "2");
            string createListNodeId = MigrationManager.GetGuidFromXmlElement(createListNode);

            //create and reconnect the connecters
            PortId     oldInPort0 = new PortId(oldNodeId, 0, PortType.INPUT);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId     oldInPort1 = new PortId(oldNodeId, 1, PortType.INPUT);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(createListNodeId, 0, PortType.INPUT);
            PortId newInPort1 = new PortId(createListNodeId, 1, PortType.INPUT);

            data.ReconnectToPort(connector0, newInPort0);
            data.ReconnectToPort(connector1, newInPort1);
            data.CreateConnector(createListNode, 0, dsRevitNode, 0);

            return(migratedData);
        }
Ejemplo n.º 41
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode   = data.MigratedNodes.ElementAt(0);
            string     oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);

            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                                                  "CoordinateSystem.Translate",
                                                  "*****@*****.**");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");

            migrationData.AppendNode(identityCoordinateSystem);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");

            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            // Update connectors
            PortId     oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId     newInPort1 = new PortId(newNodeId, 1, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            PortId     pToV0      = new PortId(pointAsVector0Id, 0, PortType.Input);

            data.ReconnectToPort(connector0, pToV0);
            data.CreateConnector(pointAsVector0, 0, newNode, 1);
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 0);

            return(migrationData);
        }
Ejemplo n.º 42
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Line.ByStartPointEndPoint", "Line.ByStartPointEndPoint@Point,Point");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, newInPort0);
            
            if (connector1 != null)
            {
                // Create new node only when the old node is connected to a normal vector
                XmlElement translateNode = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll", "Geometry.Translate",
                    "*****@*****.**");
                migrationData.AppendNode(translateNode);
                string translateNodeId = MigrationManager.GetGuidFromXmlElement(translateNode);

                // Update connectors
                PortId newInPortTranslate1 = new PortId(translateNodeId, 1, PortType.Input);
                
                string nodeOriginId = connector1.GetAttribute("start").ToString();
                data.CreateConnector(translateNode, 0, newNode, 1);
                data.CreateConnectorFromId(nodeOriginId, 0, translateNodeId, 0);
                data.ReconnectToPort(connector0, newInPortTranslate1);
            }
            
            return migrationData;
        }
Ejemplo n.º 43
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Line.ByStartPointEndPoint", "Line.ByStartPointEndPoint@Point,Point");
            newNode.SetAttribute("lacing", "Shortest");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement reverse = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "DSCoreNodes.dll",
                "List.Reverse",
                "List.Reverse@var[]..[]");
            migrationData.AppendNode(reverse);
            string reverseId = MigrationManager.GetGuidFromXmlElement(reverse);

            XmlElement rest = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll",
                "List.RestOfItems",
                "List.RestOfItems@var[]..[]");
            migrationData.AppendNode(rest);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            PortId reverseInPort0 = new PortId(reverseId, 0, PortType.Input);
            
            data.ReconnectToPort(connector0, reverseInPort0);
            data.CreateConnector(reverse, 0, newNode, 0);
            data.CreateConnector(reverse, 0, rest, 0);
            data.CreateConnector(rest, 0, newNode, 1);
            
            return migrationData;
        }
Ejemplo n.º 44
0
        public static NodeMigrationData Migrate_0700_to_0730(NodeMigrationData data)
        {
            var migrationData = new NodeMigrationData(data.Document);
            var oldNode = data.MigratedNodes.ElementAt(0);

            var sunSettingNode = MigrationManager.CloneAndChangeName(
                oldNode,
                "DSRevitNodesUI.SunSettings",
                "SunSettings.Current");
            var sunSettingsNodeId = Guid.NewGuid().ToString();
            sunSettingNode.SetAttribute("guid", sunSettingsNodeId);
            migrationData.AppendNode(sunSettingNode);

            var sunPathNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(
                sunPathNode,
                "RevitNodes.dll",
                "SunSettings.SunDirection",
                "SunSettings.SunDirection@var");
            migrationData.AppendNode(sunPathNode);

            migrationData.CreateConnector(sunSettingNode, 0, sunPathNode, 0);

            var oldConnector = data.FindFirstConnector(
                new PortId(MigrationManager.GetGuidFromXmlElement(oldNode), 0, PortType.Output));

            if (oldConnector != null)
            {
                migrationData.ReconnectToPort(
                    oldConnector,
                    new PortId(
                        MigrationManager.GetGuidFromXmlElement(sunPathNode),
                        0,
                        PortType.Output));
            }

            return migrationData;
        }
Ejemplo n.º 45
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "RevitNodes.dll",
                "ReferencePoint.ByPointVectorDistance",
                "ReferencePoint.ByPointVectorDistance@Point,Vector,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement refptAsPoint = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "RevitNodes.dll",
                "ReferencePoint.Point", "ReferencePoint.Point");
            migrationData.AppendNode(refptAsPoint);
            string refptAsPointId = MigrationManager.GetGuidFromXmlElement(refptAsPoint);

            XmlElement pointAsVector = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector);
            string pointAsVectorId = MigrationManager.GetGuidFromXmlElement(pointAsVector);

            XmlElement vectorNormalized = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "ProtoGeometry.dll",
                "Vector.Normalized", "Vector.Normalized");
            migrationData.AppendNode(vectorNormalized);
            string vectorNormalizedId = MigrationManager.GetGuidFromXmlElement(vectorNormalized);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId oldInPort2 = new PortId(newNodeId, 2, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId refptAsPointInPort0 = new PortId(refptAsPointId, 0, PortType.Input);
            PortId pointAsVectorInPort0 = new PortId(pointAsVectorId, 0, PortType.Input);

            data.ReconnectToPort(connector0, refptAsPointInPort0);
            data.ReconnectToPort(connector1, pointAsVectorInPort0);
            data.CreateConnector(refptAsPoint, 0, newNode, 0);
            data.CreateConnector(pointAsVector, 0, vectorNormalized, 0);
            data.CreateConnector(vectorNormalized, 0, newNode, 1);

            return migrationData;
        }
Ejemplo n.º 46
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "EllipseArc.ByPlaneRadiiStartAngleSweepAngle", 
                "EllipseArc.ByPlaneRadiiStartAngleSweepAngle@Plane,double,double,double,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement zAxis = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "Vector.ZAxis",
                "Vector.ZAxis");
            migrationData.AppendNode(zAxis);

            XmlElement planeNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "", "Plane.ByOriginNormal", 
                "Plane.ByOriginNormal@Point,Vector");
            planeNode.SetAttribute("isVisible", "false");
            migrationData.AppendNode(planeNode);
            string planeNodeId = MigrationManager.GetGuidFromXmlElement(planeNode);

            XmlElement converterNode0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(converterNode0);
            string converterNode0Id = MigrationManager.GetGuidFromXmlElement(converterNode0);

            XmlElement converterNode1 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 3, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(converterNode1);
            string converterNode1Id = MigrationManager.GetGuidFromXmlElement(converterNode1);

            XmlElement minusNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 4, "", "-", "-@,");
            migrationData.AppendNode(minusNode);
            string minusNodeId = MigrationManager.GetGuidFromXmlElement(minusNode);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort3 = new PortId(newNodeId, 3, PortType.Input);
            PortId oldInPort4 = new PortId(newNodeId, 4, PortType.Input);

            PortId planeNodeInPort = new PortId(planeNodeId, 0, PortType.Input);
            PortId converterInPort = new PortId(converterNode0Id, 0, PortType.Input);
            PortId minusNodeInPort0 = new PortId(minusNodeId, 0, PortType.Input);
            PortId minusNodeInPort1 = new PortId(minusNodeId, 1, PortType.Input);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);
            XmlElement connector4 = data.FindFirstConnector(oldInPort4);

            data.ReconnectToPort(connector0, planeNodeInPort);
            data.ReconnectToPort(connector3, converterInPort);
            data.ReconnectToPort(connector4, minusNodeInPort0);

            if (connector3 != null)
            {
                XmlElement connector5 = MigrationManager.CreateFunctionNodeFrom(connector3);
                data.CreateConnector(connector5);
                data.ReconnectToPort(connector5, minusNodeInPort1);
            }

            data.CreateConnector(minusNode, 0, converterNode1, 0);
            data.CreateConnector(converterNode0, 0, newNode, 3);
            data.CreateConnector(converterNode1, 0, newNode, 4);
            data.CreateConnector(zAxis, 0, planeNode, 1);
            data.CreateConnector(planeNode, 0, newNode, 0);

            return migrationData;
        }
Ejemplo n.º 47
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "CoordinateSystem.Rotate", "CoordinateSystem.Rotate@Point,Vector,double");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");
            migrationData.AppendNode(identityCoordinateSystem);

            XmlElement converterNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll",
                "Math.RadiansToDegrees", "Math.RadiansToDegrees@double");
            migrationData.AppendNode(converterNode);
            string converterNodeId = MigrationManager.GetGuidFromXmlElement(converterNode);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId oldInPort2 = new PortId(newNodeId, 2, PortType.Input);

            PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(pointAsVector0Id, 0, PortType.Input);

            PortId converterInPort = new PortId(converterNodeId, 0, PortType.Input);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort2);
            data.ReconnectToPort(connector2, converterInPort);

            data.CreateConnector(converterNode, 0, newNode, 3);
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 0);
            data.CreateConnector(pointAsVector0, 0, newNode, 2);

            return migrationData;
        }
Ejemplo n.º 48
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "CoordinateSystem.Translate",
                "*****@*****.**");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new node
            XmlElement identityCoordinateSystem = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.Identity",
                "CoordinateSystem.Identity");
            migrationData.AppendNode(identityCoordinateSystem);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            // Update connectors
            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            PortId pToV0 = new PortId(pointAsVector0Id, 0, PortType.Input);

            data.ReconnectToPort(connector0, pToV0);
            data.CreateConnector(pointAsVector0, 0, newNode, 1); 
            data.CreateConnector(identityCoordinateSystem, 0, newNode, 0);

            return migrationData;
        }
Ejemplo n.º 49
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            var migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Geometry.Intersect", "Geometry.Intersect@Geometry");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            var oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            var connector0 = data.FindFirstConnector(oldInPort0);
            var oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            var connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector0, oldInPort0);
            data.ReconnectToPort(connector1, oldInPort1);

            // reconnect output port at 1 to 0
            var oldXYZOut = new PortId(newNodeId, 1, PortType.Output);
            var newXyzOut = new PortId(newNodeId, 0, PortType.Output);
            var xyzConnects = data.FindConnectors(oldXYZOut);

            if (xyzConnects != null)
            {
                xyzConnects.ToList().ForEach(x => data.ReconnectToPort(x, newXyzOut));
            }

            // get u parm
            if (connector0 != null)
            {
                var crvInputNodeId = connector0.Attributes["start"].Value;
                var crvInputIndex = int.Parse(connector0.Attributes["start_index"].Value);

                // make parm at point node 
                var parmAtPt = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll",
                    "Curve.ParameterAtPoint",
                    "Curve.ParameterAtPoint@Point");
                migrationData.AppendNode(parmAtPt);
                var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);

                // connect output of project to parm at pt
                data.CreateConnectorFromId(crvInputNodeId, crvInputIndex, parmAtPtId, 0);
                data.CreateConnector(newNode, 0, parmAtPt, 1);

                // reconnect remaining output ports to new nodes
                var newTOut = new PortId(parmAtPtId, 0, PortType.Output);
                var oldTOut = new PortId(newNodeId, 2, PortType.Output);

                var oldTConnectors = data.FindConnectors(oldTOut);

                oldTConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newTOut));
            }

            // get v parm
            if (connector1 != null)
            {
                var crvInputNodeId = connector1.Attributes["start"].Value;
                var crvInputIndex = int.Parse(connector1.Attributes["start_index"].Value);

                // make parm at point node 
                var parmAtPt = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll",
                    "Curve.ParameterAtPoint",
                    "Curve.ParameterAtPoint@Point");
                migrationData.AppendNode(parmAtPt);
                var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);

                // connect output of project to parm at pt
                data.CreateConnectorFromId(crvInputNodeId, crvInputIndex, parmAtPtId, 0);
                data.CreateConnector(newNode, 0, parmAtPt, 1);

                // reconnect remaining output ports to new nodes
                var newTOut = new PortId(parmAtPtId, 0, PortType.Output);
                var oldTOut = new PortId(newNodeId, 3, PortType.Output);

                var oldTConnectors = data.FindConnectors(oldTOut);

                oldTConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newTOut));
            }

            return migrationData;
        }
Ejemplo n.º 50
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsCoreNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsCoreNode, "DSCoreNodes.dll",
                "List.RemoveItemAtIndex", "List.RemoveItemAtIndex@var[]..[],int[]");

            migratedData.AppendNode(dsCoreNode);
            string dsCoreNodeId = MigrationManager.GetGuidFromXmlElement(dsCoreNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(dsCoreNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsCoreNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            return migratedData;
        }
Ejemplo n.º 51
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Vector.AsPoint", "Vector.AsPoint");
            migrationData.AppendNode(newNode);

            XmlElement axisNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "CoordinateSystem.ZAxis", "CoordinateSystem.ZAxis");
            migrationData.AppendNode(axisNode);
            string axisNodeId = MigrationManager.GetGuidFromXmlElement(axisNode);

            // Update connectors
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId newInPort0 = new PortId(axisNodeId, 0, PortType.Input);

            data.ReconnectToPort(connector0, newInPort0);
            data.CreateConnector(axisNode, 0, newNode, 0);

            return migrationData;
        }
Ejemplo n.º 52
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "DSCoreNodes.dll",
                "List.Sublists", "List.Sublists@var[]..[],var[]..[],int");
            newNode.SetAttribute("lacing", "shortest");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create code block node
            string rangesString = "{0}";
            foreach (XmlNode childNode in oldNode.ChildNodes)
            {
                if (childNode.Name.Equals(typeof(string).FullName))
                    rangesString = "{" + childNode.Attributes[0].Value + "};";
            }

            XmlElement codeBlockNode = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 0, rangesString);
            migrationData.AppendNode(codeBlockNode);
            string codeBlockNodeId = MigrationManager.GetGuidFromXmlElement(codeBlockNode);

            // Update connectors
            for (int idx = 0; true; idx++)
            {
                PortId oldInPort = new PortId(newNodeId, idx + 2, PortType.Input);
                PortId newInPort = new PortId(codeBlockNodeId, idx, PortType.Input);
                XmlElement connector = data.FindFirstConnector(oldInPort);

                if (connector == null)
                    break;

                data.ReconnectToPort(connector, newInPort);
            }

            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId newInPort2 = new PortId(newNodeId, 2, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            data.ReconnectToPort(connector1, newInPort2);
            data.CreateConnector(codeBlockNode, 0, newNode, 1);

            return migrationData;
        }
Ejemplo n.º 53
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);

            var converterNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(converterNode, "DSCoreNodes.dll",
                "Math.DegreesToRadians", "Math.DegreesToRadians@double");
            migrationData.AppendNode(converterNode);
            string converterNodeId = MigrationManager.GetGuidFromXmlElement(converterNode);

            // Create new node
            XmlElement atanNode = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "DSCoreNodes.dll",
                "Math.Atan", "Math.Atan@double");
            migrationData.AppendNode(atanNode);
            string atanNodeId = MigrationManager.GetGuidFromXmlElement(atanNode);

            // Update connectors
            PortId oldInPort0 = new PortId(converterNodeId, 0, PortType.Input);
            PortId newInPortAtan = new PortId(atanNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            data.ReconnectToPort(connector0, newInPortAtan);
            data.CreateConnector(atanNode, 0, converterNode, 0);

            return migrationData;
        }
Ejemplo n.º 54
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsCoreNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsCoreNode, "DSCoreNodes.dll",
                "List.GetItemAtIndex", "List.GetItemAtIndex@var[]..[],int");
            migratedData.AppendNode(dsCoreNode);
            string dsCoreNodeId = MigrationManager.GetGuidFromXmlElement(dsCoreNode);


            XmlElement stringJoinNode = MigrationManager.CreateVarArgFunctionNode(
                data.Document, oldNode, 1, "DSCoreNodes.dll",
                "String.Join", "String.Join@string,string[]", "2");
            migratedData.AppendNode(stringJoinNode);
            string stringJoinNodeId = MigrationManager.GetGuidFromXmlElement(stringJoinNode);


            XmlElement cbn = MigrationManager.CreateCodeBlockNodeModelNode(
                data.Document, oldNode, 2, "0");
            migratedData.AppendNode(cbn);
            string cbnId = MigrationManager.GetGuidFromXmlElement(cbn);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(stringJoinNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(stringJoinNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);
            data.CreateConnector(stringJoinNode, 0, dsCoreNode, 0);
            data.CreateConnector(cbn, 0, dsCoreNode, 1);

            // Add default values
            foreach (XmlNode child in oldNode.ChildNodes)
            {
                var newChild = child.Clone() as XmlElement;

                if (newChild.GetAttribute("index") == "1")
                    newChild.SetAttribute("index", "0");

                stringJoinNode.AppendChild(newChild);
            }

            return migratedData;           
        }
Ejemplo n.º 55
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string nodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            PortId inPort0 = new PortId(nodeId, 0, PortType.Input);
            PortId inPort1 = new PortId(nodeId, 1, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(inPort0);
            XmlElement connector1 = data.FindFirstConnector(inPort1);

            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            migrationData.AppendNode(newNode);

            if (connector0 == null)
            {
                // If there is no key, migrate to List.MaximumItem
                MigrationManager.SetFunctionSignature(newNode, "DSCoreNodes.dll",
                    "List.MaximumItem", "List.MaximumItem@var[]..[]");

                PortId newInPort1 = new PortId(nodeId, 1, PortType.Input);
                data.ReconnectToPort(connector1, inPort0);

                return migrationData;
            }

            // If there is key, migrate to FunctionObject.ds MaximumItemByKey
            MigrationManager.SetFunctionSignature(newNode, "",
                "MaximumItemByKey", "MaximumItemByKey@var[]..[],_FunctionObject");

            // Update connectors
            data.ReconnectToPort(connector0, inPort1);
            data.ReconnectToPort(connector1, inPort0);

            return migrationData;
        }
Ejemplo n.º 56
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            XmlElement newNode = MigrationManager.CloneAndChangeName(oldNode, "DSCore.Map", "List.Map");
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            migrationData.AppendNode(newNode);
            return migrationData;
        }
Ejemplo n.º 57
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            // Create nodes
            XmlElement newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "DSCoreNodes.dll",
                "List.Slice", "List.Slice@var[]..[],int,int,int");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            XmlElement plus = MigrationManager.CreateFunctionNode(data.Document,
                oldNode, 0, "", "+", "+@,");
            migrationData.AppendNode(plus);
            string plusId = MigrationManager.GetGuidFromXmlElement(plus);

            // Update connectors
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            PortId oldInPort2 = new PortId(oldNodeId, 2, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);

            PortId newInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId plusInPort1 = new PortId(plusId, 1, PortType.Input);

            if (connector0 != null)
            {
                string startId = connector0.GetAttribute("start");
                data.CreateConnectorFromId(startId, 0, plusId, 0);
            }

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, plusInPort1);
            data.ReconnectToPort(connector2, newInPort0);
            data.CreateConnector(plus, 0, newNode, 2);

            // Add default value
            XmlElement defaultValue = data.Document.CreateElement("PortInfo");
            defaultValue.SetAttribute("index", "3");
            defaultValue.SetAttribute("default", "True");
            newNode.AppendChild(defaultValue);

            return migrationData;
        }
Ejemplo n.º 58
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            var migrationData = new NodeMigrationData(data.Document);

            #region Create DSFunction node

            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "Geometry.Intersect", "Geometry.Intersect@Geometry");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            var oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            var faceInConnector = data.FindFirstConnector(oldInPort0);
            var oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            var crvInConnector = data.FindFirstConnector(oldInPort1);

            // probably unnecessary
            data.ReconnectToPort(faceInConnector, oldInPort0);
            data.ReconnectToPort(crvInConnector, oldInPort1);

            #endregion

            // in ports of curve-face intersection

                // 1) crv   -> stays the same
                // 2) face  -> stays the same

            // out ports of curve-face intersection

                // 1) result    -> this will be killed off by the migration
                // 2) xyz       -> this is out port 1 of oldNode
                // 3) uv        -> use Surface.ParameterAtPoint
                // 4) t         -> use Curve.ParameterAtPoint
                // 5) edge      -> killed
                // 6) edge t    -> killed


            // reconnect output port at 1 to 0
            var oldXYZOut = new PortId(newNodeId, 1, PortType.Output);
            var newXyzOut = new PortId(newNodeId, 0, PortType.Output);
            var xyzConnects = data.FindConnectors(oldXYZOut);

            if (xyzConnects != null)
            {
                xyzConnects.ToList().ForEach(x => data.ReconnectToPort(x, newXyzOut));
            }

            // get uv parm
            if (faceInConnector != null)
            {
                var faceInputNodeId = faceInConnector.Attributes["start"].Value;
                var faceInputIndex = int.Parse(faceInConnector.Attributes["start_index"].Value);

                // get the parameter as a vector
                var parmAtPt = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll",
                    "Surface.UVParameterAtPoint",
                    "Surface.UVParameterAtPoint@Point");
                migrationData.AppendNode(parmAtPt);
                var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);

                // connect output of project to parm at pt
                data.CreateConnectorFromId(faceInputNodeId, faceInputIndex, parmAtPtId, 0);
                data.CreateConnector(newNode, 0, parmAtPt, 1);

                // reconnect remaining output ports to new nodes
                var newUVOut = new PortId(parmAtPtId, 0, PortType.Output);
                var oldUVOut = new PortId(newNodeId, 2, PortType.Output);

                var oldUVConnectors = data.FindConnectors(oldUVOut);
                if (oldUVConnectors != null)
                    oldUVConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newUVOut));
            }

            // get v parm
            if (crvInConnector != null)
            {
                var crvInputNodeId = crvInConnector.Attributes["start"].Value;
                var crvInputIndex = int.Parse(crvInConnector.Attributes["start_index"].Value);

                // make parm at point node 
                var parmAtPt = MigrationManager.CreateFunctionNode(
                    data.Document, oldNode, 0, "ProtoGeometry.dll",
                    "Curve.ParameterAtPoint",
                    "Curve.ParameterAtPoint@Point");
                migrationData.AppendNode(parmAtPt);
                var parmAtPtId = MigrationManager.GetGuidFromXmlElement(parmAtPt);

                // connect output of project to parm at pt
                data.CreateConnectorFromId(crvInputNodeId, crvInputIndex, parmAtPtId, 0);
                data.CreateConnector(newNode, 0, parmAtPt, 1);

                // reconnect remaining output ports to new nodes
                var newTOut = new PortId(parmAtPtId, 0, PortType.Output);
                var oldTOut = new PortId(newNodeId, 3, PortType.Output);

                var oldTConnectors = data.FindConnectors(oldTOut);
                if (oldTConnectors != null)
                    oldTConnectors.ToList().ForEach(x => data.ReconnectToPort(x, newTOut));
            }

            return migrationData;
        }
Ejemplo n.º 59
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migrationData = new NodeMigrationData(data.Document);

            // Create DSFunction node
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            var newNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(newNode, "ProtoGeometry.dll",
                "CoordinateSystem.PostMultiplyBy",
                "CoordinateSystem.PostMultiplyBy@CoordinateSystem");
            migrationData.AppendNode(newNode);
            string newNodeId = MigrationManager.GetGuidFromXmlElement(newNode);

            // Create new nodes
            XmlElement vectorCrossFrom = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 0, "ProtoGeometry.dll",
                "Vector.Cross", "Vector.Cross@Vector");
            migrationData.AppendNode(vectorCrossFrom);
            string vectorCrossFromId = MigrationManager.GetGuidFromXmlElement(vectorCrossFrom);

            XmlElement vectorCrossTo = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 1, "ProtoGeometry.dll",
                "Vector.Cross", "Vector.Cross@Vector");
            migrationData.AppendNode(vectorCrossTo);
            string vectorCrossToId = MigrationManager.GetGuidFromXmlElement(vectorCrossTo);

            XmlElement csFrom = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 2, "ProtoGeometry.dll", "CoordinateSystem.ByOriginVectors",
                "CoordinateSystem.ByOriginVectors@Autodesk.DesignScript.Geometry.Point,"
                + "Autodesk.DesignScript.Geometry.Vector,Autodesk.DesignScript.Geometry"
                + ".Vector,Autodesk.DesignScript.Geometry.Vector");
            string csFromId = MigrationManager.GetGuidFromXmlElement(csFrom);
            migrationData.AppendNode(csFrom);

            XmlElement csTo = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 3, "ProtoGeometry.dll", "CoordinateSystem.ByOriginVectors",
                "CoordinateSystem.ByOriginVectors@Autodesk.DesignScript.Geometry.Point,"
                + "Autodesk.DesignScript.Geometry.Vector,Autodesk.DesignScript.Geometry"
                + ".Vector,Autodesk.DesignScript.Geometry.Vector");
            string csToId = MigrationManager.GetGuidFromXmlElement(csTo);
            migrationData.AppendNode(csTo);

            XmlElement csInverse = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 4, "ProtoGeometry.dll",
                "CoordinateSystem.Inverse", "CoordinateSystem.Inverse");
            migrationData.AppendNode(csInverse);

            //append asVector Node
            XmlElement pointAsVector0 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 5, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector0);
            string pointAsVector0Id = MigrationManager.GetGuidFromXmlElement(pointAsVector0);

            XmlElement pointAsVector1 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 6, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector1);
            string pointAsVector1Id = MigrationManager.GetGuidFromXmlElement(pointAsVector1);

            XmlElement pointAsVector2 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 7, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector2);
            string pointAsVector2Id = MigrationManager.GetGuidFromXmlElement(pointAsVector2);

            XmlElement pointAsVector3 = MigrationManager.CreateFunctionNode(
                data.Document, oldNode, 8, "ProtoGeometry.dll",
                "Point.AsVector", "Point.AsVector");
            migrationData.AppendNode(pointAsVector3);
            string pointAsVector3Id = MigrationManager.GetGuidFromXmlElement(pointAsVector3);

            PortId pToV0 = new PortId(pointAsVector0Id, 0, PortType.Input);
            PortId pToV1 = new PortId(pointAsVector1Id, 0, PortType.Input);
            PortId pToV2 = new PortId(pointAsVector2Id, 0, PortType.Input);
            PortId pToV3 = new PortId(pointAsVector3Id, 0, PortType.Input);

            // Update connectors
            PortId csFrom0 = new PortId(csFromId, 0, PortType.Input);
            PortId csFrom1 = new PortId(csFromId, 1, PortType.Input);
            PortId csFrom2 = new PortId(csFromId, 2, PortType.Input);
            PortId csFrom3 = new PortId(csFromId, 3, PortType.Input);
            PortId csTo0 = new PortId(csToId, 0, PortType.Input);
            PortId csTo1 = new PortId(csToId, 1, PortType.Input);
            PortId csTo2 = new PortId(csToId, 2, PortType.Input);
            PortId csTo3 = new PortId(csToId, 3, PortType.Input);

            PortId oldInPort0 = new PortId(newNodeId, 0, PortType.Input);
            PortId oldInPort1 = new PortId(newNodeId, 1, PortType.Input);
            PortId oldInPort2 = new PortId(newNodeId, 2, PortType.Input);
            PortId oldInPort3 = new PortId(newNodeId, 3, PortType.Input);
            PortId oldInPort4 = new PortId(newNodeId, 4, PortType.Input);
            PortId oldInPort5 = new PortId(newNodeId, 5, PortType.Input);

            XmlElement connector0 = data.FindFirstConnector(oldInPort0);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);
            XmlElement connector2 = data.FindFirstConnector(oldInPort2);
            XmlElement connector3 = data.FindFirstConnector(oldInPort3);
            XmlElement connector4 = data.FindFirstConnector(oldInPort4);
            XmlElement connector5 = data.FindFirstConnector(oldInPort5);

            data.ReconnectToPort(connector0, csFrom0);
            data.ReconnectToPort(connector1, pToV0);
            data.ReconnectToPort(connector2, pToV1);
            data.ReconnectToPort(connector3, csTo0);
            data.ReconnectToPort(connector4, pToV2);
            data.ReconnectToPort(connector5, pToV3);

            data.CreateConnector(pointAsVector0, 0, csFrom, 3); 
            data.CreateConnector(pointAsVector1, 0, csFrom, 2);
            data.CreateConnector(pointAsVector2, 0, csTo, 3);
            data.CreateConnector(pointAsVector3, 0, csTo, 2);

            data.CreateConnector(pointAsVector0, 0, vectorCrossFrom, 1);
            data.CreateConnector(pointAsVector1, 0, vectorCrossFrom, 0);
            data.CreateConnector(pointAsVector2, 0, vectorCrossTo, 1);
            data.CreateConnector(pointAsVector3, 0, vectorCrossTo, 0);

            data.CreateConnector(vectorCrossFrom, 0, csFrom, 1);
            data.CreateConnector(vectorCrossTo, 0, csTo, 1);
            data.CreateConnector(csFrom, 0, csInverse, 0);
            data.CreateConnector(csInverse, 0, newNode, 1);
            data.CreateConnector(csTo, 0, newNode, 0);

            return migrationData;
        }
Ejemplo n.º 60
0
        public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data)
        {
            NodeMigrationData migratedData = new NodeMigrationData(data.Document);
            XmlElement oldNode = data.MigratedNodes.ElementAt(0);
            string oldNodeId = MigrationManager.GetGuidFromXmlElement(oldNode);

            //create the node itself
            XmlElement dsCoreNode = MigrationManager.CreateFunctionNodeFrom(oldNode);
            MigrationManager.SetFunctionSignature(dsCoreNode, "DSCoreNodes.dll",
                "List.TakeEveryNthItem", "List.TakeEveryNthItem@var[]..[],int,int");

            foreach (XmlNode child in oldNode.ChildNodes)
            {
                dsCoreNode.AppendChild(child.CloneNode(true));
            }
            migratedData.AppendNode(dsCoreNode);
            string dsCoreNodeId = MigrationManager.GetGuidFromXmlElement(dsCoreNode);

            //create and reconnect the connecters
            PortId oldInPort0 = new PortId(oldNodeId, 0, PortType.Input);
            XmlElement connector0 = data.FindFirstConnector(oldInPort0);

            PortId oldInPort1 = new PortId(oldNodeId, 1, PortType.Input);
            XmlElement connector1 = data.FindFirstConnector(oldInPort1);

            PortId newInPort0 = new PortId(dsCoreNodeId, 0, PortType.Input);
            PortId newInPort1 = new PortId(dsCoreNodeId, 1, PortType.Input);

            data.ReconnectToPort(connector0, newInPort1);
            data.ReconnectToPort(connector1, newInPort0);

            // Add default values
            foreach (XmlNode child in oldNode.ChildNodes)
                dsCoreNode.AppendChild(child.Clone());

            return migratedData;
        }