2 Replies Latest reply on Nov 11, 2015 10:21 AM by S. H.

    Get Area hatch/ Fill?

    Bruno Neves

      How can I get the Area Hatch/Fill's of a drawing (see attached image)?

       

      - swView.GetFaceHatches: Does not work;

      - swSketch.GetSketchHatches: Does not work.

       

      Thanks in advance.

       



        • Re: Get Area hatch/ Fill?
          Bruno Neves

          In detail views.

            • Re: Get Area hatch/ Fill?
              S. H.

              Please refer to FaceHatch or IFaceHatch Interface in SOLIDWORKS API Help.

               

              Preconditions: Select a drawing view with face hatch.

               

                      Dim swSelMgr As SelectionMgr

                      Dim swView As View

                      Dim vFaceHatch As Object

                      Dim swFaceHatch As FaceHatch

                      Dim i As Long

               

                      swApp = CreateObject("SldWorks.Application")

                      swModel = swApp.ActiveDoc

                      swSelMgr = swModel.SelectionManager

               

                     boolstatus = swModel.Extension.SelectByID2("DrawingView1", "DRAWINGVIEW", 0, 0, 0, False, 0, Nothing, 0)

                      swView = swSelMgr.GetSelectedObject6(1, -1)

               

                     vFaceHatch = swView.GetFaceHatches

                     If Not IsNothing(vFaceHatch) Then

                              For i = 0 To UBound(vFaceHatch)

                                       swFaceHatch = vFaceHatch(i)

                                       ……

                              Next i

                     End If

               

                     swFaceHatch is what you want.