Fixing all components in imported step file

Feb 16, 2006 10 Replies

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



You might start by searching the newsgroup. This has been discussed before.

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

steve

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

formatting link
and find fixall.swp in the list.

WT

*** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from
formatting link
***

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

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
formatting link
***

Try this:

' ****************************************************************************** 'FixAll 'Devon T. Sowell, 3-D Design Solutions,
formatting link
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

Interesting - same code that I have.

WT

*** Free account sponsored by SecureIX.com *** *** Encrypt your Internet usage with a free VPN account from
formatting link
***

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

Thanks Frank That seems to work well!

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required