/// <summary>
        /// Creates and draws a torus that is defined with the given parameters.
        /// </summary>
        /// <param name="document">The active document</param>
        /// <param name="center">The center coordinates of the torus</param>
        /// <param name="axis">The axis vector of the torus</param>
        /// <param name="mean_radius">The mean radius of the torus</param>
        /// <param name="tube_radius">The tube radius of the torus</param>
        /// <param name="tube_begin">The vector pointing from the center to where the tube begins</param>
        /// <param name="torus_angle">The angle between the tube_begin and another edge of the torus</param>
        public void DrawTorus(Document document, XYZ center, XYZ axis, double mean_radius, double tube_radius, XYZ tube_begin, double torus_angle)
        {
            string      torus_name = "Torus" + m_direct_torus_instance_count++;
            DirectTorus torus      = new DirectTorus(document, torus_name, center, axis, mean_radius, tube_radius, tube_begin, torus_angle, S_TORUS_COLOR, 50);

            m_direct_shape_list.Add(torus);
        }
Beispiel #2
0
        private void Write(DirectTorus dt)
        {
            string length_unit_string = " " + XYZUnitConversionData.LengthUnitStrings[FindSurfaceRevitPlugin.MeasurementUnit];
            string area_unit_string   = " " + XYZUnitConversionData.AreaUnitStrings[FindSurfaceRevitPlugin.MeasurementUnit];
            string volume_unit_string = " " + XYZUnitConversionData.VolumeUnitStrings[FindSurfaceRevitPlugin.MeasurementUnit];

            string content = $"{dt.Name}\n" +
                             $"    .center\n" +
                             $"        .X = {dt.Center.X.ToString("##0.####")}\n" +
                             $"        .Y = {dt.Center.Y.ToString("##0.####")}\n" +
                             $"        .Z = {dt.Center.Z.ToString("##0.####")}\n" +
                             $"    .axis = {dt.Axis.ToString()}\n" +
                             $"        .X = {dt.Axis.X.ToString("##0.####")}\n" +
                             $"        .Y = {dt.Axis.Y.ToString("##0.####")}\n" +
                             $"        .Z = {dt.Axis.Z.ToString("##0.####")}\n" +
                             $"    .mean-radius = {dt.MeanRadius.ToString("##0.####")+length_unit_string}\n" +
                             $"    .tube-radius = {dt.TubeRadius.ToString("##0.####")+length_unit_string}\n";

            if (dt.HasAnElbow)
            {
                XYZ t = (dt.TubeBegin + dt.Center);
                content += $"    .tube-begin\n" +
                           $"        .X = {t.X.ToString( "##0.####" )}\n" +
                           $"        .Y = {t.Y.ToString( "##0.####" )}\n" +
                           $"        .Z = {t.Z.ToString( "##0.####" )}\n" +
                           $"    .tube-angle = {(dt.TubeAngle*180/Math.PI).ToString("##0.####")+" deg."}\n";
            }
            content += $"    .surface-area = {dt.SurfaceArea.ToString("##0.####")+area_unit_string}\n" +
                       $"    .volume = {dt.Volume.ToString("##0.####")+volume_unit_string}\n\n";
            this.richTextBoxInspectResult.AppendText(content);
        }