Hello everybody,
I have a small application that zooms on an entity with specific properties. The problem is that if I am in paperspace and the entity is in model space, i cannot see the entity. How can I make the entity's space to become the current space?
Thanks,
e.g.
Solved! Go to Solution.
Solved by michael.robertson. Go to Solution.
If you know the name of the layout you can use
LayoutManager.Current.CurrentLayout = layoutName
If you don't know the layout of the entity you can use:
Public Shared Function GetLayoutName(ByVal ent As Entity) As String
Dim blockId As ObjectId = ent.BlockId
Dim btr As BlockTableRecord = TryCast(ent.BlockId.GetObject(OpenMode.ForRead), BlockTableRecord)
If Not btr.LayoutId.IsNull Then
Dim layout As Layout = TryCast(btr.LayoutId.GetObject(OpenMode.ForRead), Layout)
Return layout.LayoutName
End If
Return String.Empty
End Function