Programming Books that teach VB and how to use APIs

Are there any books that teach how to use vb.net as well as how to use an API?

I have some very basic knowledge of how to use visual basic, such as making forms buttons and loops, but I do not know how to implement the use of things found in the API.

As an example I want to use the askfeatlocation class, or at least I think that it's a class.
I get the following description in the object browser in microsoft visual studio
"Public Sub AskFeatLocation(feature_obj_id As NXOpen.Tag, location() As Double)
Member of NXOpen.UF.UFModl"

The problem is I have no idea how to even call that.

I was thinking of maybe getting "win32 api programming with visual basic" to see if that could teach me how to use vb.net with an API but I am not sure if that is the right book.

Does anyone have any recommendations?

Any book that gives general coverage of VB.net will have at least one chapter dedicated to object oriented programming (OOP) and will discuss classes, objects, methods, properties, etc. You will need to know how to use objects to do any programming with .net; the .net framework is objects all the way down. The NXOpen API is basically just a library of objects that allow you to interface with NX to create and manipulate geometry. I don't believe that a book on the Win 32 API will help you out at all. The Win 32 API is a different beast than NXOpen. One reason that the Win 32 API is difficult to use with VB is because of the type conversions that you need to manage (from C data types to something that VB understands). These types of conversions have already been taken care of for you in the NXOpen API. The main problem with the NXOpen API is simply finding the objects or functions that you need for the task at hand and figuring out how they work together.

The functionality of the NXOpen API is generally split into two parts: the modern, full-blown, object-oriented stuff and the older "function" type calls (what I'll call the UF functions) the format of which long time C programmers will immediately recognize. If the functionality exists in both the OOP and UF functions, I'd suggest using OOP; but sometimes there is a UF function that provides functionality not available in the OOP object model or the UF function is just much easier to manage for what you want to do.

The UF functions are still somewhat object oriented. In actuality, the UF functions are methods of special UF objects. To use these functions you will first need a reference to the UF session, example below (the code does no state checking, it may error if there are no features or if the first feature does not have location information):

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

'get a reference to the first feature in the current work part
Dim firstFeature As Features.Feature
firstFeature = workPart.Features.ToArray(0)

'create a variable to hold the coordinate information
Dim featureCoords(2) As Double

'use the UF function, UF_MODL_ask_feat_location
theUfSession.Modl.AskFeatLocation(firstFeature.Tag, featureCoords)

'report the coordinates
lw.WriteLine(firstFeature.GetFeatureName & ", location: " & featureCoords(0).ToString & ", " & featureCoords(1).ToString & ", " & featureCoords(2).ToString)
lw.WriteLine("")

'now do the same with the OOP functionality
lw.WriteLine(firstFeature.GetFeatureName & ", location: " & firstFeature.Location.ToString)

lw.Close()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

The UF functions normally ask for the .Tag of an object as input, the OOP methods generally take the object itself as input or simply use properties and/or methods of the object you already have a reference to.

Please help me with journal for updating title block text automatically on all sheets if I update on one sheet. In the title block, I need to update revision, date, drawn by, details etc. Right now I update those manually.

Probably the best way to handle this is to save the values as part attributes then the notes in the title block reference those attributes. This way, when you edit the attribute value, all the notes that make use of the attribute will also update.

If you set up your template to use these attributes, it will help keep all newly created files in synch. However, if you need to update existing files, you might want to create a journal to help update the values. I'd start by identifying the location of these notes on the sheet. The journal could then be coded to look for a note in the specified location on sheet 1 and apply the value to the note in the same location on subsequent sheets. Or, the journal could create the part attributes with the note values and update the notes on each sheet to refer to the newly created attributes.

Thank you.
I am very new to creating journal. Could you please help me to create jornal.