Reading part of dwg props

Anonymous

Reading part of dwg props

Anonymous
Not applicable
Hi,
Im just starting out with xrecords and am trying to access the custom
drawing properties.
For testing, I set the 'first' custom property in acad as

name: jobNo value: 0111

Im trying to get the value 0111 from the drawing props by using the script
below.
But it returns JobNo=0111 instead just 0111. Can anyone shine some light on
what im mincing my head over.

Cheers
Keith

ive commented through the script to illustrate what im thinking
Heres the script so far :

Sub initDetails()

'Declare dwgprop variables
Dim diction As AcadDictionary
Dim objDwgInfo As AcadXRecord
Dim varDataType As Variant
Dim varData As Variant
Dim intI As Integer
Dim unset As String 'For properties not set

'Set text for displaying unset dwgprops
unset = "Please Enter"

'Set dictionary name to use the dwgprops xrecord
Const DICTIONARY_NAME = "DWGPROPS"
On Error GoTo HandleError

'Set objDwgInfo to get dwgprops data
Set objDwgInfo = ThisDrawing.Dictionaries(DICTIONARY_NAME)
objDwgInfo.GetXRecordData varDataType, varData

'loop through each property to identify records and use data as required
For intI = LBound(varDataType) To UBound(varDataType)
'Uncomment the next line to use propmt utility for debugging
'ThisDrawing.Utility.Prompt vbCrLf & varDataType(intI) & vbTab &
varData(intI)

'Test each property
'JobNo
If varDataType(intI) = 300 Then
If varData(intI) = "" Then
JobNoTxt.Value = unset
Else
JobNoTxt.Value = varData(intI)
End If
End If

'dwg number
'as above... etc etc

Next intI

ExitHere:
Exit Sub

HandleError:
MsgBox "Drawing Properties have not been set"
Resume ExitHere

End Sub
0 Likes
Reply
235 Views
1 Reply
Reply (1)

Anonymous
Not applicable
keith had this to say
:
> But it returns JobNo=0111 instead just 0111.

That is correct; the property is stored just as you see even though it
is not displayed that way in the properties dialog. Just use Mid to
retrieve everything to the left of the equal sign:

' Assumes sJob is "JobNo=0111"
Mid(sJob, Instr(sJob, "="))

--
There are 10 kinds of people:
Those who understand binary and those who don't
http://www.acadx.com
0 Likes