/// <summary>
        /// Plane to DS Plane
        /// </summary>
        /// <param name="plane"></param>
        /// <returns></returns>
        public DS.Plane PlaneToNative(Plane plane)
        {
            var pln = DS.Plane.ByOriginXAxisYAxis(
                PointToNative(plane.origin),
                VectorToNative(plane.xdir),
                VectorToNative(plane.ydir));

            return(pln.SetDynamoProperties <DS.Plane>(GetDynamicMembersFromBase(plane)));
        }
        public RH.Plane PlaneToNative(Plane plane)
        {
            var xAxis = VectorToNative(plane.xdir);

            xAxis.Unitize();
            var yAxis = VectorToNative(plane.ydir);

            yAxis.Unitize();

            return(new RH.Plane(PointToNative(plane.origin).Location, xAxis, yAxis));
        }
Beispiel #3
0
        /// <summary>
        /// DS Vector to array of coordinates
        /// </summary>
        /// <param name="vc"></param>
        /// <returns></returns>
        //public double[] VectorToArray(DS.Vector vc)
        //{
        //  return new double[] { vc.X, vc.Y, vc.Z };
        //}

        /// <summary>
        /// Array of coordinates to DS Vector
        /// </summary>
        /// <param name="arr"></param>
        /// <returns></returns>
        //public DS.Vector VectorToVector(double[] arr)
        //{
        //  return DS.Vector.ByCoordinates(arr[0], arr[1], arr[2]);
        //}

        #endregion

        #region Planes

        /// <summary>
        /// DS Plane to Plane
        /// </summary>
        /// <param name="plane"></param>
        /// <returns></returns>
        public Plane PlaneToSpeckle(DS.Plane plane)
        {
            var p = new Plane(
                PointToSpeckle(plane.Origin),
                VectorToSpeckle(plane.Normal),
                VectorToSpeckle(plane.XAxis),
                VectorToSpeckle(plane.YAxis),
                ModelUnits);

            CopyProperties(p, plane);
            return(p);
        }
        /// <summary>
        /// DS Vector to array of coordinates
        /// </summary>
        /// <param name="vc"></param>
        /// <returns></returns>
        //public double[] VectorToArray(DS.Vector vc)
        //{
        //  return new double[] { vc.X, vc.Y, vc.Z };
        //}

        /// <summary>
        /// Array of coordinates to DS Vector
        /// </summary>
        /// <param name="arr"></param>
        /// <returns></returns>
        //public DS.Vector VectorToVector(double[] arr)
        //{
        //  return DS.Vector.ByCoordinates(arr[0], arr[1], arr[2]);
        //}

        #endregion

        #region Planes

        /// <summary>
        /// DS Plane to Plane
        /// </summary>
        /// <param name="plane"></param>
        /// <returns></returns>
        public Plane PlaneToSpeckle(DS.Plane plane, string units = null)
        {
            var u = units ?? ModelUnits;
            var p = new Plane(
                PointToSpeckle(plane.Origin, u),
                VectorToSpeckle(plane.Normal, u),
                VectorToSpeckle(plane.XAxis, u),
                VectorToSpeckle(plane.YAxis, u),
                ModelUnits);

            CopyProperties(p, plane);
            return(p);
        }
Beispiel #5
0
 public DB.Plane PlaneToNative(Plane plane)
 {
     return(DB.Plane.CreateByOriginAndBasis(PointToNative(plane.origin), VectorToNative(plane.xdir).Normalize(), VectorToNative(plane.ydir).Normalize()));
 }