Fixing all components in imported step file

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

Reply to
solid steve
Loading thread data ...

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

Reply to
TOP

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

steve

Reply to
solid 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
***
Reply to
Wayne Tiffany

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

Reply to
solid 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
***
Reply to
Wayne Tiffany

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

Reply to
Devon T. Sowell

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
***
Reply to
Wayne Tiffany

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

Reply to
Bigbear

Reply to
FrankW

Thanks Frank That seems to work well!

Reply to
Bigbear

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.