public static void SetLast(Entity entity = null) { List <Entity> list = null; if (entity == null) { PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); list = ListFromSelecion(acSSPrompt); if (list.Count == 0) { return; } entity = list.Last <Entity>(); } UserEntity uEntity = XDataManage.getXData(entity); if (uEntity == null) { uEntity = UserEntity.Create(entity, new Properties()); } if (uEntity == null) { return; } uEntity.Properties.Printable = false; uEntity.Properties.CommandType = CommandType.Last; uEntity.Properties.Last = true; uEntity = XDataManage.setXData(uEntity); LastChangeEvent?.Invoke(uEntity); }
public static List <UserEntity> GetXData(List <Entity> list = null) { if (list == null) { PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); list = ListFromSelecion(acSSPrompt); } return(XDataManage.getXData(list)); }
public static UserEntity FindUserEntityByObjectId(ObjectId objectId) { UserEntity uEntity = null; using (Transaction acTrans = Global.DB.TransactionManager.StartTransaction()) { var ent = acTrans.GetObject(objectId, OpenMode.ForRead) as Entity; uEntity = XDataManage.getXData(ent); acTrans.Abort(); } return(uEntity); }
public static void SetOrder(Properties properties = null) { int order = -1; if (properties != null) { order = properties.Order; } PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); List <Entity> list = ListFromSelecion(acSSPrompt); if (list.Count == 0) { return; } if (order < 0) { PromptIntegerOptions pOpts = new PromptIntegerOptions( "Пожалуйста, введите порядковый номер линии в чертеже: "); pOpts.LowerLimit = -1; pOpts.DefaultValue = API.prevOrder + 1; PromptIntegerResult promptInteger = Global.Doc.Editor.GetInteger(pOpts); order = promptInteger.Value; if (order < 0) { Global.Editor.WriteMessage("Порядковый номер не может быть меньше нуля для печатной линии\n"); return; } } API.prevOrder = order; foreach (Entity entity in list) { UserEntity uEntity = XDataManage.getXData(entity); if (uEntity == null) { uEntity = UserEntity.Create(entity, new Properties()); } if (uEntity == null) { continue; } uEntity.Properties.Printable = true; uEntity.Properties.Order = order; uEntity = XDataManage.setXData(uEntity); OrderChangeEvent?.Invoke(uEntity); } }
public static void SetDisablePumping(Properties properties = null) { bool disablePumping = false; PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); List <Entity> list = ListFromSelecion(acSSPrompt); if (list.Count > 1) { return; } if (properties == null) { PromptIntegerOptions pOpts = new PromptIntegerOptions( "Введите 1, чтобы отключить подач бетона после этой точки. 0, чтобы восстановить подачу: "); pOpts.LowerLimit = 0; pOpts.UpperLimit = 1; PromptIntegerResult promptInteger = Global.Doc.Editor.GetInteger(pOpts); disablePumping = promptInteger.Value == 1 ? true : false; } else { disablePumping = properties.DisablePumping; } foreach (Entity entity in list) { UserEntity uEntity = XDataManage.getXData(entity); if (uEntity == null) { uEntity = UserEntity.Create(entity, new Properties()); } if (uEntity == null) { continue; } uEntity.Properties.Printable = false; uEntity.Properties.Command = true; uEntity.Properties.CommandType = CommandType.DisablePumping; uEntity.Properties.DisablePumping = disablePumping; uEntity = XDataManage.setXData(uEntity); DisablePumpingEvent?.Invoke(uEntity); } }
public static void SetStopAndPump(Properties properties = null) { int stopAndPump = -1; if (properties != null) { stopAndPump = properties.StopAndPump; } PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); List <Entity> list = ListFromSelecion(acSSPrompt); if (list.Count > 1) { return; } if (stopAndPump == -1) { PromptIntegerOptions pOpts = new PromptIntegerOptions( "Пожалуйста, введите время прокачки в милисекундах: "); pOpts.LowerLimit = 0; PromptIntegerResult promptInteger = Global.Doc.Editor.GetInteger(pOpts); stopAndPump = promptInteger.Value; } foreach (Entity entity in list) { UserEntity uEntity = XDataManage.getXData(entity); if (uEntity == null) { uEntity = UserEntity.Create(entity, new Properties()); } if (uEntity == null) { continue; } uEntity.Properties.Printable = false; uEntity.Properties.Command = true; uEntity.Properties.CommandType = CommandType.StopAndPump; uEntity.Properties.StopAndPump = stopAndPump; uEntity = XDataManage.setXData(uEntity); StopAndPumpEvent?.Invoke(uEntity); } }
private static void SetUserEntitys(List <Entity> list = null) { bool trash = false; if (list != null) { foreach (Entity entity in list) { if (entity == null) { return; } UserEntity uEntity = XDataManage.getXData(entity); if (uEntity != null) { if (!UEntitys.ContainsKey(entity.ObjectId)) { UEntitys.Add(uEntity.ObjectId, uEntity); } else { UEntitys[uEntity.ObjectId] = uEntity; Global.Editor.WriteMessage("Warrning. UEntity already stored\n"); } } else { trash = true; OnWrongDetected(entity.ObjectId); } } if (trash == true) { Global.Editor.WriteMessage("Not all entites in document have available properties\n"); } } else { SetUserEntitys(SelectAllObjectsFromAc()); } }
public static void SetPumpingFalse(List <Entity> list = null) { if (list == null) { PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); list = ListFromSelecion(acSSPrompt); if (list.Count == 0) { return; } } UserEntity uEntity; if (list.Count < 1) { return; } foreach (Entity entity in list) { uEntity = XDataManage.getXData(entity); if (uEntity == null) { uEntity = UserEntity.Create(entity, new Properties()); } if (uEntity == null) { continue; } uEntity.Properties.Printable = true; uEntity.Properties.Pumping = false; uEntity = XDataManage.setXData(uEntity); PumpingChangeEvent?.Invoke(uEntity); } }
public static void SetXData(List <Entity> list = null) { if (list == null) { PromptSelectionResult acSSPrompt = Global.Doc.Editor.GetSelection(); list = ListFromSelecion(acSSPrompt); if (list.Count == 0) { return; } } UserEntity uEntity; foreach (Entity entity in list) { uEntity = UserEntity.Create(entity, new Properties()); if (uEntity != null) { XDataManage.setXData(uEntity); } } }