Danke Thomas,
das ganze sieht bei mir jetzt so aus:
Public Sub ZoomtoAttry(MyID As ObjectId)
Dim MyAttRef As AttributeReference
Dim APoint As Point3d
Dim BPoint As Point3d
Dim MPoint As Point3d
Dim LineDumy As LineSegment3d
Dim MyBlockref As BlockReference
Dim MylayoutManager As LayoutManager = LayoutManager.Current
Dim AktLayoutID As ObjectId
Dim MyLayBlock As BlockTableRecord
Dim Mylayout As Layout
AktLayoutID = MylayoutManager.GetLayoutId(MylayoutManager.CurrentLayout)
Using Trans As Transaction = myDB.TransactionManager.StartTransaction()
MyAttRef = Trans.GetObject(MyID, OpenMode.ForWrite)
APoint = MyAttRef.GeometricExtents.MinPoint
BPoint = MyAttRef.GeometricExtents.MaxPoint
MyBlockref = Trans.GetObject(MyAttRef.OwnerId, OpenMode.ForRead)
MyLayBlock = Trans.GetObject(MyBlockref.OwnerId, OpenMode.ForRead)
Mylayout = Trans.GetObject(MyLayBlock.LayoutId, OpenMode.ForRead)
MyBlockref.Highlight()
End Using
If AktLayoutID = Mylayout.Id Then
LineDumy = New LineSegment3d(APoint, BPoint)
MPoint = LineDumy.EvaluatePoint(0.5)
LineDumy.ScaleBy(8, MPoint)
Zoom(LineDumy.StartPoint, LineDumy.EndPoint, New Point3d, 1)
Else
MsgBox("Sorry das Attribut ist im Layout: " & Mylayout.LayoutName)
End If
End Sub
und funktioniert auch. Aber ich denke es geht nur wenn der Block mit dem Attribut direkt in einem Layout ist. Wenn es ein Block im Block im Block.........wäre, dann ginge es sicher nicht.
Gruß, Theo
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP