Author Topic: Select an entity with coords ?  (Read 154 times)

deydope

  • Newbie
  • *
  • Posts: 10
Select an entity with coords ?
« on: October 17, 2017, 12:12:31 AM »
Hi,

I have actually a problem, i need to get the color of an entity. I can select it with pointselect but i didn't find a way to get the color.

If someone have a solution it will be great :)

thanks for your time and sorry for bad english

deydope

  • Newbie
  • *
  • Posts: 10
Re: Select an entity with coords ?
« Reply #1 on: October 17, 2017, 12:25:53 AM »
I finally found a way to do this with the pointselect/getselect statement.
sorry for inconvenience

For those who are interested:
(It works on a 2d plane but i think it's gonna be working an 3d plane too)

sys(80) = 0
            >PointSelect
            {
                <PointXYZ [x2 + 70, y3]
                <Type 0
            }
            if sys(80) <> 0 then
                getselect sys(80), selected
                entity selected
                if sys(331) = 0 and sys(332) = 0 and sys(333) = 255 then
                    MESSAGE "Entity finded"
                endif
            endif

Lar

  • Hero Member
  • *****
  • Posts: 2633
Re: Select an entity with coords ?
« Reply #2 on: October 17, 2017, 04:49:53 AM »


                    MESSAGE "Entity finded"
                    MESSAGE "Entity found"

 ;)


Actually, 331, 332 and 333 are the colors of the cursor (mouse), not the entity color.


When you use the 'entity' statement, the entity properties are usually in the 90's, but I guess the color properties came along later. They are in the 290's...
Code: [Select]
if sys(80)<>0 then
getselect sys(80), selected
entity selected
if sys(290) = 0 and sys(291) = 0 and sys(292) = 255 then      'if blue...
MESSAGE "Entity found"
else
MESSAGE "Entity not found"           ' this is not necessary but without it the macro would do nothing if the entity is not blue...
endif
endif


Note: when I copied your code and pasted into Notepad the spaces at the start of each were causing errors so I had to get rid of them.


Lar



« Last Edit: October 17, 2017, 05:24:28 AM by Lar »