syntax error Sub Main() .... End sub

syntax error Sub Main() .... End sub

SpokenEarth
Advocate Advocate
516 Views
2 Replies
Message 1 of 3

syntax error Sub Main() .... End sub

SpokenEarth
Advocate
Advocate
Hi, can anyone help me with this code? massage: 1.JPG
Sub CreateView()
    ' Set a reference to the drawing document.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
	
    'References this drawing sheet
    Dim oSheet As Inventor.Sheet
    oSheet = oDrawDoc.ActiveSheet

    ' Select a drawing view.
    Dim oDrawingView As DrawingView
    oDrawingView = ActiveSheet.View("A").View
	
    ' Ready code for creating of reference points
    Dim oTG As TransientGeometry
    oTG = ThisApplication.TransientGeometry

    ' Set a reference to the center of the base view.
    Dim oPoint As Point2d
    oPoint = oDrawingView.Center
    oPoint.X = oPoint.X + oDrawingView.Width
    
    Dim oCurveSeg As DrawingCurveSegment
    oCurveSeg = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Pick")
    Dim oCenterPoint As Point2d
    oCenterPoint = oCurveSeg.StartPoint

    ' Create the detail view.
    Dim oDetailView As DetailDrawingView
    oDetailView = oSheet.DrawingViews.AddDetailView(oDrawingView, oPoint, kFromBaseDrawingViewStyle, True, oCentrePoint, 1, , oDrawingView.Scale * 3, True, "Detail C")
	
End Sub
0 Likes
Accepted solutions (2)
517 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @SpokenEarth 

The main sub (where the code starts) in an ilogic rule has to be named "Main". So just change the line:

Sub CreateView()

To

Sub Main()

 

Or since you only have the one sub/function you can just delete the lines:

Sub CreateView() and End Sub

Message 3 of 3

SpokenEarth
Advocate
Advocate
Accepted solution

Silly me....Thank you

0 Likes