xgulism1 / UE_Spice_Demo

A demo project for the Spice plugin for Unreal Engine.
3 stars 0 forks source link

could you Help using your PlugIn in CPP function #4

Open Angelo50 opened 1 year ago

Angelo50 commented 1 year ago

Hey Martin

If you could help me a bit..

As I told you, I come from unity so, I'm used with C# But, I'm newby with cpp (even if I did some c code 30 years ago ^^ for business app) Anyway, I do have an issue since, Unreal Blueprint does not manage double variable types. And, when I use capacitor with small value(I have implemented circuit with NE555 and your plugin), NGspice return very very small value that truncated to zero because of Float Type Var. So, I want to convert one of my blueprint function to CPP And, the misery start (for me) I have created a CPP function which is callable from blueprint What I want is to have a parameter used to send the circuit and being able to call the "GetAnalysisValues" based on the circuit parameter in the cpp function Then from that, I'll be able to retreive the values array and compute what I want with very small time interval etc... Again, just need to know how to pass the circuit parameter and call the GetAnalysisValue Function in this CPP Function

FString USLFBlueprintFunctionLibrary::SLFFunctionGetValues(UObject* Circuit) { FVector2D myArray; //I Suppose the type of Circuit in the function parameter is not good //How to fill MyArray ? MyArray = Circuit.GetAnalysisValue(time)

FString Rstring = "Done";
return Rstring;

}

Thanks for your time Angelo.

Angelo50 commented 1 year ago

Hi Martin, I did some progress by myself What I did: Add "Spice" as PublicDependencymodule in my build.cs With that, I was able to include NgspiceCircuit.h without problem

Then, for a starting point, just created a simple function for test

`FString USLFBlueprintFunctionLibrary::SLFFunction(UNgspiceCircuit* circuit, int b) { TArray Result = circuit->GetAnalysisValueKeys(); b = sizeof(Result);

return (FString::Printf(TEXT ("Nombre :%d"),b)); }` and it returns as expected the number of values So, I'm able to communicate with your EUSpice in c++

I imagine this is quite easy for you but this is new for me ^^

Angelo.

Angelo50 commented 1 year ago

Going forward, I was able to achive that https://www.youtube.com/watch?v=cKoYasZrseA

I don't want to bother you with my personnal project so this will be my last update on that Angelo.

xgulism1 commented 1 year ago

Hi!

I am sorry I could not be helpful lately, I was too busy. The project looks amazing. I am glad everything is working.

Martin.