4 Replies Latest reply on Sep 13, 2016 6:34 AM by roberto gennari

    Flashing TemporaryBody Feature preview Mouse Event

    roberto gennari

      Hallo,

      I'm trying to create the event of the movement of the mouse to preview the feature during insertion of points in the holes.

      My problem, as seen in the attached video is that the feature flash continuously even when the mouse is stopped, you see both the temporary body both in StatusBar Solidworks.

      I tried turning off the graphics generation, but it is not the right solution.

       

      These are my steps to generate the temporary body:

       

       

      Function TheMouse_MouseMoveNotify(ByVal X As Long, ByVal Y As Long, ByVal WParam As Long) As Long

       

       

      swBodytemp = Nothing

      GC.Collect()

       

      GC.Collect()

       

       

      swModeldoc.GraphicsRedraw2()

       

       

       

       

      ''''

      ''''

      ''''

       

      PreSelectionPoint(SwModeldoc_Globale, ModViewX, ModViewY, RefFace)

       

       

      swBodytemp = swModeler.CreateBodyFromCyl(CylDimArray)

       

       

       

      retval = swBodytemp.Display3(MyswPart, 0, swTempBodySelectOptions_e.swTempBodySelectOptionNone) 'IN MY OPINION THE PROBLEM HERE IS , BECAUSE FOR EVERY CREATION OF THE MODEL REDRAW THE GRAPHIC AREA

       

      End Function

       

      Have you an idea for fix this problem?

      Thanks to every one

      Roberto

       

       

       

       

       

        • Re: Flashing TemporaryBody Feature preview Mouse Event
          Artem Taturevych

          Hi Roberto,

           

          You are trying to do an animation with the macro feature. Unfortunately they are not designed for this. You need to use the Open GL functions to render your animation. Take a look at this thread: Is there support for rendering IBody2 objects in opengl

           

          Thanks,
          Artem

            • Re: Flashing TemporaryBody Feature preview Mouse Event
              roberto gennari

              Hi Artem,

              thanks a lot for your answare.

              If I understand it you're telling me that there is no solution to my problem, if not using OpenGL?

               

              There is a Function where I can pass my swBody (Temporary) and is converted to render?

              Do you think the HoleWizard command SolidWorks, during insertion of the points of the holes, using the render event of mouse movement?

               

               

              For me I can not use the Open GL functions is really a problem.

               

              What do you think about it?

              I know you are very knowledgeable in this and I respect you a lot

               

              Thanks

              Roberto

                • Re: Flashing TemporaryBody Feature preview Mouse Event
                  Artem Taturevych

                  I would suggest to create a temp body as you do it now then get the tessellation and render this tessellation using the OpenGL.

                  For me I can not use the Open GL functions is really a problem.

                  Is this because you do not have experience with OGL or there are some other reasons?

                  Do you think the HoleWizard command SolidWorks, during insertion of the points of the holes, using the render event of mouse movement?

                  To be honest, I'm not sure. These might be some special internal functions for this.

                    • Re: Flashing TemporaryBody Feature preview Mouse Event
                      roberto gennari

                      Hi Artem,

                      thanks a lot for your answare.

                      I'm havn't experience about Open GL function and his leanguage, I'd like to study well the OpenGL if you could give me the support.

                      As I understand it after I created my temporary body

                       

                      swBodytemp = swModeler.CreateBodyFromCyl(CylDimArray)

                       

                      execute it's tessellation with

                      IGetTessellation Method (IBody2)

                       

                      I read that part of the code should be inserted in the event render

                      DModelViewEvents_BufferSwapNotifyEventHandler

                      is correct?

                       

                      Luckily my temporary body has few faces and a few edges (CreateBodyFromCyl), you could steer a bit with the code?

                      I use VB.Net, I do not know C #

                       

                      Thank you a lot

                      Roberto