.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Even after much searching and asking for help, I have not come to a solution for creating DBTEXT elements within a BackgroundWorker, this element has problem with the alignment point. So there is an example ZIP to anyone who can help, just run the command and check the elements created, you will see that I'm creating the element with the point in alinahmento MIDLECENTER but the result is not correct.
I am creating other elements in the same way and they had no problems (MTEXT, POLYLINE, CIRCLE, SPLINE, LINE, etc. ..), they are correct, but the element and the element DBTEXT block that contains attributes present problems in the alignment points.
Solved! Go to Solution.
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
OK I understand, I should create the elements in a single transaction block, perfect, but it does not change the fact that when creating the element within DBTEXT a Background Worker and the alignment point set to MIDLECENTER results in the element with the point of hanging indent. I am using Background Worker to perform this process because there is much information and without the Background Worker AutoCAD indicates NOTRESPONDING and we have no idea that while the process is.
See this attachment to get an idea of the problem, and thank you.
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am using BackgroundWorker because we have thousands of elements to be created in the example represents the element DBTEXT a lot in a court in one state, I am reading data from an xml and caring for autocad, but this process is resulting in NOTRESPONDING, we know that yet the process is running, but we have no idea of progress, so I decided to use BackgroundWorker that worked well until you create the element and DBTEXT BLOCK, gave error in alignment point. Thank you for help!
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
One suggestion I have is to look into the DBText.AdjustAlignment() method. There's some information about this one in the ObjectARX docs.
I tried to call this within your NewDBText() function but it had no effect. However after running your tool, I iterated model space and called the DBText.AdjustAlignment() method on all of the created DBText entities and this corrected the alignments. Below is the command I used to do this in C#.
Is it possible for you to update the aligments seperately after your worker thread has finished adding DBText entities?
[CommandMethod("DBTextUpdateAlignments")]
public static void DBTextUpdateAlignments()
{
Document doc = AcApplication.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(SymbolUtilityServic es.GetBlockModelSpaceId(db), OpenMode.ForRead);
foreach (ObjectId id in btr)
{
DBText text = tr.GetObject(id, OpenMode.ForRead) as DBText;
if (text != null)
{
text.UpgradeOpen();
text.AdjustAlignment(db);
}
}
tr.Commit();
}
}
Re: Create DBTEXT element in Background Worker vb .net?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thank you, I will apply this solution to the project, I am very grateful for the attention and time wasted! I'll soon be posting the results!
Solved Background Worker X
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Greetings Artvegas, I applied the solution you pointed out using the method (AdjustAlignment), it worked perfectly if executed after completion of the process BackgroundWorker. Unfortunately the same method does not result if used within the process BackgroundWorker, but even being used after the process was fast and solved my problems, so I would like to thank for helping OK.
Re: Solved Background Worker X
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Solved Background Worker X
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I understand, using the objects rendered in a ObjectIdCollection I could make adjustments more quickly this?



