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); }
protected override void DisposeDisplayable() { if (null != mGeometry && mAutoDispose) { mGeometry.Dispose(); mGeometry = null; } }
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(); }