예제 #1
0
        getPoint(string strPrompt, Point3d pnt3d, out bool escape, out PromptStatus promptStatus, int osMode)
        {
            object mode = SnapMode.getOSnap();

            SnapMode.setOSnap(osMode);

            promptStatus = PromptStatus.Error;
            escape       = false;
            Point3d           pnt3dX = Pub.pnt3dO;
            Editor            ED     = BaseObjs._editor;
            PromptPointResult PPR    = null;

            PromptPointOptions PPO = new PromptPointOptions(strPrompt);

            PPO.AllowNone = true;
            if (pnt3d != pnt3dX)
            {
                PPO.AllowNone     = true;
                PPO.UseBasePoint  = true;
                PPO.BasePoint     = pnt3d;
                PPO.UseDashedLine = true;
            }

            try
            {
                PPR = ED.GetPoint(PPO);
                switch (PPR.Status)
                {
                case PromptStatus.Cancel:
                    escape = true;
                    break;

                case PromptStatus.Other:
                    pnt3dX = Pub.pnt3dO;
                    break;

                case PromptStatus.OK:
                    pnt3dX = PPR.Value;
                    break;
                }
                promptStatus = PPR.Status;
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " UserInput.cs: line: 138");
            }
            finally
            {
                SnapMode.setOSnap((int)mode);
            }
            return(pnt3dX);
        }
예제 #2
0
        pickAngle(Point3d pnt3dBase, int osMode)
        {
            object mode = SnapMode.getOSnap();

            SnapMode.setOSnap(osMode);

            Editor             ED = BaseObjs._editor;
            Point3d            pnt3d;
            PromptPointOptions PPO = new PromptPointOptions("\nSelect Last Point: ");

            PPO.UseBasePoint = true;
            PPO.BasePoint    = pnt3dBase;

            double dblRotation = 0.0;

            try
            {
                PromptPointResult PPR = ED.GetPoint(PPO);
                if (PPR.Status == PromptStatus.OK)
                {
                    pnt3d = PPR.Value;
                }
                else
                {
                    return(-999.999);
                }

                dblRotation = Base_Tools45.Measure.getAzRadians(pnt3dBase, pnt3d);
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " UserInput.cs: line: 918");
            }
            finally
            {
                SnapMode.setOSnap((int)mode);
            }

            return(dblRotation);
        }
예제 #3
0
        getPoint(string strPrompt, out PromptStatus ps, int osMode)
        {
            object mode = SnapMode.getOSnap();

            SnapMode.setOSnap(osMode);

            Point3d           pnt3dX = Pub.pnt3dO;
            Editor            ed     = BaseObjs._editor;
            PromptPointResult ppr    = null;

            ps = PromptStatus.Cancel;

            PromptPointOptions ppo = new PromptPointOptions(strPrompt);

            ppo.AllowNone = true;

            try
            {
                ppr = ed.GetPoint(ppo);
                ps  = ppr.Status;
                if (ps == PromptStatus.OK)
                {
                    pnt3dX = ppr.Value;
                }
                else
                {
                    ed.WriteMessage("Point selection canceled");
                    pnt3dX = Pub.pnt3dO;
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " UserInput.cs: line: 182");
            }
            finally
            {
                SnapMode.setOSnap((int)mode);
            }
            return(pnt3dX);
        }
예제 #4
0
        getPnt3d(Point3d pntBase, string strPrompt, int osMode)
        {
            object mode = SnapMode.getOSnap();

            SnapMode.setOSnap(osMode);

            try
            {
                Editor             ED  = BaseObjs._editor;
                PromptPointOptions PPO = new PromptPointOptions(strPrompt);
                if (pntBase != Pub.pnt3dO)
                {
                    PPO.UseBasePoint = true;
                    PPO.BasePoint    = pntBase;
                }
                else
                {
                    PPO.UseBasePoint = false;
                }

                PromptPointResult PPR = ED.GetPoint(PPO);

                if (PPR.Status == PromptStatus.OK)
                {
                    Point3d pntRet = PPR.Value;
                    return(pntRet);
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " UserInput.cs: line: 85");
            }
            finally
            {
                SnapMode.setOSnap((int)mode);
            }

            return(Pub.pnt3dO);
        }
예제 #5
0
        bubble(int numSides)
        {
            ObjectId idWO  = ObjectId.Null;             //wipeout
            ObjectId idSM  = ObjectId.Null;             //symbol
            ObjectId idTX  = ObjectId.Null;             //text
            ObjectId idLDR = ObjectId.Null;             //leader

            Object osMode = SnapMode.getOSnap();

            SnapMode.setOSnap(0);

            double  angleView = -(double)Application.GetSystemVariable("VIEWTWIST");
            Point3d pnt3d     = Pub.pnt3dO;
            Point3d pnt3dEnd  = Pub.pnt3dO;

            Handle                   hTarget     = "0000".stringToHandle();
            string                   layerTarget = "";
            ObjectIdCollection       idsLDR      = new ObjectIdCollection();
            FullSubentityPath        path        = new FullSubentityPath();
            List <FullSubentityPath> paths       = new List <FullSubentityPath>();
            int scale = Misc.getCurrAnnoScale();

            bool   canLdr = false;
            string result = bubTxt;

            try
            {
                do
                {
                    Entity ent = Ldr.getFirstLdrPoint(out pnt3d, out canLdr, out hTarget, out layerTarget, out path);
                    if (ent == null)
                    {
                        break;
                    }
                    Color color = Misc.getColorByLayer();
                    idLDR = JigSplineLeader_BB.jigSplineLeader(pnt3d, 0.09, "BUBBLE", color);

                    if (idLDR == ObjectId.Null)
                    {
                        break;
                    }

                    paths.Add(path);
                    pnt3dEnd = idLDR.getLastVertex();

                    Ldr.setLdrXData(pnt3dEnd, idLDR, idSM);

                    idsLDR.Add(idLDR);

                    bool cancel = false;

                    if (idsLDR.Count == 1)
                    {
                        if (numSides == 0)
                        {
                            cancel = UserInput.getUserInput(result, "\nEnter Callout Number: ", out result);
                            if (cancel || result == string.Empty)
                            {
                                return;
                            }
                            bubTxt = result;
                            idTX   = Txt.addMText(result, pnt3dEnd, angleView, 0.8, 0.09, AttachmentPoint.MiddleCenter, "Annotative", "BUBBLE", color, Pub.JUSTIFYCENTER);
                        }
                        else
                        {
                            cancel = UserInput.getUserInput(result, "\nEnter Callout Number", out result);
                            if (cancel || result == string.Empty)
                            {
                                return;
                            }
                            bubTxt = result;
                            idSM   = Draw.addSymbolAndWipeout(pnt3dEnd, angleView, out idWO, Pub.radius, numSides, true);
                            idSM.moveToTop();
                            idSM.moveBelow(new ObjectIdCollection {
                                idWO
                            });
                            idTX = Txt.addMText(result, pnt3dEnd, angleView, 0.0, 0.09, AttachmentPoint.MiddleCenter, "Annotative", "BUBBLE", color, Pub.JUSTIFYCENTER);
                        }
                    }
                }while (!canLdr);
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " Draw2.cs: line: 91");
            }
            finally
            {
                Application.SetSystemVariable("OSMODE", osMode);
                xRef.unHighlightNestedEntity(paths);
            }

            if (idTX.IsValid)
            {
                addXData(idSM, scale, idTX, idsLDR, idWO, numSides, hTarget, layerTarget);
            }
        }
예제 #6
0
        getCogoPoint(string prompt1, out ObjectId idCgPnt, ObjectId idCgPntBase, int osMode)
        {
            Object   mode      = SnapMode.getOSnap();
            string   elev      = string.Empty;
            ObjectId idCogoPnt = ObjectId.Null;

            idCgPnt = ObjectId.Null;

            Point3d pnt3dBase = Pub.pnt3dO;
            Point3d pnt3dX    = Pub.pnt3dO;

            if (idCgPntBase != ObjectId.Null)
            {
                pnt3dBase = idCgPntBase.getCogoPntCoordinates();
            }

            bool         escape;
            PromptStatus ps;

            try
            {
                if (pnt3dBase != Pub.pnt3dO)
                {
                    pnt3dX = UserInput.getPoint(prompt1, pnt3dBase, out escape, out ps, osMode);
                }
                else
                {
                    pnt3dX = UserInput.getPoint(prompt1, out ps, osMode);
                }

                if (pnt3dX == Pub.pnt3dO)
                {
                    return(elev);
                }

                ObjectIdCollection ids = new ObjectIdCollection();
                BaseObjs._db.forEachMS <CogoPoint>(cg =>
                {
                    if (cg.Location == pnt3dX)
                    {
                        idCogoPnt = cg.ObjectId;
                        ids.Add(idCogoPnt);
                    }
                });

                switch (ids.Count)
                {
                case 0:
                    break;

                case 1:
                    elev    = string.Format("{0:F2}", idCogoPnt.getCogoPntElevation());
                    idCgPnt = idCogoPnt;
                    break;

                case 2:
                    Application.ShowAlertDialog("Multiple CogoPoints at same location. Exiting...");
                    break;
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " UserInput.cs: line: 384");
            }
            finally
            {
                SnapMode.setOSnap((int)mode);
            }

            return(elev);
        }