Exemplo n.º 1
0
        /// <summary>
        /// This operation creates a new Workplane from just an origin and a Z axis.  The X and Y axes are
        /// created off the Z axis orientation.
        /// </summary>
        /// <param name="origin">The origin at which to create the new workplane.</param>
        /// <param name="zAxis">The Z axis of the new workplane.</param>
        /// <returns>The created workplane.</returns>
        public PSWorkplane CreateWorkplaneFromZAxis(Geometry.Point origin, Geometry.Vector zAxis)
        {
            // Ensure that the z axis is normalised so as not to skew the X and Y axes when they get created
            Geometry.Vector localZAxis = zAxis.Clone();
            localZAxis.Normalize();

            Geometry.Vector xAxis = null;
            Geometry.Vector yAxis = null;
            localZAxis.GetXYVectors(ref xAxis, ref yAxis);

            PSWorkplane newWorkplane = new PSWorkplane(_powerSHAPE, new Geometry.Workplane(origin, xAxis, yAxis, localZAxis));

            Add(newWorkplane);
            return(newWorkplane);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This operation creates a new Workplane from just an origin and an X and Y axis.  The Z axis is
        /// created off the X and Y axes orientation.
        /// </summary>
        /// <param name="origin">The origin at which to create the new workplane.</param>
        /// <param name="xAxis">The X axis of the new workplane.</param>
        /// <param name="yAxis">The Y axis of the new workplane.</param>
        /// <returns>The created workplane.</returns>
        public PSWorkplane CreateWorkplaneFromXYAxes(Geometry.Point origin, Geometry.Vector xAxis, Geometry.Vector yAxis)
        {
            // Ensure that the x and y axes are normalised so as not to skew the Z axis when it gets created
            Geometry.Vector localXAxis = xAxis.Clone();
            localXAxis.Normalize();
            Geometry.Vector localYAxis = yAxis.Clone();
            localYAxis.Normalize();

            Geometry.Vector zAxis = Geometry.Vector.CrossProduct(localXAxis, localYAxis);

            PSWorkplane newWorkplane =
                new PSWorkplane(_powerSHAPE, new Geometry.Workplane(origin, localXAxis, localYAxis, zAxis));

            Add(newWorkplane);
            return(newWorkplane);
        }