예제 #1
0
파일: Cmpt_Post.cs 프로젝트: tsvilans/tas
        protected override void BeforeSolveInstance()
        {
            if (PostParameter.SourceCount > 0)
            {
                var last = PostParameter.Sources.Last();
                if (last.InstanceGuid != LastValueList && last is GH_ValueList)
                {
                    var valueList = last as GH_ValueList;
                    valueList.ListItems.Clear();

                    for (int i = 0; i < AvailablePosts.Length; ++i)
                    {
                        valueList.ListItems.Add(new GH_ValueListItem(AvailablePosts[i], $"\"{AvailablePosts[i]}\""));
                    }

                    valueList.SelectItem(0);
                    LastValueList = last.InstanceGuid;
                }

                PostParameter.CollectData();
            }
        }
        protected override void BeforeSolveInstance()
        {
            if (valueList == null)
            {
                if (parameter.Sources.Count == 0)
                {
                    valueList = new GH_ValueList();
                }
                else
                {
                    foreach (var source in parameter.Sources)
                    {
                        if (source is GH_ValueList)
                        {
                            valueList = source as GH_ValueList;
                        }
                        return;
                    }
                }

                valueList.CreateAttributes();
                valueList.Attributes.Pivot = new PointF(this.Attributes.Pivot.X - 200, this.Attributes.Pivot.Y - 1);
                valueList.ListItems.Clear();

                var alignmentNames  = Enum.GetNames(typeof(GlulamData.CrossSectionPosition));
                var alignmentValues = Enum.GetValues(typeof(GlulamData.CrossSectionPosition));

                for (int i = 0; i < alignmentNames.Length; ++i)
                {
                    valueList.ListItems.Add(new GH_ValueListItem(alignmentNames[i], $"{i}"));
                }

                valueList.SelectItem(4);

                Instances.ActiveCanvas.Document.AddObject(valueList, false);
                parameter.AddSource(valueList);
                parameter.CollectData();
            }
        }
예제 #3
0
        protected override void BeforeSolveInstance()
        {
            if (valueList == null)
            {
                if (parameter.Sources.Count == 0)
                {
                    valueList = new GH_ValueList();
                }
                else
                {
                    foreach (var source in parameter.Sources)
                    {
                        if (source is GH_ValueList)
                        {
                            valueList = source as GH_ValueList;
                        }
                        return;
                    }
                }

                valueList.CreateAttributes();
                valueList.Attributes.Pivot = new PointF(this.Attributes.Pivot.X - 200, this.Attributes.Pivot.Y - 1);
                valueList.ListItems.Clear();

                var glulamParameters = Glulam.ListProperties();

                foreach (string param in glulamParameters)
                {
                    valueList.ListItems.Add(new GH_ValueListItem(param, $"\"{param}\""));
                }

                Instances.ActiveCanvas.Document.AddObject(valueList, false);
                parameter.AddSource(valueList);
                parameter.CollectData();
            }
        }
예제 #4
0
파일: Machine.cs 프로젝트: zimhe/Robots
        protected override void BeforeSolveInstance()
        {
            if (valueList == null)
            {
                if (parameter.Sources.Count == 0)
                {
                    valueList = new GH_ValueList();
                }
                else
                {
                    foreach (var source in parameter.Sources)
                    {
                        if (source is GH_ValueList)
                        {
                            valueList = source as GH_ValueList;
                        }
                        return;
                    }
                }

                valueList.CreateAttributes();
                valueList.Attributes.Pivot = new PointF(this.Attributes.Pivot.X - 180, this.Attributes.Pivot.Y - 31);
                valueList.ListItems.Clear();

                var robotSystems = RobotSystem.ListRobotSystems();

                foreach (string robotSystemName in robotSystems)
                {
                    valueList.ListItems.Add(new GH_ValueListItem(robotSystemName, $"\"{robotSystemName}\""));
                }

                Instances.ActiveCanvas.Document.AddObject(valueList, false);
                parameter.AddSource(valueList);
                parameter.CollectData();
            }
        }
예제 #5
0
        protected override void BeforeSolveInstance()
        {
            if (alignment_parameter.SourceCount > 0)
            {
                var last = alignment_parameter.Sources.Last();
                if (last.InstanceGuid != LastValueList && last is GH_ValueList)
                {
                    var valueList = last as GH_ValueList;
                    valueList.ListItems.Clear();

                    var alignmentNames = Enum.GetNames(typeof(GlulamData.CrossSectionPosition));
                    //var alignmentValues = Enum.GetValues(typeof(GlulamData.CrossSectionPosition));

                    for (int i = 0; i < alignmentNames.Length; ++i)
                    {
                        valueList.ListItems.Add(new GH_ValueListItem(alignmentNames[i], $"{i}"));
                    }

                    valueList.SelectItem(4);
                    LastValueList = last.InstanceGuid;
                }

                alignment_parameter.CollectData();
            }

            /*
             *
             * }
             * foreach (var source in alignment_parameter.Sources)
             * {
             * if (source is GH_ValueList) valueList = source as GH_ValueList;
             * valueList.ListItems.Clear();
             *
             * for (int i = 0; i < alignmentNames.Length; ++i)
             * {
             *  valueList.ListItems.Add(new GH_ValueListItem(alignmentNames[i], $"{i}"));
             * }
             *
             * valueList.SelectItem(4);
             * //return;
             * }
             * }
             * if (valueList == null)
             * {
             * if (alignment_parameter.Sources.Count == 0)
             * {
             * valueList = new GH_ValueList();
             *
             * valueList.CreateAttributes();
             * valueList.Attributes.Pivot = new PointF(this.Attributes.Pivot.X - 200, this.Attributes.Pivot.Y - 1);
             * valueList.ListItems.Clear();
             *
             * var alignmentNames = Enum.GetNames(typeof(GlulamData.CrossSectionPosition));
             * var alignmentValues = Enum.GetValues(typeof(GlulamData.CrossSectionPosition));
             *
             * for (int i = 0; i < alignmentNames.Length; ++i)
             * {
             *  valueList.ListItems.Add(new GH_ValueListItem(alignmentNames[i], $"{i}"));
             * }
             *
             * valueList.SelectItem(4);
             * Instances.ActiveCanvas.Document.AddObject(valueList, false);
             * alignment_parameter.AddSource(valueList);
             *
             * }
             * else
             * {
             * foreach (var source in alignment_parameter.Sources)
             * {
             *  if (source is GH_ValueList) valueList = source as GH_ValueList;
             *  //return;
             * }
             * }
             *
             * alignment_parameter.CollectData();
             * }*/
        }