PDA

View Full Version : procedure too large



pipu123
09-27-2010, 10:45 PM
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

jrajul
02-16-2011, 05:42 PM
Hi I wrote that program

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
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.