0 Members and 1 Guest are viewing this topic.
private void StampDrawing(string fullDwgPath, string stampString, bool FullSize){ Document ThisDrawing = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(fullDwgPath); Database thisDB = ThisDrawing.Database; Autodesk.AutoCAD.ApplicationServices.TransactionManager tm = ThisDrawing.TransactionManager; using (Transaction trans = tm.StartTransaction()) { BlockTable bt = (BlockTable)thisDB.BlockTableId.GetObject(OpenMode.ForWrite); BlockTableRecord modelsp = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); DBText stampText = new DBText(); stampText.TextString = stampString; stampText.Height = 12; stampText.HorizontalMode = TextHorizontalMode.TextRight; stampText.Rotation = 0; modelsp.AppendEntity(stampText); trans.TransactionManager.AddNewlyCreatedDBObject(stampText, true); trans.Commit(); } tm.Dispose(); ThisDrawing.CloseAndSave(fullDwgPath); thisDB.Dispose();}