示例#1
0
        private InputState GetAxisByChainage(out double ch)
        {
            ch = 0;
            AcadEditor.PromptChainageOptions opts;
            if (!FirstRun)
            {
                opts = new AcadEditor.PromptChainageOptions("\nAks kilometresi [Mesafe/Nokta/Seçenekler/çıKış]: ", "Distance Point Settings Exit");
            }
            else
            {
                opts = new AcadEditor.PromptChainageOptions("\nAks kilometresi [Nokta/Seçenekler/çıKış]: ", "Point Settings Exit");
            }

            AcadEditor.PromptChainageResult res = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.GetChainage(opts);
            if (res.Status == PromptStatus.Keyword && res.StringResult == "Distance")
            {
                SelectionMethod = AxisSelectionMethod.Distance;
                return(InputState.Continue);
            }
            else if (res.Status == PromptStatus.Keyword && res.StringResult == "Point")
            {
                SelectionMethod = AxisSelectionMethod.Point;
                return(InputState.Continue);
            }
            else if (res.Status == PromptStatus.Keyword && res.StringResult == "Settings")
            {
                ShowSettings();
                return(InputState.Continue);
            }
            else if (res.Status == PromptStatus.Keyword && res.StringResult == "Exit")
            {
                return(InputState.Exit);
            }
            else if (res.Status != PromptStatus.OK)
            {
                return(InputState.Exit);
            }

            if (AcadUtility.AcadText.TryChainageFromString(res.StringResult, out ch))
            {
                return(InputState.OK);
            }
            else
            {
                return(InputState.Continue);
            }
        }
示例#2
0
        private bool GetAlignmentParameters()
        {
            var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            var ed  = doc.Editor;

            Matrix3d ucs2wcs = AcadGraphics.UcsToWcs;
            Matrix3d wcs2ucs = AcadGraphics.WcsToUcs;

            // Alignment type
            Alignment = Bridge.PickAlignment();
            if (Alignment == Bridge.AlignmentType.None)
            {
                return(false);
            }

            // Alignment line
            PromptEntityOptions entityOpts = new PromptEntityOptions("\nEksen: ");

            entityOpts.SetRejectMessage("\nSelect a curve.");
            entityOpts.AddAllowedClass(typeof(Curve), false);
            PromptEntityResult entityRes = ed.GetEntity(entityOpts);

            if (entityRes.Status == PromptStatus.OK)
            {
                CenterlineId = entityRes.ObjectId;
            }
            else
            {
                return(false);
            }

            // Start point
            PromptPointResult ptRes = ed.GetPoint("\nBaşlangıç noktası: ");

            if (ptRes.Status == PromptStatus.OK)
            {
                StartPoint = ptRes.Value.TransformBy(ucs2wcs);
            }
            else
            {
                return(false);
            }

            // Start CH
            AcadEditor.PromptChainageOptions chOpts = new AcadEditor.PromptChainageOptions("\nBaşlangıç kilometresi: ");
            chOpts.DefaultValue    = AcadText.ChainageToString(StartCH, ChPrecision);
            chOpts.UseDefaultValue = true;
            AcadEditor.PromptChainageResult chRes = ed.GetChainage(chOpts);
            if (chRes.Status == PromptStatus.OK)
            {
                StartCH = chRes.DoubleResult;
            }
            else if (chRes.Status == PromptStatus.None)
            {
                // Use default
            }
            else if (chRes.Status != PromptStatus.OK)
            {
                return(false);
            }

            return(true);
        }