Poll

How to remove a entity from a block?

How to remove a entity from a block?
1 (50%)
Dear all,
1 (50%)

Total Members Voted: 1

Author Topic: How to remove a entity from a block?  (Read 2227 times)

0 Members and 1 Guest are viewing this topic.

taner

  • Guest
How to remove a entity from a block?
« on: April 30, 2009, 01:34:48 AM »
Dear all,

Just like the subject described.

Thanks in advance.
« Last Edit: April 30, 2009, 01:39:48 AM by taner »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to remove a entity from a block?
« Reply #1 on: April 30, 2009, 02:06:44 AM »
Iterate the block's collection (vlax-for object block_collection) and remove the offending objects (vla-delete object).

Wutz up with the poll?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

taner

  • Guest
Re: How to remove a entity from a block?
« Reply #2 on: April 30, 2009, 02:39:30 AM »
Iterate the block's collection (vlax-for object block_collection) and remove the offending objects (vla-delete object).

Wutz up with the poll?

I am wondering how the poll happened!

Can you write a Function for me! I do not understand clearly. Tks!

Patrick_35

  • Guest
Re: How to remove a entity from a block?
« Reply #3 on: April 30, 2009, 04:25:18 AM »
hi

Try this

Code: [Select]
(and (setq sel (nentsel))
(setq sel (vlax-ename->vla-object (car sel)))
(vla-delete sel)
)

and regen

@+

taner

  • Guest
Re: How to remove a entity from a block?
« Reply #4 on: April 30, 2009, 11:26:13 AM »
I find below codes written by someone else just now. It is just I am looking for.

Code: [Select]
;; Deletes the specified subentity from its block definition
;;; Arguments: the entity name of an item within a block reference
;;; Returns: the remaining item count of the block definition
;;; The drawing must be regenerated for the change to become visible
(defun ax:DeleteObjectFromBlock (ent / doc blk)
  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
ent (vlax-ename->vla-object ent)
blk (vla-ObjectIdToObject doc (vla-get-OwnerID ent))
  )
  (vla-Delete ent)
  (vla-get-Count blk)
)

Patrick_35

  • Guest
Re: How to remove a entity from a block?
« Reply #5 on: April 30, 2009, 11:50:26 AM »
it is the same as what I wrote  :?

@+

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to remove a entity from a block?
« Reply #6 on: April 30, 2009, 11:56:56 AM »
it is the same as what I wrote  :?

@+

And the same as a util I have in my lib (DeleteX) written back AC2000+/- (tho mine protects from locked layers et al).
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to remove a entity from a block?
« Reply #7 on: April 30, 2009, 12:03:12 PM »
You might be able to use the code in this thread.

[ http://www.theswamp.org/index.php?topic=27786.0 ]
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.