G'day Guys,
I had a search and couldn't find any details on how to create a transformation between a face & a plane.
What I would like to do, is move a body, So that a point is on origin, an edge on the Top plane & the Face coincident to the front plane.
Any help would greatly appreciated.
Code below doesn't help, As I have no idea of the correct methods to use.
SolidworksApi macrosPublic Function BoundingBox(ByVal aBody As Body2) As Double()
'Dim AcDoc As ModelDoc2 = swApp.ActiveDoc
'Dim aBody As Body2 = Nothing ' ToDo :Get a really body.
Dim Xdist, Ydist, Zdist As Double
For Each obFace As Face2 In aBody.GetFaces
If obFace.IGetSurface.IsPlane Then 'Face is not planaer, so align will not work
Try
Dim refEdge As Edge = obFace.IGetEdges
Dim newBody As Body2 = aBody.ICopy()
'Aim Rotate body, based on obface so that one point is on origin & the face is coincident with front plane.
'Then Align a edge to the Top plane.
'newBody.GetCoincidenceTransform(
'if can get transform of face, delta that of front plane = new transform.
Dim Transform As New MathTransform 'Has 16 elements
' Dim Vector1 As New MathVector
' Transform.ISetData = transformdata
newBody.ApplyTransform(Transform)
Dim Box() As Double = TryCast(newBody.GetBodyBox, Double()) 'x,y,z,x1,y1,z1
'newbody.dispose 'Dispose of temp body
Catch ex As Exception
End Try
End If
Next
Return Nothing
End Function