当前位置: 首页>>代码示例>>C#>>正文


C# Canguro.GetVector方法代码示例

本文整理汇总了C#中Canguro.GetVector方法的典型用法代码示例。如果您正苦于以下问题:C# Canguro.GetVector方法的具体用法?C# Canguro.GetVector怎么用?C# Canguro.GetVector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canguro的用法示例。


在下文中一共展示了Canguro.GetVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        /// <summary>
        /// Executes the command. 
        /// Asks for selected Items repetitions and a Vector, and makes the copies.
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Dictionary<Joint, Joint> joints = new Dictionary<Joint, Joint>();
            Dictionary<Joint, Joint> jSelection = new Dictionary<Joint, Joint>();
            List<LineElement> lines = new List<LineElement>();
            List<LineElement> lSelection = new List<LineElement>();
            List<AreaElement> areas = new List<AreaElement>();
            List<AreaElement> aSelection = new List<AreaElement>();
            ItemList<Joint> jList = services.Model.JointList;
            ItemList<LineElement> lList = services.Model.LineList;
            ItemList<AreaElement> aList = services.Model.AreaList;
            Joint nJoint;
            LineElement nLine;
            AreaElement nArea;

            List<Item> selection = services.GetSelection();

            if (selection.Count == 0)
                return;

            foreach (Item item in selection)
            {
                if (item is Joint)
                {
                    jSelection.Add((Joint)item, null);
                    joints.Add((Joint)item, null);
                }
                else if (item is LineElement)
                {
                    LineElement l = (LineElement)item;
                    lSelection.Add(l);
                    lines.Add(l);
                    if (!jSelection.ContainsKey(l.I))
                    {
                        jSelection.Add(l.I, null);
                        joints.Add(l.I, null);
                    }
                    if (!jSelection.ContainsKey(l.J))
                    {
                        jSelection.Add(l.J, null);
                        joints.Add(l.J, null);
                    }
                }
                else if (item is AreaElement)
                {
                    AreaElement a = (AreaElement)item;
                    aSelection.Add(a);
                    areas.Add(a);
                    for (int i = 0; i < ((a.J4 != null) ? 4 : 3); i++)
                    {
                        if (!jSelection.ContainsKey(a[i]))
                        {
                            jSelection.Add(a[i], null);
                            joints.Add(a[i], null);
                        }
                    }
                }
            }

            Microsoft.DirectX.Vector3 v;
            services.GetVector(out v);

            uint n;
            string str = services.GetString(Culture.Get("getArrayRepetition"));
            n = Convert.ToUInt32(str);

            List<Joint> newJoints = new List<Joint>();
            List<LineElement> newLines = new List<LineElement>();
            List<AreaElement> newAreas = new List<AreaElement>();
            for (int i = 1; i <= n; i++)
            {
                foreach (Joint j in joints.Keys)
                {
                    jList.Add(nJoint = new Joint(j.X + i * v.X, j.Y + i * v.Y, j.Z + i * v.Z));
                    nJoint.Masses = j.Masses;
                    nJoint.DoF = j.DoF;
                    jSelection[j] = nJoint;
                    newJoints.Add(nJoint);
                }
                foreach (LineElement l in lines)
                {
                    lList.Add(nLine = new LineElement(l, jSelection[l.I], jSelection[l.J]));
                    newLines.Add(nLine);
                }
                foreach (AreaElement a in areas)
                {
                    aList.Add(nArea = new AreaElement(a, jSelection[a.J1], jSelection[a.J2], jSelection[a.J3], jSelection[a.J4]));
                    newAreas.Add(nArea);
                }
                services.ReportProgress((uint)(100 * i / n));
                System.Windows.Forms.Application.DoEvents();
            }
            JoinCmd.Join(services.Model, newJoints, newLines, newAreas);
        }
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:99,代码来源:ArrayCmd.cs


注:本文中的Canguro.GetVector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。