- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Having a problem justifying the text of an attribute created in vb ...
here's an simple example ..
Sub BlkAttribute()
Dim blockObj As AcadBlock
Dim insertionPnt(0 To 2) As Double
Dim txtstyle As AcadTextStyle
Dim Pnts(0 To 9) As Double
insertionPnt(0) = 0
insertionPnt(1) = 5
insertionPnt(2) = 0
Set blockObj = ThisDrawing.Blocks.Add _
(insertionPnt, "BlockWithAttribute")
Pnts(0) = -7.5: Pnts(1) = 5
Pnts(2) = -7.5: Pnts(3) = 10
Pnts(4) = 7.5: Pnts(5) = 10
Pnts(6) = 7.5: Pnts(7) = 5
Pnts(8) = -7.5: Pnts(9) = 5
' Create a lightweight Polyline object in model space
Set plineObj = blockObj.AddLightWeightPolyline(Pnts)
' Add an attribute to the block
Dim attributeObj 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
Dim value As String
height = 3.5
mode = acAttributeModeVerify
prompt = "New Prompt"
insertionPoint(0) = 0
insertionPoint(1) = 7.5
insertionPoint(2) = 0
tag = "New Tag"
value = "New Value"
Set attributeObj = blockObj.AddAttribute(height, mode, _
prompt, insertionPoint, tag, value)
'attributeObj.Alignment = acAlignmentBottomCenter
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
(insertionPnt, "BlockWithAttribute", 1#, 1#, 1#, 0)
End Sub
the attribute is created with a 'left' justification.
when the hi lited part of the code is used the attributes insertion point is changed to 0,0
Any suggestions!!!!
Regards
Geoff
Solved! Go to Solution.