Ejemplo n.º 1
0
Archivo: Misc.cs Proyecto: 15831944/EM
        gotoEnt()
        {
            string result = "";
            bool   escape = UserInput.getUserInput("Enter handle", out result);

            if (escape)
            {
                return;
            }
            Entity ent = null;

            try
            {
                Handle h = result.stringToHandle();
                ent = h.getEnt();
                if (ent == null)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Entity not found.");
                }
            }
            catch
            {
                return;
            }

            Extents3d ext3d = (Extents3d)ent.Bounds;

            Point3d pnt3dMin = ext3d.MinPoint;
            Point3d pnt3dMax = ext3d.MaxPoint;

            ViewTableRecord vtr = new ViewTableRecord();

            vtr.CenterPoint = new Point2d((pnt3dMin.X + pnt3dMax.X) / 2, (pnt3dMin.Y + pnt3dMax.Y) / 2);
            vtr.Height      = 50;
            vtr.Width       = 70;
            BaseObjs._editor.SetCurrentView(vtr);
        }
Ejemplo n.º 2
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);
            }
        }