[CommandMethod("CMD1")]
public void Cmd1()
{
var ed = Application.DocumentManager.MdiActiveDocument.Editor;
var pointOptions
= new PromptPointOptions
("\nBottom center point: "); var pointResult = ed.GetPoint(pointOptions);
if (pointResult.Status != PromptStatus.OK)
return;
var bottomCenterPoint = pointResult.Value;
var distanceOptions
= new PromptDistanceOptions
("\nRadius: "); distanceOptions.UseBasePoint = true;
distanceOptions.BasePoint = bottomCenterPoint;
var distanceResult = ed.GetDistance(distanceOptions);
if (distanceResult.Status != PromptStatus.OK)
return;
var radius = distanceResult.Value;
pointOptions.Message = "\nTop center point: ";
pointOptions.UseBasePoint = true;
pointOptions.BasePoint = bottomCenterPoint;
pointResult = ed.GetPoint(pointOptions);
if (pointResult.Status != PromptStatus.OK)
return;
var topCenterPoint = pointResult.Value;
// transform the UCS defined points into WCS defined points
var ucs = ed.CurrentUserCoordinateSystem;
bottomCenterPoint = bottomCenterPoint.TransformBy(ucs);
topCenterPoint = topCenterPoint.TransformBy(ucs);
CreateFrustumCylinder(bottomCenterPoint, topCenterPoint, radius);
//CreateExtrudedCylinder(bottomCenterPoint, topCenterPoint, radius);
//CreateSweptCylinder(bottomCenterPoint, topCenterPoint, radius);
}