<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reading part of dwg props in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/reading-part-of-dwg-props/m-p/297354#M70100</link>
    <description>Hi,&lt;BR /&gt;
Im just starting out with xrecords and am trying to access the custom&lt;BR /&gt;
drawing properties.&lt;BR /&gt;
For testing, I set the 'first' custom property in acad as&lt;BR /&gt;
&lt;BR /&gt;
name: jobNo        value: 0111&lt;BR /&gt;
&lt;BR /&gt;
Im trying to get the value 0111 from the drawing props by using the script&lt;BR /&gt;
below.&lt;BR /&gt;
But it returns JobNo=0111 instead just 0111.  Can anyone shine some light on&lt;BR /&gt;
what im mincing my head over.&lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
Keith&lt;BR /&gt;
&lt;BR /&gt;
ive commented through the script to illustrate what im thinking&lt;BR /&gt;
Heres the script so far :&lt;BR /&gt;
&lt;BR /&gt;
Sub initDetails()&lt;BR /&gt;
&lt;BR /&gt;
    'Declare dwgprop variables&lt;BR /&gt;
    Dim diction As AcadDictionary&lt;BR /&gt;
    Dim objDwgInfo As AcadXRecord&lt;BR /&gt;
    Dim varDataType As Variant&lt;BR /&gt;
    Dim varData As Variant&lt;BR /&gt;
    Dim intI As Integer&lt;BR /&gt;
    Dim unset As String 'For properties not set&lt;BR /&gt;
&lt;BR /&gt;
    'Set text for displaying unset dwgprops&lt;BR /&gt;
    unset = "Please Enter"&lt;BR /&gt;
&lt;BR /&gt;
    'Set dictionary name to use the dwgprops xrecord&lt;BR /&gt;
    Const DICTIONARY_NAME = "DWGPROPS"&lt;BR /&gt;
    On Error GoTo HandleError&lt;BR /&gt;
&lt;BR /&gt;
    'Set objDwgInfo to get dwgprops data&lt;BR /&gt;
    Set objDwgInfo = ThisDrawing.Dictionaries(DICTIONARY_NAME)&lt;BR /&gt;
    objDwgInfo.GetXRecordData varDataType, varData&lt;BR /&gt;
&lt;BR /&gt;
    'loop through each property to identify records and use data as required&lt;BR /&gt;
    For intI = LBound(varDataType) To UBound(varDataType)&lt;BR /&gt;
        'Uncomment the next line to use propmt utility for debugging&lt;BR /&gt;
        'ThisDrawing.Utility.Prompt vbCrLf &amp;amp; varDataType(intI) &amp;amp; vbTab &amp;amp;&lt;BR /&gt;
varData(intI)&lt;BR /&gt;
&lt;BR /&gt;
        'Test each property&lt;BR /&gt;
        'JobNo&lt;BR /&gt;
        If varDataType(intI) = 300 Then&lt;BR /&gt;
            If varData(intI) = "" Then&lt;BR /&gt;
                JobNoTxt.Value = unset&lt;BR /&gt;
            Else&lt;BR /&gt;
                JobNoTxt.Value = varData(intI)&lt;BR /&gt;
            End If&lt;BR /&gt;
        End If&lt;BR /&gt;
&lt;BR /&gt;
       'dwg number&lt;BR /&gt;
       'as above... etc etc&lt;BR /&gt;
&lt;BR /&gt;
    Next intI&lt;BR /&gt;
&lt;BR /&gt;
ExitHere:&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
&lt;BR /&gt;
HandleError:&lt;BR /&gt;
  MsgBox "Drawing Properties have not been set"&lt;BR /&gt;
  Resume ExitHere&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
    <pubDate>Tue, 01 Oct 2002 12:10:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-10-01T12:10:24Z</dc:date>
    <item>
      <title>Reading part of dwg props</title>
      <link>https://forums.autodesk.com/t5/vba-forum/reading-part-of-dwg-props/m-p/297354#M70100</link>
      <description>Hi,&lt;BR /&gt;
Im just starting out with xrecords and am trying to access the custom&lt;BR /&gt;
drawing properties.&lt;BR /&gt;
For testing, I set the 'first' custom property in acad as&lt;BR /&gt;
&lt;BR /&gt;
name: jobNo        value: 0111&lt;BR /&gt;
&lt;BR /&gt;
Im trying to get the value 0111 from the drawing props by using the script&lt;BR /&gt;
below.&lt;BR /&gt;
But it returns JobNo=0111 instead just 0111.  Can anyone shine some light on&lt;BR /&gt;
what im mincing my head over.&lt;BR /&gt;
&lt;BR /&gt;
Cheers&lt;BR /&gt;
Keith&lt;BR /&gt;
&lt;BR /&gt;
ive commented through the script to illustrate what im thinking&lt;BR /&gt;
Heres the script so far :&lt;BR /&gt;
&lt;BR /&gt;
Sub initDetails()&lt;BR /&gt;
&lt;BR /&gt;
    'Declare dwgprop variables&lt;BR /&gt;
    Dim diction As AcadDictionary&lt;BR /&gt;
    Dim objDwgInfo As AcadXRecord&lt;BR /&gt;
    Dim varDataType As Variant&lt;BR /&gt;
    Dim varData As Variant&lt;BR /&gt;
    Dim intI As Integer&lt;BR /&gt;
    Dim unset As String 'For properties not set&lt;BR /&gt;
&lt;BR /&gt;
    'Set text for displaying unset dwgprops&lt;BR /&gt;
    unset = "Please Enter"&lt;BR /&gt;
&lt;BR /&gt;
    'Set dictionary name to use the dwgprops xrecord&lt;BR /&gt;
    Const DICTIONARY_NAME = "DWGPROPS"&lt;BR /&gt;
    On Error GoTo HandleError&lt;BR /&gt;
&lt;BR /&gt;
    'Set objDwgInfo to get dwgprops data&lt;BR /&gt;
    Set objDwgInfo = ThisDrawing.Dictionaries(DICTIONARY_NAME)&lt;BR /&gt;
    objDwgInfo.GetXRecordData varDataType, varData&lt;BR /&gt;
&lt;BR /&gt;
    'loop through each property to identify records and use data as required&lt;BR /&gt;
    For intI = LBound(varDataType) To UBound(varDataType)&lt;BR /&gt;
        'Uncomment the next line to use propmt utility for debugging&lt;BR /&gt;
        'ThisDrawing.Utility.Prompt vbCrLf &amp;amp; varDataType(intI) &amp;amp; vbTab &amp;amp;&lt;BR /&gt;
varData(intI)&lt;BR /&gt;
&lt;BR /&gt;
        'Test each property&lt;BR /&gt;
        'JobNo&lt;BR /&gt;
        If varDataType(intI) = 300 Then&lt;BR /&gt;
            If varData(intI) = "" Then&lt;BR /&gt;
                JobNoTxt.Value = unset&lt;BR /&gt;
            Else&lt;BR /&gt;
                JobNoTxt.Value = varData(intI)&lt;BR /&gt;
            End If&lt;BR /&gt;
        End If&lt;BR /&gt;
&lt;BR /&gt;
       'dwg number&lt;BR /&gt;
       'as above... etc etc&lt;BR /&gt;
&lt;BR /&gt;
    Next intI&lt;BR /&gt;
&lt;BR /&gt;
ExitHere:&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
&lt;BR /&gt;
HandleError:&lt;BR /&gt;
  MsgBox "Drawing Properties have not been set"&lt;BR /&gt;
  Resume ExitHere&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Tue, 01 Oct 2002 12:10:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/reading-part-of-dwg-props/m-p/297354#M70100</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-10-01T12:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reading part of dwg props</title>
      <link>https://forums.autodesk.com/t5/vba-forum/reading-part-of-dwg-props/m-p/297355#M70101</link>
      <description>keith had this to say&lt;BR /&gt;
:&lt;BR /&gt;
&amp;gt; But it returns JobNo=0111 instead just 0111.&lt;BR /&gt;
&lt;BR /&gt;
That is correct; the property is stored just as you see even though it&lt;BR /&gt;
is not displayed that way in the properties dialog. Just use Mid to&lt;BR /&gt;
retrieve everything to the left of the equal sign:&lt;BR /&gt;
&lt;BR /&gt;
' Assumes sJob is "JobNo=0111"&lt;BR /&gt;
Mid(sJob, Instr(sJob, "="))&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
There are 10 kinds of people:&lt;BR /&gt;
Those who understand binary and those who don't&lt;BR /&gt;
http://www.acadx.com</description>
      <pubDate>Tue, 01 Oct 2002 12:18:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/reading-part-of-dwg-props/m-p/297355#M70101</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-10-01T12:18:18Z</dc:date>
    </item>
  </channel>
</rss>

