Author Topic: C# regen single object, not the whole drawing .. possible??  (Read 3365 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
C# regen single object, not the whole drawing .. possible??
« on: March 20, 2020, 11:57:53 PM »
I vaguely remember that in Lisp or maybe VBA you could regen/refresh or update a single object in the drawing window, but I have not found a similar method in C#. Of course, maybe I am just missing it or my brain is not working right anymore.

The issue is that with the latest programming project, the drawings tend to be very big and take quite a long time to regen completely. I'd like to simply update the objects I am modifying programmatically instead of calling acDoc.Editor.Regen() every few changes just to keep the window relevant and accurate.

Ideas?
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: C# regen single object, not the whole drawing .. possible??
« Reply #1 on: March 21, 2020, 01:44:44 AM »
Maybe .recordgraphicmodified()?

huiz

  • Swamp Rat
  • Posts: 913
  • Certified Prof C3D
Re: C# regen single object, not the whole drawing .. possible??
« Reply #2 on: March 22, 2020, 06:09:44 AM »
If you only need to update the screen to show some visual progress, you don't need REGEN but REDRAW:


Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen()
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: C# regen single object, not the whole drawing .. possible??
« Reply #3 on: March 22, 2020, 08:18:50 AM »
Hi,

Did you try the Entity.Draw() method?
Speaking English as a French Frog

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: C# regen single object, not the whole drawing .. possible??
« Reply #4 on: March 23, 2020, 02:11:23 PM »
Ok,

Draw() doesn't update the object on the screen until something else causes the screen to be invalidated like a mouse move or pan, but it's not the worst case scenario;
UpdateScreen() updates the screen as needed and it seems to be faster than a full regen, although I'll have to test to see what kind of performance boost I can expect on my test machine.
RecordGraphicsModified(t/f) is a new one that I had not used previously, although it appears to have the same drawbacks as Draw() in that it doesn't actually update the screen.

I'll have to examine each one of these in a test case and see what kind of performance improvement I can get. I'm thinking that RecordGraphicsModified is a perhaps building a queue for Draw() in which case I can do that manually, but UpdateScreen() doesn't differentiate between updated and non-updated objects.

I am modifying hundreds of blocks, each with the potential for between 24 and 128 attributes, and that isn't counting the other stuff in the drawing.

Anyway, those are great suggestions and are certainly leaps and bounds better than doc.Editor.Regen()!! Thanks!
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

twdotson

  • Mosquito
  • Posts: 17
Re: C# regen single object, not the whole drawing .. possible??
« Reply #5 on: March 24, 2020, 09:04:06 AM »
Going from memory, I believe this regenerated a single entity.

Entity.Visible = False
Entity.Visible = True

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: C# regen single object, not the whole drawing .. possible??
« Reply #6 on: March 24, 2020, 10:14:59 AM »
Going from memory, I believe this regenerated a single entity.

Entity.Visible = False
Entity.Visible = True

I may give that a shot and see if it works, and if it does, if it improves the performance.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8661
  • AKA Daniel
Re: C# regen single object, not the whole drawing .. possible??
« Reply #7 on: March 25, 2020, 08:39:01 AM »

How about using a document transaction and FlushGraphics();? maybe RecordGraphicsModified(true) would be needed too

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: C# regen single object, not the whole drawing .. possible??
« Reply #8 on: March 25, 2020, 04:59:12 PM »

How about using a document transaction and FlushGraphics();? maybe RecordGraphicsModified(true) would be needed too

Perhaps, overhead may be a little much on FlushGraphics()

I know that once upon a time this was done in ADS but I don't want to go about mixing a bunch of code and introducing problems.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie