makePointEnt(Point3d pt, int colorIndex, Database db) { int mode = (int)AcadApp.GetSystemVariable("pdmode"); if (mode == 0) { AcadApp.SetSystemVariable("pdmode", 99); } try { using (Transaction tr = BaseObjs.startTransactionDb()) { using (DBPoint dbPt = new DBPoint(pt)) { dbPt.ColorIndex = colorIndex; SymTbl.AddToCurrentSpace(dbPt, db); } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Db.cs: line: 431"); } }
makeBotSurfaceGrid(int intInterval, int i1) { App.SetSystemVariable("PDSISE", 0.01); setPointStyleBOT(); setPointLabelStyleBOT(); bool exists; TinSurface objSurfaceCPNT_ON = Surf.getTinSurface("CPNT-ON", out exists); Object[] varLimits = EW_Utility2.getLimits(intInterval); double dblPntXmin = (double)varLimits[0]; double dblPntYmin = (double)varLimits[1]; int iMax = (int)varLimits[2]; int jMax = (int)varLimits[3]; for (int j = 0; j <= jMax; j++) { double dblY = dblPntYmin + (j * intInterval); for (int i = 0; i <= iMax; i++) { double dblX = dblPntXmin + (i * intInterval); double dblZ_OX = objSurfaceCPNT_ON.FindElevationAtXY(dblX, dblY); if (dblZ_OX > 0) //point is inside OX boundary { Point3d dblPnt = new Point3d(dblX, dblY, dblZ_OX); ObjectId idCivilPnt = dblPnt.setPoint("GRID-POINTS"); } } } TypedValue[] tvs = new TypedValue[4] { new TypedValue(1001, "BOT"), new TypedValue(1040, varLimits[0]), new TypedValue(1040, varLimits[1]), new TypedValue(1070, intInterval) }; ObjectId idDictBOT = Dict.getNamedDictionary("BOT", out exists); idDictBOT.setXData(tvs, "BOT"); return(varLimits); }
public static void Setup() { // Установка flexBrics // 1. Добавить папку в доверенные var fbLocalDir = GetFBLocalDir(); if (Directory.Exists(fbLocalDir)) { if (isAcadVerLater2013()) { string trustedPath = AutoCadApp.GetSystemVariable("TRUSTEDPATHS").ToString(); if (!trustedPath.ToLower().Contains(fbLocalDir.ToLower())) { trustedPath += ";" + fbLocalDir + @"\..."; AutoCadApp.SetSystemVariable("TRUSTEDPATHS", trustedPath); } try { Log.Info("FlexBrics.Setup. trustedPath ={0}", trustedPath); } catch { } } // 2. Добавить в пути поиска dynamic preference = AutoCadApp.Preferences; string supPath = preference.Files.SupportPath; supPath = AddPath(fbLocalDir, supPath); //Папка flexBrics supPath = AddPath(Path.Combine(fbLocalDir, "dwg"), supPath); //папка dwg preference.Files.SupportPath = supPath; try { Log.Info("FlexBrics.Setup. SupportPath ={0}", supPath); } catch { } } }
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); } } }