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: 

Units of Measure, and precision

1 REPLY 1
SOLVED
Reply
Message 1 of 2
riff62
633 Views, 1 Reply

Units of Measure, and precision

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"... Smiley LOL

Any help would be appreciated.

 

1 REPLY 1
Message 2 of 2
philippe.leefsma
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

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

Post to forums  

Autodesk Design & Make Report