After dealing with a lot of other projects, I decided to take another look at this challenge, just to see if it could be done any easier, or more efficiently. I realized that since we have the ability to specify OriginIndicator.RelativeX and OriginIndicator.RelativeY, then it really does not matter which GeometryIntent you associate the OriginIndicator with, because you can simply use the mathematical position difference between the two locations to offset it. With that fact in mind, I adapted my earlier code for finding the geometric lower left point of the views geometry, then simply used the 'first' GeometryIntent, from the 'first' DrawingCurve of the view to create the OriginIndicator on. Then applied the mathematical offsets to it, and it seems to work just fine for this task.
When getting the GeometryIntent of that first DrawingCurve, I specified the second input as being either its 'mid point', or its 'center point', because we need a point intent, and pretty much every type of DrawingCurve will have one or the other.
Here is the revised code, just for the extra reference, and another option.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)
Dim oMinPoint As Point2d = GetViewMinPoint(oView)
If oMinPoint Is Nothing Then Exit Sub
Logger.Info("oMinPoint.X = " & oMinPoint.X & vbCrLf & "oMinPoint.Y = " & oMinPoint.Y)
Dim oGI As GeometryIntent = Nothing
Try
oGI = oSheet.CreateGeometryIntent(oView.DrawingCurves.Item(1), PointIntentEnum.kMidPointIntent)
Catch
oGI = oSheet.CreateGeometryIntent(oView.DrawingCurves.Item(1), PointIntentEnum.kCenterPointIntent)
Catch
Logger.Debug("Could not get GeometryIntent from first DrawingCurve in view.")
End Try
If oGI Is Nothing Then Exit Sub
If oView.HasOriginIndicator Then
oView.OriginIndicator.Intent = oGI
Else
oView.CreateOriginIndicator(oGI)
End If
Dim dXOffset As Double = (oGI.PointOnSheet.X - oMinPoint.X) * (-1) / oView.Scale
Dim dYOffset As Double = (oGI.PointOnSheet.Y - oMinPoint.Y) * (-1) / oView.Scale
oView.OriginIndicator.RelativeX = dXOffset
oView.OriginIndicator.RelativeY = dYOffset
End Sub
Function GetViewMinPoint(oView As DrawingView) As Point2d
If oView Is Nothing Then Return Nothing
Dim oDCE As DrawingCurvesEnumerator = Nothing
Try : oDCE = oView.DrawingCurves : Catch : End Try
If oDCE Is Nothing OrElse oDCE.Count = 0 Then Return Nothing
Dim dMinPointX As Double = oView.Left + oView.Width
Dim dMinPointY As Double = oView.Top
For Each oDC As DrawingCurve In oDCE
Dim dMinParam, dMaxParam As Double
oDC.Evaluator2D.GetParamExtents(dMinParam, dMaxParam)
Dim oParams() As Double = {dMinParam, dMaxParam}
Dim oPointCoords() As Double = {}
oDC.Evaluator2D.GetPointAtParam(oParams, oPointCoords)
If oPointCoords(0) < dMinPointX Then dMinPointX = oPointCoords(0)
If oPointCoords(1) < dMinPointY Then dMinPointY = oPointCoords(1)
Next
Dim oMinPoint As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(dMinPointX, dMinPointY)
Return oMinPoint
End Function
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)