Author Topic: Delete entity  (Read 191 times)

deydope

  • Newbie
  • *
  • Posts: 10
Delete entity
« on: October 06, 2017, 12:43:50 AM »
Hi,

I just would you to ask if is there a way to delete an entity selected with the entity statement.

Actually i do this:

entity i
pointval entx enty entz 1
>PointSelect
{
    <PointXYZ [entx, enty, entz]
   <Type 0
}
>SelectDelete
{
}

But sometimes, two or more entity are in the same position and it doesn't delete the right entity.

Thanks for the help  :)

bdeck

  • Hero Member
  • *****
  • Posts: 827
Re: Delete entity
« Reply #1 on: October 06, 2017, 10:56:59 PM »
deydope,

I had a somewhat similar question years ago, and Lar helped out by pointing me to the (then new) query and change commands.

If you know which entity you want to delete, then this will work:

Alias ENT_SELECTED  &H010C
>deselect
{
}
entity i
change Ent_Selected, 1
update
>erase
{
}
« Last Edit: October 07, 2017, 11:02:20 AM by bdeck »

Lar

  • Hero Member
  • *****
  • Posts: 2633
Re: Delete entity
« Reply #2 on: October 07, 2017, 10:23:46 PM »

Deydope, once you use the entity statements you don't have to set a point to select it. Just tell dcad to select that entity. You can do this the way bdeck just explained, using query and change, or the long winded Getattr and Putattr statements.


Lar

bdeck

  • Hero Member
  • *****
  • Posts: 827
Re: Delete entity
« Reply #3 on: October 09, 2017, 09:51:31 PM »
Code: [Select]
>deselect
{
}
GETATTR i, t
PUTATTR i, t, 1
>erase
{
}

Lar,
Longwinded indeed.  ;D 

deydope,
I've been using query and change for so long that I ALSO had forgotten that the entity statement could be used with the pointval statement in that manner you describe. Not useful in this instance, but pointval as you used it is a valid alternative to query ent_point.

However, a nice thing about the query/change parameters is that they are all organized in the SDK under: "query and change parameters" for easy reference.

Thanks Lar and deydope for the refresher.
bd

deydope

  • Newbie
  • *
  • Posts: 10
Re: Delete entity
« Reply #4 on: October 11, 2017, 02:42:38 AM »
thank you so much for your answers, my problem is now resolved!