protected override IEnumerable <Entity> GetEntities() { var en = new List <Entity>(); var att1 = new AttributeDefinition(); att1.SetDatabaseDefaults(); att1.TextStyle = CADProxy.Database.Textstyle; att1.HorizontalMode = TextHorizontalMode.TextLeft; att1.VerticalMode = TextVerticalMode.TextVerticalMid; att1.ColorIndex = 7; att1.Height = 2; att1.Position = new Point3d(2, 1.5, 0); att1.Justify = AttachmentPoint.MiddleLeft; att1.AlignmentPoint = new Point3d(2, 1.5, 0); att1.Tag = "Value"; att1.Prompt = "Value"; att1.TextString = value.ToString(); en.Add(att1); var l1 = new Line(new Point3d(-1.5, -1.5, 0), new Point3d(1.5, 1.5, 0)); en.Add(l1); var l2 = new Line(new Point3d(-1.5, 1.5, 0), new Point3d(1.5, -1.5, 0)); en.Add(l2); var textArea = CADProxy.GetTextArea(CADProxy.ToDBText(att1)); var l3 = new Line(new Point3d(0, 0, 0), new Point3d(textArea[1].X - textArea[0].X + 2, 0, 0)); en.Add(l3); return(en); }
private void verticalMirroring() { double textWidth = 0; foreach (var e in entities) { if (e.GetType() == typeof(DBText)) { var textArea = CADProxy.GetTextArea(e as DBText); textWidth += textArea[1].X - textArea[0].X; } } textWidth += 4; foreach (var e in entities) { if (e.GetType() == typeof(DBText)) { e.TransformBy(Matrix3d.Displacement(new Vector3d((IsVMirror ? textWidth : -textWidth) * AppSettings.Get.ScaleFactor, 0, 0))); } else { e.TransformBy(Matrix3d.Mirroring(new Line3d(basePoint, new Vector3d(0, 1, 0)))); } } IsVMirror = !IsVMirror; }
public static SystemVariables GetActualSystemVariables() { SystemVariables variables = new SystemVariables(); variables.CLayer = (string)CADProxy.GetSystemVariable("CLayer"); return(variables); }
private void GetSettingsFromDocument() { drawingUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDrawingUnit"), Units.mm); dimensionUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDimensionUnit"), Units.mm); drawingScale = CADProxy.GetCustomProperty("CKDrawingScale"); if (drawingScale == "") { DrawingScale = CADProxy.Database.Cannoscale.Name; } }
public JigMark(IEnumerable <Entity> _entities, Point3d _originPoint, Point3d _basePoint, IEnumerable <IEntityConverter> _converters = null) : base(_entities, _originPoint, _basePoint, _converters) { var transform = Matrix3d.Scaling(AppSettings.Get.ScaleFactor, new Point3d(0, 0, 0)); transforms.Add(transform); entities.TransformBy(transform); transform = Matrix3d.Displacement(new Point3d(0, 0, 0).GetVectorTo(basePoint)); entities.TransformBy(transform); CADProxy.UsingTransaction(PrepareEntity); }
private void OnDocumentActivate(object sender, CADApplicationServices.DocumentCollectionEventArgs arg) { BindScaleList(); View.SelectedScale = new ScaleDTO() { UniqueIdentifier = CADProxy.Database.Cannoscale.UniqueIdentifier, Name = CADProxy.Database.Cannoscale.Name }; View.SelectedDrawingUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDrawingUnit"), Units.mm); View.SelectedDimensionUnit = EnumsUtil.GetEnum(CADProxy.GetCustomProperty("CKDimensionUnit"), Units.mm); }
protected override IEnumerable <Entity> GetEntities() { var en = new List <Entity>(); var att1 = new AttributeDefinition(); att1.SetDatabaseDefaults(); att1.TextStyle = CADProxy.Database.Textstyle; att1.HorizontalMode = TextHorizontalMode.TextRight; att1.VerticalMode = TextVerticalMode.TextVerticalMid; att1.ColorIndex = 7; att1.Height = 2; att1.Position = new Point3d(-0.5, 4.5, 0); att1.Justify = AttachmentPoint.MiddleRight; att1.AlignmentPoint = new Point3d(-0.5, 4.5, 0); att1.Tag = "Sign"; att1.Prompt = "Sign"; att1.TextString = value.Sign; en.Add(att1); var att2 = new AttributeDefinition(); att2.SetDatabaseDefaults(); att2.TextStyle = CADProxy.Database.Textstyle; att2.HorizontalMode = TextHorizontalMode.TextLeft; att2.VerticalMode = TextVerticalMode.TextVerticalMid; att2.ColorIndex = 7; att2.Height = 2; att2.Position = new Point3d(0.5, 4.5, 0); att2.Justify = AttachmentPoint.MiddleLeft; att2.AlignmentPoint = new Point3d(0.5, 4.5, 0); att2.Tag = "Value"; att2.Prompt = "Value"; att2.TextString = value.Value; en.Add(att2); var textArea = CADProxy.GetTextArea(CADProxy.ToDBText(att2)); var pl1 = new Polyline(); pl1.AddVertexAt(0, new Point2d(0, 5.5), 0, 0, 0); pl1.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pl1.AddVertexAt(0, new Point2d(-2, 3), 0, 0, 0); pl1.AddVertexAt(0, new Point2d(textArea[1].X - textArea[0].X + 0.5, 3), 0, 0, 0); en.Add(pl1); return(en); }
public void CreateMark(object sender, BeginMarkCreateEventArgs args) { markID = args.ID; var cmdActive = Convert.ToInt32(CADProxy.GetSystemVariable("CMDACTIVE")); if (cmdActive > 0) { isMarkCreateRunning = true; CADProxy.Document.CommandCancelled += CommandCancelled; CADProxy.CancelRunningCommand(); } else { CADProxy.MainWindow.Focus(); CreateMark(); } }
public IEnumerable <Entity> Convert(IEnumerable <Entity> _entities) { IList <Entity> result = new List <Entity>(); foreach (var item in _entities) { if (true && item.GetType().Equals(typeof(AttributeDefinition))) { result.Add(CADProxy.ToDBText((AttributeDefinition)item)); } else { result.Add(item); } } return(result); }
private void VerticalMirroring() { double textWidth = 0; foreach (var e in entities) { if (e.GetType() == typeof(DBText)) { var textArea = CADProxy.GetTextArea(e as DBText); textWidth += textArea[1].X - textArea[0].X; } } using (var tr = CADProxy.Document.TransactionManager.StartTransaction()) { foreach (var e in entities) { var ent = e.ObjectId.GetObject(OpenMode.ForWrite, true) as Entity; ent.Erase(false); if (ent.GetType() == typeof(DBText)) { ent.TransformBy(Matrix3d.Displacement(new Vector3d((isVMirror ? textWidth : -textWidth), 0, 0))); } else { ent.TransformBy(Matrix3d.Mirroring(new Line3d(basePoint, new Vector3d(0, 1, 0)))); } ent.Erase(); } tr.Commit(); } foreach (var ent in buffer) { if (ent.GetType() == typeof(DBText) || ent.GetType() == typeof(AttributeDefinition)) { ent.TransformBy(Matrix3d.Displacement(new Vector3d((isVMirror ? textWidth : -textWidth) / AppSettings.Get.ScaleFactor, 0, 0))); } else { ent.TransformBy(Matrix3d.Mirroring(new Line3d(new Point3d(0, 0, 0), new Vector3d(0, 1, 0)))); } } isVMirror = !isVMirror; }
protected override IEnumerable <Entity> GetEntities() { var en = new List <Entity>(); var att1 = new AttributeDefinition(); att1.SetDatabaseDefaults(); att1.TextStyle = CADProxy.Database.Textstyle; att1.HorizontalMode = TextHorizontalMode.TextLeft; att1.VerticalMode = TextVerticalMode.TextVerticalMid; att1.ColorIndex = 7; att1.Height = 2; att1.Position = new Point3d(0, 4.5, 0); att1.Justify = AttachmentPoint.MiddleLeft; att1.AlignmentPoint = new Point3d(0, 4.5, 0); att1.Tag = "Value"; att1.Prompt = "Value"; att1.TextString = value.ToString(); en.Add(att1); var pl1 = new Polyline(); pl1.AddVertexAt(0, new Point2d(-1.5, 1.5), 0, 0, 0); pl1.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pl1.AddVertexAt(0, new Point2d(1.5, 1.5), 0, 0, 0); if (value.Value == "0,000") { pl1.Closed = true; AddHatchingArrow(en); Index = "zero"; } en.Add(pl1); var textArea = CADProxy.GetTextArea(CADProxy.ToDBText(att1)); var pl2 = new Polyline(); pl2.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0); pl2.AddVertexAt(0, new Point2d(0, 3), 0, 0, 0); pl2.AddVertexAt(0, new Point2d(textArea[1].X - textArea[0].X, 3), 0, 0, 0); en.Add(pl2); return(en); }
public static void RestoreSystemVariables(SystemVariables variables) { CADProxy.SetSystemVariable("CLayer", variables.CLayer); }
public void Initialize() { AppSettings.Get.CADKitPalette.Add("Ustawienia", DI.Container.Resolve <ISettingsView>() as Control); AppSettings.Get.CADKitPalette.Visible = true; CADProxy.SetSystemVariable("CANNOSCALE", "1:100"); }
private void SetSettingsToDocument() { CADProxy.SetCustomProperty("CKDrawingUnit", drawingUnit.ToString()); CADProxy.SetCustomProperty("CKDimensionUnit", dimensionUnit.ToString()); CADProxy.SetCustomProperty("CKDrawingScale", drawingScale); }
public void OnScaleSelect(object sender, EventArgs e) { CADProxy.SetSystemVariable("CANNOSCALE", View.SelectedScale.Name); }