菜鸟求教:怎么指定“宽度因子”?
各位好!我在程序里面指定了文字样式,可是发现“宽度因子”不对。我预设的文字样式“宽度因子”为0.7,但是我通过程序指定TextStyleId后发现“宽度因子”变成了1.0。怎么通过程序指定呢?
谢谢啊! (defun c:kuu()
(setq ent(entget (car (entsel))))
(setq ge (getdist "\n输入文字宽度:"))
(entmod (subst (cons 41 ge) (assoc 41 ent) ent))
(princ)
)
点选文字,直接改宽度
public static void Test2()
{
using (var tr = new DBTransaction())
{
var tsid = tr.TextStyleTable.Add("Test1", "gbenor.shx", "gbcbig.shx", 0.7);
var btr = tr.OpenModelSpace();
var tstr = tr.TextStyleTable["Test1"].GetObject<TextStyleTableRecord>(tr);
var txt =
new DBText
{
TextStyleId = tsid,
TextString = "hello",
Position = new Point3d(10,10,0),
WidthFactor = 0.7,
};
tr.AddEntity(btr, txt);
}
} 把你写的程序贴上来。 我的代码:
Dim bt As BlockTable = trans.GetObject(dwg.BlockTableId, OpenMode.ForRead)
Dim btrMs As BlockTableRecord = trans.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim tst As TextStyleTable = trans.GetObject(dwg.TextStyleTableId, OpenMode.ForRead) '获取字体样式集合
Dim tech_req_pt As Point3d '插入点
Dim Tech_req_head As MText = New MText()
Tech_req_head.Contents = " 技术要求"
Tech_req_head.TextHeight = 350
'Tech_req.SetAttachmentMovingLocation(AttachmentPoint.MiddleCenter)
tech_req_pt = New Point3d(sheet_pt(0) + sheet - 8000, sheet_pt(1) + 13850, 0)
Tech_req_head.Location = tech_req_pt
Tech_req_head.Layer = "JY"
Tech_req_head.ColorIndex = 81
Tech_req_head.TextStyleId = tst("HZ")‘该样式是已经制定好的
btrMs.AppendEntity(Tech_req_head)
trans.AddNewlyCreatedDBObject(Tech_req_head, True)
雪山飞狐_lzh 发表于 2014-8-26 19:54 static/image/common/back.gif
感谢飞狐!
页:
[1]