Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
Solved! Go to Solution.