public element(_Area_v2 dim, _Area_v2 reinf, string nr23, string nr27) { _23 = dim; _27 = reinf; _nr23 = nr23; _nr27 = nr27; }
private void outputWeight(_Area_v2 a, int weight) { _Db.DBObject currentEntity = _c.trans.GetObject(a.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; foreach (_Db.ObjectId arId in blockRef.AttributeCollection) { _Db.DBObject obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite); _Db.AttributeReference ar = obj as _Db.AttributeReference; if (ar != null) { if (ar.Tag == "SUMMA_OVRIG_ARMERING") { if (weight == 0) { write("[WARINING] Weight set to 'YYY'"); ar.TextString = "YYY"; } else { ar.TextString = weight.ToString(); } } } } } _c.trans.Commit(); }
private void outputTable(_Area_v2 a, List <_Mark> rows) { _Db.DBObject currentEntity = _c.trans.GetObject(a.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; double scale = blockRef.ScaleFactors.X; string name = blockRef.Name; _Ge.Point3d currentPoint = a.Start; if (name == newBoxNames[0]) { currentPoint = new _Ge.Point3d(a.Start.X + (366 * scale), a.Start.Y + (141.8 * scale), a.Start.Z); } else if (name == newBoxNames[1]) { currentPoint = new _Ge.Point3d(a.Start.X + (366 * scale), a.Start.Y + (263.5 * scale), a.Start.Z); } int counter = 0; foreach (_Mark r in rows) { if (r.Position != "emptyrow") { double txtHeight = 1.5 * scale; _Ge.Point3d position_IP = new _Ge.Point3d(currentPoint.X + (1 * scale), currentPoint.Y + (1.125 * scale), currentPoint.Z); _Ge.Point3d diameter_IP = new _Ge.Point3d(currentPoint.X + (0.75 * scale) + (6.1 * scale), currentPoint.Y + (1.125 * scale), currentPoint.Z); _Ge.Point3d number_IP = new _Ge.Point3d(currentPoint.X + (1.5 * scale) + (9.75 * scale), currentPoint.Y + (1.125 * scale), currentPoint.Z); insertText(r.Position, position_IP, _Mark.markLayerName, txtHeight); insertText(r.Diameter.ToString(), diameter_IP, _Mark.markLayerName, txtHeight); insertText(r.Number.ToString(), number_IP, _Mark.markLayerName, txtHeight); } if (counter == 19) { if (name == newBoxNames[0]) { currentPoint = new _Ge.Point3d(a.Start.X + (336 * scale), a.Start.Y + (141.8 * scale), a.Start.Z); } else if (name == newBoxNames[1]) { currentPoint = new _Ge.Point3d(a.Start.X + (336 * scale), a.Start.Y + (263.5 * scale), a.Start.Z); } } else { currentPoint = new _Ge.Point3d(currentPoint.X, currentPoint.Y - (4 * scale), currentPoint.Z); } counter++; } } }
private string getAreaName(_Area_v2 area) { string ritn_nr = "x"; _Db.DBObject currentEntity = _c.trans.GetObject(area.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; foreach (_Db.ObjectId arId in blockRef.AttributeCollection) { _Db.DBObject obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite); _Db.AttributeReference ar = obj as _Db.AttributeReference; if (ar != null) { if (ar.Tag == "RITN_NR") { ritn_nr = ar.TextString; } if (blockRef.Name == "KN-V23") { if (ar.Tag == "RITN_23_NR") { ritn_nr = ar.TextString; } } else if (blockRef.Name == "KN-V27") { if (ar.Tag == "RITN_27_NR") { ritn_nr = ar.TextString; } } } } if (blockRef.Name == "KN-V23") { if (!ritn_nr.Contains("23")) { ritn_nr = "V23-" + ritn_nr; } } else if (blockRef.Name == "KN-V27") { if (!ritn_nr.Contains("73")) { ritn_nr = "V27-" + ritn_nr; } } } return(ritn_nr); }
private double getAreaScale(_Area_v2 area) { double scale = 1; _Db.DBObject currentEntity = _c.trans.GetObject(area.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; scale = blockRef.ScaleFactors.X; } return(scale); }
private void get27Data(List <element> elements) { foreach (element el in elements) { _Area_v2 area = el._27; string date = "xyz"; string rev = "xyz"; string net_weight = "xyz"; string reinf_weight = "xyz"; _Db.DBObject currentEntity = _c.trans.GetObject(area.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; foreach (_Db.ObjectId arId in blockRef.AttributeCollection) { _Db.DBObject obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite); _Db.AttributeReference ar = obj as _Db.AttributeReference; if (ar != null) { if (ar.Tag == "DATUM") { date = ar.TextString; } if (ar.Tag == "REVISION") { rev = ar.TextString; } if (ar.Tag == "SUMMA_NATARMERING") { net_weight = ar.TextString; } if (ar.Tag == "SUMMA_OVRIG_ARMERING") { reinf_weight = ar.TextString; } } } } el._date27 = date; el._rev27 = rev; el._sum_net = net_weight; el._sum_reinf = reinf_weight; } }
private List <_Area_v2> getBoxAreas(List <_Db.BlockReference> blocks) { List <_Area_v2> parse = new List <_Area_v2>(); foreach (_Db.BlockReference block in blocks) { _Db.Extents3d blockExtents = block.GeometricExtents; _Area_v2 area = new _Area_v2(block.Id, blockExtents.MinPoint, blockExtents.MaxPoint); parse.Add(area); } parse = parse.OrderBy(o => o.Start.X).ToList(); return(parse); }
private List <_Mark> getMarksInArea(_Area_v2 area, List <_Mark> allmarks) { List <_Mark> marks = new List <_Mark>(); for (int i = allmarks.Count - 1; i >= 0; i--) { _Mark mark = allmarks[i]; if (area.isPointInArea(mark.IP)) { marks.Add(mark); allmarks.RemoveAt(i); } } return(marks); }
private _Ge.Point3d getAreaCenter(_Area_v2 area) { _Ge.Point3d center = new _Ge.Point3d(0, 0, 0); _Db.DBObject currentEntity = _c.trans.GetObject(area.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; _Ge.Point3d max = blockRef.GeometricExtents.MaxPoint; _Ge.Point3d min = blockRef.GeometricExtents.MinPoint; center = new _Ge.Point3d(min.X + ((max.X - min.X) / 2), min.Y + ((max.Y - min.Y) / 2), 0); } return(center); }
private List <_Db.RotatedDimension> getDimsInArea(_Area_v2 area, List <_Db.RotatedDimension> allDims) { List <_Db.RotatedDimension> dims = new List <_Db.RotatedDimension>(); for (int i = allDims.Count - 1; i >= 0; i--) { _Db.RotatedDimension dim = allDims[i]; _Ge.Point3d p1 = dim.XLine1Point; if (area.isPointInArea(p1)) { dims.Add(dim); allDims.RemoveAt(i); } } return(dims); }
private void getDimentions(List <element> elements) { List <_Db.RotatedDimension> allDims = getAllDims(); foreach (element el in elements) { _Area_v2 area = el._23; List <_Db.RotatedDimension> sortedDims = getDimsInArea(area, allDims); double length = 0; double height = 0; foreach (_Db.RotatedDimension rd in sortedDims) { double rot0 = Math.Abs(rd.Rotation % Math.PI); double rot90 = Math.Abs(Math.Abs(rd.Rotation % Math.PI) - Math.PI / 2); if (rot0 < 0.01) { if (length < rd.Measurement) { length = rd.Measurement; // MEASURMENT REQUIRES TO SAVE } } else if (rot90 < 0.01) { if (height < rd.Measurement) { height = rd.Measurement; // MEASURMENT REQUIRES TO SAVE } } } el._length = (int)Math.Round(length, 0); el._height = (int)Math.Round(height, 0); } }
private void get23Data(List <element> elements) { foreach (element el in elements) { _Area_v2 area = el._23; string date = "xyz"; string rev = "xyz"; _Db.DBObject currentEntity = _c.trans.GetObject(area.ID, _Db.OpenMode.ForWrite, false) as _Db.DBObject; if (currentEntity is _Db.BlockReference) { _Db.BlockReference blockRef = currentEntity as _Db.BlockReference; foreach (_Db.ObjectId arId in blockRef.AttributeCollection) { _Db.DBObject obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite); _Db.AttributeReference ar = obj as _Db.AttributeReference; if (ar != null) { if (ar.Tag == "DATUM") { date = ar.TextString; } if (ar.Tag == "REVISION") { rev = ar.TextString; } } } } el._date23 = date; el._rev23 = rev; } }