Ejemplo n.º 1
0
        public static AcDb.ObjectId CreateFontStyle(String textStyleName, AcGi.FontDescriptor font)
        {
            AcDb.ObjectId txtStyleId = AcDb.ObjectId.Null;

            using (AcDb.Transaction tr = doc.Database.TransactionManager.StartTransaction())
            {
                AcDb.TextStyleTable newTextStyleTable = tr.GetObject(doc.Database.TextStyleTableId, AcDb.OpenMode.ForRead) as AcDb.TextStyleTable;

                if (!newTextStyleTable.Has(textStyleName))
                {
                    newTextStyleTable.UpgradeOpen();
                    AcDb.TextStyleTableRecord newTextStyleTableRecord = new AcDb.TextStyleTableRecord();
                    //newTextStyleTableRecord.FileName = "romans.shx";
                    newTextStyleTableRecord.Name = textStyleName;
                    newTextStyleTableRecord.Font = font;
                    newTextStyleTable.Add(newTextStyleTableRecord);
                    tr.AddNewlyCreatedDBObject(newTextStyleTableRecord, true);

                    txtStyleId = newTextStyleTable[textStyleName];
                }
                tr.Commit();
            }

            return(txtStyleId);
        }
Ejemplo n.º 2
0
        private void textStyleHandler()
        {
            _Db.TextStyleTable txtStyleTable = _c.trans.GetObject(_c.db.TextStyleTableId, _Db.OpenMode.ForWrite) as _Db.TextStyleTable;

            if (!txtStyleTable.Has("Stommest"))
            {
                _Db.TextStyleTableRecord newStyle = new _Db.TextStyleTableRecord();
                newStyle.Name = "Stommest";

                newStyle.FileName       = "ARIALN.TTF";
                newStyle.FlagBits       = 0;
                newStyle.Font           = new _Gi.FontDescriptor("Arial Narrow", false, false, 0, 34);
                newStyle.IsVertical     = false;
                newStyle.ObliquingAngle = 0;
                newStyle.TextSize       = 0;
                newStyle.XScale         = 1;

                txtStyleTable.Add(newStyle);
                _c.trans.AddNewlyCreatedDBObject(newStyle, true);
                write("[OUTPUT] TextStyle 'Stommest' created");
            }
        }