.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to display my object while taking user input for its modification?

1 REPLY 1
SOLVED
Reply
Message 1 of 2
ognyandim
457 Views, 1 Reply

How to display my object while taking user input for its modification?

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.

1 REPLY 1
Message 2 of 2
joshuamodglin
in reply to: ognyandim

You will want to look into jigs. They work perfectly for what you are looking for.

Josh Modglin
Advanced Technologies Solutions Logo

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost