Example #1
0
        addLdr()
        {
            Point3d                  pnt3d  = Pub.pnt3dO;
            bool                     canLdr = false;
            Handle                   hTarget;
            ObjectId                 idSM        = ObjectId.Null;
            string                   layerTarget = "";
            FullSubentityPath        path        = new FullSubentityPath();
            List <FullSubentityPath> paths       = new List <FullSubentityPath>();

            Entity ent = Ldr.getFirstLdrPoint(out pnt3d, out canLdr, out hTarget, out layerTarget, out path);

            if (canLdr)
            {
                return;
            }
            ent.PushHighlight(path, Autodesk.AutoCAD.GraphicsInterface.HighlightStyle.Glow);
            Color    color = Misc.getColorByLayer();
            ObjectId idLDR = JigSplineLeader_BB.jigSplineLeader(pnt3d, 0.09, "BUBBLE", color);

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

            Point3d     pnt3dEnd = idLDR.getLastVertex();
            List <Type> types    = new List <Type> {
                typeof(Polyline),
                typeof(Circle)
            };

            ObjectId[] ids = Select.getEntityatPoint(pnt3dEnd, types, "BUBBLE");

            if (ids == null)
            {
                return;
            }

            foreach (ObjectId id in ids)
            {
                ResultBuffer rb = id.getXData(apps.lnkBubs);
                if (rb != null)
                {
                    idSM = id;
                    Ldr.setLdrXData(pnt3dEnd, idLDR, idSM);
                    if (!updateSMxData(idSM, idLDR))
                    {
                        Application.ShowAlertDialog("Leader linkage to Symbol failed.");
                    }
                    break;
                }
            }
            paths.Add(path);
            xRef.unHighlightNestedEntity(paths);
        }
Example #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);
            }
        }