.NET

Reply
*Carlos
Message 1 of 9 (346 Views)

What's the best way to refresh the drawing after adding blocks?

346 Views, 8 Replies
08-23-2005 12:26 PM
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish this from .NET?

Thanks so much for any help.
-Carlos
*Tony Tanzillo
Message 2 of 9 (342 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-23-2005 03:01 PM in reply to: *Carlos
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish this from .NET?

Thanks so much for any help.
-Carlos
*Carlos
Message 3 of 9 (339 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-23-2005 04:07 PM in reply to: *Carlos
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =
db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish this from .NET?

Thanks so much for any help.
-Carlos
*Tony Tanzillo
Message 4 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-23-2005 04:28 PM in reply to: *Carlos
There are two of them:

Autodesk.AutoCAD.ApplicationServices.TransactionManager
Autodesk.AutoCAD.DatabaseServices.TransactionManager

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message news:4936807@discussion.autodesk.com...
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =
db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish this from .NET?

Thanks so much for any help.
-Carlos
*Carlos
Message 5 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-23-2005 05:22 PM in reply to: *Carlos
Thanks very much for your help so far, but FlushGraphics doesn't seem to be
doing the trick. Am I calling it incorrectly? My code is attached in a
text file.

I've noticed that the PAN command seems to be the only thing that will make
things work (as opposed to what I thought earlier). If I insert the blocks
from C# and then type Redrawall, Regenall, or Zoom 1x, the last block that
was inserted remains invisible until I pan. If I move my mouse over the
block, a dotted outline appears, but the block does not remain visible until
I pan.

Any other ideas?

Thanks again.
-Carlos


"Tony Tanzillo" wrote in message
news:4936836@discussion.autodesk.com...
There are two of them:

Autodesk.AutoCAD.ApplicationServices.TransactionManager
Autodesk.AutoCAD.DatabaseServices.TransactionManager

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936807@discussion.autodesk.com...
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =
db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish this from .NET?

Thanks so much for any help.
-Carlos
*Tony Tanzillo
Message 6 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-23-2005 06:50 PM in reply to: *Carlos
Since you're doing this in a modal command handler,
there should be no problem like this.

You're not showing the whole picture, so can you
confirm that the code that creates the new entities
calsl AddNewlyCreatedDBObject() ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message news:4936876@discussion.autodesk.com...
Thanks very much for your help so far, but FlushGraphics doesn't seem to be
doing the trick. Am I calling it incorrectly? My code is attached in a
text file.

I've noticed that the PAN command seems to be the only thing that will make
things work (as opposed to what I thought earlier). If I insert the blocks
from C# and then type Redrawall, Regenall, or Zoom 1x, the last block that
was inserted remains invisible until I pan. If I move my mouse over the
block, a do
tted outline appears, but the block does not remain visible until
I pan.

Any other ideas?

Thanks again.
-Carlos


"Tony Tanzillo" wrote in message
news:4936836@discussion.autodesk.com...
There are two of them:

Autodesk.AutoCAD.ApplicationServices.TransactionManager
Autodesk.AutoCAD.DatabaseServices.TransactionManager

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" <
carlos at sensametrics dot com> wrote in message
news:4936807@discussion.autodesk.com...
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =

db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.cadd
zone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish thi
s from .NET?

Thanks so much for any help.
-Carlos
*Carlos
Message 7 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-24-2005 12:05 PM in reply to: *Carlos
I'm fairly sure the call to AddNewlyCreatedDBObject is working, but I've
attached the code for actually inserting the blocks into AutoCAD just in
case.

I've tried all sorts of stuff. Can you see the problem?

Thanks,
Carlos

"Tony Tanzillo" wrote in message
news:4936905@discussion.autodesk.com...
Since you're doing this in a modal command handler,
there should be no problem like this.

You're not showing the whole picture, so can you
confirm that the code that creates the new entities
calsl AddNewlyCreatedDBObject() ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936876@discussion.autodesk.com...
Thanks very much for your help so far, but FlushGraphics doesn't seem to be
doing the trick. Am I calling it incorrectly? My code is attached in a
text file.

I've noticed that the PAN command seems to be the only thing that will make
things work (as opposed to what I thought earlier). If I insert the blocks
from C# and then type Redrawall, Regenall, or Zoom 1x, the last block that
was inserted remains invisible until I pan. If I move my mouse over the
block, a do
tted outline appears, but the block does not remain visible until
I pan.

Any other ideas?

Thanks again.
-Carlos


"Tony Tanzillo" wrote in message
news:4936836@discussion.autodesk.com...
There are two of them:

Autodesk.AutoCAD.ApplicationServices.TransactionManager
Autodesk.AutoCAD.DatabaseServices.TransactionManager

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" <
carlos at sensametrics dot com> wrote in message
news:4936807@discussion.autodesk.com...
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =

db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.cadd
zone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish thi
s from .NET?

Thanks so much for any help.
-Carlos
*Carlos
Message 8 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

08-24-2005 12:16 PM in reply to: *Carlos
As a side note,

I've never had to use the call to db.ReadDwgFile() because the condition
(bt.Has("Sensing Unit")) has always been met. I've had some issues with
that call anyway, so that is why it's commented out.

-Carlos


"Tony Tanzillo" wrote in message
news:4936905@discussion.autodesk.com...
Since you're doing this in a modal command handler,
there should be no problem like this.

You're not showing the whole picture, so can you
confirm that the code that creates the new entities
calsl AddNewlyCreatedDBObject() ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936876@discussion.autodesk.com...
Thanks very much for your help so far, but FlushGraphics doesn't seem to be
doing the trick. Am I calling it incorrectly? My code is attached in a
text file.

I've noticed that the PAN command seems to be the only thing that will make
things work (as opposed to what I thought earlier). If I insert the blocks
from C# and then type Redrawall, Regenall, or Zoom 1x, the last block that
was inserted remains invisible until I pan. If I move my mouse over the
block, a do
tted outline appears, but the block does not remain visible until
I pan.

Any other ideas?

Thanks again.
-Carlos


"Tony Tanzillo" wrote in message
news:4936836@discussion.autodesk.com...
There are two of them:

Autodesk.AutoCAD.ApplicationServices.TransactionManager
Autodesk.AutoCAD.DatabaseServices.TransactionManager

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" <
carlos at sensametrics dot com> wrote in message
news:4936807@discussion.autodesk.com...
That sounds like what I want, but for some reason FlushGraphics is not
listed as a method of TransactionManager. I see QueueForGraphicsFlush, but
not FlushGraphics. How is that method used?

Here's my code:

Database db=Application.DocumentManager.MdiActiveDocument.Database;
Autodesk.AutoCAD.DatabaseServices.TransactionManager TM =

db.TransactionManager;
Transaction trans = TM.StartTransaction();

try
{
<<>>
trans.Commit();
}
catch
{
}
finally
{
trans.Dispose();
TM.FlushGraphics(); ???
Autodesk.AutoCAD.DatabaseServices.TransactionManager.FlushGraphics?
}





"Tony Tanzillo" wrote in message
news:4936774@discussion.autodesk.com...
Have you tried calling TransactionManager.FlushGraphics ?

--
http://www.cadd
zone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Carlos" wrote in message
news:4936528@discussion.autodesk.com...
Hi,

I've got some C# code (VS 2003 and AutoCAD 2006) that adds some blocks to a
drawing. It works, but the blocks are initially invisible. I have to pan
or zoom (or do anything, as far as I know) for them to appear.

I'd like to try calling the Zoom command with a scale of 1x. How do I
accomplish thi
s from .NET?

Thanks so much for any help.
-Carlos
New Member
phol
Posts: 2
Registered: ‎11-17-2005
Message 9 of 9 (340 Views)

Re: What's the best way to refresh the drawing after adding blocks?

11-17-2005 07:19 PM in reply to: *Carlos
Hi,

Did you already try to use this:
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen();

Pedro Henrique Liberato, sorry the 'little' delay and the poor English :-)

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community