INTELLIGENT WORK FORUMS FOR ENGINEERING PROFESSIONALS
Come Join Us!
Are you an Engineering professional? Join EngTips now!
 Talk With Other Members
 Be Notified Of Responses
To Your Posts
 Keyword Search
 OneClick Access To Your
Favorite Forums
 Automated Signatures
On Your Posts
 Best Of All, It's Free!
*EngTips's functionality depends on members receiving email. By joining you are opting in to receive email.
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.

bigkadz (Automotive) (OP) 
3 Apr 06 12:37 
I was wondering if it is possible for Solidworks to give you an IJK vector, I haven't been able to find any info on this matter, perhaps there is a macro made or something. Help would be much appreciated! 

ctopher (Mechanical) 
3 Apr 06 12:40 

bigkadz (Automotive) (OP) 
3 Apr 06 12:49 
IJK vectors are the cosine values of the X, Y, and Z angles. they provide you with the direction of your vector. 

rfus (Mechanical) 
3 Apr 06 13:25 
Lets say your vector is line from a point at the origin (0,0,0) to some value (x,y,z). The length of this line would be the magnitude of the vector. You want the direction of this line in each reference plane, or the projection of this line into a reference plane. You could just open a sketch in each reference plane and convert the line entity into each plane and smart dimension this from a horizontal or vertical center line to obtain your cosines. Or you could create a 3d sketch and do this all in one sketch using your tab key to change reference planes. Do you want to get outputs or compute dot and cross products on line entities in space.
I'd put my vectors into mathcad and take the eigen values of the vector to get its pricipals.
RFUS 

bigkadz (Automotive) (OP) 
3 Apr 06 13:29 

rfus (Mechanical) 
3 Apr 06 13:57 
So then, essentially, all you are looking to do is dimension a box with centerlines drawn on faces accross three planes. Make a box that your vector streatches accross, Sketch a centerline on the three views TOP, LEFT, FRONT, and then insert these views into a drawing. Dimension the three views and link these to a table. 

ctopher (Mechanical) 
3 Apr 06 14:02 

Stoker (Mechanical) 
3 Apr 06 18:32 
This is easy with the API, but the contents of the routine would depend on how flexible you need it to be. For example, will you preselect the points, or do you also want to be able to select an edge/sketch entity/curve as well? 

bigkadz (Automotive) (OP) 
4 Apr 06 8:20 
I would just want to select points


Stoker (Mechanical) 
4 Apr 06 15:01 
This will get you started. It will present the results in a message box and also will copy them to the clipboard so you can just paste into the target application. Copying data to the windows clipboard makes use of the DataObject variable type. You must have a reference set in your VBA project to the Microsoft Forms 2.0 object library (under tools, references). You can expand this to also work with other input yourself (sketch points, reference points etc). I have not included any error checking. CODEOption Explicit
Sub Main()
Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swSelMgr As SldWorks.SelectionMgr Dim swVertex1 As SldWorks.Vertex Dim swVertex2 As SldWorks.Vertex Dim DataObj As New DataObject Dim vPt1 As Variant Dim vPt2 As Variant Dim PointDist As Double Dim i As Double Dim j As Double Dim k As Double Dim Msg As String Dim LongStatus As Long Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swSelMgr = swModel.SelectionManager If Not (swSelMgr.GetSelectedObjectCount = 2) Then Msg = "Select two vertices to calculate the IJK vectors" LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk) End End If Set swVertex1 = swSelMgr.GetSelectedObject6(1, 1) vPt1 = swVertex1.GetPoint Set swVertex2 = swSelMgr.GetSelectedObject6(2, 1) vPt2 = swVertex2.GetPoint PointDist = Sqr((vPt2(0)  vPt1(0)) ^ 2 + (vPt2(1)  vPt1(1)) ^ 2 + (vPt2(2)  vPt1(2)) ^ 2) Msg = "i = " & (vPt2(0)  vPt1(0)) / PointDist & Chr(13) Msg = Msg & "j = " & (vPt2(1)  vPt1(1)) / PointDist & Chr(13) Msg = Msg & "k = " & (vPt2(2)  vPt1(2)) / PointDist DataObj.SetText Msg DataObj.PutInClipboard LongStatus = swApp.SendMsgToUser2(Msg, swMbWarning, swMbOk) End Sub 

Stoker (Mechanical) 
4 Apr 06 15:19 
Forgot to mention that this calculates the ijk vector between two preselected vertices. 

rfus (Mechanical) 
4 Apr 06 16:00 
Nice macro Stoker. Another noteable: FAQ5591040Export your points using this and then just use them with an equation in excel where your i j and k could each be solved in their own cell. If; v=(xx0)i + (yy0)j + (zz0)k and magnitude = SQRT((xx0)^2 + (yy0)^2 + (zz0)^2) a= (xx0)/SQRT((xx0)^2 + (yy0)^2 + (zz0)^2) b= (yy0)/SQRT((xx0)^2 + (yy0)^2 + (zz0)^2) c= (zz0)/SQRT((xx0)^2 + (yy0)^2 + (zz0)^2) Vijk = ai + bj + ck 



