Solidworks IJK
Solidworks IJK
(OP)
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!
When was the last time you drove down the highway without seeing a commercial truck hauling goods?
Download nowINTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
|
RE: Solidworks IJK
Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
RE: Solidworks IJK
RE: Solidworks IJK
I'd put my vectors into mathcad and take the eigen values of the vector to get its pricipals.
RFUS
RE: Solidworks IJK
RE: Solidworks IJK
RE: Solidworks IJK
Please see FAQ559-1100
Showing pic here doesn't do well within the thread.
thanks.
Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
RE: Solidworks IJK
RE: Solidworks IJK
RE: Solidworks IJK
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.
CODE
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
RE: Solidworks IJK
RE: Solidworks IJK
Another noteable: FAQ559-1040
Export 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=(x-x0)i + (y-y0)j + (z-z0)k
and magnitude = SQRT((x-x0)^2 + (y-y0)^2 + (z-z0)^2)
a= (x-x0)/SQRT((x-x0)^2 + (y-y0)^2 + (z-z0)^2)
b= (y-y0)/SQRT((x-x0)^2 + (y-y0)^2 + (z-z0)^2)
c= (z-z0)/SQRT((x-x0)^2 + (y-y0)^2 + (z-z0)^2)
Vijk = ai + bj + ck