Reading part of dwg props
Not applicable
10-01-2002
05:10 AM
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
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
Link copied