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

how to visual the entity before 'trans.commit?'

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
swaywood
776 Views, 4 Replies

how to visual the entity before 'trans.commit?'

Hi,all:

I just want to add some entities to the currentspace, I want they can be added visually, that means i want to added it before the trans commit.

can all these entities be added in one transaction?

best regards.

swaywood

4 REPLIES 4
Message 2 of 5
Hallex
in reply to: swaywood

I often use this way:

   Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            doc.TransactionManager.EnableGraphicsFlush(true);
            Point3dCollection pts= ...;
            using (Transaction tr = doc.TransactionManager.StartTransaction())
            {
                BlockTableRecord btr =
                    (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                foreach (Point3d pt in pts)
                {
                DBText txt= new DBText();
               txt.Position=pt;
               // some other options for text
                    btr.AppendEntity(txt);
                    tr.AddNewlyCreatedDBObject(txt,true);
               tr.TransactionManager.QueueForGraphicsFlush();// add this line after every object is added
                }
                doc.TransactionManager.FlushGraphics();// add this before of commiting a transaction
                tr.Commit();
            
            }

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 5
_gile
in reply to: swaywood

Hi,

 

Have a look at TransactionManager.QueueForGraphicFlush() method.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 5
cdinten
in reply to: Hallex

Excellent! this works fine, but could name a few occasions that using in this way? i am just curious about, it look quite similar to JIG
Message 5 of 5
SENL1362
in reply to: Hallex

Hallex,
recently i needed this text methode(text.AdjustAlignment(db), after changing the alignment type and position to get the text shown at the new position.



This is my total list of all "update" functions:
doc.TransactionManager.QueueForGraphicsFlush();
ed.Regen();
Application.Update;
Application.UpdateScreen();
pvp.UpdateDisplay();
db.UpdateExt(true);
(attRef|Text).AdjustAlignment(db);
(MTEXT)AttributeReference.UpdateMTextAttribute
blr.RecordGraphicsModified(true);


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