Hello
You can set the attachpoint by code. Below is a sample code that will try to find a drawingcurve around the fencecenter of each detail drawing view on the active sheet and attach the detail drawingview to it. After this, it should be possible to copy the sheet, edit sheet size and drawing view scales and the fences stay in position.
Option Explicit on
Dim oApp As Inventor.Application= ThisApplication
Dim oDrawDoc As Inventor.DrawingDocument= oApp.ActiveDocument
Dim oSheet As Sheet= oDrawDoc.ActiveSheet
Dim oView As DrawingView
Dim oDetailView As DetailDrawingView
Dim dRadius As Double
For Each oView In oSheet.DrawingViews
If oView.ViewType = DrawingViewTypeEnum.kDetailDrawingViewType Then
oDetailView = TryCast(oView, DetailDrawingView)
If oDetailView.AttachPoint Is Nothing Then
If oDetailView.CircularFence = True Then
dRadius=oDetailView.FenceRadius
Else
dRadius = oDetailView.FenceCenter.DistanceTo(oDetailView.FenceCornerOne)
End If
Dim oObjEnum As ObjectsEnumerator = oSheet.FindUsingPoint(oDetailView.FenceCenter, dRadius)
Dim oDrawCurveSegment As DrawingCurveSegment
Dim oObj As Object
For Each oObj In oObjEnum
If TypeOf oObj Is DrawingCurveSegment Then
oDrawCurveSegment = oObj
Exit For
End If
Next
If Not oDrawCurveSegment Is Nothing Then
Dim oGeomIntent As GeometryIntent= oSheet.CreateGeometryIntent(oDrawCurveSegment.Parent, oDrawCurveSegment.Parent.EndPoint)
oDetailView.AttachPoint = oGeomIntent
Else
MsgBox ("Could not find an entity to attach Detailview " & oDetailView.Name)
End If
End If
End If
Next
MsgBox("Done",MsgBoxStyle.Information,"iLogic")
R. Krieg
RKW Solutions
www.rkw-solutions.com