1
00:00:10,000 --> 00:00:11,000
Hello, friends.

2
00:00:11,000 --> 00:00:15,000
Welcome to Python and live view.

3
00:00:15,000 --> 00:00:18,000
Integration course.

4
00:00:18,000 --> 00:00:20,000
Basically in this course.

5
00:00:22,000 --> 00:00:25,000
We will create a python code.

6
00:00:26,000 --> 00:00:31,000
And using that python code, we will get the results in lab.

7
00:00:31,000 --> 00:00:32,000
Or you can say.

8
00:00:34,000 --> 00:00:35,000
We will call.

9
00:00:36,000 --> 00:00:37,000
Python coding lab.

10
00:00:38,000 --> 00:00:44,000
So for that purpose, first you have to download lab, you and your system.

11
00:00:45,000 --> 00:00:51,000
So over here you have to type, download or you can say.

12
00:00:52,000 --> 00:00:53,000
Have you.

13
00:00:54,000 --> 00:00:58,000
Download Apps for your download and on the first link.

14
00:00:59,000 --> 00:01:02,000
You get the information?

15
00:01:04,000 --> 00:01:07,000
For the lab view integration with Python.

16
00:01:08,000 --> 00:01:12,000
They require by time 3.9.

17
00:01:13,000 --> 00:01:25,000
In case of if you have lab view 2021, if you have lab view 2022 because right now 2022 is available.

18
00:01:26,000 --> 00:01:31,000
You can use any type of war zone that is available one by one.

19
00:01:31,000 --> 00:01:35,000
So first, let's say you are using 2022 to.

20
00:01:36,000 --> 00:01:45,000
From here you can download it and over here you will get 6.4, six and B file and click on that.

21
00:01:45,000 --> 00:01:54,000
After clicking on that file, you have to select which toolbox you want to use in view.

22
00:01:54,000 --> 00:02:02,000
And over here there are different versions like this full professional community or runtime right now

23
00:02:02,000 --> 00:02:05,000
or here 32 bit is also there.

24
00:02:06,000 --> 00:02:09,000
So if you want to download this.

25
00:02:10,000 --> 00:02:12,000
Again, the same procedure is there.

26
00:02:12,000 --> 00:02:16,000
And if you want to install it.

27
00:02:17,000 --> 00:02:18,000
Offline.

28
00:02:18,000 --> 00:02:22,000
In that case, 48.76 GB software is there.

29
00:02:22,000 --> 00:02:26,000
You can just click on this and extract it.

30
00:02:26,000 --> 00:02:27,000
After this.

31
00:02:28,000 --> 00:02:32,000
Like a video game or a game software.

32
00:02:32,000 --> 00:02:38,000
You have to click next, next, next before selecting your particular toolbox.

33
00:02:38,000 --> 00:02:47,000
So this is how you can download view in my system I already have lab view 2021.

34
00:02:48,000 --> 00:02:54,000
As you see over here, this is my 2021 version and it is 32 bit.

35
00:02:54,000 --> 00:02:56,000
Okay, so I just minimize it.

36
00:02:57,000 --> 00:03:01,000
When you download life, you.

37
00:03:01,000 --> 00:03:04,000
After that, you have to search for Python.

38
00:03:07,000 --> 00:03:08,000
Download Python.

39
00:03:11,000 --> 00:03:11,000
Okay.

40
00:03:12,000 --> 00:03:13,000
So over here.

41
00:03:15,000 --> 00:03:21,000
When you go to Python download or here the latest version is 3.10.6.

42
00:03:22,000 --> 00:03:25,000
It will work with 2022 live version.

43
00:03:26,000 --> 00:03:31,000
But in my case, that is 2021.

44
00:03:31,000 --> 00:03:38,000
So the last test was done which will work with Lebanon 2021 it is 3.9.

45
00:03:38,000 --> 00:03:42,000
So I have in my PC 3.9.

46
00:03:43,000 --> 00:03:45,000
Ideally 3.9 32 bit.

47
00:03:46,000 --> 00:03:49,000
So I just go for.

48
00:03:49,000 --> 00:03:50,000
Let Python.

49
00:03:53,000 --> 00:03:56,000
3.9 download.

50
00:03:56,000 --> 00:04:00,000
Okay, so over here when I just click on this.

51
00:04:06,000 --> 00:04:09,000
Here are executable files.

52
00:04:10,000 --> 00:04:15,000
So I just go with window x 86.

53
00:04:15,000 --> 00:04:17,000
Basically it is 32 bit.

54
00:04:17,000 --> 00:04:24,000
If there is 64, in that case there is 6064 bit installer also there.

55
00:04:24,000 --> 00:04:26,000
I just go with this.

56
00:04:26,000 --> 00:04:29,000
I already have python also after downloading Python.

57
00:04:31,000 --> 00:04:33,000
You just go to VI?

58
00:04:33,000 --> 00:04:41,000
PM basically when you download and install lab view, in that case you will get via PM.

59
00:04:41,000 --> 00:04:42,000
Basically, this is a.

60
00:04:45,000 --> 00:04:46,000
We are a package manager.

61
00:04:46,000 --> 00:04:53,000
So over here in the search menu, you just search for Python and over here there are different toolbox.

62
00:04:53,000 --> 00:04:55,000
Basically, these are part of our toolbox.

63
00:04:55,000 --> 00:04:58,000
I just install this one.

64
00:04:58,000 --> 00:05:01,000
If you want to install accommodation, you just go over here.

65
00:05:01,000 --> 00:05:03,000
I have standard edition.

66
00:05:03,000 --> 00:05:07,000
So in that case there is an installation option, is there?

67
00:05:07,000 --> 00:05:14,000
So it is installed by turn integration toolkit is already installed in my system.

68
00:05:14,000 --> 00:05:19,000
So these are the three requirements for Python integration with live view.

69
00:05:19,000 --> 00:05:22,000
So I just close this.

70
00:05:25,000 --> 00:05:25,000
Okay.

71
00:05:26,000 --> 00:05:31,000
So now I just go to my lab part.

72
00:05:34,000 --> 00:05:35,000
I disclose this also.

73
00:05:38,000 --> 00:05:43,000
So now I already create a folder in documents.

74
00:05:45,000 --> 00:05:49,000
I got here by ten and leave you integration as you see.

75
00:05:50,000 --> 00:05:53,000
And in this I already create a addition.

76
00:05:54,000 --> 00:05:54,000
VI.

77
00:05:55,000 --> 00:06:00,000
So let's check how we can create an education program in.

78
00:06:01,000 --> 00:06:01,000
Lab.

79
00:06:01,000 --> 00:06:04,000
You add wells as well as in Python.

80
00:06:05,000 --> 00:06:06,000
So over here.

81
00:06:07,000 --> 00:06:09,000
So first I open.

82
00:06:10,000 --> 00:06:15,000
By ten, ideally 3.9.

83
00:06:20,000 --> 00:06:24,000
And I just open the already created file.

84
00:06:27,000 --> 00:06:28,000
So I just go to document.

85
00:06:31,000 --> 00:06:34,000
Python integration with lab code.

86
00:06:34,000 --> 00:06:39,000
So this is my code as you see or hear my result.

87
00:06:39,000 --> 00:06:41,000
Initial result is zero.

88
00:06:41,000 --> 00:06:44,000
I just define a function addition.

89
00:06:45,000 --> 00:06:46,000
X comma y.

90
00:06:48,000 --> 00:06:49,000
In mutation.

91
00:06:50,000 --> 00:06:52,000
Result is equal to X plus y.

92
00:06:52,000 --> 00:06:55,000
And I also want to print it.

93
00:06:56,000 --> 00:06:56,000
Brent.

94
00:06:58,000 --> 00:06:59,000
President.

95
00:07:06,000 --> 00:07:06,000
Okay.

96
00:07:07,000 --> 00:07:09,000
Great result.

97
00:07:09,000 --> 00:07:13,000
And over here, I want to.

98
00:07:15,000 --> 00:07:15,000
Brent.

99
00:07:16,000 --> 00:07:22,000
The addition of two and five, so I just run it.

100
00:07:27,000 --> 00:07:29,000
If you ask me to save the code.

101
00:07:30,000 --> 00:07:32,000
So when I save, I got the result.

102
00:07:33,000 --> 00:07:34,000
Two plus five is by two seven.

103
00:07:35,000 --> 00:07:40,000
If you want to go with different result, let's say four plus five.

104
00:07:40,000 --> 00:07:42,000
Again, I want to run it.

105
00:07:44,000 --> 00:07:47,000
Ask me to save as I got mine.

106
00:07:47,000 --> 00:07:48,000
So this is the python code.

107
00:07:49,000 --> 00:07:54,000
Now I want to call this code in live view.

108
00:07:54,000 --> 00:07:58,000
So for that purpose, I do not require this print.

109
00:08:02,000 --> 00:08:05,000
And I also did not require this.

110
00:08:06,000 --> 00:08:10,000
So my program for life is result is value zero.

111
00:08:10,000 --> 00:08:13,000
Initial value is zero defined.

112
00:08:14,000 --> 00:08:19,000
Define a function addition x comma y result x plus y return result.

113
00:08:20,000 --> 00:08:25,000
Okay, so I just make it over here.

114
00:08:35,000 --> 00:08:36,000
Okay.

115
00:08:36,000 --> 00:08:37,000
So I just save it.

116
00:08:37,000 --> 00:08:41,000
Controllers, just close this over here.

117
00:08:41,000 --> 00:08:43,000
There is my hydration dot.

118
00:08:43,000 --> 00:08:46,000
By now I create.

119
00:08:47,000 --> 00:08:48,000
Calling via.

120
00:08:50,000 --> 00:08:54,000
So I just open my lab view and over here there is my.

121
00:08:55,000 --> 00:08:57,000
So this will.

122
00:08:58,000 --> 00:09:02,000
Comes for the components comes from over here, as you see.

123
00:09:04,000 --> 00:09:06,000
So I just use strip pop.

124
00:09:06,000 --> 00:09:08,000
This is my strip path.

125
00:09:08,000 --> 00:09:14,000
The function of strip part is return, the name of the last component of a path and the strip path that

126
00:09:14,000 --> 00:09:16,000
leads to that component.

127
00:09:16,000 --> 00:09:24,000
Basically, this current VI path goes here and it will create a path for my.

128
00:09:26,000 --> 00:09:26,000
Via.

129
00:09:28,000 --> 00:09:30,000
Or it will create a path.

130
00:09:30,000 --> 00:09:32,000
Python or path.

131
00:09:32,000 --> 00:09:33,000
So over here.

132
00:09:35,000 --> 00:09:45,000
This is my build path, step path, great path as you see and in the file constant, you will get the

133
00:09:46,000 --> 00:09:47,000
this current view path.

134
00:09:47,000 --> 00:09:50,000
So over here this is my current path.

135
00:09:51,000 --> 00:09:59,000
Now I just create a constant for this build path and I just name it the function name of my python code.

136
00:09:59,000 --> 00:10:07,000
As you see, my code is addition by I just put addition by.

137
00:10:07,000 --> 00:10:11,000
And when I control E, when I hit on run button it will create the path.

138
00:10:11,000 --> 00:10:14,000
So C users so know this is my name.

139
00:10:15,000 --> 00:10:17,000
So command python and integration.

140
00:10:18,000 --> 00:10:21,000
Python integration py code and addition.

141
00:10:21,000 --> 00:10:24,000
It will create the location of the this code.

142
00:10:25,000 --> 00:10:28,000
And over here I just create patterns.

143
00:10:28,000 --> 00:10:30,000
From here I just use single.

144
00:10:30,000 --> 00:10:34,000
And in this, I just edit my icon.

145
00:10:35,000 --> 00:10:40,000
Right now my code is for addition, so I just put add.

146
00:10:41,000 --> 00:10:43,000
So I just close this.

147
00:10:44,000 --> 00:10:45,000
Save it.

148
00:10:46,000 --> 00:10:49,000
Okay, so this is my sub vi over here.

149
00:10:49,000 --> 00:10:52,000
This is my sub by tradition.

150
00:10:53,000 --> 00:11:01,000
Now, I just go to my main vi that is in lab view.

151
00:11:01,000 --> 00:11:05,000
So over here in this.

152
00:11:09,000 --> 00:11:10,000
So I just

153
00:11:13,000 --> 00:11:14,000
put it over here.

154
00:11:15,000 --> 00:11:20,000
So these functions are from that third party manager that is from VIP.

155
00:11:21,000 --> 00:11:24,000
So you have to just go to connectivity.

156
00:11:25,000 --> 00:11:30,000
And this this is my Python integration toolkit.

157
00:11:30,000 --> 00:11:33,000
So over here, first you have to open Python session.

158
00:11:33,000 --> 00:11:36,000
This one is my open python session.

159
00:11:36,000 --> 00:11:44,000
I just make the label visible, as you see over here.

160
00:11:44,000 --> 00:11:51,000
This is my open python session, and this is my python node.

161
00:11:51,000 --> 00:11:57,000
As you see over here, visible item, python code.

162
00:11:57,000 --> 00:11:58,000
And this is my python.

163
00:11:59,000 --> 00:12:01,000
Close the session.

164
00:12:02,000 --> 00:12:06,000
And I also use over here a simple error handler.

165
00:12:09,000 --> 00:12:10,000
So just connected.

166
00:12:14,000 --> 00:12:15,000
Visible its name.

167
00:12:15,000 --> 00:12:17,000
Simple error.

168
00:12:18,000 --> 00:12:23,000
And over here I just create a y loop for continuously reading.

169
00:12:23,000 --> 00:12:25,000
And this is my function name.

170
00:12:26,000 --> 00:12:27,000
This is my function name.

171
00:12:28,000 --> 00:12:33,000
That is a region that is defined in python code.

172
00:12:33,000 --> 00:12:42,000
And over here there is my sub v the error sub v as you see over here, this is my sub vi.

173
00:12:42,000 --> 00:12:43,000
I just close this.

174
00:12:43,000 --> 00:12:45,000
It will go over here.

175
00:12:45,000 --> 00:12:50,000
Connect the in session now to session in error.

176
00:12:50,000 --> 00:12:59,000
How to error in and over here I just put zero value and in this case I have two variables x and Y.

177
00:12:59,000 --> 00:13:01,000
So that's why I just connected.

178
00:13:01,000 --> 00:13:07,000
There is no addition code right now in lab view.

179
00:13:07,000 --> 00:13:14,000
If I want to create a validation code for this, I want to create this code.

180
00:13:14,000 --> 00:13:22,000
This code, this python code is similar to this block as you just create a control.

181
00:13:23,000 --> 00:13:25,000
Create a control over here.

182
00:13:28,000 --> 00:13:39,000
And this is my indicator and I just put a Y loop over here and create in the node indicator, create

183
00:13:39,000 --> 00:13:39,000
a control.

184
00:13:40,000 --> 00:13:43,000
So this code and this code are similar.

185
00:13:44,000 --> 00:13:46,000
This code is in Python.

186
00:13:46,000 --> 00:13:52,000
And in this code I will call Python code and leave this code in lab view.

187
00:13:52,000 --> 00:13:59,000
So I just delete this and let's check the output of python code over here.

188
00:13:59,000 --> 00:14:10,000
My version is 3.9 because I already told you that 20, 20, 21 version will work with 3.9 Python version

189
00:14:11,000 --> 00:14:13,000
for 20 2022.

190
00:14:13,000 --> 00:14:18,000
You can use 3.10 or later on versions.

191
00:14:18,000 --> 00:14:31,000
Okay, so I just go to the front panel window and I just put over here four and over here for I just

192
00:14:31,000 --> 00:14:31,000
run it.

193
00:14:32,000 --> 00:14:34,000
Let's check what is the value?

194
00:14:35,000 --> 00:14:38,000
As you see over here, I go to the eight in the real time.

195
00:14:38,000 --> 00:14:40,000
I will check the value.

196
00:14:40,000 --> 00:14:50,000
As you see, I goes on increasing, the value goes on increasing and the code is written in Python.

197
00:14:50,000 --> 00:14:58,000
So this is how you can create additional code in lab view.

198
00:14:58,000 --> 00:15:05,000
Or you can say you can call python code in the Python edition code in live view.

199
00:15:05,000 --> 00:15:06,000
Thank you.

