hello, i was wandering if it is feasible to use c sharp libraries for quick-sort and random distribution with script node..
also, since im new to ty-flow i have the free version, it seems that threading can be done, or better not try this at all??
the script operator allows me to practice those skills, so it would be nice to know what options are available..
the basic idea is to use it to create and spawn particles, although not sure how to use the test:true feature yet..
any thoughts, ideas would help.. thanks!
The Assemblies rollout of the Script operator allows you to import whatever C# assembly you need.
As for threading in the free version...you can use the threaded function of the Script operator to get used to its syntax, but only a single thread will spawn for it unless you're using tyFlow PRO.
(06-03-2023, 02:33 AM)tyFlow Wrote: The Assemblies rollout of the Script operator allows you to import whatever C# assembly you need.
As for threading in the free version...you can use the threaded function of the Script operator to get used to its syntax, but only a single thread will spawn for it unless you're using tyFlow PRO.
thanks for the answer! ive tried to import the math.numerics .dll without luck, im not sure how to install the library, just downloaded the file and used the path, however it didn't import properly.. obviously im doing something wrong..
anyway, i will try again once i find more about assemblies, since it can be done..
and of course there are some other things im have to try first before that
its great that it can be done with script, if we want to add a probability to the spawning or to the rest attributes..
Have you tried Math.Random? That’s built in…
(06-05-2023, 09:48 PM)tyFlow Wrote: Have you tried Math.Random? That’s built in…
Mathf.Sin() and Math.Sin() worked, however Math.Random didn't.. also i can't find any reference for max.net..
tried to import MathNet.Numerics, those lines:
MathNet.Numerics.LinearAlgebra.Double.Matrix<double> A = MathNet.Numerics.LinearAlgebra.Double.DenseMatrix.OfArray(new double[,] {
{1,1,1,1},{1,2,3,4},{4,3,2,1}});
MathNet.Numerics.LinearAlgebra.Double.Vector<double>[] nullspace = A.Kernel();
got this error:
'the non-generic type MathNet.Numerics...Matrix cannot be used with type arguments..'
also tried:
using MathNet.Numerics.LinearAlgebra; however this also didnt work..
i have no idea how to implement this, any thoughts-recommendations would help..
Oh sorry it's not Math.Random, it's System.Random (or just Random since the System assembly will be pre-loaded).
https://learn.microsoft.com/en-us/dotnet...ew=net-7.0
(06-07-2023, 02:29 AM)tyFlow Wrote: Oh sorry it's not Math.Random, it's System.Random (or just Random since the System assembly will be pre-loaded).
https://learn.microsoft.com/en-us/dotnet...ew=net-7.0
Thanks for the link! the built-in functions work properly now..
Although there is no really need to use external assembly would be great to know how to do that..
i have vs however don't know how to make a reference for 3dsmax..
after trying:
MathNet.Numerics.Random.SystemRandomSource();
i get:
the type 'System.Random' is defined in an assembly that is not referenced.. Must add a reference to 'System.Runtime, version 5.0.0.0, culture=neutral, publickey.....'
the folder contains versions net461, net48, net5, 6, standard2.0.
besides of this issue the rest is already in the documentation, so it would be great if there is a workaround to import-include this,
although its big library and would be ideal to get only some parts.. or would be good to know if-how it can be done..
thanks in advance!
Can you post the assembly you're trying to load?
06-07-2023, 03:34 PM
(This post was last modified: 06-07-2023, 03:53 PM by akis.)
ive downloaded the package in the zip file, just realized that its not installed anywhere..
https://numerics.mathdotnet.com/Packages
there is also this info.. however ive only used vs for c++, i dont think i have those features enabled..
anyway, i can try if it can/should install on my windows, for the learning purpose.. the options i want to use is random and perhaps sort algorithm..
''This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.''
PM> NuGet\Install-Package MathNet.Numerics -Version 5.0.0
thanks again for the help and sorry for the trouble..
! although the download link is not work at this time, im sure ive downloaded a zip file, that has 5 folders containing a .dll and an .xml files..
for unknown reason i cant find the zip file today, yet i can make them into a new zip if needed and upload..
(06-07-2023, 01:30 PM)tyFlow Wrote: Can you post the assembly you're trying to load?
tried once again and i got another file this time..
sorry about confusion, i used 7-zip to unzip the 'mathnet.numerics.5.0.0.nupkg' file..
inside there are folders with .dll and .xml for each .net version, however the file(s) 'MathNet.Numerics.dll' is ~1.5mb
today i download 'mathnet.numerics.mkl.win-x64.3.0.0.nupkg'
inside there is a folder 'runtimes.winx-64..' this has a bigger file 'libMathNetNumericsMKL.dll' ~153mb
and there is another .dll, 'libiomp5md.dll' ~1.9mb
im not sure if it can be used, still its interesting to use for projects in c#..
anyway, i will post projects with script operators here or fb group in the future, since its a favorite workflow, that already covers everything..
have to explore a bit more about the buillt-in features in ty-flow..
An assembly will be a C# DLL. You can type the full path into the assembly loader textbox or just the name if it's placed in the Max root directory.
(06-08-2023, 01:25 PM)tyFlow Wrote: An assembly will be a C# DLL. You can type the full path into the assembly loader textbox or just the name if it's placed in the Max root directory.
thanks for the help, however ive tried all possible versions and getting this error:
the type System.Object is defined in an assembly that is not referenced..
you must add a reference to 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
tried with version netstandard2.0 i get the same error..
with versions 4 i got different error.. it can't find the file..
searching on the web does not give solution, however other users say they used previous versions and worked..
ive tried: using MathNet.Numerics.LinearAlgebra;
that doesnt give error, however it doesnt work, because it says that System.Runtime is not referenced..
i dont understand what is wrong with this version..
Just based on that error it seems like it could just be a .NET version incompatibility...Max implements .NET 4.7/4.8 depending on your Max version, whereas it seems your package required 5.0 or higher.
(06-08-2023, 03:29 PM)tyFlow Wrote: Just based on that error it seems like it could just be a .NET version incompatibility...Max implements .NET 4.7/4.8 depending on your Max version, whereas it seems your package required 5.0 or higher.
Got it! Thanks so much for the help!.. After installing .NET4.8 it works if i use it inside another function..
inside the SimulationStep it doesnt compile, still, thats not an issue at all..
this is very cool, it was totally worth the effort..
What's the error you see when calling the function in SimulationStep?
(06-08-2023, 05:35 PM)tyFlow Wrote: What's the error you see when calling the function in SimulationStep?
this is the test code..
-------------------------------
using MathNet.Numerics.Distributions;
void hello()
{
double[] samples = SystemRandomSource.Doubles(100, 90);
}
the above works, however:
----------------------------------
public void simulationStep()
{
double[] samples = SystemRandomSource.Doubles(100, 90);
}
says: 'could not load file or assembly 'MathNet.Numerics4.8.0.0, Culture=neutral, PublicKeyToken=Null' or one of its dependencies.. System cannot find the file specified....'
Solved! After copying to the bin folder and restarting max it works properly..
just sharing if someone else wants to use this workflow..
thxx..
Ah, nice! I actually forgot about that...been a long time since I imported custom assemblies.
I'll add that note to the docs.
04-24-2024, 08:29 PM
(This post was last modified: 04-24-2024, 08:40 PM by 11paf.
Edit Reason: image add
)
What am I doing wrong, I want to access these libraries:
NAudio, Bass, Math.Net, Spectrogramm
I have tried all the options, it does not work for me....
I downloaded the packages, tried all the versions, of course indicated the paths to the dll in the window "custom assembly" c# OP.
The errors are as follows:
could not load file or assembly 'MathNet.Numerics 5.0.0........
System.Object is defined in an assembly that is not referenced..
you must add a reference to 'System.Runtime, Version=5.0.0.0.........
https://drive.google.com/file/d/1nKVrN2c...sp=sharing
|