.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lots of transient graphics hang orbit

11 REPLIES 11
Reply
Message 1 of 12
JamesMaeding
1097 Views, 11 Replies

Lots of transient graphics hang orbit

I have a tin surface with 16,000 triangles, and am displaying the edges as transients of 3d lines.

I get about 26,000 of those for the 16k triangles.

Yes, I did weed duplicates of adjacent triangle edges, so cannot reduct eth edge count.

 

When I orbit, it hangs for about 10x longer than if those edges were real entities.

Its like 15 seconds before I can drag the view a bit.

 

Why would transients be causing such a slowdown compared to real entities?

 

my code for making the transient is very boring:

ln = new Line(pts[i], pts[i + 1]);
ln.SetDatabaseDefaults();

 I add that line to transientmanager:

tm.AddTransient(trEnt.Entity, TransientDrawingMode.DirectShortTerm, 0, trEnt.ViewportNumbers);

 I have a wrapper object I call trEnt that I use but its properties feed the right values in.

 

Does the fact that that I used DirectShortTerm have any effect?

What should I be using for better performance?

 

I do want to see the items in orbit, not erase them and redraw after.

 

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

11 REPLIES 11
Message 2 of 12
moogalm
in reply to: JamesMaeding

Hi ,

 

Can you share a sample project to demonstrate said behavior , meanwhile you can try Highlight as transient drawing mode at your end ,check if that change anything.

 

Thank you!

Message 3 of 12
JamesMaeding
in reply to: moogalm

something like:

 

[CommandMethod("TTR2")]
    public void TestTransGraphics2() {
      TransientManager tm = TransientManager.CurrentTransientManager;
      double y = 0.0;
      for (int i = 0; i < 500000; i++) {
        AcDb.Line ln = new AcDb.Line(new Point3d(0.0, y, 0.0), new Point3d(5.0, y, 0.0));
        transients.Add(ln);
        tm.AddTransient(ln, TransientDrawingMode.Main, 128, new IntegerCollection());
        y = y + 1.0;
      }
    }

 

then to get rid of:

 

[CommandMethod("TTRR1")]
    public void TestRemoveTransGraphics() {
      TransientManager tm = TransientManager.CurrentTransientManager;
      tm.EraseTransients(TransientDrawingMode.Main, 128, new IntegerCollection());
      //for (int i = 0; i < transients.Count; i++) {
      //    Entity ent = transients[i];
      //    tm.EraseTransients(TransientDrawingMode.DirectShortTerm, 0, new IntegerCollection());
      //    ent.Dispose();
      //    ent = null;
      //}
    }

 you can see the commented out portion that would do things one by one. I tried both and both are pretty slow.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 4 of 12
moogalm
in reply to: JamesMaeding

Hi ,

 

I don't see any performance down in the application , I've tested with the following code on ACAD 2015-SP2 ,WIN7X64,16GB RAM, can you let me know you system configuration , just to check whether system config has any impact.

 

DBObjectCollection _markers = null;
       [CommandMethod("TTRC")] 
       public void ClearTransientGraphics()
       {
           TransientManager tm = TransientManager.CurrentTransientManager;
           IntegerCollection intCol = new IntegerCollection();
           tm.EraseTransients(TransientDrawingMode.DirectShortTerm, 128, intCol);
                 
       }
       [CommandMethod("TTR2")]
       public void TestTransGraphics2()
       {
           TransientManager tm = TransientManager.CurrentTransientManager;
           double y = 0.0;
           _markers = new DBObjectCollection();
           for (int i = 0; i < 500000; i++)
           {
               Line ln = new Line(new Point3d(0.0, y, 0.0), new Point3d(5.0, y, 0.0));
               _markers.Add(ln);
               tm.AddTransient(ln, TransientDrawingMode.DirectShortTerm, 128, new IntegerCollection());
               y = y + 1.0;
           }
       }

 

Message 5 of 12
JamesMaeding
in reply to: moogalm

those specs are similar to mine. I have a Dell Precision 6800 laptop, so its better hardware than the average cad user for my office at least.

 

Can you comment on how long it takes to:

display the transients

erase the transients

actually drag the view once you run orbit command - there is always some regen-like delay.

 

I'll do the same. I'm very happy to hear you are not seeing the lockups, love it when I'm the problem not the software 🙂


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 6 of 12
JamesMaeding
in reply to: moogalm

So I ran a few tests in vanilla acad 2015, sp2. I am finding for acad:

2 seconds to display 50k transients - uses 600k ram

2 seconds to delete - does not release the 600k ram. Each time I display the transients it goes up 600k.

locks on orbit no matter what, CPU is at 13%, and memory jumps to about 1gb

 

are you saying command "orbit" does not lock you up? How much memory did it use by the time you could drag the cursor?

 

Interestingly, if I make real lines (using only one transaction...) instead of transients, it takes:

4 seconds to draw lines

orbit takes forever or locks on them also, cpu goes to 10% and memory jumps to 13gb! wow, never seen that before.

 

So just trying to understand if you see anything like me for orbit.

 

oddly enough, in bricscad, the display time of transients is almost the same, and orbit is instant. Erasing the transients locks it up.

another odd thing is you can zoom extents with bricscad transients, acad ignores them.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 7 of 12
JamesMaeding
in reply to: JamesMaeding

that memory increase of 600k each time I run was because

tm.EraseTransients does not dispose of the ent.

after tm.EraseTransients I did:

 

for (int i = 0; i < transients.Count; i++) {
 Entity ent = transients[i];
 //netload tm.EraseTransients(TransientDrawingMode.DirectShortTerm, 0, new IntegerCollection());
 ent.Dispose();
 ent = null;
}

 

and that increasing emory issue goes away.

It does not affect the orbit issue, which is the main thing I care about.

 

I guess a fundamental question is if transients are lighter weight than drawn entities, for the display. I can't tell since orbit lock on a lot of them.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 8 of 12
moogalm
in reply to: JamesMaeding

I completely focussed on generation of transients consuming time , and missed the orbit part. Sorry about that I can repro and performance down.

Let me do few more tests and will get back to you.

 

Thanks for your patience.

Message 9 of 12
moogalm
in reply to: moogalm

I have tested using C++ API , at least application doesn't hang there, however there is bit performance lag between DB entities and transients.

 

Using .NET API ,I can reproduce the behavior , I will check with engineering colleagues about this.

 

Meanwhile can you try using C++ code and let me know .

 /*global*/
static AcArray<int> viewportNumbers;
static AcArray<AcDbEntity*> _markers;


static void ClearTransientGraphics()
 {
    AcGiTransientManager* pTransientManager = acgiGetTransientManager();
    int numOfMarkers = _markers.length();
    if (numOfMarkers > 0)
    {
        for(int index = 0; index < numOfMarkers; index++)
        {
            AcDbEntity *pMarker = _markers.at(index);
            pTransientManager->eraseTransient(
            pMarker,
            viewportNumbers
            );
            delete pMarker;
        }
        _markers.removeAll();
    }
}

 static void ADSKMyGroupTTest()
 {
	
	 AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
	 AcGiTransientManager* pTransientManager = acgiGetTransientManager();
	 ClearTransientGraphics();
	 viewportNumbers.removeAll();

	 struct resbuf res;
	 acedGetVar(L"CVPORT", &res);
	 viewportNumbers.append(res.resval.rint);
	 double y = 0.00;
	 for(int i=0; i < 5000; ++i)
	 {
		 AcDbLine* marker = new AcDbLine(AcGePoint3d(0.0,y,0.0),AcGePoint3d(5.0,y,0.0));
		 pTransientManager->addTransient(marker,kAcGiDirectShortTerm,128,viewportNumbers);
		 _markers.append(marker);
		 y= y+1.0;
	 }
 }

 static void ADSKMyGroupDTest()
 {
	 AcDbDatabase *pDb = acdbHostApplicationServices()->workingDatabase();
	 double y = 0.00;
	 for(int i=0; i < 50000; ++i)
	 {
		 AcDbLine* marker = new AcDbLine(AcGePoint3d(50.0,y,0.0),AcGePoint3d(55.0,y,0.0));
		 marker->setColorIndex(3);
		if(appendEntity(pDb,marker)!= Acad::eOk)
		delete marker;
		else
		marker->close();
		y= y+1.0;
	 }

 }

 

 

I have attached a video , in the video the entities in green are DB entities which behaves correctly ,transients also do with low performance ,however there no lock up when executing 3DORBIT

DemoVideo

Message 10 of 12
moogalm
in reply to: moogalm

I'm terrible and sorry ,

 

Scratch my previous post , in both C++ and .NET I can reproduce the problem, I've sent a mail across engineering team for insights.

But with DB entites application doesn't hang \or lock up while executing 3DORBIT.

Message 11 of 12
JamesMaeding
in reply to: moogalm

ahh, glad you are seeing it too, but wish it was just me 🙂

I'd like to figure this out, so lets keep on it.

 

I also do not get lockups with real drawn entities, but man its slow. I tweaked hardware accelleration and settings with no luck.

 

The interesting thing is whatever method the civil3d team uses to show tin surface triangle edges, its fast.

I am actually doing the same thing - writing tools that deal with triangles so showing lots of them is useful.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 12 of 12

Hello,
do you have a solution to solve the problem ?
I have a similar case : 80000 transients (AcDbSolid*) to display areas in the drawing.
And deleting the allocated pointers (used by transients) is VERY slow (C++ & ObjectARX)
Thank you.

Olivier BERRIER
www.geo-media.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost