• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk Inventor Engineer-to-Order

    Reply
    Distinguished Contributor
    ludesroc
    Posts: 131
    Registered: ‎05-03-2005

    run DLL

    91 Views, 4 Replies
    12-20-2012 11:30 AM

    Hi,

     

    I'm trying to run a simple .dll from ETO but can't acheive anything!!!!

     

    Here's my approach:

     

    Copied the .dll is in the Design Files folder of the current project.

     

    Tested in ETO --> Rule myValuesAdded As Number = ClassLibrary1.Class1.AddMyValues(5, 2)

     

    I get --> No such method 'AddMyValues'  while calling (static) on ClassLibrary1.Class1

     

    ' Here is the dll...

    Public Class Class1

      Public Function AddMyValues(ByVal Value1 As Double, ByVal Value2 As Double)

        Dim Result As Double
        Result = Value1 + Value2

        Return Result

      End Function

    End Class

     

    ' Created a simple form to test the dll...it works just fine!!!

    Imports ClassLibrary1

      Public Class Form1

        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
          Dim Add As New ClassLibrary1.Class1

          TextBox3.Text = Add.AddMyValues(CDbl(TextBox1.Text), CDbl(TextBox2.Text)).ToString
        End Sub

      End Class

     

    Any help would be appreciated.

    Regards,

    Ludesroc
    Please use plain text.
    Employee
    Posts: 84
    Registered: ‎11-13-2007

    Re: run DLL

    12-20-2012 12:19 PM in reply to: ludesroc

    See if the attached helps (code from Jon Balgley's Potlatch presentation on this topic).

     

    Intent rules: 

         

          Rule cus1 = New vbclasslib.customer("Jon", "Balgley", "503-555-1234")
          
          Rule cus2 = New vbclasslib.customer("Jon", "Yelglab", "503-555-4321")
          
          Rule allCus = { cus1, cus2 }
                
          Rule allPhones As List 
                For Each C In allCus 
                      allPhones = allPhones + {c.phone}
                Next C
          End Rule
    

     

    Sanjay-

    Please use plain text.
    Distinguished Contributor
    ludesroc
    Posts: 131
    Registered: ‎05-03-2005

    Re: run DLL

    12-20-2012 12:45 PM in reply to: sanjay.ramaswamy

    Hi Sanjay,

     

    When evaluating allPhones, I get this error...

     

     

    ------------------------------------------
    Error - vbclasslib.customer
    ------------------------------------------
    Error Message:
    vbclasslib.customer

    Rule Stack:
    Part: Root
    Rule: cus1
    Design: ViewWindow
    Source:
    Rule cus1 = New vbclasslib.customer("Jon", "Balgley", "503-555-1234")

    Part: Root
    Rule: allCus
    Design: ViewWindow
    Source:
    Rule allCus = { cus1, cus2 }

    Part: Root
    Rule: allPhones
    Design: ViewWindow
    Source:
    Rule allPhones As List
    For Each C In allCus
    allPhones = allPhones + {c.phone}
    Next C
    End Rule

    Part: Root
    Rule: %%EVAL_TEMP_1
    Design: ViewWindow
    Source:
    Uncached Rule %%EVAL_TEMP_1 As Any = allPhones

    ------------------------------------------

     

    Are there any other steps to follow prior to run a dll from ETO?

     

    1- I closed Inventor

    2- Copy the dll in the design files folder (of current project)

    3- Restarted Inventor

    4- ...

    Ludesroc
    Please use plain text.
    Mentor
    FarrenYoung
    Posts: 246
    Registered: ‎07-13-2009

    Re: run DLL

    12-20-2012 02:02 PM in reply to: ludesroc

    Try this instead

    Public Class Class1

      Public Shared Function AddMyValues(ByVal Value1 As Double, ByVal Value2 As Double) As Double

        Dim Result As Double
        Result = Value1 + Value2

        Return Result

      End Function

    End Class

    --Farren

    ************************************************************************************
    If this post helps, please click the "thumbs up" to give kudos
    If this post answers your question, please click "Accept as Solution"
    ************************************************************************************
    Please use plain text.
    Mentor
    FarrenYoung
    Posts: 246
    Registered: ‎07-13-2009

    Re: run DLL

    12-20-2012 02:07 PM in reply to: ludesroc

    If you don't want static methods in your .net code, you could get an instance in your intent code.

     

    Rule myValuesAdded As Number

      Dim instance As Any = New ClassLibrary1.Class1()

      Return instance.AddMyValues(5, 2)

    End Rule

    --Farren

    ************************************************************************************
    If this post helps, please click the "thumbs up" to give kudos
    If this post answers your question, please click "Accept as Solution"
    ************************************************************************************
    Please use plain text.