I have to move and save a bunch of parts in a assembly and then save a tiff image of them. I have to repeate it about 200 times, so i want have a macro do the job for me.
But i cannot get the macro to move the selected components. It just saves the same image again and again.
Here is the macro code. Does anyoen have any idea what might be wrong?
Regards
Peter
' ****************************************************************************** ' C:\DOCUME~1\vmpeut\LOKALE~1\Temp\swx3864\Macro1.swb - macro recorded on 03/10/05 by vmpeut ' ****************************************************************************** Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim FeatureData As Object Dim Feature As Object Dim Component As Object Dim counter As Integer
Sub main()
Set swApp = Application.SldWorks For counter = 1 To 10
Set Part = swApp.ActiveDoc boolstatus = Part.Extension.SelectByID("emnederived-1@flytbund", "COMPONENT", 0, 0, 0, False, 0, Nothing) boolstatus = Part.Extension.SelectByID("centraludstøder2-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstøder-4@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstøder-3@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstøder-2@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstøder-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("bevægelig opspændingsplade-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstøderholdeplade-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("udstødertrykplade-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("lineal-3@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("lineal-2@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("indsats-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) boolstatus = Part.Extension.SelectByID("bevægelig formplade-1@flytbund", "COMPONENT", 0, 0, 0, True, 0, Nothing) Part.TranslateComponent Part.ClearSelection2 True
Part.SaveAs2 "\\stsfil\Brugerprofiler\vmpeut\Desktop\a" & Str(counter) & ".tif", 0, True, False Next counter End Sub