ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
SRSeth Ruhan21/09/2012

Gday,

I am quite new at Solidworks API & learning it API is quite a shock to the system.

My current problem is as follows.

I want to get the distances maximum & minimum between two faces.

To do this, I assume I will need to ilterate between all points on each face getting the min and max from both.

So starting on item 1. I pick a point on face1, and a point on Face2. However I want the distance between the two points normal to Face1.  This is where I am stuck.

Below is the code I think I will use, However since I don't know what im doing I could be way off.

All so prt file has a sketch with three dimensions, this is what I am trying to achive.

Thanks

For Each Face As Face2 In allFace

            Dim Edges() As Edge = Face.GetEdges

            Dim Points() As Point3d

            For Each edgeFace In Edges

                Dim SVertex As Vertex = DirectCast(Edges(1).GetStartVertex(), Vertex)

                Dim EVertex As Vertex = DirectCast(Edges(1).GetEndVertexetStartVertex(), Vertex)

                ReDim Preserve Points(Points.Length + 1)

                Points(Points.Length - 1) = New Point3d(DirectCast(SVertex.GetPoint(), Double()))

                'Points(Points.Length - 2) = New Point3d(DirectCast(EVertex.GetPoint(), Double())) end point will be another items start point.

            Next

            For Each Face1 As Face2 In allFace

                Dim Points1() As Point3d

                For Each edgeFace In Edges

                    Dim SVertex As Vertex = DirectCast(Edges(1).GetStartVertex(), Vertex)

                    Dim EVertex As Vertex = DirectCast(Edges(1).GetEndVertexetStartVertex(), Vertex)

                    ReDim Preserve Points(Points.Length + 1)

                    Points1(Points1.Length - 1) = New Point3d(DirectCast(SVertex.GetPoint(), Double()))

                    'Points1(Points1.Length - 2) = New Point3d(DirectCast(EVertex.GetPoint(), Double())) end point will be another items start point.

                Next

            Next

            For Each Point As Point3d In Points

                'compare point & Face against all in points1

            Next

            '''

            '''

            ' Dim vTessTriangle As Object = Face.GetTessTriangles(True)

            ' ProcessTessTriangles(vTessTriangle)

        Next