3 Replies Latest reply on Jun 12, 2014 5:56 AM by Santosh Pawar

    Create SpeadPack automatically Using API

    Rami Noah

      Hi,

       

      I have posted this query also in Asseblies discussion = Sorry for the hassle.

       

      like all we having some issues with large assemblies preformance.

      one off the new technique i'm about to implement is SpeadPack.

       

      what i would like to advice with you is the necessety and advantage of writing adedicated utility, using API, for

      creating default speadpack for high-levels asms.

       

      any special recomandation for ? something in specific to watch\check ?

      does SW have such a tool already in place in task scedualre or somewhere else ( partners / self development )?

       

      Many thanks,

      Ram

        • Re: Create SpeadPack automatically Using API
          Manikandan Babu

          Dear Rami,

           

                              Run this macro in Toplevelassembly ,it will create default speedpak every subassembly which is present in toplevel.

           

          Option Explicit

          Dim swApp As SldWorks.SldWorks

          Dim swmodel As SldWorks.ModelDoc2

          Dim swassembly As SldWorks.AssemblyDoc

          Dim vcomp As Variant

          Dim i As Integer

          Dim j As Integer

          Dim comp As SldWorks.Component2

          Dim error As Long

          Dim warning As Long

          Dim assemblytitle As String

          Dim ConfigMgr As SldWorks.ConfigurationManager

          Sub main()

          Set swApp = Application.SldWorks

          Set swmodel = swApp.ActiveDoc

          Set swassembly = swmodel

          assemblytitle = swmodel.GetPathName

          vcomp = swassembly.GetComponents(True)

          For i = 0 To UBound(vcomp)

              Set comp = vcomp(i)

              swApp.OpenDoc6 comp.GetPathName, 2, 0, "", error, warning

              swApp.ActivateDoc2 comp.GetPathName, True, error

              Set swmodel = swApp.ActiveDoc

              Set ConfigMgr = swmodel.ConfigurationManager

              ConfigMgr.AddSpeedPak2 2, 0.5

              swApp.CloseDoc swmodel.GetTitle

          Next

              For j = 0 To UBound(vcomp)

                  Set comp = vcomp(j)

                  comp.ReferencedConfiguration = "Default_speedpak"

              Next

              Set swmodel = swApp.ActivateDoc2(assemblytitle, True, error)

              swmodel.ForceRebuild3 True

              swApp.SendMsgToUser ("Speedpak completed")

          End Sub

           

          Manikandan

          EGS Computers India Pvt Ltd

          http://www.egsindia.com

          http://www.egs.co.in