PlantSimulation 底层Dll二次开发-创建及删除对象
PlantSimulation 底层Dll二次开发-创建及删除对象
#define WIN32_LEAN_AND_MEAN // We don't need all the stuff
#include <pch.h>
extern "C" __declspec(dllexport)
void DeleteTargetObject(UF_Value * ret, UF_Value * mRootFrame)
{
// Get object id of object "RootFrame"
UF_Value RootFrame = *mRootFrame;
if ((RootFrame.type != UF_OBJECT) || !RootFrame.value.object)
return;
deleteObject(RootFrame.value.object);
}
/// <summary>
/// 调用仿真中的Method程序
/// </summary>
/// <param name="ret"></param>
/// <param name="arg"></param>
extern "C" __declspec(dllexport)
void callMethod(UF_Value * ret, UF_Value * arg)
{
UF_Value aMethod = evalPath(0, ".Models.Frame.calcSin", 0, 0);
UF_Value arguments[1];
arguments[0].type = UF_REAL;
arguments[0].value.real = 3.1415;
UF_Value retValue = executeMethod(aMethod.value.object, 0 /* Caller (?) */, 0 /* Active Element (@) */, _countof(arguments), arguments);
}