Consulting

Results 1 to 2 of 2

Thread: procedure too large

  1. #1
    VBAX Newbie
    Joined
    Aug 2010
    Posts
    5
    Location

    procedure too large

    Hi I wrote that program

    Public Sub podciag1()

    With ThisDrawing.Utility

    Dim k0Deg As Double

    'every 1degree till 355

    Dim k355Deg As Double

    k0Deg = .AngleToReal("0d", acDegrees)
    k355Deg = .AngleToReal("355d", acDegrees)

    Const od0p As Integer = 0

    'every 1 till 1000

    Const od10000p As Integer = 10000

    Dim layerObj As AcadLayer
    Dim tekststyl As AcadTextStyle

    Set layerObj = ThisDrawing.Layers.Item("defpoints")
    Set wymiarstyl = ThisDrawing.DimStyles.Item("aL")
    Set tekststyl = ThisDrawing.TextStyles.Item("Arial")
    Dim bż As Integer
    Dim hż As Integer
    Dim bpd As Integer
    Dim hpd As Integer
    'and many moro variables

    ' 2.1 from here there is main program, wchich draws


    isoA1hp1w = .PolarPoint(isoA1hp1pos, k90Deg, od140p)

    End Sub

    ' There are about 3000 lines, When I compile it shows
    ' procedure too large
    ' ?? How to split this procedure

  2. #2
    VBAX Regular
    Joined
    Feb 2011
    Posts
    27
    Location

    Call another function

    Hi I wrote that program

    [vba]Public Sub podciag1()


    'every 1degree till 355 '<<=== What is this? Is it a loop?

    ...

    'every 1 till 1000
    ...

    Set layerObj = ThisDrawing.Layers.Item("defpoints")
    Set wymiarstyl = ThisDrawing.DimStyles.Item("aL")
    Set tekststyl = ThisDrawing.TextStyles.Item("Arial")
    Dim bż As Integer
    Dim hż As Integer
    Dim bpd As Integer
    Dim hpd As Integer
    'and many moro variables

    call Your_Subroutine (necessary_parameter ) 'Have another sub do the drawing


    isoA1hp1w = .PolarPoint(isoA1hp1pos, k90Deg, od140p)

    End Sub[/vba]
    You can write other procedures and call them. Place portions of your code in these other procedures. You can also put the other procedures in new separate modules if the current module is too long. Just remember to make them public modules. You may have to use static variables when doing this. You may also have to create a blank form simply for holding your subroutines.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •