Hello
I'm developing a program which runs several simulations and obtains the results automatically.
I'm using the dynamic simulation API created in Inventor 2013. For that I use the GetResultValues(ByRef values() as Double) method of the class DSResult.
I used the method inside the VBA of inventor and worked well. But when I wrote the program in Visual Basic Express 2010, the method doesn't return anything.
I share an excerpt of the code:
---------------------------------------------------------------------------------
Dim odoc As AssemblyDocument
odoc=invApp.Documents.Open(testPath, True)
Dim dsman As Inventor.SimulationManager = odoc.ComponentDefinition.SimulationManager
Dim dssim As Inventor.DynamicSimulation = dsman.DynamicSimulations.Item(1)
Dim oJoints As Inventor.DSJoints = dssim.DSJoints
oJoint = oJoints.Item(1)
oJointDef = oJoint.Definition
oDegs = oJointDef.DegreesOfFreedom
Dim values(steps* 2 + 1) As Double
oDeg = oDegs(1)
oResults = oDeg.Results
oResult = oResults(9)
nombre = oResult.Name
Call oResult.GetResultValues(values)
------------------------------------------------------------------------
The method GetResultValues(values) should modify 'values' to a time,value vector.
It works well inside Inventor, but doesn't in the program in VB, although it runs the simulations and does everything else right.
Thanks for any help
Juan Diego Gómez
Hi Juan,
I've forwarded the question onto Development with a link to this thread.
Best regards, -Hugh
Hi Juan,
We can get the VB Express code to work on our end. However, if the model / simulation is not the same one used, it may not work. This is the only reason we can come up with why the code works in Inventor VBA but not VB Express.
Attached is the code we used successfully in VB Express.
Best regards, -Hugh
Hello
I'm now using the code you provided.
Here are the steps I followed:
First I open the assembly
Then get to the Dynamic Simulation Environment
Then run the simulation.
Then check the output grapher to verify if I got something
Finally I run the code in vb express.
But I still get nothing in the values() vector.
Any ideas why the reference vector doesn't modify?
Thanks
Juan Diego Gómez