Расчет площади и длины окружности кругов
Contents
[
Hide
]Как рассчитать площадь и длину окружности кругов
Проблема: Как рассчитать площадь и длину окружности кругов (CADNET-1153).
Советы: Для этого получите радиус из CadEntityTypeName.CIRCLE из сущностей и используйте формулу “2 * Math.PI * radius”.
Пример:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity.TypeName == CadEntityTypeName.CIRCLE) | |
{ | |
double radius = ((CadCircle)entity).Radius; | |
System.Console.WriteLine("Circumference= " + 2 * Math.PI * radius); | |
System.Console.WriteLine("Area= " + Math.PI * radius * radius); | |
} | |
} |