<?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: Selecting window and changing color in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407567#M41401</link>
    <description>Rough program outline.&lt;BR /&gt;
&lt;BR /&gt;
Define filter for line entities that are magenta&lt;BR /&gt;
Create selection set with filter&lt;BR /&gt;
loop thro selection set&lt;BR /&gt;
change colour property to cyan&lt;BR /&gt;
delete selection set&lt;BR /&gt;
&lt;BR /&gt;
Search this NG and the help files for specifics. Post back here if you get &lt;BR /&gt;
stuck.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B_NERD&gt; wrote in message news:4930326@discussion.autodesk.com...&lt;BR /&gt;
I'm having a hard time writing a simple program in VBA. I want the user to &lt;BR /&gt;
select a window in the drawing and in that window the program will filter &lt;BR /&gt;
only lines.&lt;BR /&gt;
&lt;BR /&gt;
Now if a selected line is say magenta I want a program that will &lt;BR /&gt;
automatically turn the color into cyan.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.&lt;/B_NERD&gt;</description>
    <pubDate>Wed, 17 Aug 2005 02:18:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-08-17T02:18:14Z</dc:date>
    <item>
      <title>Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407566#M41400</link>
      <description>I'm having a hard time writing a simple program in VBA. I want the user to select a window in the drawing and in that window the program will filter only lines. &lt;BR /&gt;
&lt;BR /&gt;
Now if a selected line is say magenta I want a program that will automatically turn the color into cyan. &lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Tue, 16 Aug 2005 21:50:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407566#M41400</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-16T21:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407567#M41401</link>
      <description>Rough program outline.&lt;BR /&gt;
&lt;BR /&gt;
Define filter for line entities that are magenta&lt;BR /&gt;
Create selection set with filter&lt;BR /&gt;
loop thro selection set&lt;BR /&gt;
change colour property to cyan&lt;BR /&gt;
delete selection set&lt;BR /&gt;
&lt;BR /&gt;
Search this NG and the help files for specifics. Post back here if you get &lt;BR /&gt;
stuck.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B_NERD&gt; wrote in message news:4930326@discussion.autodesk.com...&lt;BR /&gt;
I'm having a hard time writing a simple program in VBA. I want the user to &lt;BR /&gt;
select a window in the drawing and in that window the program will filter &lt;BR /&gt;
only lines.&lt;BR /&gt;
&lt;BR /&gt;
Now if a selected line is say magenta I want a program that will &lt;BR /&gt;
automatically turn the color into cyan.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.&lt;/B_NERD&gt;</description>
      <pubDate>Wed, 17 Aug 2005 02:18:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407567#M41401</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-17T02:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407568#M41402</link>
      <description>Having a hard time looping through selection set and I want to also include hatches. &lt;BR /&gt;
&lt;BR /&gt;
Also, what's the line of code that asks for user to input a selection box (upper left corner to lower right corner) &lt;BR /&gt;
&lt;BR /&gt;
Bernard</description>
      <pubDate>Wed, 17 Aug 2005 14:47:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407568#M41402</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-17T14:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407569#M41403</link>
      <description>Hello Bernard&lt;BR /&gt;
&lt;BR /&gt;
To loop thro' a selection use something like the following:&lt;BR /&gt;
&lt;BR /&gt;
    Dim Ent As AcadEntity&lt;BR /&gt;
    Dim SS As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
    For Each Ent In SS&lt;BR /&gt;
        'do something here...ie change colour&lt;BR /&gt;
        Ent.color = acCyan&lt;BR /&gt;
    Next Ent&lt;BR /&gt;
&lt;BR /&gt;
To include hatches you need to add the OR operator to your selectionset &lt;BR /&gt;
filter. You have got a filter working haven't you???&lt;BR /&gt;
If not it looks something like this:&lt;BR /&gt;
&lt;BR /&gt;
    'set up filter data&lt;BR /&gt;
    gpCode(0) = -4:    dataValue(0) = "&lt;AND&gt;
    gpCode(1) = -4:    dataValue(1) = "&lt;OR&gt;
    gpCode(2) = 0:    dataValue(2) = "LINE"         'filter for line &lt;BR /&gt;
entities...&lt;BR /&gt;
    gpCode(3) = 0:    dataValue(3) = "HATCH"        'or hatched entities...&lt;BR /&gt;
    gpCode(4) = -4:    dataValue(4) = "OR&amp;gt;"      'close OR operator&lt;BR /&gt;
    gpCode(5) = 62:    dataValue(5) = "6"           'that are colour magenta &lt;BR /&gt;
(6)&lt;BR /&gt;
    gpCode(6) = -4:    dataValue(6) = "AND&amp;gt;"     'close AND operator&lt;BR /&gt;
&lt;BR /&gt;
Did you look up selection methods in the help file at all...&lt;BR /&gt;
If you want to select via a window when your program will provide the window &lt;BR /&gt;
coords use the SELECT method of the SelectionSet object.&lt;BR /&gt;
If you want the User to enter the window use the SelectOnScreen method of &lt;BR /&gt;
the SelectionSet object.&lt;BR /&gt;
Both methods accept the filter as a parameter.&lt;BR /&gt;
&lt;BR /&gt;
Keep at it. If you have any more problems post some code and will get it &lt;BR /&gt;
nutted&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B_NERD&gt; wrote in message news:4930933@discussion.autodesk.com...&lt;BR /&gt;
Having a hard time looping through selection set and I want to also include &lt;BR /&gt;
hatches.&lt;BR /&gt;
&lt;BR /&gt;
Also, what's the line of code that asks for user to input a selection box &lt;BR /&gt;
(upper left corner to lower right corner)&lt;BR /&gt;
&lt;BR /&gt;
Bernard&lt;/B_NERD&gt;&lt;/OR&gt;&lt;/AND&gt;</description>
      <pubDate>Thu, 18 Aug 2005 01:41:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407569#M41403</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-18T01:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407570#M41404</link>
      <description>the filters can be simplified:&lt;BR /&gt;
gpCode(0) = 0: dataValue(0) = "LINE,HATCH"&lt;BR /&gt;
gpCode(1) = 62: dataValue(1) = 6&lt;BR /&gt;
&lt;BR /&gt;
If you group like Objects into the same string, seperated by a comma it &lt;BR /&gt;
implies OR&lt;BR /&gt;
The SS function uses AND unless told otherwise. So the filters above will be &lt;BR /&gt;
read by the SS function as "If an object is a Line OR Hatch, AND it is the &lt;BR /&gt;
color 6, include it.&lt;BR /&gt;
&lt;BR /&gt;
When filtering for specific layers, you can do the same thing:&lt;BR /&gt;
gpcode(0) = 8: dataValue(0) = "0,Layer1,Layer2"&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Jeff&lt;BR /&gt;
&lt;BR /&gt;
"Tom Roberts" &lt;NOSPAM&gt; wrote in message &lt;BR /&gt;
news:4931798@discussion.autodesk.com...&lt;BR /&gt;
Hello Bernard&lt;BR /&gt;
&lt;BR /&gt;
To loop thro' a selection use something like the following:&lt;BR /&gt;
&lt;BR /&gt;
    Dim Ent As AcadEntity&lt;BR /&gt;
    Dim SS As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
    For Each Ent In SS&lt;BR /&gt;
        'do something here...ie change colour&lt;BR /&gt;
        Ent.color = acCyan&lt;BR /&gt;
    Next Ent&lt;BR /&gt;
&lt;BR /&gt;
To include hatches you need to add the OR operator to your selectionset&lt;BR /&gt;
filter. You have got a filter working haven't you???&lt;BR /&gt;
If not it looks something like this:&lt;BR /&gt;
&lt;BR /&gt;
    'set up filter data&lt;BR /&gt;
    gpCode(0) = -4:    dataValue(0) = "&lt;AND&gt;
    gpCode(1) = -4:    dataValue(1) = "&lt;OR&gt;
    gpCode(2) = 0:    dataValue(2) = "LINE"         'filter for line&lt;BR /&gt;
entities...&lt;BR /&gt;
    gpCode(3) = 0:    dataValue(3) = "HATCH"        'or hatched entities...&lt;BR /&gt;
    gpCode(4) = -4:    dataValue(4) = "OR&amp;gt;"      'close OR operator&lt;BR /&gt;
    gpCode(5) = 62:    dataValue(5) = "6"           'that are colour magenta&lt;BR /&gt;
(6)&lt;BR /&gt;
    gpCode(6) = -4:    dataValue(6) = "AND&amp;gt;"     'close AND operator&lt;BR /&gt;
&lt;BR /&gt;
Did you look up selection methods in the help file at all...&lt;BR /&gt;
If you want to select via a window when your program will provide the window&lt;BR /&gt;
coords use the SELECT method of the SelectionSet object.&lt;BR /&gt;
If you want the User to enter the window use the SelectOnScreen method of&lt;BR /&gt;
the SelectionSet object.&lt;BR /&gt;
Both methods accept the filter as a parameter.&lt;BR /&gt;
&lt;BR /&gt;
Keep at it. If you have any more problems post some code and will get it&lt;BR /&gt;
nutted&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B_NERD&gt; wrote in message news:4930933@discussion.autodesk.com...&lt;BR /&gt;
Having a hard time looping through selection set and I want to also include&lt;BR /&gt;
hatches.&lt;BR /&gt;
&lt;BR /&gt;
Also, what's the line of code that asks for user to input a selection box&lt;BR /&gt;
(upper left corner to lower right corner)&lt;BR /&gt;
&lt;BR /&gt;
Bernard&lt;/B_NERD&gt;&lt;/OR&gt;&lt;/AND&gt;&lt;/NOSPAM&gt;</description>
      <pubDate>Thu, 18 Aug 2005 01:52:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407570#M41404</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-18T01:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting window and changing color</title>
      <link>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407571#M41405</link>
      <description>v. nice Jeff...I didn't think of that&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"Jeff Mishler" &lt;MIFFATSONICDOTNETIS_ALL&gt; wrote in message &lt;BR /&gt;
news:4931800@discussion.autodesk.com...&lt;BR /&gt;
the filters can be simplified:&lt;BR /&gt;
gpCode(0) = 0: dataValue(0) = "LINE,HATCH"&lt;BR /&gt;
gpCode(1) = 62: dataValue(1) = 6&lt;BR /&gt;
&lt;BR /&gt;
If you group like Objects into the same string, seperated by a comma it&lt;BR /&gt;
implies OR&lt;BR /&gt;
The SS function uses AND unless told otherwise. So the filters above will be&lt;BR /&gt;
read by the SS function as "If an object is a Line OR Hatch, AND it is the&lt;BR /&gt;
color 6, include it.&lt;BR /&gt;
&lt;BR /&gt;
When filtering for specific layers, you can do the same thing:&lt;BR /&gt;
gpcode(0) = 8: dataValue(0) = "0,Layer1,Layer2"&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Jeff&lt;BR /&gt;
&lt;BR /&gt;
"Tom Roberts" &lt;NOSPAM&gt; wrote in message&lt;BR /&gt;
news:4931798@discussion.autodesk.com...&lt;BR /&gt;
Hello Bernard&lt;BR /&gt;
&lt;BR /&gt;
To loop thro' a selection use something like the following:&lt;BR /&gt;
&lt;BR /&gt;
    Dim Ent As AcadEntity&lt;BR /&gt;
    Dim SS As AcadSelectionSet&lt;BR /&gt;
&lt;BR /&gt;
    For Each Ent In SS&lt;BR /&gt;
        'do something here...ie change colour&lt;BR /&gt;
        Ent.color = acCyan&lt;BR /&gt;
    Next Ent&lt;BR /&gt;
&lt;BR /&gt;
To include hatches you need to add the OR operator to your selectionset&lt;BR /&gt;
filter. You have got a filter working haven't you???&lt;BR /&gt;
If not it looks something like this:&lt;BR /&gt;
&lt;BR /&gt;
    'set up filter data&lt;BR /&gt;
    gpCode(0) = -4:    dataValue(0) = "&lt;AND&gt;
    gpCode(1) = -4:    dataValue(1) = "&lt;OR&gt;
    gpCode(2) = 0:    dataValue(2) = "LINE"         'filter for line&lt;BR /&gt;
entities...&lt;BR /&gt;
    gpCode(3) = 0:    dataValue(3) = "HATCH"        'or hatched entities...&lt;BR /&gt;
    gpCode(4) = -4:    dataValue(4) = "OR&amp;gt;"      'close OR operator&lt;BR /&gt;
    gpCode(5) = 62:    dataValue(5) = "6"           'that are colour magenta&lt;BR /&gt;
(6)&lt;BR /&gt;
    gpCode(6) = -4:    dataValue(6) = "AND&amp;gt;"     'close AND operator&lt;BR /&gt;
&lt;BR /&gt;
Did you look up selection methods in the help file at all...&lt;BR /&gt;
If you want to select via a window when your program will provide the window&lt;BR /&gt;
coords use the SELECT method of the SelectionSet object.&lt;BR /&gt;
If you want the User to enter the window use the SelectOnScreen method of&lt;BR /&gt;
the SelectionSet object.&lt;BR /&gt;
Both methods accept the filter as a parameter.&lt;BR /&gt;
&lt;BR /&gt;
Keep at it. If you have any more problems post some code and will get it&lt;BR /&gt;
nutted&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
Regards&lt;BR /&gt;
Tom Roberts&lt;BR /&gt;
__________________________&lt;BR /&gt;
MechWest Design &amp;amp; Drafting&lt;BR /&gt;
Perth, Western Australia&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;B_NERD&gt; wrote in message news:4930933@discussion.autodesk.com...&lt;BR /&gt;
Having a hard time looping through selection set and I want to also include&lt;BR /&gt;
hatches.&lt;BR /&gt;
&lt;BR /&gt;
Also, what's the line of code that asks for user to input a selection box&lt;BR /&gt;
(upper left corner to lower right corner)&lt;BR /&gt;
&lt;BR /&gt;
Bernard&lt;/B_NERD&gt;&lt;/OR&gt;&lt;/AND&gt;&lt;/NOSPAM&gt;&lt;/MIFFATSONICDOTNETIS_ALL&gt;</description>
      <pubDate>Thu, 18 Aug 2005 02:57:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/selecting-window-and-changing-color/m-p/1407571#M41405</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-08-18T02:57:14Z</dc:date>
    </item>
  </channel>
</rss>

