×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Running all the configurations with a macro
3

Running all the configurations with a macro

Running all the configurations with a macro

(OP)
With SWX  Animator>Screen Capture, I would like to make an AVI file by running all the configurations one after the other to show the automation process. Is there any macro I can find?

RE: Running all the configurations with a macro

Have you tried making your own macro by recording all the keystrokes?

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: Running all the configurations with a macro

(OP)
My Design Table is having 360 configurations to run and I’m not an API guy.

Tanks, Anyway I'll give a try.

RE: Running all the configurations with a macro

(OP)
To recode all the configurations or to edit the macro with all the configuration names is not easy.

RE: Running all the configurations with a macro

If you go to http://www.mikejwilson.com/solidworks/solidworks_files-05.htm and download Mandrel Pipe Bender, he did what you are trying to do.  He used Animator instead of using a macro to transverse an assembly and capturing screenshots to make an avi file.  After downloading the zip file, open Pipe Bender.sldasm, go to "animation - none" and hit play.  I really haven't used the animator, but hopefully now someone here understands what you want to do and can help you better.

Flores
SW06 SP4.1

RE: Running all the configurations with a macro

3
1)Paste the following into a new macro and assign the macro to a toolbutton.  You don't really have to trigger the macro from a button but it is easier if you do this regularly.
2) Set window size as required.
3) Zoom out so that the model will not extend past the boundaries of the viewport in any of the configurations
4) Choose "screen capture", type in .avi name and choose SWX screen renderer.
5) Run the config iteration macro from the toolbar button you assigned in step 1.
6) Stop screen capture.

FYI, this is one way to make animations of bending of sheet metal and tubing, which has been requested here many times.

CODE

Option Explicit
Const PAUSETIME = 0.01

Sub Main()

    Dim swApp                   As SldWorks.SldWorks
    Dim swModel                 As SldWorks.ModelDoc2
    Dim vConfNameArr            As Variant
    Dim sConfigName             As String
    Dim Start                   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)
        bRebuild = swModel.ForceRebuild3(False)
        
        Start = Timer
        Do While Timer < Start + PAUSETIME
            DoEvents    ' Yield to other processes.
        Loop

        Debug.Print "  Config       = " & sConfigName
    Next i

End Sub

RE: Running all the configurations with a macro

Worked great Stoker.  After making all necessary configurations, I closed the assembly and opened it "Lightweight".  This made everything run smoother for the video.  If you have a fast computer, this may not be an issue.

Flores
SW06 SP4.1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources