<?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 Re: help with my ADT 'Generate Layers from Layer Key' Code? in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617278#M35120</link>
    <description>Corey A. Layton wrote:&lt;BR /&gt;
&amp;gt; The section: 're-set layer key overrides&lt;BR /&gt;
&amp;gt; below produces the error:&lt;BR /&gt;
Ok,&lt;BR /&gt;
problem solved.&lt;BR /&gt;
Credit to B.Winterscheidt over in the arch-desktop discussion group.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; ThisDrawing.SendCommand ("LayerKeyOverride ")&lt;BR /&gt;
&lt;BR /&gt;
The line above was the culprit,&lt;BR /&gt;
with regard to its position in sequence of things.&lt;BR /&gt;
Wasn't really behaving 'synchronously', as advertised,...&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;'re-set layer key overrides&lt;BR /&gt;
&amp;gt;For Each x In SavedOverrideSettings&lt;BR /&gt;
&amp;gt;   LayKeyStyle.OverrideSettings.Item(x(1)).Value = x(2)&lt;BR /&gt;
&amp;gt;Next x&lt;BR /&gt;
&lt;BR /&gt;
...which caused the code above to error.&lt;BR /&gt;
Moving this piece of code 'further downstream' to execute just before the &lt;BR /&gt;
End Sub,&lt;BR /&gt;
did the trick.&lt;BR /&gt;
&lt;BR /&gt;
I have *no idea* why...&lt;BR /&gt;
(but I'll take it!)&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; End Sub</description>
    <pubDate>Thu, 20 Apr 2006 12:40:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-04-20T12:40:56Z</dc:date>
    <item>
      <title>help with my ADT 'Generate Layers from Layer Key' Code?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617277#M35119</link>
      <description>The section: 're-set layer key overrides&lt;BR /&gt;
below produces the error:&lt;BR /&gt;
&lt;BR /&gt;
Run-time error '-214746259 (80004005)'&lt;BR /&gt;
Method 'Value' of Object  'IAecLayerOverrideSettings' failed&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
See VBA code below:&lt;BR /&gt;
&lt;BR /&gt;
Sub GenerateLayersFromLayerKey()&lt;BR /&gt;
&lt;BR /&gt;
getAecArchBaseApp&lt;BR /&gt;
getAecArchDbPref&lt;BR /&gt;
&lt;BR /&gt;
Dim CurrentLayerKeyStyle As String&lt;BR /&gt;
CurrentLayerKeyStyle = getLayerStandard&lt;BR /&gt;
&lt;BR /&gt;
Dim AecDoc As New AecArchBaseDocument&lt;BR /&gt;
AecDoc.Init ThisDrawing&lt;BR /&gt;
&lt;BR /&gt;
Dim LayKeyStyle As AecLayerKeyStyle&lt;BR /&gt;
Set LayKeyStyle = AecDoc.LayerKeyStyles(CurrentLayerKeyStyle)&lt;BR /&gt;
&lt;BR /&gt;
'save current Layer Key Overrides&lt;BR /&gt;
Dim SavedOverrideSettings() As Variant&lt;BR /&gt;
&lt;BR /&gt;
With LayKeyStyle.OverrideSettings&lt;BR /&gt;
SavedOverrideSettings = Array((Array(.Item("Discipline").Name, &lt;BR /&gt;
.Item("Discipline").Value)), _&lt;BR /&gt;
                                (Array(.Item("Status").Name, &lt;BR /&gt;
.Item("Status").Value)), _&lt;BR /&gt;
                                (Array(.Item("Component").Name, &lt;BR /&gt;
.Item("Component").Value)), _&lt;BR /&gt;
                                (Array(.Item("Description").Name, &lt;BR /&gt;
.Item("Description").Value)) _&lt;BR /&gt;
                            )&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
'set Layer Standard Wildcards&lt;BR /&gt;
With LayKeyStyle.OverrideSettings&lt;BR /&gt;
    .Item("Discipline").Value = "?"&lt;BR /&gt;
    .Item("Status").Value = "-?"&lt;BR /&gt;
    .Item("Component").Value = "-????"&lt;BR /&gt;
    .Item("Description").Value = "-*"&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing.SendCommand ("LayerKeyOverride ")&lt;BR /&gt;
&lt;BR /&gt;
'build Layer Generate Filter String&lt;BR /&gt;
Dim LayerFilter As String&lt;BR /&gt;
With LayKeyStyle.OverrideSettings&lt;BR /&gt;
&lt;BR /&gt;
    'Discipline Field is required&lt;BR /&gt;
    If .Item("Discipline").Value &amp;lt;&amp;gt; "" Then&lt;BR /&gt;
        LayerFilter = .Item("Discipline").Value&lt;BR /&gt;
    Else&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; "?"&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    'Status Field is optional&lt;BR /&gt;
    If .Item("Status").Value &amp;lt;&amp;gt; "" Then&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; .Item("Status").Value&lt;BR /&gt;
    Else&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; "*"&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    'Component Field is required&lt;BR /&gt;
    If .Item("Component").Value &amp;lt;&amp;gt; "" Then&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; .Item("Component").Value&lt;BR /&gt;
    Else&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; "-????"&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    'Description Field is optional&lt;BR /&gt;
    If .Item("Description").Value &amp;lt;&amp;gt; "" Then&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; .Item("Description").Value&lt;BR /&gt;
    Else&lt;BR /&gt;
        LayerFilter = LayerFilter &amp;amp; "*"&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
End With&lt;BR /&gt;
&lt;BR /&gt;
're-set layer key overrides&lt;BR /&gt;
For Each x In SavedOverrideSettings&lt;BR /&gt;
   LayKeyStyle.OverrideSettings.Item(x(1)).Value = x(2)&lt;BR /&gt;
Next x&lt;BR /&gt;
&lt;BR /&gt;
Dim LayerKey As AecLayerKey&lt;BR /&gt;
&lt;BR /&gt;
For Each LayerKey In LayKeyStyle.Keys&lt;BR /&gt;
&lt;BR /&gt;
    If LayerKey.Index = 86 Then 'special code for the 'Count' item, I think?&lt;BR /&gt;
        GoTo SkipLayerKey&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
    If LayerKey.Layer Like LayerFilter Then&lt;BR /&gt;
        LayKeyStyle.GenerateLayer (LayerKey.Name)&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
SkipLayerKey:&lt;BR /&gt;
Next LayerKey&lt;BR /&gt;
&lt;BR /&gt;
EndSub:&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Wed, 19 Apr 2006 14:39:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617277#M35119</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-19T14:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: help with my ADT 'Generate Layers from Layer Key' Code?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617278#M35120</link>
      <description>Corey A. Layton wrote:&lt;BR /&gt;
&amp;gt; The section: 're-set layer key overrides&lt;BR /&gt;
&amp;gt; below produces the error:&lt;BR /&gt;
Ok,&lt;BR /&gt;
problem solved.&lt;BR /&gt;
Credit to B.Winterscheidt over in the arch-desktop discussion group.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; ThisDrawing.SendCommand ("LayerKeyOverride ")&lt;BR /&gt;
&lt;BR /&gt;
The line above was the culprit,&lt;BR /&gt;
with regard to its position in sequence of things.&lt;BR /&gt;
Wasn't really behaving 'synchronously', as advertised,...&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;'re-set layer key overrides&lt;BR /&gt;
&amp;gt;For Each x In SavedOverrideSettings&lt;BR /&gt;
&amp;gt;   LayKeyStyle.OverrideSettings.Item(x(1)).Value = x(2)&lt;BR /&gt;
&amp;gt;Next x&lt;BR /&gt;
&lt;BR /&gt;
...which caused the code above to error.&lt;BR /&gt;
Moving this piece of code 'further downstream' to execute just before the &lt;BR /&gt;
End Sub,&lt;BR /&gt;
did the trick.&lt;BR /&gt;
&lt;BR /&gt;
I have *no idea* why...&lt;BR /&gt;
(but I'll take it!)&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; End Sub</description>
      <pubDate>Thu, 20 Apr 2006 12:40:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617278#M35120</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-20T12:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: help with my ADT 'Generate Layers from Layer Key' Code?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617279#M35121</link>
      <description>&amp;gt;Wasn't really behaving 'synchronously', as advertised,...&lt;BR /&gt;
Who advertised it as being synchronous? We usually go out of our way to tell &lt;BR /&gt;
everyone to stay away from SendCommand if possible, because it is &lt;BR /&gt;
asyncronous.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----</description>
      <pubDate>Thu, 20 Apr 2006 14:45:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617279#M35121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-20T14:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: help with my ADT 'Generate Layers from Layer Key' Code?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617280#M35122</link>
      <description>Ed Jobe wrote:&lt;BR /&gt;
&amp;gt; Who advertised it as being synchronous? We usually go out of our way&lt;BR /&gt;
&amp;gt; to tell everyone to stay away from SendCommand if possible, because&lt;BR /&gt;
&amp;gt; it is asyncronous.&lt;BR /&gt;
&lt;BR /&gt;
snipped from the Help file.&lt;BR /&gt;
&lt;BR /&gt;
&lt;SNIP&gt;&lt;BR /&gt;
&lt;BR /&gt;
"This method is generally synchronous. However, if the command sent with &lt;BR /&gt;
this method requires any user interaction (such as picking a point on the &lt;BR /&gt;
screen) then this method will continue as soon as the user input begins. The &lt;BR /&gt;
command will then continue to be processed asynchronously."&lt;BR /&gt;
&lt;BR /&gt;
&lt;/SNIP&gt;&lt;BR /&gt;
&lt;BR /&gt;
I guess my use of the Layer Key Overrides UI,&lt;BR /&gt;
constitutes 'user interaction', eh?&lt;BR /&gt;
&lt;BR /&gt;
I should read these things more closely...</description>
      <pubDate>Thu, 20 Apr 2006 14:57:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617280#M35122</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-20T14:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: help with my ADT 'Generate Layers from Layer Key' Code?</title>
      <link>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617281#M35123</link>
      <description>Oh, the "help" file. &lt;SNICKER&gt;&lt;SNICKER&gt; That blurb is a little misleading, &lt;BR /&gt;
easily misunderstood. Although SendCommand method is processed syncronously, &lt;BR /&gt;
the processing of whatever is output to the command line is asyncronous.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
----&lt;BR /&gt;
Ed&lt;BR /&gt;
----&lt;/SNICKER&gt;&lt;/SNICKER&gt;</description>
      <pubDate>Thu, 20 Apr 2006 23:28:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/help-with-my-adt-generate-layers-from-layer-key-code/m-p/1617281#M35123</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-04-20T23:28:41Z</dc:date>
    </item>
  </channel>
</rss>

