//[Command] //public void Test() //{ // string activeDgnFileName = Program.GetActiveDgnFile().GetFileName(); // List<string> dgnFileNameList = new List<string> {activeDgnFileName}; // GetAttachmentsDgnFiles(ref dgnFileNameList, activeDgnFileName); //} private void GetLevelInfo(ref List <LevelInfo> levelInfos, string inDgnFileName) { BD.DgnDocument inDgnDocument = BD.DgnDocument.CreateForLocalFile(inDgnFileName); BD.DgnFile inDgnFile = BD.DgnFile.Create(inDgnDocument, BD.DgnFileOpenMode.ReadOnly).DgnFile; BD.StatusInt openFileStatusInt; if (BD.DgnFileStatus.Success != inDgnFile.LoadDgnFile(out openFileStatusInt)) { return; } if (BD.StatusInt.Success != inDgnFile.FillDictionaryModel()) { return; } string inDgnFileNameWithoutExt = Path.GetFileNameWithoutExtension(inDgnFile.GetFileName()); var fileLevelCache = inDgnFile.GetLevelCache(); var handles = fileLevelCache.GetHandles(); foreach (var handle in handles) { if (IsOnlyUsedLevel && !fileLevelCache.IsLevelUsedInFile(handle.LevelId)) { continue; } uint colorint = handle.GetByLevelColor().Color; BD.ColorInformation colorInformation = BD.DgnColorMap.ExtractElementColorInfo(colorint, handle.GetByLevelColor().GetDefinitionFile()); levelInfos.Add(new LevelInfo { DgnFileName = inDgnFileNameWithoutExt, LevelName = handle.Name, LevelColor = colorInformation.ColorDefinition.SystemColor }); } }
protected override void OnInitializeInRuntime() { var alllevel = new ObservableCollection <BD.LevelHandle>(); BD.DgnFile activefile = Program.GetActiveDgnFile(); BD.FileLevelCache flevel = activefile.GetLevelCache(); foreach (var levelhandle in flevel.GetHandles()) { alllevel.Add(levelhandle); } AllDgnLevels = alllevel; //PileCrossSectionTypes = new Dictionary<string, PileCrossSectionType> //{ // {"圆形截面桩", PileCrossSectionType.Roundness }, // {"方形截面桩", PileCrossSectionType.Square }, // {"环形截面桩", PileCrossSectionType.Annular } //}; SelectedPileCrossSectionType = SoildPileCrossSectionType.Square; SelectedPileType = PileType.Solid; Eta = 1; PileWeight = 25; PileUnderwaterWeight = 15; }