Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro 1

Status
Not open for further replies.

malis

Mechanical
Nov 29, 2005
31
I have a design table inserted into my assembly that controls the motion of a skeleton sketch. I'm using the design table to drive one dimesion while getting the results of another dimension. The problem is that you have to activate each configuration in order for the design table to record the result of the second dimension. In my case i have 70 configs. Does anyone have a Macro that will do this process for me? or is there an easier way to get this information.

Thanks
 
Replies continue below

Recommended for you

Can you explain a bit more about what you are trying to do & how you are doing it?

Can you not build formulae/equations into the DT which populate the other configuration dimensions?

[cheers]
Helpful SW websites faq559-520​
How to find answers ... faq559-1091​
 
I made my DT's fully automated, using Excel formula's and equations... I never had any problems such as that... but you do have to activate the config before the model would update to the new specs given for each COnfig.

Regards,

Scott Baugh, CSWP [pc2]
faq731-376
 
If you want to force a rebuild of every configuration there is a macro in the help to do that. Here it is:

SolidWorks API Help said:
Forcibly Rebuild All Configurations Example (VB)
This example shows how to forcibly rebuild all of the configurations in a SolidWorks document.


Code:
'--------------------------------------

Option Explicit

Sub main()

    Dim swApp                   As SldWorks.SldWorks

    Dim swModel                 As SldWorks.ModelDoc2

    Dim vConfNameArr            As Variant

    Dim sConfigName             As String

    Dim nStart                  As Single

    Dim i                       As Long

    Dim bShowConfig             As Boolean

    Dim bRebuild                As Boolean

    Dim bRet                    As Boolean

    

    Set swApp = CreateObject("SldWorks.Application")

    Set swModel = swApp.ActiveDoc

    

    Debug.Print "File = " + swModel.GetPathName

    

    vConfNameArr = swModel.GetConfigurationNames

    For i = 0 To UBound(vConfNameArr)

        sConfigName = vConfNameArr(i)

        

        bShowConfig = swModel.ShowConfiguration2(sConfigName)

        

        nStart = Timer

        bRebuild = swModel.ForceRebuild3(False)

        

        Debug.Print "  Config       = " & sConfigName

        Debug.Print "    ShowConfig = " & bShowConfig

        Debug.Print "    Rebuild    = " & bRebuild

        Debug.Print "    Time       = " & Timer - nStart & " s"

    Next i

End Sub

'--------------------------------------
 
Thanks Handleman, That is exactly what i was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor