Convert TNumber in VB .net plug-in

Convert TNumber in VB .net plug-in - Is it possible to convert TNumber to Single or Double? - Messages

#1 Posted: 7/21/2021 11:52:42 AM
Engr

Engr

8 likes in 24 posts.

Group: User

I have a previous VB subroutine (with a iterative mathematical calculation) which I would like to put into a plug-in for use with SMath Studio. I have started with the VB.net plug-in template and have a function started which passes the starting values from a smath worksheet to the plug-in. I have gotten so far as the values from the worksheet are transfered to the plug-in as TNumber objects. I need to convert the values from TNumber to Single or Double VB numbers to pass them to the subroutine (the subroutine uses single and doubles in the calculations). Is there a way to convert between TNumber and Single or double and then back again in VB code?

Thanks,
Engr
#2 Posted: 7/21/2021 2:41:03 PM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

I recommend making a copy of the repository on a local disk and then looking for code examples in it.

Also, right in the program there is a user's guide (or Core documentation).

2021-07-21_22-21-05.png

[TNumber].obj.ToDouble() - convert to double

New TNumber( double, double ) or CType( double, TNumber ) - for back operation, but I'm not sure how it will look in basic. There is an implicit conversion operator.

2021-07-21_22-40-34.png

2021-07-21_22-41-58.png
Russia ☭ forever, Viacheslav N. Mezentsev
1 users liked this post
Engr 7/27/2021 11:05:00 AM
#3 Posted: 7/27/2021 11:04:22 AM
Engr

Engr

8 likes in 24 posts.

Group: User

Uni,

Thanks for the reply and the tips for finding information.

I hope you can help with one more item I am struggling with. I am able to return a double with the solution from my calculation subroutine back to the SMath worksheet with the following:

Dim force as Double

result = New Entry( force )

However I would like to return four values to SMath instead of just one. Is it possible to have a single function in a plug-in return a 4x1 matrix to SMath?

I appreciate the assistance.

Engr
  • New Posts New Posts
  • No New Posts No New Posts