GetOrLoadLinetypeId(string ltypeName, Database db) { ObjectId ltypeId = GetSymbolTableRecId(typeof(LinetypeTableRecord), ltypeName, db); if (ltypeId.IsNull) { string[] ltypeFiles = { "acad.lin", "acadiso.lin", "ltypeshp.lin" }; int len = ltypeFiles.Length; for (int i = 0; i < len; i++) { // try to load the linetype from the external file db.LoadLineTypeFile(ltypeName, ltypeFiles[i]); ltypeId = GetSymbolTableRecId(typeof(LinetypeTableRecord), ltypeName, db); if (ltypeId.IsNull == false) { return(ltypeId); } } BaseObjs.write(string.Format("\nERROR: Could not load linetype \"{0}\", using CONTINUOUS instead.", ltypeName)); ltypeId = db.ContinuousLinetype; } return(ltypeId); }
showHandle() { bool escape = true; Entity ent = Select.selectEntity("Select ent:", out escape); if (escape) { return; } BaseObjs.write(string.Format("\nHandle: {0}", ent.Handle.ToString())); }
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); } } }