求救:CAD属性一问
我在图块中创建一个属性,为什么进行图块引用的时候这个属性不在我最初定义的点上?块中还有其它的实体,插入后属性值的
位置一直不对,但是手动操作的就可以,这是为什么?
我也是按照帮助里写的
Dim attCode As AcadAttribute
Dim height As Double
Dim mode As Long
Dim prompt As String
Dim insertionPoint(0 To 2) As Double
Dim tag As String
height = 3.5
mode = acAttributeModeVerify
prompt = ""
insertionPoint(0) = 1000: insertionPoint(1) = 1000: insertionPoint(2) = 0
tag = "TagCode"
Set attCode = blockObj.AddAttribute(height, mode, prompt, insertionPoint, tag, strCode)
attCode.Alignment = acAlignmentMiddleCenter
Dim blockRefObj As AcadBlockReference
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "NameTableBlock", fscale, fscale, fscale, 0)
Re: 属性对齐
问题出在这:attCode.Alignment = acAlignmentMiddleCenter ,你可知道单行文字、属性对象的初始对齐点在坐标原点(0,0,0),因而设置对齐方式后,要把对齐点更改到你想要的位置。故在后面加上一句就可以了,tCode.extAlignmentPoint = insertionPoint。
页:
[1]