GetIntersection giving error in iLogic.

GetIntersection giving error in iLogic.

floccipier
Advocate Advocate
573 Views
2 Replies
Message 1 of 3

GetIntersection giving error in iLogic.

floccipier
Advocate
Advocate

This code below works fine in VBA but coverting them to iLogic this GenIntersection method gives follwoing error.

'GetIntersection' is not declared. It may be inaccessible due to its protection level.

 

Sub main()

' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
    
    'Set a reference to the active sheet.
    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet

    ' Select a drawing view.
    Dim oViews As DrawingViews
    'define collection of views objects
    oViews = ThisApplication.ActiveDocument.ActiveSheet.DrawingViews
    
    Dim oDrawingView As DrawingView
    For Each oDrawingView In oViews
            
    AddExtentDimensions (oDrawingView)
    Next
    
End Sub

Private Function AddExtentDimensions(ByRef DView As DrawingView)
    Dim LT As Point2d, RT As Point2d, LB As Point2d, RB As Point2d
    LT = ThisApplication.TransientGeometry.CreatePoint2d(DView.Left, DView.Top)
    RT = ThisApplication.TransientGeometry.CreatePoint2d(DView.Left + DView.Width, DView.Top)
    LB = ThisApplication.TransientGeometry.CreatePoint2d(DView.Left, DView.Top - DView.Height)
    RB = ThisApplication.TransientGeometry.CreatePoint2d(DView.Left + DView.Width, DView.Top - DView.Height)
    Dim TL As LineSegment2d, BL As LineSegment2d, LL As LineSegment2d, RL As LineSegment2d
    TL = ThisApplication.TransientGeometry.CreateLineSegment2d(LT, RT)
    BL = ThisApplication.TransientGeometry.CreateLineSegment2d(LB, RB)
    LL = ThisApplication.TransientGeometry.CreateLineSegment2d(LT, LB)
    RL = ThisApplication.TransientGeometry.CreateLineSegment2d(RT, RB)
    Dim TG As GeometryIntent, BG As GeometryIntent, LG As GeometryIntent, RG As GeometryIntent
    TG = Nothing
    BG = Nothing
    LG = Nothing
    RG = Nothing
    Dim Intersect As Point2d
    For Each DrawingCurve In DView.DrawingCurves
		
        If TG Is Nothing Then
			Intersect = GetIntersection (DrawingCurve, TL)
			
            If Not (Intersect Is Nothing) Then
                Select Case DrawingCurve.CurveType
                    Case kCircleCurve, kCircularArcCurve, kEllipseFullCurve, kEllipticalArcCurve
                        TG = DView.Parent.CreateGeometryIntent(DrawingCurve, kCircularTopPointIntent)
                    Case Else
                        TG = DView.Parent.CreateGeometryIntent(DrawingCurve, Intersect)
                End Select
            End If
        End If
        If BG Is Nothing Then
            Intersect = GetIntersection(DrawingCurve, BL)
            If Not (Intersect Is Nothing) Then
                Select Case DrawingCurve.CurveType
                    Case kCircleCurve, kCircularArcCurve, kEllipseFullCurve, kEllipticalArcCurve
                        BG = DView.Parent.CreateGeometryIntent(DrawingCurve, kCircularBottomPointIntent)
                    Case Else
                        BG = DView.Parent.CreateGeometryIntent(DrawingCurve, Intersect)
                End Select
            End If
        End If
        If LG Is Nothing Then
            Intersect = GetIntersection(DrawingCurve, LL)
            If Not (Intersect Is Nothing) Then
                Select Case DrawingCurve.CurveType
                    Case kCircleCurve, kCircularArcCurve, kEllipseFullCurve, kEllipticalArcCurve
                        LG = DView.Parent.CreateGeometryIntent(DrawingCurve, kCircularLeftPointIntent)
                    Case Else
                        LG = DView.Parent.CreateGeometryIntent(DrawingCurve, Intersect)
                End Select
            End If
        End If
        If RG Is Nothing Then
            Intersect = GetIntersection(DrawingCurve, RL)
            If Not (Intersect Is Nothing) Then
                Select Case DrawingCurve.CurveType
                    Case kCircleCurve, kCircularArcCurve, kEllipseFullCurve, kEllipticalArcCurve
                        RG = DView.Parent.CreateGeometryIntent(DrawingCurve, kCircularRightPointIntent)
                    Case Else
                        RG = DView.Parent.CreateGeometryIntent(DrawingCurve, Intersect)
                End Select
            End If
        End If
    Next
    
    Dim PT1 As Point2d
    PT1 = ThisApplication.TransientGeometry.CreatePoint2d
    If (Not TG Is Nothing) And (Not BG Is Nothing) Then
        PT1.X = DView.Left - 0.75
        PT1.Y = DView.Center.Y
        VDim = DView.Parent.DrawingDimensions.GeneralDimensions.AddLinear(PT1, TG, BG, kVerticalDimensionType)
    End If
    If (Not LG Is Nothing) And (Not RG Is Nothing) Then
        PT1.X = DView.Center.X
        PT1.Y = DView.Top - DView.Height - .75
        HDim = DView.Parent.DrawingDimensions.GeneralDimensions.AddLinear(PT1, LG, RG, kHorizontalDimensionType)
    End If
End Function

 

Any idea how could this be fixed? is it me doing something wrong?

Regards, 

Flo

0 Likes
Accepted solutions (1)
574 Views
2 Replies
Replies (2)
Message 2 of 3

Michael.Navara
Advisor
Advisor
Accepted solution

Used function is not declared in your code. Look for this method to your VBA project and add this method to your iLogic rule. May be it is in another module

Function GetIntersection(DrawingCurve, LineSegment2D) as Point2D

 

Message 3 of 3

floccipier
Advocate
Advocate
That is right - it was me just being silly. Thanks for you help sir, have good day.
0 Likes