See the top rated post in this thread. Click here

Results 1 to 2 of 2

Thread: Inventor VB Code

  1. #1
    Member
    Join Date
    2018-01
    Location
    Canada
    Posts
    2
    Login to Give a bone
    0

    Default Inventor VB Code

    Hello
    Inventor 18 : the following code that worked up to 2000 liters for “Vi” value.

    If Vi = 1000 l Then
    TrouHomme = "False"
    ElseIf Vi = 2000 l Then
    TrouHomme = "True"
    End If

    But upper than 2000 liters for Vi value (ei 3000 liters), I got the following error message:

    « Erreurs de compilation de règles dans Trou d'homme, Cuve_iLogic.ipt
    Erreur sur la ligne 3: L'expression constante n'est pas représentable dans le type 'Integer »

    Can someone help to solve this problem please?
    Best regards
    Eloge Tounou

  2. #2
    Member
    Join Date
    2012-06
    Posts
    28
    Login to Give a bone
    1

    Default Re: Inventor VB Code

    Your error message shows that the variable VI is set as integer. Here lies the problem.

    When you want to use 3000 L as a variable, inventor converts that to his internal units for volume as mm^3.
    That means 3000L = 3,000,000,000 mm^3. But the variable Integer ranges from
    –2,147,483,647 to 2,147,438,647.
    So 3000L exceeds the maximum value of an Integer. When you change the VI type to Long Integer the problem must be solved.

    Rob


Similar Threads

  1. CP326-2C: Porting Your SolidWorks® API Code to Autodesk® Inventor®
    By Autodesk University in forum Customization and Programming
    Replies: 0
    Last Post: 2015-08-07, 04:07 PM
  2. Code that runs when Inventor loads
    By ed.w.cler in forum VBA/COM Interop
    Replies: 2
    Last Post: 2010-07-15, 03:10 PM
  3. Inventor Parameters "start with" code
    By csmac2004 in forum VBA/COM Interop
    Replies: 2
    Last Post: 2009-03-23, 07:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •