Author Topic: Simple add text  (Read 9227 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Simple add text
« Reply #15 on: January 09, 2007, 08:34:42 PM »
.... - also, remember that Glenn mentioned that if it is wrap inside a using the transaction, there were no need of the lock doc?... or I am dreaming? ...

That doesn't sound correct Luis

perhaps you mean it doesn't need disposing if it's wrapped in a using statement < As per my example > 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: Simple add text
« Reply #16 on: January 09, 2007, 09:24:07 PM »
Kerry;
.... anyway, I think Mark has something that is working now :)...Cheers!

Not working.
I tried moving the procedure code out of my form class to regular class. No text.
 :?

I think it might have something to do with where I'm calling the code from. In my case it's a modal dialog.


Can you run the command as-is.... without seeing the other code, is not easy to make a full test.

LE

  • Guest
Re: Simple add text
« Reply #17 on: January 09, 2007, 09:25:59 PM »
.... - also, remember that Glenn mentioned that if it is wrap inside a using the transaction, there were no need of the lock doc?... or I am dreaming? ...

That doesn't sound correct Luis

perhaps you mean it doesn't need disposing if it's wrapped in a using statement < As per my example > 

It's all right, was an old comment, and do not recall exactly (my age)... :)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Simple add text
« Reply #18 on: January 09, 2007, 09:28:50 PM »
............ and do not recall exactly (my age)... :)

Thats the excuse I use too ... it [ the excuse ] works most of the time :lol:
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Simple add text
« Reply #19 on: January 10, 2007, 09:48:54 AM »
Kerry and Luis,

I did indeed say that you do in fact, as Kerry pointed out, wrap the locking of a document in a using ONLY if the command is being run in the DOCUMENT EXECUTION CONTEXT...if not, AutoCAD handles the locking implicitly for you and you don't need to lock (eg. modeless dialog you would need to lock).

Mark,

It sounds like you need to construct a new Database, then use Database.ReadDwg to read your dwg file into the newly created dbase, run your add text mojo on it, save it, then dispose of the dbase as you NEW'ed it in the first place. You should be able to do this from a modal dialog as well.

Note that the method I just described will do your mojo 'in memory' and you will not see the dwg in the editor. Make sure to add DataBase.RetainOriginalThumbnailBitmap = true to keep the thumbnail as Tim pointed out.

The problem with your original code is that DocumentManager.Open is ASYNCHRONOUS - which means the line of code to open the dwg will execute, but then the program will continue blissfully on, WITHOUT waiting for your dwg to finish opening.

Hope this helps.

Cheers from London,
Glenn.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Simple add text
« Reply #20 on: January 10, 2007, 05:53:02 PM »
Thanks Glenn,
The ASYNCHRONOUS hint helped me understand.
I went back to my orginal code with some minor modifications and things are working now.

Thanks everyone else who contributed.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions