Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Transforms

Status
Not open for further replies.

Milothicus

Mechanical
Sep 21, 2003
39
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?
 
Replies continue below

Recommended for you

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.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor