Hello everybody,
You know that when you type "c" for circle in AutoCAD and place the base point that the next step is setting the radius. While you set the radius the circle is constantly refreshing its view and the radius distance is diplayed.
I want to duplicate this for any distance-like property of and entity or dynamic block, but I dont know how to do it. I tried an introduction from AND that creates circle and then prompts user for input, but the circle is not displayed while the user picks up the radius. Only the line of the radius is displayed, but not the circle itself. Here is the code:
[code]
case "Circle":
PromptPointOptions circleBasePointOptions = new PromptPointOptions("Pick the base point of the circle.");
PromptPointResult circleBasePointResult = ed.GetPoint(circleBasePointOptions);
if (circleBasePointResult.Status == PromptStatus.OK)
{
PromptDistanceOptions circleRadiusOptions = new PromptDistanceOptions("Pick radius.");
circleRadiusOptions.BasePoint = circleBasePointResult.Value;
circleRadiusOptions.UseBasePoint = true;
PromptDoubleResult circleRadiusResult = ed.GetDistance(circleRadiusOptions);
if (circleRadiusResult.Status == PromptStatus.OK)
{
ed.WriteMessage("The radius is {0}", circleRadiusResult.Value);
Circle myCircle = new Circle(circleBasePointResult.Value, Vector3d.ZAxis, circleRadiusResult.Value);
// Database dwg = ed.Document;
Database dwg = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
Transaction transaction = dwg.TransactionManager.StartTransaction();
using (transaction)
{
try
{
BlockTableRecord CurrentSpace = (BlockTableRecord)transaction.GetObject(dwg.CurrentSpaceId, OpenMode.ForWrite);
CurrentSpace.AppendEntity(myCircle);
transaction.AddNewlyCreatedDBObject(myCircle, true);
transaction.Commit();
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
MessageBox.Show("A problem occured becaue of : {0}", ex.Message);
}
finally
{
transaction.Dispose();
}
}
}
}
break;
[\code]
This is the code with which does not display the circle. How to modify the code in order to display it while the uset picks up the radius options?
I want to know the principle, not the exact code for a circle. I want it for example. I will modify it for dynamic blocks and etc.
Solved! Go to Solution.
Solved by joshuamodglin. Go to Solution.