Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Procedure in iLogic

2 REPLIES 2
Reply
Message 1 of 3
abilabib
332 Views, 2 Replies

Procedure in iLogic

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)

 

2 REPLIES 2
Message 2 of 3
xiaodong_liang
in reply to: abilabib

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 
Message 3 of 3
abilabib
in reply to: abilabib

Thanks for your reply. 

I'll try Smiley Wink

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report