×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API Transforms

API Transforms

API Transforms

(OP)
SW2005, if it makes a difference....

I'm using API to create some drawings, and this (of course) involves some transformation matrices to convert between the different coordinate systems (component -> assembly -> drawing)

I've got a simple piping assembly made up of  90° elbows and pipe sections that i'm using to experiment...

when i run the "Get Transforms of Assembly Components Example" on it, i get some matrices that look really nice, and then some that involve rotation numbers like
-9.26450756388864E-17 and -6.47031582366316E-31.

obviously these really should be zeroes. is there a setting somewhere that will get it to round these numbers to, say, 12 decimal places, or something so they work properly?

or... any idea why it's coming up with these numbers in the first place?

RE: API Transforms

MyValue = Round(MyValue, 12)

Ken

RE: API Transforms

(OP)
I've tried that, but it's a pain when you have an array-ful of them. i was wondering if there's a setting somewhere to automatically limit the number of decimal places that the VBA works with.

RE: API Transforms

How about this:

CODE

Option Explicit
Dim MyArray(10000) As Double
Dim iCount As Integer
Dim MyRoundVal As Integer

Sub main()

'Fill array
MyArray(0) = 1 * 10 ^ (-16)
Debug.Print MyArray(0)
For iCount = 1 To UBound(MyArray)
    MyArray(iCount) = MyArray(iCount - 1) + MyArray(0)
'    Debug.Print MyArray(iCount)
Next iCount

'Round array values
MyRoundVal = 8
For iCount = 0 To UBound(MyArray)
    MyArray(iCount) = Round(MyArray(iCount), MyRoundVal)
'    Debug.Print MyArray(iCount)
Next iCount

End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources