Esempio n. 1
0
 public GetDataFromExcelWorksheet()
 {
     InPortData.Add(new PortData("worksheet", "The excel workbook"));
     OutPortData.Add(new PortData("worksheet", "The worksheet with the given name"));
     RegisterAllPorts();
 }
Esempio n. 2
0
        public dynActiveRevitView()
        {
            OutPortData.Add(new PortData("v", "The active revit view.", typeof(Value.Container)));

            RegisterAllPorts();
        }
Esempio n. 3
0
 public LengthFromString()
 {
     _measure = Length.FromDouble(0.0);
     OutPortData.Add(new PortData("length", "The length. Stored internally as decimal meters."));
     RegisterAllPorts();
 }
Esempio n. 4
0
 protected DSDropDownBase(WorkspaceModel workspaceModel, string outputName) : base(workspaceModel)
 {
     OutPortData.Add(new PortData(outputName, string.Format("The selected {0}", outputName)));
     RegisterAllPorts();
     PopulateItems();
 }
Esempio n. 5
0
        public dynAnalysisResultsDisplayStyleColor()
        {
            OutPortData.Add(new PortData("ads", "Colored surface Analysis Display Style", typeof(Value.Container)));

            RegisterAllPorts();
        }
Esempio n. 6
0
 public LengthInput()
 {
     _measure = new Units.Length(0.0, dynSettings.Controller.UnitsManager);
     OutPortData.Add(new PortData("length", "The length. Stored internally as decimal meters.", typeof(FScheme.Value.Container)));
     RegisterAllPorts();
 }
Esempio n. 7
0
        public dynTransformIdentity()
        {
            OutPortData.Add(new PortData("t", "Transform", typeof(Value.Container)));

            RegisterAllPorts();
        }
Esempio n. 8
0
        public DynamoRobotEngine()
        {
            OutPortData.Add(new PortData("eng", "The Robot Structural Analysis engine.", typeof(object)));

            NodeUI.RegisterAllPorts();
        }
Esempio n. 9
0
 public ElementsOfType()
 {
     InPortData.Add(new PortData("element type", "An element type."));
     OutPortData.Add(new PortData("elements", "All elements in the active document of a given type."));
     RegisterAllPorts();
 }
Esempio n. 10
0
 public Formula()
 {
     OutPortData.Add(new PortData("", "Result of math computation", typeof(Value.Number)));
     RegisterAllPorts();
 }
Esempio n. 11
0
 public PlaneFromRefPoint()
 {
     InPortData.Add(new PortData("pt", "The point to extract the plane from", typeof(Value.Container)));
     OutPortData.Add(new PortData("r", "Reference", typeof(Value.Container)));
     RegisterAllPorts();
 }
Esempio n. 12
0
        protected override void DeserializeCore(XmlElement element, SaveContext context)
        {
            base.DeserializeCore(element, context); //Base implementation must be called

            if (context == SaveContext.Undo)
            {
                var helper = new XmlElementHelper(element);
                NickName = helper.ReadString("functionName");

                Guid funcId;
                if (!Guid.TryParse(helper.ReadString("functionId"), out funcId))
                {
                    funcId = GuidUtility.Create(GuidUtility.UrlNamespace, NickName);
                }

                if (!VerifyFuncId(ref funcId))
                {
                    LoadProxyCustomNode(funcId);
                    return;
                }

                Definition = Workspace.DynamoModel.CustomNodeManager.GetFunctionDefinition(funcId);

                XmlNodeList inNodes  = element.SelectNodes("functionInput");
                XmlNodeList outNodes = element.SelectNodes("functionOutput");

                var inData =
                    inNodes.Cast <XmlNode>()
                    .Select(
                        (inputNode, i) =>
                        new
                {
                    data = new PortData(inputNode.Attributes[0].Value, "Input #" + (i + 1)),
                    idx  = i
                });

                foreach (var dataAndIdx in inData)
                {
                    if (InPortData.Count > dataAndIdx.idx)
                    {
                        InPortData[dataAndIdx.idx] = dataAndIdx.data;
                    }
                    else
                    {
                        InPortData.Add(dataAndIdx.data);
                    }
                }

                var outData =
                    outNodes.Cast <XmlNode>()
                    .Select(
                        (outputNode, i) =>
                        new
                {
                    data = new PortData(outputNode.Attributes[0].Value, "Output #" + (i + 1)),
                    idx  = i
                });

                foreach (var dataAndIdx in outData)
                {
                    if (OutPortData.Count > dataAndIdx.idx)
                    {
                        OutPortData[dataAndIdx.idx] = dataAndIdx.data;
                    }
                    else
                    {
                        OutPortData.Add(dataAndIdx.data);
                    }
                }

                //Added it the same way as LoadNode. But unsure of when 'Output' ChildNodes will
                //be added to element. As of now I dont think it is added during serialize

                #region Legacy output support

                foreach (var portData in
                         from XmlNode subNode in element.ChildNodes
                         where subNode.Name.Equals("Output")
                         select new PortData(subNode.Attributes[0].Value, "function output"))
                {
                    if (OutPortData.Any())
                    {
                        OutPortData[0] = portData;
                    }
                    else
                    {
                        OutPortData.Add(portData);
                    }
                }

                #endregion

                RegisterAllPorts();

                Description = helper.ReadString("functionDesc");
            }
        }
Esempio n. 13
0
        protected override void LoadNode(XmlNode nodeElement)
        {
            List <XmlNode> childNodes = nodeElement.ChildNodes.Cast <XmlNode>().ToList();

            XmlNode nameNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("Name"));

            if (nameNode != null && nameNode.Attributes != null)
            {
                NickName = nameNode.Attributes[0].Value;
            }

            XmlNode idNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("ID"));

            if (idNode != null && idNode.Attributes != null)
            {
                string id = idNode.Attributes[0].Value;
                Guid   funcId;
                if (!Guid.TryParse(id, out funcId) && nodeElement.Attributes != null)
                {
                    funcId = GuidUtility.Create(GuidUtility.UrlNamespace, nodeElement.Attributes["nickname"].Value);
                }
                if (!VerifyFuncId(ref funcId))
                {
                    LoadProxyCustomNode(funcId);
                }
                Definition = Workspace.DynamoModel.CustomNodeManager.GetFunctionDefinition(funcId);

                if (Definition.IsProxy)
                {
                    Error("Cannot load custom node");
                }
            }

            foreach (XmlNode subNode in childNodes)
            {
                if (subNode.Name.Equals("Outputs"))
                {
                    var data =
                        subNode.ChildNodes.Cast <XmlNode>()
                        .Select(
                            (outputNode, i) =>
                            new
                    {
                        data = new PortData(outputNode.Attributes[0].Value, "Output #" + (i + 1)),
                        idx  = i
                    });

                    foreach (var dataAndIdx in data)
                    {
                        if (OutPortData.Count > dataAndIdx.idx)
                        {
                            OutPortData[dataAndIdx.idx] = dataAndIdx.data;
                        }
                        else
                        {
                            OutPortData.Add(dataAndIdx.data);
                        }
                    }
                }
                else if (subNode.Name.Equals("Inputs"))
                {
                    var data =
                        subNode.ChildNodes.Cast <XmlNode>()
                        .Select(
                            (inputNode, i) =>
                            new
                    {
                        data = new PortData(inputNode.Attributes[0].Value, "Input #" + (i + 1)),
                        idx  = i
                    });

                    foreach (var dataAndIdx in data)
                    {
                        if (InPortData.Count > dataAndIdx.idx)
                        {
                            InPortData[dataAndIdx.idx] = dataAndIdx.data;
                        }
                        else
                        {
                            InPortData.Add(dataAndIdx.data);
                        }
                    }
                }

                #region Legacy output support

                else if (subNode.Name.Equals("Output"))
                {
                    var data = new PortData(subNode.Attributes[0].Value, "function output");

                    if (OutPortData.Any())
                    {
                        OutPortData[0] = data;
                    }
                    else
                    {
                        OutPortData.Add(data);
                    }
                }

                #endregion
            }

            if (!IsInSyncWithDefinition())
            {
                ResyncWithDefinition();
            }
            else
            {
                RegisterAllPorts();
            }

            //argument lacing on functions should be set to disabled
            //by default in the constructor, but for any workflow saved
            //before this was the case, we need to ensure it here.
            ArgumentLacing = LacingStrategy.Disabled;

            //if (Definition != null)
            //    ResyncWithDefinition();
        }
Esempio n. 14
0
        private void SetOutputPorts()
        {
            // Get all defined variables and their locations
            var definedVars = codeStatements.Select(s => new KeyValuePair <Variable, int>(s.FirstDefinedVariable, s.StartLine))
                              .Where(pair => pair.Key != null)
                              .Select(pair => new KeyValuePair <string, int>(pair.Key.Name, pair.Value))
                              .OrderBy(pair => pair.Key)
                              .GroupBy(pair => pair.Key);

            // Calc each variable's last location of definition
            var locationMap = new Dictionary <string, int>();

            foreach (var defs in definedVars)
            {
                var name = defs.FirstOrDefault().Key;
                var loc  = defs.Select(p => p.Value).Max <int>();
                locationMap[name] = loc;
            }

            // Create output ports
            var allDefs = locationMap.OrderBy(p => p.Value);

            if (allDefs.Any() == false)
            {
                return;
            }

            double prevPortBottom = 0.0;
            var    map            = CodeBlockUtils.MapLogicalToVisualLineIndices(this.code);

            foreach (var def in allDefs)
            {
                // Map the given logical line index to its corresponding visual
                // line index. Do note that "def.Value" here is the line number
                // supplied by the paser, which uses 1-based line indexing so we
                // have to remove one from the line index.
                //
                var logicalIndex = def.Value - 1;
                var visualIndex  = map.ElementAt(logicalIndex);

                string tooltip = def.Key;
                if (tempVariables.Contains(def.Key))
                {
                    tooltip = Formatting.ToolTipForTempVariable;
                }

                double portCoordsY = Formatting.InitialMargin;
                portCoordsY += visualIndex * Configurations.CodeBlockPortHeightInPixels;

                OutPortData.Add(new PortData(string.Empty, tooltip)
                {
                    VerticalMargin = portCoordsY - prevPortBottom,
                    Height         = Configurations.CodeBlockPortHeightInPixels
                });

                // Since we compute the "delta" between the top of the current
                // port to the bottom of the previous port, we need to record
                // down the bottom coordinate value before proceeding to the next
                // port.
                //
                prevPortBottom = portCoordsY + Configurations.CodeBlockPortHeightInPixels;
            }
        }
Esempio n. 15
0
 public AreaInput()
 {
     _measure = new Area(0.0, dynSettings.Controller.UnitsManager);
     OutPortData.Add(new PortData("area", "The area. Stored internally as decimal meters squared.", typeof(FScheme.Value.Container)));
     RegisterAllPorts();
 }
Esempio n. 16
0
 public NodeWithFailingASTOutput()
 {
     InPortData.Add(new PortData("input", "dummy input"));
     OutPortData.Add(new PortData("result", "dummy result"));
     RegisterAllPorts();
 }
Esempio n. 17
0
 public VolumeInput()
 {
     _measure = new Volume(0.0, dynSettings.Controller.UnitsManager);
     OutPortData.Add(new PortData("volume", "The volume. Stored internally as decimal meters cubed.", typeof(FScheme.Value.Container)));
     RegisterAllPorts();
 }
Esempio n. 18
0
 protected PythonNodeBase(WorkspaceModel workspace) : base(workspace)
 {
     OutPortData.Add(new PortData("OUT", "Result of the python script"));
     ArgumentLacing = LacingStrategy.Disabled;
 }
Esempio n. 19
0
 protected PythonNodeBase()
 {
     OutPortData.Add(new PortData("OUT", Properties.Resources.PythonNodePortDataOutputToolTip));
     ArgumentLacing = LacingStrategy.Disabled;
 }
Esempio n. 20
0
 public dynReferencePoint()
 {
     OutPortData.Add(new PortData(null, "pt", "The Reference Point(s) created from this operation.", typeof(dynReferencePoint)));
     OutPortData[0].Object = this.Tree;
 }
Esempio n. 21
0
 protected PythonNodeBase()
 {
     OutPortData.Add(new PortData("OUT", "Result of the python script"));
     AddInput();
     ArgumentLacing = LacingStrategy.Disabled;
 }
Esempio n. 22
0
 public dynCurveLoop()
 {
     InPortData.Add(new PortData("curves", "Geometry curves to make curve loop", typeof(Value.List)));
     OutPortData.Add(new PortData("CurveLoop", "CurveLoop", typeof(Value.Container)));
     RegisterAllPorts();
 }
Esempio n. 23
0
 protected MultipleElementSelectionBase(PortData outData)
 {
     OutPortData.Add(outData);
     RegisterAllPorts();
 }
Esempio n. 24
0
 protected DSDropDownBase(string outputName)
 {
     OutPortData.Add(new PortData(outputName, string.Format(Resources.DropDownPortDataResultToolTip, outputName)));
     RegisterAllPorts();
     PopulateItems();
 }
Esempio n. 25
0
        protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
        {
            List <XmlNode> childNodes = nodeElement.ChildNodes.Cast <XmlNode>().ToList();

            if (!Controller.IsInSyncWithNode(this))
            {
                Controller.SyncNodeWithDefinition(this);
                OnNodeModified();
            }
            else if (Controller.Definition == null || Controller.Definition.IsProxy)
            {
                foreach (XmlNode subNode in childNodes)
                {
                    if (subNode.Name.Equals("Outputs"))
                    {
                        var data =
                            subNode.ChildNodes.Cast <XmlNode>()
                            .Select(
                                (outputNode, i) =>
                                new
                        {
                            data = new PortData(outputNode.Attributes[0].Value, Properties.Resources.ToolTipOutput + (i + 1)),
                            idx  = i
                        });

                        foreach (var dataAndIdx in data)
                        {
                            if (OutPortData.Count > dataAndIdx.idx)
                            {
                                OutPortData[dataAndIdx.idx] = dataAndIdx.data;
                            }
                            else
                            {
                                OutPortData.Add(dataAndIdx.data);
                            }
                        }
                    }
                    else if (subNode.Name.Equals("Inputs"))
                    {
                        var data =
                            subNode.ChildNodes.Cast <XmlNode>()
                            .Select(
                                (inputNode, i) =>
                                new
                        {
                            data = new PortData(inputNode.Attributes[0].Value, Properties.Resources.ToolTipInput + (i + 1)),
                            idx  = i
                        });

                        foreach (var dataAndIdx in data)
                        {
                            if (InPortData.Count > dataAndIdx.idx)
                            {
                                InPortData[dataAndIdx.idx] = dataAndIdx.data;
                            }
                            else
                            {
                                InPortData.Add(dataAndIdx.data);
                            }
                        }
                    }

                    #region Legacy output support

                    else if (subNode.Name.Equals("Output"))
                    {
                        var data = new PortData(subNode.Attributes[0].Value, Properties.Resources.ToolTipFunctionOutput);

                        if (OutPortData.Any())
                        {
                            OutPortData[0] = data;
                        }
                        else
                        {
                            OutPortData.Add(data);
                        }
                    }

                    #endregion
                }

                RegisterAllPorts();
            }

            base.DeserializeCore(nodeElement, context); //Base implementation must be called

            XmlNode nameNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("Name"));
            if (nameNode != null && nameNode.Attributes != null)
            {
                NickName = nameNode.Attributes["value"].Value;
            }

            XmlNode descNode = childNodes.LastOrDefault(subNode => subNode.Name.Equals("Description"));
            if (descNode != null && descNode.Attributes != null)
            {
                Description = descNode.Attributes["value"].Value;
            }
        }
Esempio n. 26
0
 public ReadExcelFile(WorkspaceModel workspace) : base(workspace)
 {
     OutPortData.Add(new PortData("workbook", "The workbook opened from the file"));
     RegisterAllPorts();
 }
Esempio n. 27
0
 public ElementsOfType()
 {
     InPortData.Add(new PortData("element type", Properties.Resources.PortDataElementTypeToolTip));
     OutPortData.Add(new PortData("elements", Properties.Resources.PortDataAllElementsInDocumentToolTip));
     RegisterAllPorts();
 }
Esempio n. 28
0
 public NewExcelWorkbook(WorkspaceModel workspace)
     : base(workspace)
 {
     OutPortData.Add(new PortData("workbook", "The new Excel Workbook "));
     RegisterAllPorts();
 }
Esempio n. 29
0
 public AreaFromString()
 {
     _measure = Area.FromDouble(0.0);
     OutPortData.Add(new PortData("area", "The area. Stored internally as decimal meters squared."));
     RegisterAllPorts();
 }
Esempio n. 30
0
 public GetWorksheetsFromExcelWorkbook()
 {
     InPortData.Add(new PortData("workbook", "The excel workbook"));
     OutPortData.Add(new PortData("worksheets", "A list of worksheets"));
     RegisterAllPorts();
 }