Exemplo n.º 1
0
        private IAgCrdnAngle CreateAngle(IAgStkObject stkObject, string name, IAgCrdnVector fromVector, IAgCrdnVector toVector)
        {
            IAgCrdnAngleFactory factory = stkObject.Vgt.Angles.Factory;

            // Check if component exists.
            CheckExistingVgtComponent(stkObject.Vgt.Angles, name);

            IAgCrdnAngleBetweenVectors angle = factory.Create(name, "", AgECrdnAngleType.eCrdnAngleTypeBetweenVectors) as IAgCrdnAngleBetweenVectors;

            angle.FromVector.SetVector(fromVector);
            angle.ToVector.SetVector(toVector);

            return(angle as IAgCrdnAngle);
        }
Exemplo n.º 2
0
        public static IAgCrdnAngle CreateAngleBetweenVectors(IAgCrdnVector fromVector, IAgCrdnVector toVector,
                                                             IAgStkObject parentObject, string name = "", bool addDisplay = false)
        {
            IAgCrdnAngleFactory angleFactory = parentObject.Vgt.Angles.Factory;

            string newAngleName;

            if (!String.IsNullOrEmpty(name))
            {
                newAngleName = name;
            }
            else
            {
                newAngleName = "From_" + (fromVector as IAgCrdn).Name + "_To_" + (toVector as IAgCrdn).Name;
            }

            IAgCrdnAngleBetweenVectors angle;

            if (parentObject.Vgt.Angles.Contains(newAngleName))
            {
                angle = parentObject.Vgt.Angles[newAngleName] as IAgCrdnAngleBetweenVectors;
            }
            else
            {
                angle = angleFactory.Create(newAngleName, newAngleName,
                                            AgECrdnAngleType.eCrdnAngleTypeBetweenVectors) as IAgCrdnAngleBetweenVectors;
                angle.FromVector.SetVector(fromVector);
                angle.ToVector.SetVector(toVector);
            }

            if (addDisplay)
            {
                StkAssistant.DisplayAngle(newAngleName, parentObject, System.Drawing.Color.Yellow);
            }

            return(angle as IAgCrdnAngle);
        }