learning coding

learning coding

donaldleigh
Advocate Advocate
565 Views
3 Replies
Message 1 of 4

learning coding

donaldleigh
Advocate
Advocate

Evening all.

 

I have been using ilogic for a while now (maybe 3 or 4 years) but have no experience with coding at all.

To get the most of of ilogic , what type of coding is the best to learn.

 

Cheers

Donald

0 Likes
566 Views
3 Replies
Replies (3)
Message 2 of 4

CCarreiras
Mentor
Mentor

HI!

 

iLogic is similar yo VisualBasic

CCarreiras

EESignature

0 Likes
Message 3 of 4

A.Acheson
Mentor
Mentor

Inside the ilogic editor you are likely all ready using the the VB.NET Language for some time now. If you want to get into more advance use of VB.NET then you can get Visual studio and create WinForms and build Addin's and have more extensive debugging capabilities.

AAcheson_1-1669345254941.png

 

 

The Inventor API is what you will be wanting to drive with VB.NET. However the language the majority of the samples are written in the help documents are in VBA Language. So because of the similarities you will likely end up learning both VBA and VB.NET with conversion of the code to the VB.NET for use in the ilogic Editor. In my experience there is more general VBA content and tutorials on the internet. So what works in VBA will likely only need small changes in VB.NET. On this forum ilogic/VB.NET seems to be the more popular content. 

 

Here are some difference between the languages when trying to work with iproperties. As you will see the ilogic snippet is the shortest but actually behind the scenes is code like the VB.NET/VBA carrying out the retrieval of the property. You will see that the VB.NET code can be shorten considerably as you can both declare and set a object variable on the same line. 

iLogic

 

MessageBox.Show(iProperties.Value("Project", "Part Number"))

 

VB.NET

 

Sub Main
    ' Get the active document.
    Dim invDoc As Document = ThisApplication.ActiveDocument
    
    ' Get the design tracking property set.
    Dim invDesignInfo As PropertySet = invDoc.PropertySets.Item("Design Tracking Properties")
    
    ' Get the part number property.
    Dim invPartNumberProperty As Inventor.Property = invDesignInfo.Item("Part Number")
    
    MsgBox ("Part Number: " & invPartNumberProperty.value)
End Sub

 

VBA GetPropertySample from API

 

Public Sub GetPropertySample()
    ' Get the active document.
    Dim invDoc As Document
    Set invDoc = ThisApplication.ActiveDocument
    
    ' Get the design tracking property set.
    Dim invDesignInfo As PropertySet
    Set invDesignInfo = invDoc.PropertySets.Item("Design Tracking Properties")
    
    ' Get the part number property.
    Dim invPartNumberProperty As Property
    Set invPartNumberProperty = invDesignInfo.Item("Part Number")
    
    MsgBox "Part Number: " & invPartNumberProperty.value
End Sub

 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 4 of 4

donaldleigh
Advocate
Advocate

Thanks for the relay @A.Acheson 

 

The examples you gave are interesting. Looks like I might have to learn VBA and VB.Net.

 

Cheers

Donald

0 Likes