Inventor Customization

Reply
Valued Contributor
riff62
Posts: 52
Registered: ‎02-25-2009
Message 1 of 2 (288 Views)
Accepted Solution

Units of Measure, and precision

288 Views, 1 Replies
01-16-2013 11:10 AM

I have an AutoLisp code (not written by me) that creates an assembly model from a table it reads that contains part information, such as Length, and X,Y,and Z dimensions for placement in an assembly.Since Lisp wont work in Inventor, and we dont use AutoCAD anymore,

I am trying to do the same sort of thing in Inventor, and have gotten some great ideas by reading the posts here, as well as directly from Mr. Ekins, who provided me with the prototype code that got me started.,

Unfortunately for me, Brian is a busy guy, and I have little experience in programming, so I thought I would try to get some help here.

I am trying to figure out how to do the following using VB express 2010..

I have a table that the code reads. It includes dimensions in meters, that are similar to this: 2.7175482888E+05

E+05 is scientific notation for 10^5. The 2.717... number above is the length for a piece of tubing..there are other parts in the assembly, as well as variations of the same part..ie: the tubing there might be 30 different lengths of the same size tube.

I want to turn the number above into cm so that me code displays the part at the correct length in the assembly file., but I am not sure how to do that. I was looking at the Units of Measure in the API help, but didnt see a good way to do the conversion reading from a table.

With respect to the way the numbers are presented in the table, it appears that Inventor cant read them in this format. Any ideas on what to do about this?

Just an FYI, We are using the table to lay out the path of a laser, and the magnets associated with bending the beam.

The numbers in the table are generated from the calculations made in determining the optimum layout by people way smarter than me. myself being a lowly Drafter, they said "hey..could you do this in Inventor?" to which I replied, "Sure..no problem"... :smileylol:

Any help would be appreciated.

 

Hi There,

 

The UnitOfMeasure object can achieve conversions from a digit to a string literal with units or teh other way around, but I am not sure it can handle that scientific notation that you mentionned. You can check the "UnitsOfMeasure.GetValueFromExpression" that takes a string as input.

 

If it doesn't accept that notation, then you would need to rely on functionality of the programming language you are using to handle that or a 3rd party library/utility because there are no specific API with Inventor to achieve this kind of task: for example if you are using .Net that should be no problem to handle conversion between scientific notation and normal one but that's a topic you should investigate on your own.

 

I hope it helps.

 

Regards,

Philippe.

ADN Support Specialist
philippe.leefsma
Posts: 637
Registered: ‎06-02-2009
Message 2 of 2 (273 Views)

Re: Units of Measure, and precision

01-21-2013 01:27 AM in reply to: riff62

Hi There,

 

The UnitOfMeasure object can achieve conversions from a digit to a string literal with units or teh other way around, but I am not sure it can handle that scientific notation that you mentionned. You can check the "UnitsOfMeasure.GetValueFromExpression" that takes a string as input.

 

If it doesn't accept that notation, then you would need to rely on functionality of the programming language you are using to handle that or a 3rd party library/utility because there are no specific API with Inventor to achieve this kind of task: for example if you are using .Net that should be no problem to handle conversion between scientific notation and normal one but that's a topic you should investigate on your own.

 

I hope it helps.

 

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.