Hi,
Here is some C# example that works for me.
Database db = acDbService.HostApplicationServices.WorkingDatabase;
using (TransactionManager tm = db.TransactionManager)
{
using (Transaction acadTrans = tm.StartTransaction())
{
try
{
foreach (ObjectId oi in ids)
{
Entity ent = (Entity)tm.GetObject(oi, OpenMode.ForRead);
ent.Highlight();
}
acadTrans.Commit();
}
catch
{
throw;
}
}
}
Hope you find it usefull...
Regards
Peter
wrote in message news:5625938@discussion.autodesk.com...
Hi all,
I am trying to highlight polylines and block references on drawings using
AutoCAD 2006, ObjectARX 2006 and VS 2005.
I've been reading some threads on highlighting entities at this forum, and I
found a piece of code at
http://discussion.autodesk.com/thread.jspa?messageID=5205357
for ObjectARX 2006. I tried it, and it works for the polylines, but I am
not able to highlight the block references.
Here is the code I am using to highlight / unhighlight entities:
' --------------------------- CODE STARTS HERE -------------------------
Public Shared Sub HighlightEntity(ByVal entity As Entity, _
ByVal enable As Boolean)
If (entity IsNot Nothing AndAlso entity.Id.IsValid) Then
Dim ids(1) As ObjectId
ids(0) = entity.Id
Dim index As SubentityId = New SubentityId(SubentityType.Null,
0)
Dim path As FullSubentityPath = New FullSubentityPath(ids,
index)
If (enable) Then
entity.Highlight(path, True)
Else
entity.Unhighlight(path, True)
End If
Application.DocumentManager.MdiActiveDocument.Editor.UpdateScreen()
End If
End Sub 'HighlightEntity()
' --------------------------- CODE ENDS HERE -------------------------
If you see something strange, or you miss something at this piece of code,
please let me know.
Thanks in advance 😉
Message was edited by: rubendm
PS: I tried using each of the possible values of SubentityType, but
the result was always the same: it works for Polylines, but not for
BlockReferences