コード例 #1
0
ファイル: Examination.cs プロジェクト: alx1808/Parifizierung
        private static bool HasWohnungblockInvalidKomma(_AcDb.BlockReference blockRef)
        {
            var attDict  = Globs.GetAttributesUcKey(blockRef);
            var nutzwert = Globs.GetValOrEmpty("NUTZWERT", attDict);

            if (nutzwert.IndexOf(".", StringComparison.Ordinal) >= 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public void ReadBlocksFromModelspace()
        {
            _blockInfos.Clear();
            _wohnungInfos.Clear();
            _projektInfo = null;

            var doc = Application.DocumentManager.MdiActiveDocument;
            var db  = doc.Database;

            using (_AcDb.Transaction tr = doc.TransactionManager.StartTransaction())
            {
                _AcDb.BlockTable       bt  = (_AcDb.BlockTable)tr.GetObject(db.BlockTableId, _AcDb.OpenMode.ForRead);
                _AcDb.BlockTableRecord btr = (_AcDb.BlockTableRecord)tr.GetObject(bt[_AcDb.BlockTableRecord.ModelSpace], _AcDb.OpenMode.ForRead);

                foreach (var oid in btr)
                {
                    var blockRef = tr.GetObject(oid, _AcDb.OpenMode.ForRead) as _AcDb.BlockReference;
                    if (blockRef != null)
                    {
                        if (string.Compare(blockRef.Name, Globs.RaumBlockName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            var attDict   = Globs.GetAttributesUcKey(blockRef);
                            var blockInfo = new BlockInfo
                            {
                                Raum       = Globs.GetValOrEmpty("RAUM", attDict),
                                Flaeche    = Globs.GetValOrEmpty("FLÄCHE", attDict),
                                Zusatz     = Globs.GetValOrEmpty("ZUSATZ", attDict),
                                Top        = Globs.GetValOrEmpty("TOP", attDict),
                                Geschoss   = Globs.GetValOrEmpty("GESCHOSS", attDict),
                                Nutzwert   = Globs.GetValOrEmpty("NUTZWERT", attDict),
                                Begrundung = Globs.GetValOrEmpty("BEGRUNDUNG", attDict),
                                Handle     = blockRef.Handle.ToString()
                            };
                            _blockInfos.Add(blockInfo);
                        }
                        else if (string.Compare(blockRef.Name, Globs.GstinfoBlockName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            if (_projektInfo == null)
                            {
                                _projektInfo = _factory.CreateProjectInfo();                       // new AcadPari.ProjektInfo();
                            }
                            var attDict = Globs.GetAttributesUcKey(blockRef);
                            _projektInfo.Bauvorhaben       = Globs.GetValOrEmpty("BAUVORHABEN", attDict);
                            _projektInfo.Katastralgemeinde = Globs.GetValOrEmpty("KATASTRALGEMEINDE", attDict);
                            _projektInfo.EZ = Globs.GetValOrEmpty("EZ", attDict);

                            var subInfo = _factory.CreateSubInfo(); // new AcadPari.ProjektInfo.SubInfo();
                            subInfo.Gstnr      = Globs.GetValOrEmpty("GRUNDSTÜCKSNUMMER", attDict);
                            subInfo.Flaeche    = Globs.GetValOrEmpty("FLACHE", attDict);
                            subInfo.AcadHandle = blockRef.Handle.ToString();
                            _projektInfo.SubInfos.Add(subInfo);
                        }
                        else if (string.Compare(blockRef.Name, Globs.WohnunginfoBlockName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            var attDict     = Globs.GetAttributesUcKey(blockRef);
                            var wohnungInfo = new WohnungInfo
                            {
                                Top      = Globs.GetValOrEmpty("TOP", attDict),
                                Typ      = Globs.GetValOrEmpty("TYP", attDict),
                                Widmung  = Globs.GetValOrEmpty("WIDMUNG", attDict),
                                Nutzwert = Globs.GetValOrEmpty("NUTZWERT", attDict),
                            };
                            _wohnungInfos.Add(wohnungInfo);
                        }
                    }
                }
                tr.Commit();
            }

            WidmungNutzwertBegrundungCorrection();
        }