private List <_AcDb.ObjectId> GetFgAnz(_AcGe.Point3d minExt, _AcGe.Point3d maxExt, _AcDb.ObjectId elFG)
        {
            List <_AcDb.ObjectId> Ret = new List <_AcDb.ObjectId>();

            _AcEd.Editor          ed     = _AcAp.Application.DocumentManager.MdiActiveDocument.Editor;
            _AcEd.SelectionFilter filter = new _AcEd.SelectionFilter(new _AcDb.TypedValue[] {
                new _AcDb.TypedValue((int)_AcDb.DxfCode.Start, "*POLYLINE"),
                new _AcDb.TypedValue((int)_AcDb.DxfCode.LayerName, _FgLayer)
            });
            _AcEd.PromptSelectionResult res = null;
            res = ed.SelectCrossingWindow(minExt, maxExt, filter);
            //res = ed.SelectAll(filter);
            if (res.Status != _AcEd.PromptStatus.OK)
            {
                // todo: logging: lot4net?
                return(Ret);
            }

#if BRX_APP
            _AcEd.SelectionSet ss = res.Value;
#else
            using (_AcEd.SelectionSet ss = res.Value)
#endif
            {
                _AcDb.ObjectId[]         idArray = ss.GetObjectIds();
                _AcDb.Database           db      = _AcAp.Application.DocumentManager.MdiActiveDocument.Database;
                _AcDb.TransactionManager tm      = db.TransactionManager;
                _AcDb.Transaction        myT     = tm.StartTransaction();
                try
                {
                    for (int i = 0; i < idArray.Length; i++)
                    {
                        _AcDb.ObjectId oid = idArray[i];
                        if (!oid.Equals(elFG))
                        {
                            if (PolyInPoly(tm, oid, elFG))
                            {
                                AddRbToRetCol(Ret, tm, oid);
                            }
                        }
                    }
                    myT.Commit();
                }
                finally
                {
                    myT.Dispose();
                }
            }

            return(Ret);
        }
Example #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);
            }
        }