Hey all,
I appreciate this is more VB than VBA but its an AutoCAD tool i'm making so posting it here too..
Trying to creating a tool that inserts datum lines in a drawing which is fine, the only issue is the formatting of the attribute to display within the block (see the bold part of the code below). I'm trying to display the datum level as "+0.000" which is fine for most input but if the number has any trailing zeros, they are not displayed. I've searched high and low on the net for this and have tried everything i have found but still no results..
(All variables in the code have been declared and no errors occur at run-time, just not the correct display:
ie: "+6.800" displays in the block as "+6.8" and "+8.760" displays as "+8.76")
Code:
'*************************************************
'************ GROUND FLOOR ***************
'*************************************************
GROUND:
' Check if GROUND is selected..
If LVLtxtGRND.Text = "" Then
GoTo FIRST
Else 'If a value is shown then insert the block..
LVLvalueGRND = LVLtxtGRND.Text
' Draw LINE for level..
LineGRNDstart(0) = 0: LineGRNDstart(1) = LVLvalueGRND: LineGRNDstart(2) = 0
LineGRNDend(0) = LINEend: LineGRNDend(1) = LVLvalueGRND: LineGRNDend(2) = 0
Set LINEgrnd = ThisDrawing.ModelSpace.AddLine(LineGRNDstart, LineGRNDend)
LINEgrnd.Layer = "X-Levels"
' Insert LEVEL Block..
LVLinsertGRND(0) = 0: LVLinsertGRND(1) = LVLvalueGRND: LVLinsertGRND(2) = 0
Set LVLblockGRND = ThisDrawing.ModelSpace.InsertBlock(LVLinsertGRND, "Level", 250#, 250#, 250#, 0)
LVLblockGRND.Layer = "X-Notes"
' Display level figure on screen..
LVLvalueGRND = LVLvalueGRND / 1000 'Get it into metres, no mm..
LVLvalueGRND = Round(LVLvalueGRND, 3)
LVLvalueGRND = Format(LVLvalueGRND, "0.000")
AttribZ = LVLblockGRND.GetAttributes ' Get Block attributes..
For CountX = LBound(AttribZ) To UBound(AttribZ)
Select Case AttribZ(CountX).TagString
Case "LEVEL"
AttribZ(CountX).TextString = PlusChar & LVLvalueGRND & " " & " " & DESCcomboGRND.Text
End Select
Next CountX
'On Error Resume Next
' MsgBox Err.Number & vbCr & Err.Description, vbExclamation, "Error:"
End If
'*************************************************
'************ GROUND FLOOR ***************
'*************************************************
Any ideas? This is twisting my melon now grrr
Bookmarks