Help needed - Using the above code, when a point is selected in the black area on the drawing which means nothing is selected, the autocad keeps running infinitely in a loop like thing.
Is there a way to check when there is no selection made for a nested entity. Like when nothing is selected do something.
I am using vb.net
I have or seen something similar. When I get more time I will try to find it
For now this goes in the oppisite direction but might help.
The basic idea is when you are in paperspace and notice the xref is missing something or you want to add something. Instead of opening the xref or switching to model or editing in place the xref. You can just draw on top of the viewport then send it to the xref just as it appears.
Here is the link and alot of other great info and users http://www.theswamp.org/index.php?topic=34590.0
thanks for the reply..
But I want to check if the selected point is on a nested entity not an entity.
For entity we can do addallowedclass(viewport) but how can we do something similar to that for a nested entity.?
i have the code i am using to get nested entity at selected point.
Dim pneo As PromptNestedEntityOptions
pneo =NewPromptNestedEntityOptions("")
pneo.NonInteractivePickPoint = selectedpoint
pneo.UseNonInteractivePickPoint =True
Dim psubent As Entity = acTrans.GetObject(acDoc.Editor.GetNestedEntity(pneo).ObjectId, OpenMode.ForRead)
it hangs up in the above line where i am getting the objectid.
anything i am doing wrong?
What is the owner of the entity ?? ... may help decide
ie is the container BlockTable ModelSpace, Paperspace or a block
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper
Thanks for the reply..
I am unable to get the owner ID of the nested entity. Since, it hangs up at getting the object ID itself, it does not go till the point I am able to get the nested entity.
Please, find my whole code is as below:
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
While (True)
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
' Open the Block table record for read
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
'' Open the Block table record Model space for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Application.SetSystemVariable("OSMODE", 512)
Dim acnsprompt As PromptPointResult = acDoc.Editor.GetPoint(vbCrLf & "Select APN or <exit>: ")
If acnsprompt.Status = PromptStatus.OK And Not IsNothing(acnsprompt.Value) Then
Dim pneo As PromptNestedEntityOptions
pneo =New PromptNestedEntityOptions("")
pneo.NonInteractivePickPoint = acnsprompt.Value
pneo.UseNonInteractivePickPoint =True
pneo.AllowNone =True
If acDoc.Editor.GetNestedEntity(pneo).ObjectId = ObjectId.Null Or Not IsNothing(acDoc.Editor.GetNestedEntity(pneo).ObjectId) Or Not IsDBNull(acDoc.Editor.GetNestedEntity(pneo).ObjectId) Then
Dim psubent As Entity = acTrans.GetObject(acDoc.Editor.GetNestedEntity(pneo).ObjectId,OpenMode.ForRead)
If psubent.GetRXClass.Name.ToString = "AcDbText" Then
If psubent.Layer.Contains("APN") Then
Dim txt As DBText = DirectCast(psubent, Entity)
End If
End If
psubent.Dispose()
End If
pneo =Nothing
end if
end using
end while