示例#1
0
 internal Dyn.Geometry EnsureUnit(Dyn.Geometry geo, bool disposeInput = false)
 {
     Dyn.Geometry scgeo = null;
     Dyn.Plane    xy    = Dyn.Plane.XY();
     if (targetUnit == baseUnit)
     {
         scgeo = geo.Scale(xy, 1, 1, 1);
     }
     else
     {
         if (baseUnit == "Meters" && targetUnit == "Feet")
         {
             double factor = 3.280841666667;
             scgeo = geo.Scale(xy, factor, factor, factor);
         }
         else if (baseUnit == "Feet" && targetUnit == "Meters")
         {
             double factor = 0.304800164592;
             scgeo = geo.Scale(xy, factor, factor, factor);
         }
         else
         {
         }
     }
     if (disposeInput)
     {
         geo.Dispose();
     }
     xy.Dispose();
     return(scgeo);
 }
示例#2
0
 protected override void DisposeDisplayable()
 {
     if (null != mGeometry && mAutoDispose)
     {
         mGeometry.Dispose();
         mGeometry = null;
     }
 }
示例#3
0
        public void Tessellate(IRenderPackage package, TessellationParameters parameters)
        {
            package.RequiresPerVertexColoration = true;
            Point center = SphereNode.Center(this);

            Autodesk.DesignScript.Geometry.Geometry geometry = Sphere.ByCenterPointRadius(center, this.radius);
            byte[] color = new byte[] { 0, 200, 200, 50 };
            // As you add more data to the render package, you need
            // to keep track of the index where this coloration will
            // start from.

            geometry.Tessellate(package, parameters);

            if (package.MeshVertexCount > 0)
            {
                package.ApplyMeshVertexColors(CreateColorByteArrayOfSize(package.MeshVertexCount, color[0], color[1], color[2], color[3]));
            }
            center.Dispose();
            geometry.Dispose();
        }