TheSwamp

Code Red => .NET => Topic started by: JohnSnow on August 02, 2023, 08:27:45 PM

Title: Rotating the view becomes very slow due to transient texts
Post by: JohnSnow on August 02, 2023, 08:27:45 PM
Hi,
I have this code to generate transient texts. it is working but when I rotate the view in 3D. It gets very slow to finalise the view. I have replaced texts with circles and rotating is very smooth. Any chances that I can improve the performance for texts?
 

Code: [Select]
[CommandMethod("Test500")]
        public void Test500()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            using (Transaction transaction = doc.TransactionManager.StartTransaction())
            {
                for (int i = 0; i < 500; i++)
                {
                    MText acText = new MText();
                    acText.SetDatabaseDefaults();
                    acText.Contents = "Test";
                    acText.TextHeight = 0.5;
                    acText.Location = new Point3d(i, i, 0);
                    aGi.TransientManager.CurrentTransientManager.AddTransient(acText, aGi.TransientDrawingMode.Main, 128, new IntegerCollection());
                }
                transaction.Commit();
            }
        }
Title: Re: Rotating the view becomes very slow due to transient texts
Post by: Atook on August 02, 2023, 10:41:20 PM
I know nothin' JohnSnow, but does an SHX font instead of a TTF font help?
Title: Re: Rotating the view becomes very slow due to transient texts
Post by: kdub_nz on August 02, 2023, 11:50:22 PM
For transient texts, isn't 500 objects an unreasonably high quantity ??
Title: Re: Rotating the view becomes very slow due to transient texts
Post by: JohnSnow on August 02, 2023, 11:57:05 PM
I just tried shx and it does help! Thank you Atook.
@kdub_nz, that 500 is just for testing purposes.