1 Reply Latest reply on Jul 4, 2014 4:59 PM by Sushil Chaskar

    Getting 3d intersection curves..

    Sushil Chaskar

      Hi.. I don't know how to get 3d the intersection curves between modeldoc and number of planes automatically. I think first we need to select all faces of model, then use firstfeature to automatically select each plane and get 3d intersection curve on model. I did it manually i.e. hardcoded way but I need a general method that will work for every case. Any help guys. I also want to know how we can get the extreme points of model doc or possible max and min values of x, y, z coordinates.. Plz help me out guys...

        • Re: Getting 3d intersection curves..
          Sushil Chaskar

          There need some changes to be made... Any thoughts..?


          Option Explicit



          Sub main()





          Dim swApp As SldWorks.SldWorks



          Dim swModel As SldWorks.ModelDoc2



          Dim swSelMgr As SldWorks.SelectionMgr



          Dim swSelData As SldWorks.SelectData





          Dim swPart As SldWorks.PartDoc





          Dim swBody As SldWorks.Body2





          Dim swFace As SldWorks.Face





          Dim swEnt As SldWorks.Entity





          Dim bRet As Boolean





          Dim vBodies As Variant



          Dim boolstatus As Boolean



          Dim count1 As Integer



          count1 = 0



          Set swApp = CreateObject("SldWorks.Application")





          Set swModel = swApp.ActiveDoc





          Set swPart = swModel





          Set swSelMgr = swModel.SelectionManager





          Set swSelData = swSelMgr.CreateSelectData





          vBodies = swPart.GetBodies2(swAllBodies, True)





          Set swBody = vBodies(0)





          Set swFace = swBody.GetFirstFace




          swModel.ClearSelection2 True




          Do While Not swFace Is Nothing





          Set swEnt = swFace




          ' Select through Entity





          bRet = swEnt.Select4(True, swSelData): Debug.Assert bRet




          Set swFace = swFace.GetNextFace

          count1 = count1 + 1






          MsgBox count1



          Dim Count As Integer

          Count = 0

          Dim swfeature As SldWorks.Feature

          Set swfeature = swModel.FirstFeature

          While Not swfeature Is Nothing

          If swfeature.GetTypeName = "RefPlane" Then

          swfeature.Select2 True, 0

          Count = Count + 1

          End If

          Set swfeature = swfeature.GetNextFeature




          MsgBox Count

          Dim i, j As Integer

          For i = 1 To Count - 3

          swModel.SketchManager.InsertSketch True


          boolstatus = swModel.Extension.SelectByID2("Plane" & i, "PLANE", 0, 0, 0, False, 0, Nothing, 0)

          For j = 1 To count1

          boolstatus = swModel.Extension.SelectByID2("Face" & j, "FACE", 0, 0, 0, False, 0, Nothing, 0)

          Next j




          swModel.ClearSelection2 True


          swModel.ClearSelection2 True

          swModel.SketchManager.InsertSketch True



          Next i



          End Sub