private void AddLengthLine() { //AcDb.DBText oText; AcDb.MText oMText; AcDb.Line lineCur = null; AcDb.ObjectId idLineCur; AcGe.Point2d startPoint = this.Parcel.Points.ToArray()[this.Parcel.Points.Count - 1]; AcGe.Point3d midPoint; foreach (AcGe.Point2d endPoint in this.Parcel.Points) { midPoint = new AcGe.Point3d((endPoint.X + startPoint.X) / 2, (endPoint.Y + startPoint.Y) / 2, 0); lineCur = new AcDb.Line(new AcGe.Point3d(startPoint.X, startPoint.Y, 0), new AcGe.Point3d(endPoint.X, endPoint.Y, 0)); lineCur.ColorIndex = 222; lineCur.LineWeight = AcDb.LineWeight.LineWeight030; idLineCur = ServiceCAD.InsertObject(lineCur); ServiceCAD.ZoomCenter(midPoint, 1); /* * oText = new AcDb.DBText(); * oText.Height = 2 * this.SettingsForm.ScaleDrawing; * oText.TextString = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",","."); * //oText.Layer = settingsDrawing.Plan.LengthLine.Layer; * * ServiceCAD.ManualInsertText(oText); */ oMText = new AcDb.MText(); oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing; oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer; oMText.Contents = startPoint.GetDistanceTo(endPoint).ToString("0.00").Replace(",", "."); ServiceCAD.ZoomCenter(midPoint, 1); ServiceSimpleElements.ManualInsertMText(oMText); ServiceCAD.DeleteObject(idLineCur); startPoint = endPoint; } }
private void AddNumdersPoints() { int iCurNumberPoint = 0; //AcDb.DBText oText; AcDb.MText oMText; AcDb.Circle circleCurPoint = null; AcDb.ObjectId idCircleCurPoint; foreach (AcGe.Point2d point in this.Parcel.Points) { iCurNumberPoint += 1; circleCurPoint = new AcDb.Circle( new AcGe.Point3d(point.X, point.Y, 0), new AcGe.Vector3d(0, 0, 1), 1.75 * this.SettingsForm.ScaleDrawing); circleCurPoint.ColorIndex = 222; circleCurPoint.LineWeight = AcDb.LineWeight.LineWeight030; idCircleCurPoint = ServiceCAD.InsertObject(circleCurPoint); /* * oText = new AcDb.DBText(); * oText.TextString = Convert.ToString(iCurNumberPoint); * oText.Height = settingsDrawing.Plan.NumberPoint.TextHeight * this.SettingsForm.ScaleDrawing; * //oText.Layer = settingsDrawing.Plan.NumberPoint.Layer; */ oMText = new AcDb.MText(); oMText.TextHeight = 2 * this.SettingsForm.ScaleDrawing; oMText.Attachment = AcDb.AttachmentPoint.MiddleCenter; //oMText.Layer = settingsDrawing.Plan.LengthLine.Layer; oMText.Contents = Convert.ToString(iCurNumberPoint); ServiceCAD.ZoomCenter(new AcGe.Point3d(point.X, point.Y, 0), 1); ServiceSimpleElements.ManualInsertMText(oMText); ServiceCAD.DeleteObject(idCircleCurPoint); } }