Hello all,
My name Stanislav Spektor from Israel.
I am use software version 2010 SP1.0.
Before few year one employee build macro file, in this macro has two parameters.
First parameter width, other parameter height in construction model.
After run macro, model change in two parameters, but problem, drawing sheet doesn’t change scale.
In this reason model exceed from drawing sheet.
I search helps who know macro and help me or give direction.
Macro code:
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
boolstatus = Part.ActivateView("Drawing View1")
boolstatus = Part.Extension.SelectByID2("DetailItem145@Drawing View1", "NOTE", 0.2043458840282, 0.1700934820286, 0, False, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("DetailItem145@Drawing View1", "NOTE", 0.2057870681322, 0.1700934820286, 0, False, 0, Nothing, 0)
boolstatus = Part.SetupSheet5("KOROT", 12, 12, 1, 2, False, "C:\Program Files\SolidWorks\data\A4-Vert.slddrt", 0.2794, 0.2159, "Default", False)
- Part.ClearSelection2 True
' Release Data
F = Part.DeleteCustomInfo2("", "makat")
F = Part.DeleteCustomInfo2("", "gimur")
Dim swView As SldWorks.View
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swView = swDraw.GetFirstView
Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
' Set swView = swView.GetNextView
For k = 6 To 15 '7-15 ''MIS110 6-15
W = k * 100
For j = 70 To 100 Step 5 '30-100
L = j * 100
swView.ReferencedConfiguration = Trim(Str(L)) & "-" & Trim(Str(W))
swModel.EditRebuild
For i = 1 To 5 ' GIMUR
'130 for B , 120 for A , 110 MISG110
gimur = 100 + i ' 01 - painted , 02 - megulvan, 04 - gilvun ham, 05 - meorav
g = Switch(i = 1, "öáåò", i = 2, "îâåìååï", i = 3, "ììà âéîåø", i = 4, "âéìååï çí", i = 5, "îòåøá")
' Prepare the MAKAT
makat = "09-" & Trim(Str(gimur + panel)) & "-00" & Trim(Str(W / 10)) & "-0" & Trim(Str(L / 10))
If W > 999 Then
makat = "09-" & Trim(Str(gimur + panel)) & "-0" & Trim(Str(W / 10)) & "-0" & Trim(Str(L / 10))
End If
If L > 9999 Then
makat = "09-" & Trim(Str(gimur + panel)) & "-00" & Trim(Str(W / 10)) & "-" & Trim(Str(L / 10))
End If
If W > 999 And L > 9999 Then
makat = "09-" & Trim(Str(gimur + panel)) & "-0" & Trim(Str(W / 10)) & "-" & Trim(Str(L / 10))
End If
' Capture Data
retval = Part.AddCustomInfo3("", "makat", swCustomInfoText, makat)
retval = Part.AddCustomInfo3("", "gimur", swCustomInfoText, g)
' Save
Part.SaveAs2 "C:\NEWPDF1\" & makat & ".PDF", 0, True, False
' Release Data
F = Part.DeleteCustomInfo2("", "makat")
F = Part.DeleteCustomInfo2("", "gimur")
Next i
Next j
Next k
End Sub
Thanks
Stanislav
SolidworksApi macros