예제 #1
0
        updateDictGRADEDOCK(Handle HANDLE3D, double dblSlope, Point3d pnt3dBase0, Point3d pnt3dBase1)
        {
            ResultBuffer rb = null;

            TypedValue[] tvs;
            int          numBldgs    = 0;
            int          numBldgCurr = 0;

            using (BaseObjs._acadDoc.LockDocument())
            {
                try
                {
                    using (Transaction tr = BaseObjs.startTransactionDb())
                    {
                        bool exists = false;
                        Dict.removeNamedDictionary("GRADEDOCK");
                        ObjectId idDictGRADEDOCK = Dict.getNamedDictionary("GRADEDOCK", out exists);
                        if (exists)
                        {
                            rb       = Dict.getXRec(idDictGRADEDOCK, "BLDGCOUNT");
                            tvs      = rb.AsArray();
                            numBldgs = int.Parse(tvs[0].Value.ToString());
                            rb       = new ResultBuffer();
                            rb.Add(new TypedValue(1070, numBldgs + 1));
                            Dict.addXRec(idDictGRADEDOCK, "BLDGCOUNT", rb);
                        }
                        else
                        {
                            rb = new ResultBuffer();
                            rb.Add(new TypedValue(1070, 1));
                            Dict.addXRec(idDictGRADEDOCK, "BLDGCOUNT", rb);
                        }

                        numBldgCurr = numBldgs + 1;
                        ObjectId idDictBLDG = Dict.addSubDict(idDictGRADEDOCK, numBldgCurr.ToString(CultureInfo.InvariantCulture));

                        rb = new ResultBuffer();
                        rb.Add(new TypedValue((int)DxfCode.Handle, HANDLE3D));
                        Dict.addXRec(idDictBLDG, "HANDLE3D", rb);

                        rb = new ResultBuffer();
                        rb.Add(new TypedValue((int)DxfCode.Real, dblSlope));
                        Dict.addXRec(idDictBLDG, "SLOPE", rb);

                        rb = new ResultBuffer();
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase0.X));
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase0.Y));
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase0.Z));
                        Dict.addXRec(idDictBLDG, "CENtrOID", rb);

                        rb = new ResultBuffer();
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase1.X));
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase1.Y));
                        rb.Add(new TypedValue((int)DxfCode.Real, pnt3dBase1.Z));
                        Dict.addXRec(idDictBLDG, "TARGET", rb);

                        tr.Commit();
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " Grading_Floor.cs: line: 243");
                }
            }
            return(numBldgCurr);
        }
예제 #2
0
        getDockLimits(int intNumDocks)
        {
            bool     exists          = false;
            ObjectId idDictGRADEDOCK = Dict.getNamedDictionary("GRADEDOCK", out exists);
            ObjectId idDictX         = default(ObjectId);

            if ((idDictGRADEDOCK == ObjectId.Null))
            {
                Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("GRADEDOCK dictionary missing - run AVG");
            }
            Point3d pnt3dPick;

            Entity ent = Select.selectEntity(typeof(Polyline3d), "\nSelect Finish Floor 3d Polyline: ",
                                             "3d Polyline selection failed.  Exiting...", out pnt3dPick);

            Polyline3d poly3d = (Polyline3d)ent;

            ResultBuffer rb = poly3d.ObjectId.getXData("AVG");

            if (rb == null)
            {
                return;
            }
            TypedValue[] tvs = rb.AsArray();

            bldgNum = tvs[2].Value.ToString();

            ObjectId idDictBLDG = Dict.getSubDict(idDictGRADEDOCK, bldgNum);

            ObjectId idDictDOCKS = Dict.getSubEntry(idDictBLDG, "DOCKS");

            if (idDictDOCKS == ObjectId.Null)
            {
                idDictDOCKS = Dict.addSubDict(idDictBLDG, "DOCKS");
            }

            using (BaseObjs._acadDoc.LockDocument())
            {
                Object selectCycling = Application.GetSystemVariable("SELECTIONCYCLING");
                Application.SetSystemVariable("SELECTIONCYCLING", 0);
                PromptStatus ps;
                try
                {
                    for (int i = 1; i < intNumDocks + 1; i++)
                    {
                        idDictX = Dict.addSubDict(idDictDOCKS, i.ToString(CultureInfo.InvariantCulture));

                        bool    escape   = false;
                        Point3d pnt3dRet = UserInput.getPoint(string.Format("\nSelect Dock {0} : Begin point (CCW orientation)", i), Pub.pnt3dO, out escape, out ps, osMode: 0);
                        BaseObjs.write("\n");

                        TypedValue[] TVs = new TypedValue[] {
                            new TypedValue(1040, pnt3dRet.X),
                            new TypedValue(1040, pnt3dRet.Y),
                            new TypedValue(1040, pnt3dRet.Z)
                        };

                        Dict.addXRec(idDictX, "BEG", TVs);

                        pnt3dRet = UserInput.getPoint(string.Format("\nSelect Dock {0} : End point (CCW orientation)", i), pnt3dRet, out escape, out ps, osMode: 0);
                        BaseObjs.write("\n");

                        TVs = new TypedValue[] {
                            new TypedValue(1040, pnt3dRet.X),
                            new TypedValue(1040, pnt3dRet.Y),
                            new TypedValue(1040, pnt3dRet.Z)
                        };

                        Dict.addXRec(idDictX, "END", TVs);
                    }
                }
                catch (System.Exception ex)
                {
                    BaseObjs.writeDebug(ex.Message + " Grading_Dock.cs: line: 85");
                }
                finally
                {
                    Application.SetSystemVariable("SELECTIONCYCLING", selectCycling);
                }
            }
        }