Author Topic: Block insertion from other drawing  (Read 10558 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #15 on: August 30, 2010, 01:48:45 PM »
Tim, would you know of a way to check whether an Undo is 'open-ended' before calling StartUndoMark to start another?

Or, is it OK to call EndUndoMark first in all cases?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Block insertion from other drawing
« Reply #16 on: August 30, 2010, 01:51:24 PM »
Lee,

You might want to use ' InsertBlock ' method instead of entmake.  With entmake, you would have to entmake all the attributes, and other sub-entities of the block, but with InsertBlock you don't.
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Block insertion from other drawing
« Reply #17 on: August 30, 2010, 01:52:24 PM »
Tim, would you know of a way to check whether an Undo is 'open-ended' before calling StartUndoMark to start another?

Or, is it OK to call EndUndoMark first in all cases?

I just end them.  I haven't ever ran into issues with just ending them, so I have not looked into a way to count them, but I would think there should be a way.

Edit:  Look in the help at the system variable ' UndoCtl '.  It looks like what you want.
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #18 on: August 30, 2010, 01:56:22 PM »
Tim, would you know of a way to check whether an Undo is 'open-ended' before calling StartUndoMark to start another?

Or, is it OK to call EndUndoMark first in all cases?

I just end them.  I haven't ever ran into issues with just ending them, so I have not looked into a way to count them, but I would think there should be a way.

Edit:  Look in the help at the system variable ' UndoCtl '.  It looks like what you want.

Thanks mate - will investigate.  :-)

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #19 on: August 30, 2010, 01:56:47 PM »
You might want to use ' InsertBlock ' method instead of entmake.  With entmake, you would have to entmake all the attributes, and other sub-entities of the block, but with InsertBlock you don't.

Very good point - I had overlooked that. Will update the code momentarily.  :-)

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #20 on: August 30, 2010, 02:04:38 PM »
Code updated as per Tim's suggestion.  :-)

Many thanks Tim for your time perusing the code.  :-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Block insertion from other drawing
« Reply #21 on: August 30, 2010, 02:13:57 PM »
Code updated as per Tim's suggestion.  :-)

Many thanks Tim for your time perusing the code.  :-)

You're welcome.
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #22 on: August 30, 2010, 02:16:30 PM »
Perhaps something like this Tim:

Code: [Select]
(and (= 8 (logand 8 (getvar 'UNDOCTL)))
     (vla-EndUndoMark <doc>)
)

(vla-StartUndoMark <doc>)

...

(vla-EndUndoMark <doc>)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Block insertion from other drawing
« Reply #23 on: August 30, 2010, 02:41:37 PM »
That should work, as it seems like you can only have one group going at a time.  I tried to open more than one group, but once I ended the group, the bit code 8 was gone.

Edit: No need to do an ' and ' though, as just an ' if ' would work, as the second part will always return nil.  Not that it matters though.
Tim

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

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #24 on: August 30, 2010, 02:46:01 PM »
Edit: No need to do an ' and ' though, as just an ' if ' would work, as the second part will always return nil.  Not that it matters though.

I agree - an IF would be better programming

*prays Se7en doesn't stumble across earlier post using AND*

ozimad

  • Guest
Re: Block insertion from other drawing
« Reply #25 on: August 31, 2010, 02:43:55 PM »
everyone thanks a lot! for undo block, this is really the solution i need in all my lisps.
I think it would be nice to have CABs break routine with such block, to undo all the breakings by one key press.

Lee Mac

  • Seagull
  • Posts: 12916
  • London, England
Re: Block insertion from other drawing
« Reply #26 on: August 31, 2010, 03:19:56 PM »
You're very welcome Ozimad, I enjoyed this thread  :-)