<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C# Sortents in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665460#M23439</link>
    <description>Look at your code.&lt;BR /&gt;
&lt;BR /&gt;
You're trying to open a BlockTableRecord as &lt;BR /&gt;
a DrawOrderTable.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5198186@discussion.autodesk.com...&lt;BR /&gt;
Ok, I am stuck again.&lt;BR /&gt;
I am trying to get the DrawOrderTable and this is what I have done&lt;BR /&gt;
&lt;BR /&gt;
DrawOrderTable dot;&lt;BR /&gt;
Transaction trans;&lt;BR /&gt;
trans=HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction();&lt;BR /&gt;
dot=(DrawOrderTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId,OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
When I run this I get the following error:&lt;BR /&gt;
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.InvalidCastException: Unable to cast object of type 'Autodesk.AutoCAD.DatabaseServices.BlockTable' to type 'Autodesk.AutoCAD.DatabaseServices.DrawOrderTable'.&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong?&lt;/TECHNO&gt;</description>
    <pubDate>Wed, 07 Jun 2006 22:27:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2006-06-07T22:27:58Z</dc:date>
    <item>
      <title>C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665456#M23435</link>
      <description>I am new to C# and am trying to access the sortents table.&lt;BR /&gt;
Can anybody give me some help?&lt;BR /&gt;
When I look in the help files (ObjectArx Referance) I see this:&lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus&lt;BR /&gt;
getSortentsTable(&lt;BR /&gt;
AcDbSortentsTable*&amp;amp; pSortents,&lt;BR /&gt;
AcDb::OpenMode openMode,&lt;BR /&gt;
bool createIfNecessary = false);&lt;BR /&gt;
&lt;BR /&gt;
I can tell this is referance for C or C+ but how do I use this in C#?</description>
      <pubDate>Tue, 06 Jun 2006 09:41:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665456#M23435</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-06T09:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665457#M23436</link>
      <description>The BlockTableRecord has a DrawOrderTableId property&lt;BR /&gt;
that is the ObjectId of the associated DrawOrderTable&lt;BR /&gt;
managed wrapper class.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5196672@discussion.autodesk.com...&lt;BR /&gt;
I am new to C# and am trying to access the sortents table.&lt;BR /&gt;
Can anybody give me some help?&lt;BR /&gt;
When I look in the help files (ObjectArx Referance) I see this:&lt;BR /&gt;
&lt;BR /&gt;
Acad::ErrorStatus&lt;BR /&gt;
getSortentsTable(&lt;BR /&gt;
AcDbSortentsTable*&amp;amp; pSortents,&lt;BR /&gt;
AcDb::OpenMode openMode,&lt;BR /&gt;
bool createIfNecessary = false);&lt;BR /&gt;
&lt;BR /&gt;
I can tell this is referance for C or C+ but how do I use this in C#?&lt;/TECHNO&gt;</description>
      <pubDate>Tue, 06 Jun 2006 14:19:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665457#M23436</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-06T14:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665458#M23437</link>
      <description>Thank for a nudge in the right direction!</description>
      <pubDate>Tue, 06 Jun 2006 21:30:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665458#M23437</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-06T21:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665459#M23438</link>
      <description>Ok, I am stuck again.&lt;BR /&gt;
I am trying to get the DrawOrderTable and this is what I have done&lt;BR /&gt;
&lt;BR /&gt;
DrawOrderTable dot;&lt;BR /&gt;
Transaction trans;&lt;BR /&gt;
trans=HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction();&lt;BR /&gt;
dot=(DrawOrderTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId,OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
When I run this I get the following error:&lt;BR /&gt;
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.InvalidCastException: Unable to cast object of type 'Autodesk.AutoCAD.DatabaseServices.BlockTable' to type 'Autodesk.AutoCAD.DatabaseServices.DrawOrderTable'.&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong?</description>
      <pubDate>Wed, 07 Jun 2006 12:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665459#M23438</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-07T12:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665460#M23439</link>
      <description>Look at your code.&lt;BR /&gt;
&lt;BR /&gt;
You're trying to open a BlockTableRecord as &lt;BR /&gt;
a DrawOrderTable.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5198186@discussion.autodesk.com...&lt;BR /&gt;
Ok, I am stuck again.&lt;BR /&gt;
I am trying to get the DrawOrderTable and this is what I have done&lt;BR /&gt;
&lt;BR /&gt;
DrawOrderTable dot;&lt;BR /&gt;
Transaction trans;&lt;BR /&gt;
trans=HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction();&lt;BR /&gt;
dot=(DrawOrderTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId,OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
When I run this I get the following error:&lt;BR /&gt;
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt; System.InvalidCastException: Unable to cast object of type 'Autodesk.AutoCAD.DatabaseServices.BlockTable' to type 'Autodesk.AutoCAD.DatabaseServices.DrawOrderTable'.&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong?&lt;/TECHNO&gt;</description>
      <pubDate>Wed, 07 Jun 2006 22:27:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665460#M23439</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-07T22:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665461#M23440</link>
      <description>Yes, I noticed that after I posted.&lt;BR /&gt;
But when I get to&lt;BR /&gt;
HostApplicationServices.WorkingDatabase.????&lt;BR /&gt;
I do not get the choice to select DrawTable.&lt;BR /&gt;
I guess I am asking is how to open the DrawOrderTable, I am sure its in the help files but I am having a tough time finding the info I need in them.</description>
      <pubDate>Thu, 08 Jun 2006 00:16:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665461#M23440</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-08T00:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665462#M23441</link>
      <description>Please review my first post in this thread,&lt;BR /&gt;
note what object has the DrawOrderTableId&lt;BR /&gt;
property.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5199272@discussion.autodesk.com...&lt;BR /&gt;
Yes, I noticed that after I posted.&lt;BR /&gt;
But when I get to&lt;BR /&gt;
HostApplicationServices.WorkingDatabase.????&lt;BR /&gt;
I do not get the choice to select DrawTable.&lt;BR /&gt;
I guess I am asking is how to open the DrawOrderTable, I am sure its in the help files but I am having a tough time finding the info I need in them.&lt;/TECHNO&gt;</description>
      <pubDate>Thu, 08 Jun 2006 01:41:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665462#M23441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-08T01:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665463#M23442</link>
      <description>Yep, I did that.&lt;BR /&gt;
Thanks for the patients!&lt;BR /&gt;
Anyone else who is following this extreemly painfull learning curve, heres what I did to get this to work.&lt;BR /&gt;
&lt;BR /&gt;
Transaction trans=HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction();&lt;BR /&gt;
&lt;BR /&gt;
DrawOrderTable dot;&lt;BR /&gt;
BlockTableRecord btr;&lt;BR /&gt;
&lt;BR /&gt;
btr=BlockTableRecord)trans.GetObject(HostApplicationServices.WorkingDatabase.CurrentSpaceId,OpenMode.ForWrite);&lt;BR /&gt;
&lt;BR /&gt;
dot=(DrawOrderTable)trans.GetObject(btr.DrawOrderTableId,OpenMode.ForWrite);&lt;BR /&gt;
&lt;BR /&gt;
Just like Tony said.&lt;BR /&gt;
If this is still not tech correct please correct for the rest of us.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again</description>
      <pubDate>Thu, 08 Jun 2006 01:46:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665463#M23442</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-08T01:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665464#M23443</link>
      <description>Ok, More problems.&lt;BR /&gt;
I have been trying for 2 day and I cant figure out what I am doing wrong.&lt;BR /&gt;
&lt;BR /&gt;
I have a list of blocks names in a listview&lt;BR /&gt;
I want to get the ObjectId's of the blocks&lt;BR /&gt;
Then put them in a ObjectId Collection&lt;BR /&gt;
Then pass the collection through the MoveToTop function(in the draworder table)&lt;BR /&gt;
&lt;BR /&gt;
Heres what I did.&lt;BR /&gt;
ObjectIdCollection Idcollection = new ObjectIdCollection();&lt;BR /&gt;
//cycle throught the listview&lt;BR /&gt;
foreach (ListViewItem item in lvwXrefs.Items)&lt;BR /&gt;
				{&lt;BR /&gt;
//cycle through current space block record table&lt;BR /&gt;
				foreach(ObjectId objId in btr)&lt;BR /&gt;
					{&lt;BR /&gt;
					    DBObject dbObj = trans.GetObject(objId,OpenMode.ForRead);&lt;BR /&gt;
					    BlockReference blkRef = dbObj as BlockReference;&lt;BR /&gt;
					    if (blkRef!=null)&lt;BR /&gt;
					    {&lt;BR /&gt;
					        BlockTableRecord blkDef=(BlockTableRecord)trans.GetObject(blkRef.BlockTableRecord,OpenMode.ForRead);&lt;BR /&gt;
					        if (blkDef.Name == item.Text)&lt;BR /&gt;
					        {&lt;BR /&gt;
							Idcollection.Add(blkDef.ObjectId);&lt;BR /&gt;
					        }&lt;BR /&gt;
					    }&lt;BR /&gt;
					}&lt;BR /&gt;
&lt;BR /&gt;
				}&lt;BR /&gt;
					dot.MoveToTop(Idcollection);&lt;BR /&gt;
					trans.Commit();&lt;BR /&gt;
                                       trans.Dispose();&lt;BR /&gt;
			}&lt;BR /&gt;
&lt;BR /&gt;
Now I do get all the Object Id's and can print them to the editor.&lt;BR /&gt;
But as soon as I try to pass them to the "movetotop" fuction, autocad crashs badly&lt;BR /&gt;
&lt;BR /&gt;
any help?</description>
      <pubDate>Tue, 13 Jun 2006 04:12:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665464#M23443</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-13T04:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665465#M23444</link>
      <description>&amp;gt;&amp;gt; Idcollection.Add(blkDef.ObjectId);&lt;BR /&gt;
&lt;BR /&gt;
Your code appears to be adding the object ids&lt;BR /&gt;
of block table records to the id collection, rather&lt;BR /&gt;
than the ids of block references.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5203828@discussion.autodesk.com...&lt;BR /&gt;
Ok, More problems.&lt;BR /&gt;
I have been trying for 2 day and I cant figure out what I am doing wrong.&lt;BR /&gt;
&lt;BR /&gt;
I have a list of blocks names in a listview&lt;BR /&gt;
I want to get the ObjectId's of the blocks&lt;BR /&gt;
Then put them in a ObjectId Collection&lt;BR /&gt;
Then pass the collection through the MoveToTop function(in the draworder table)&lt;BR /&gt;
&lt;BR /&gt;
Heres what I did.&lt;BR /&gt;
ObjectIdCollection Idcollection = new ObjectIdCollection();&lt;BR /&gt;
//cycle throught the listview&lt;BR /&gt;
foreach (ListViewItem item in lvwXrefs.Items)&lt;BR /&gt;
{&lt;BR /&gt;
//cycle through current space block record table&lt;BR /&gt;
foreach(ObjectId objId in btr)&lt;BR /&gt;
{&lt;BR /&gt;
    DBObject dbObj = trans.GetObject(objId,OpenMode.ForRead);&lt;BR /&gt;
    BlockReference blkRef = dbObj as BlockReference;&lt;BR /&gt;
    if (blkRef!=null)&lt;BR /&gt;
    {&lt;BR /&gt;
        BlockTableRecord blkDef=(BlockTableRecord)trans.GetObject(blkRef.BlockTableRecord,OpenMode.ForRead);&lt;BR /&gt;
        if (blkDef.Name == item.Text)&lt;BR /&gt;
        {&lt;BR /&gt;
Idcollection.Add(blkDef.ObjectId);&lt;BR /&gt;
        }&lt;BR /&gt;
    }&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
dot.MoveToTop(Idcollection);&lt;BR /&gt;
trans.Commit();&lt;BR /&gt;
                                       trans.Dispose();&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
Now I do get all the Object Id's and can print them to the editor.&lt;BR /&gt;
But as soon as I try to pass them to the "movetotop" fuction, autocad crashs badly&lt;BR /&gt;
&lt;BR /&gt;
any help?&lt;/TECHNO&gt;</description>
      <pubDate>Tue, 13 Jun 2006 06:33:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665465#M23444</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-13T06:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665466#M23445</link>
      <description>As a somewhat related question,&lt;BR /&gt;
Doesn’t the DrawOrderTable contain ObjectIds of block references?&lt;BR /&gt;
As a last resort I tried taking the ObjectIds from the DrawOrderTable and putting them in the “MovetoTop” function and that also failed.&lt;BR /&gt;
&lt;BR /&gt;
I guess I am really off the mark in terms of figuring out the logic of this.

Message was edited by: Techno Destructo</description>
      <pubDate>Tue, 13 Jun 2006 21:10:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665466#M23445</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-13T21:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: C# Sortents</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665467#M23446</link>
      <description>The DrawOrderTable contains the ids of any visible entity&lt;BR /&gt;
(any object derived from AcDbEntity) which includes block&lt;BR /&gt;
references.&lt;BR /&gt;
&lt;BR /&gt;
Your code isn't adding block references to the DOT, it is&lt;BR /&gt;
adding block definitions, which are not visible entities.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;TECHNO destructo=""&gt; wrote in message news:5205008@discussion.autodesk.com...&lt;BR /&gt;
As a somewhat related question,&lt;BR /&gt;
Doesn’t the DrawOrderTable contain ObjectIds of block references?&lt;BR /&gt;
As a last resort I tried taking the ObjectIds from the DrawOrderTable and putting them in the “MovetoTop” function and that also failed.&lt;BR /&gt;
&lt;BR /&gt;
I guess I am really of the mark in terms of figuring out the logic of this.&lt;/TECHNO&gt;</description>
      <pubDate>Wed, 14 Jun 2006 18:55:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/c-sortents/m-p/1665467#M23446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2006-06-14T18:55:30Z</dc:date>
    </item>
  </channel>
</rss>

