public static List <Pile> Filter(List <ObjectId> selblocks, PileOptions pileOptions, bool checkNum) { var resVal = new List <Pile>(); var db = HostApplicationServices.WorkingDatabase; using (var t = db.TransactionManager.StartTransaction()) { foreach (var idBlRef in selblocks) { using (var blRef = idBlRef.GetObject(OpenMode.ForRead, false, true) as BlockReference) { var blName = blRef.GetEffectiveName(); if (Regex.IsMatch(blName, pileOptions.PileBlockNameMatch)) { var pile = new Pile(blRef, blName); if (pile.Error == null) { resVal.Add(pile); } else { Inspector.AddError(pile.Error); } } } } t.Commit(); } return(resVal); }
public static PileOptions Load() { // Создать дефолтные var options = new PileOptions(); // Загрузка начтроек чертежа options.LoadFromNOD(); return(options); }
public PileOptions PromptOptions() { PileOptions resVal = this; //Запрос начальных значений AcadLib.UI.FormProperties formProp = new AcadLib.UI.FormProperties(); PileOptions thisCopy = (PileOptions)resVal.MemberwiseClone(); formProp.propertyGrid1.SelectedObject = thisCopy; if (Application.ShowModalDialog(formProp) != System.Windows.Forms.DialogResult.OK) { throw new Exception(General.CanceledByUser); } try { resVal = thisCopy; resVal.Save(); } catch (Exception ex) { Logger.Log.Error(ex, "Не удалось сохранить стартовые параметры."); } return(resVal); }