Hi i'm new to macros and API.
I am trying to create a marco to add .002" to a dimension of a part(in an assembly ), then save a Jpeg (of the assembly). I need torepeat this step 250 times. Also, it would be great if the Jpegscould be saved with incrimenting file names (for example, jpeg1,jpeg2, jepg3.... jpeg250)
I tried recording a marco with in solidworks, but i'm not havingmuch luck.
Here's what i was able to record...
' ************************
' C:\DOCUME~1\Ryan\LOCALS~1\Temp\swx228\Macro1.swb - macro recordedon 12/10/08 by Ryan
' *************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
---------------------------------------
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
boolstatus = Part.Extension.SelectByID2("change this in .001inc.@gel-1@Medipacs Assembly", "SKETCH", 0, 0, 0, False, 0,Nothing, 0)
Part.ActivateSelectedFeature
boolstatus = Part.Extension.SelectByID2("D1@change this in .001inc.@gel-1@Medipacs Assembly", "DIMENSION", 0.03445823466426,0.001334141779371, -0.004879878089606, False, 0, Nothing, 0)
Part.Parameter("D1@change this in .001 inc.@gel.Part").SystemValue= 0.0030734
Part.ClearSelection2 True
boolstatus = Part.EditRebuild3
Part.Extension.SaveAs "C:\Documents and Settings\AllUsers\Documents\medipacs animation\1.JPG", 0, 0, Nothing,longstatus, longwarnings
End Sub
----------------------------
Can someone help?SolidworksApi macros
I am trying to create a marco to add .002" to a dimension of a part(in an assembly ), then save a Jpeg (of the assembly). I need torepeat this step 250 times. Also, it would be great if the Jpegscould be saved with incrimenting file names (for example, jpeg1,jpeg2, jepg3.... jpeg250)
I tried recording a marco with in solidworks, but i'm not havingmuch luck.
Here's what i was able to record...
' ************************
' C:\DOCUME~1\Ryan\LOCALS~1\Temp\swx228\Macro1.swb - macro recordedon 12/10/08 by Ryan
' *************************
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
---------------------------------------
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
swApp.ActiveDoc.ActiveView.FrameState = 1
boolstatus = Part.Extension.SelectByID2("change this in .001inc.@gel-1@Medipacs Assembly", "SKETCH", 0, 0, 0, False, 0,Nothing, 0)
Part.ActivateSelectedFeature
boolstatus = Part.Extension.SelectByID2("D1@change this in .001inc.@gel-1@Medipacs Assembly", "DIMENSION", 0.03445823466426,0.001334141779371, -0.004879878089606, False, 0, Nothing, 0)
Part.Parameter("D1@change this in .001 inc.@gel.Part").SystemValue= 0.0030734
Part.ClearSelection2 True
boolstatus = Part.EditRebuild3
Part.Extension.SaveAs "C:\Documents and Settings\AllUsers\Documents\medipacs animation\1.JPG", 0, 0, Nothing,longstatus, longwarnings
End Sub
----------------------------
Can someone help?SolidworksApi macros