Community
How to create and use procedure in iLogic.
I have try for create simple procedure / function in iLogic but can't work.
function LOD (ByVal a as string) as DrawingView ThisApplication.FileManager.GetLastActiveLevelOfDetailRepresentation(a) end function LOD_Assy = LOD(DirName)
Hi,
When you define a procedure, you need to define Main procedure for the main workflow. And if a procedure is a function, you need to make sure to provide a return value for the function. Please refer to the code snippet below.
Sub Main() Dim DirName As String DirName = "c:\Assembly2.iam" LOD_Assy = LOD(DirName) End Sub Function LOD (ByVal a As String) As DrawingView Dim oLODStr As String oLODStr = ThisApplication.FileManager.GetLastActiveLevelOfDetailRepresentation(a) 'just to make sure the prcedure is called MsgBox(oLODStr) ' do your job to get a drawing view... ' remember assign the drawing view to the ' function name LOD as the return value ' LOD = ..... 'I set it to nothing just for demo LOD = Nothing End Function