• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Active Member
    Posts: 8
    Registered: ‎03-21-2012

    Symulation Results in API

    158 Views, 3 Replies
    04-30-2012 11:38 AM

    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

    Please use plain text.
    Employee
    Posts: 567
    Registered: ‎06-07-2007

    Re: Symulation Results in API

    04-30-2012 12:56 PM in reply to: jd.gomez242

    Hi Juan,

     

      I've forwarded the question onto Development with a link to this thread.

     

    Best regards, -Hugh

    *Please press the 'accept as solution' button if this thread answers your question, so others can quickly benefit*


    Hugh Henderson
    Simulation QA Engineer
    DLS (Simulation and Material Sciences)
    Please use plain text.
    Employee
    Posts: 567
    Registered: ‎06-07-2007

    Re: Symulation Results in API

    05-01-2012 02:15 PM in reply to: jd.gomez242

    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

    *Please press the 'accept as solution' button if this thread answers your question, so others can quickly benefit*


    Hugh Henderson
    Simulation QA Engineer
    DLS (Simulation and Material Sciences)
    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎03-21-2012

    Re: Symulation Results in API

    05-01-2012 03:12 PM in reply to: henderh

    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

    Please use plain text.