Fixing all components in imported step file

Discussion in 'SolidWorks' started by solid steve, Feb 16, 2006.

  1. solid steve

    solid steve Guest

    Has anyone created a macro that can fix, as in not float, all parts in
    all subassembly's
    I have a step file with about 1000 parts and 50 subassembly's

    steve
     
    solid steve, Feb 16, 2006
    #1
  2. solid steve

    TOP Guest

    You might start by searching the newsgroup. This has been discussed
    before.
     
    TOP, Feb 16, 2006
    #2
  3. solid steve

    solid steve Guest

    I did but for some reason fix and fixing are very popular terms in this
    group :)

    steve
     
    solid steve, Feb 16, 2006
    #3
  4. I have one that I use especially for imported models that goes through and
    fixes all parts. Email me and I will send it to you.

    Or, you can go to http://kcswug.com/programs/macros/ and find fixall.swp in
    the list.

    WT


    *** Free account sponsored by SecureIX.com ***
    *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
     
    Wayne Tiffany, Feb 16, 2006
    #4
  5. solid steve

    solid steve Guest

    Hi Wayne

    Thanks for your help, but I must be doing something wrong, with the top
    level assy open I run the macro but nothing happens. I am a complete
    macro virgin, I keep meaning to give them a bit of time, but always
    seem to busy.


    steve
     
    solid steve, Feb 16, 2006
    #5
  6. Hmmm, I just tried it with SW2006, opened an assy, ran the macro, and all
    parts are now fixed. Do you get any error messages? What version of SW are
    you on?

    WT


    *** Free account sponsored by SecureIX.com ***
    *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
     
    Wayne Tiffany, Feb 16, 2006
    #6
  7. Try this:

    '
    ******************************************************************************
    'FixAll
    'Devon T. Sowell, 3-D Design Solutions, www.3-ddesignsolutions.com, 760
    809-9046
    '
    ******************************************************************************
    Option Explicit
    Dim swApp As Object
    Dim AssyDoc As Object
    Dim Configuration As Object
    Dim Part As Object
    Dim Component() As Object
    Dim RootComponent As Object
    Dim Child As Object
    Dim i, ChildCount As Integer
    Dim retval As Boolean
    Dim AssyName As Variant
    Const swDocASSEMBLY = 2

    Sub main()
    Set swApp = CreateObject("SldWorks.Application")
    Set AssyDoc = swApp.ActiveDoc ' Current document
    If (AssyDoc.GetType <> swDocASSEMBLY) Then Exit Sub ' Make sure this is an
    assembly

    AssyName = AssyDoc.GetTitle 'Current Assy Name
    If InStr(1, AssyName, ".") Then
    AssyName = Left$(AssyName, InStr(1, AssyName, ".") - 1) 'Strip off
    ..SLDASM if its there
    End If

    ' Find the Root Component
    Set Configuration = AssyDoc.GetActiveConfiguration()
    Set RootComponent = Configuration.GetRootComponent()

    ' Get list of children
    Component = RootComponent.GetChildren

    ChildCount = UBound(Component) + 1
    For i = 0 To (ChildCount - 1) ' For each Child in this subassembly
    Set Child = Component(i) ' Get Child component object
    retval = AssyDoc.SelectByID(Child.name2 & "@" & AssyName, "COMPONENT",
    0, 0, 0) ' Select it
    AssyDoc.FixComponent ' Fix it
    Next i
    End Sub
     
    Devon T. Sowell, Feb 16, 2006
    #7
  8. Interesting - same code that I have.

    WT


    *** Free account sponsored by SecureIX.com ***
    *** Encrypt your Internet usage with a free VPN account from http://www.SecureIX.com ***
     
    Wayne Tiffany, Feb 16, 2006
    #8
  9. solid steve

    Bigbear Guest

    How does one search the newsgroup? I am using Outlook Express as the reader
    and can see that there are about 60000 mesages available that I have not
    read (including all the headers I have downloaded. Can one search the
    newsgroup without downloading all those headers?

    TIA

    bigbear
     
    Bigbear, Feb 16, 2006
    #9
  10. solid steve

    FrankW Guest

    goto dejanews
     
    FrankW, Feb 16, 2006
    #10
  11. solid steve

    Bigbear Guest

    Thanks Frank
    That seems to work well!


     
    Bigbear, Feb 16, 2006
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.