Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Same Vb.net and C# code produce different drawing views

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
871 Views, 3 Replies

Same Vb.net and C# code produce different drawing views

Hi,

 

We are creating drawing views for an assembly using C#. It did not look quite right, so we created the same using Vb.Net and this looked right. The only differnce in these codes are for C#, the assembly document needs to be casted as _Document object while using the AddBaseView method. The trouble with C# output is that an object participating in a Combine Feature (Boolean subtract) shows up in drawing views as if it was a Boolean addition.

 

Attached files shows the output. 

 

Has anyone had any experience like these? Appreciate any suggestion.

 

Thanks!

3 REPLIES 3
Message 2 of 4
ekinsb
in reply to: Anonymous

The API is the same regardless of which language calls it.  Inventor doesn't even know what language is making the API call.  However, there are small differences in the languages that can sometimes make correctly formatting a call a bit tricky.  Is it possible for you to provide a simple test case that demonstrates this so we can see what you're doing in the C# call to be causing the difference in the result?


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 4
Anonymous
in reply to: ekinsb

Please find the attached zip file which has got both the C# and Vb.net versions of code to generate the drawing views.

Message 4 of 4
adam.nagy
in reply to: Anonymous

There are differences in arithmetics between C# and VB.NET:

e.g. 

C#
    double val1 = 7;
    double val2 = val1 / 2; // val2 = 3.5
    double val3 = 1 / 2; // val3 = 0.0 !!

VB.NET
    Dim val1 As Double = 7
    Dim val2 As Double = val1 / 2 ' val2 = 3.5
    Dim val3 As Double = 1 / 2 ' val3 = 0.5 !!
    Dim val4 As Double = 1 \ 2 ' val4 = 0.0

You are using System.Math.Atan(1 / 2), which would be affected by the above. I might have missed other calculations in your code that might also end up with different results.

 

You should check all the values you're passing to Inventor functions to make sure they are the same.


Cheers,



Adam Nagy
Autodesk Platform Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report