Example #1
0
            public static bool Jig(Point3d p0, int segments)
            {
                ParabolaJig jigger = new ParabolaJig(CreatePolyline(), p0, segments);

                Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
                Autodesk.AutoCAD.DatabaseServices.Database    db  = doc.Database;

                PromptResult res = doc.Editor.Drag(jigger);

                if (res.Status == PromptStatus.OK)
                {
                    using (Transaction tr = db.TransactionManager.StartTransaction())
                        using (BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite))
                        {
                            btr.AppendEntity(jigger.Entity);
                            tr.AddNewlyCreatedDBObject(jigger.Entity, true);

                            tr.Commit();
                        }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Example #2
0
        public void DrawParabola()
        {
            if (!CheckLicense.Check())
            {
                return;
            }

            Autodesk.AutoCAD.ApplicationServices.Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Autodesk.AutoCAD.DatabaseServices.Database    db  = doc.Database;

            PromptPointResult p0Res;

            while (true)
            {
                PromptPointOptions p0Opts = new PromptPointOptions("\nVertex Point: [Seçenekler]", "Settings");
                p0Res = doc.Editor.GetPoint(p0Opts);
                if (p0Res.Status == PromptStatus.Keyword && p0Res.StringResult == "Settings")
                {
                    PromptIntegerOptions opts = new PromptIntegerOptions("Eğri segment sayısı: ");
                    opts.AllowNone       = true;
                    opts.AllowZero       = false;
                    opts.AllowNegative   = false;
                    opts.LowerLimit      = 1;
                    opts.UpperLimit      = 100;
                    opts.DefaultValue    = CurveSegments;
                    opts.UseDefaultValue = true;
                    PromptIntegerResult res = doc.Editor.GetInteger(opts);
                    if (res.Status == PromptStatus.Cancel)
                    {
                        return;
                    }
                    else if (res.Status == PromptStatus.OK)
                    {
                        CurveSegments = res.Value;
                    }
                }
                else if (p0Res.Status != PromptStatus.OK)
                {
                    return;
                }
                else
                {
                    break;
                }
            }

            ParabolaJig.Jig(p0Res.Value, CurveSegments);
        }