Beispiel #1
0
        private AcDb.ObjectId AddBorders()
        {
            AcDb.Polyline2d borderParcel = ServiceSimpleElements.CreatePolyline2d(this.Parcel.Points, true);
            borderParcel.LayerId = ServiceCAD.CreateLayer(settingsDrawing.Plan.FillParcel.Layer);
            AcDb.ObjectId idBorderParcel = ServiceCAD.InsertObject(borderParcel);

            AcDb.ResultBuffer xData = new AcDb.ResultBuffer();
            int dxfCode;

            AcDb.TypedValue typedValue;

            dxfCode    = (int)AcDb.DxfCode.ExtendedDataRegAppName;
            typedValue = new AcDb.TypedValue(dxfCode, "Земельна ділянка");
            xData.Add(typedValue);

            foreach (LandInfo infoValue in this.Parcel.Info)
            {
                dxfCode    = (int)AcDb.DxfCode.ExtendedDataAsciiString;
                typedValue = new AcDb.TypedValue(dxfCode, "<" + infoValue.Key + "> " + infoValue.Value);
                xData.Add(typedValue);
            }

            ServiceCAD.SetXData(idBorderParcel, xData);

            return(idBorderParcel);
        }
Beispiel #2
0
        private void AddPoints(AcDb.ObjectId idBorderParcel)
        {
            AcDb.ResultBuffer xData = new AcDb.ResultBuffer();
            int dxfCode;

            AcDb.TypedValue typedValue;

            dxfCode    = (int)AcDb.DxfCode.ExtendedDataRegAppName;
            typedValue = new AcDb.TypedValue(dxfCode, "Точки межі");
            xData.Add(typedValue);

            int iCurNumberPoint = 0;

            Dictionary <string, string> tags = new Dictionary <string, string>();

            foreach (AcGe.Point2d point in this.Parcel.Points)
            {
                iCurNumberPoint += 1;
                tags.Clear();
                tags.Add("NUMBER", "");
                AcDb.ObjectId idPoint = ServiceBlockElements.InsertBlock
                                        (
                    settingsDrawing.Plan.Point.NameBlock,
                    new AcGe.Point3d(point.X, point.Y, 0.0),
                    this.SettingsForm.ScaleDrawing,
                    0,
                    ServiceCAD.CreateLayer(settingsDrawing.Plan.Point.Layer),
                    tags
                                        );

                //dxfCode = (int)DxfCode.ExtendedDataHandle;
                dxfCode    = (int)AcDb.DxfCode.ExtendedDataAsciiString;
                typedValue = new AcDb.TypedValue(dxfCode, point.ToString());
                xData.Add(typedValue);
            }
            if (!idBorderParcel.Equals(AcDb.ObjectId.Null))
            {
                ServiceCAD.SetXData(idBorderParcel, xData);
            }
        }
Beispiel #3
0
        private void getSettings()
        {
            _Db.TypedValue[] filterlist = new _Db.TypedValue[2];
            filterlist[0] = new _Db.TypedValue(0, "INSERT");
            filterlist[1] = new _Db.TypedValue(2, "Reinf_program_settings");
            _Ed.SelectionFilter filter = new _Ed.SelectionFilter(filterlist);

            _Ed.PromptSelectionOptions opts = new _Ed.PromptSelectionOptions();
            opts.MessageForAdding = "\nSelect Reinf_program_settings block: ";

            _Ed.PromptSelectionResult selection = _c.ed.GetSelection(opts, filter);
            if (selection.Status != _Ed.PromptStatus.OK)
            {
                throw new DMTException("[ERROR] Reinf_program_settings - cancelled");
            }
            if (selection.Value.Count != 1)
            {
                throw new DMTException("[ERROR] Reinf_program_settings - too many in selection");
            }


            _Db.ObjectId       selectionId = selection.Value.GetObjectIds()[0];
            _Db.BlockReference selectionBR = _c.trans.GetObject(selectionId, _Db.OpenMode.ForWrite) as _Db.BlockReference;

            L._V_.Z_DRAWING_SCALE = selectionBR.ScaleFactors.X;

            foreach (_Db.ObjectId arId in selectionBR.AttributeCollection)
            {
                _Db.DBObject           obj = _c.trans.GetObject(arId, _Db.OpenMode.ForWrite);
                _Db.AttributeReference ar  = obj as _Db.AttributeReference;

                if (ar != null)
                {
                    setProgramVariables(ar);
                }
            }
        }
Beispiel #4
0
 public ArgumentTypeException(string s, _AcDb.TypedValue tv)
     : base(string.Format(
                "invalid argument type: {0}: {1}",
                s, tv.TypeCode == (int)_AcBrx.LispDataType.Nil ? "nil" : tv.Value))
 {
 }