Macro to Set Printing Line Weights 2009

I've made this macro to set printing line weights. It worksfor setting any line weight above .01 . In this macro, the first 3line weights are not set (.003 .005 .007), but the last 5 are set(.01 .014 .017 .02 .06).

Is there any way to set a line weight below .01?

Any help would be greatly appreciated.



Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swLayerMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer
Dim ModelDocExtension As ModelDocExtension
Dim boolstatus As Boolean
Public arrLayerNames(76) As String
Public arrLineWeight(76) As Variant



Sub main()

'Half Size Plot

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

Set ModelDocExtension = swModel.Extension

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThinLineWeight,0, 0.0000762) '0.0030

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterNormalLineWeight,0, 0.000127) '0.0050

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThickLineWeight,0, 0.0001778) '0.0070

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThick2LineWeight,0, 0.000254) '0.0100

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThick3LineWeight,0, 0.0003556) '0.0140

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThick4LineWeight,0, 0.0004318) '0.0170

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThick5LineWeight,0, 0.000508) '0.0200

boolstatus =ModelDocExtension.SetUserPreferenceDouble(swUserPreferenceDoubleValue_e.swPageSetupPrinterThick6LineWeight,0, 0.001524) '0.0600

End Sub
SolidworksApi macros
Answers 4
SF
SF 2009-01-29 Best Answer
It is probably being set but your printer cannot go below acertain size. Try setting them to bigger sizes to see if theyactually alter.
SF
SF 2009-01-29
Any size above .01 sets correctly.

It has been reported by Solidworks as a critical bug where a macrocannot set a print line weight below .01

Waiting for a fix. Or if anyone can think of a workaround? It wouldbe greatly appreciated!

Thanks guys
SF
SF 2009-01-30
Bit of a rubbish work around but export to another format(such as dxf) and set the thickness and print through anotherprogram
SF
SF 2009-02-12
Found a nice workaround. I wrote a macro that just sendskeystrokes to solidworks.
It effectively sets the line thickness for printing. We heard backfrom SolidWorks that the bug will be fixed in 2009 SP03.

But, this macro works for now.
Here it is in case anyone's interested:

Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelView As SldWorks.ModelView

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

'Open Line Weight Area
SendKeys "^p"
SendKeys "%l"

'thin
SendKeys "%n"
SendKeys ".003"

'normal
SendKeys "%o"
SendKeys ".005"

'thick
SendKeys "%k"
SendKeys ".007"

'thick2
SendKeys "%2"
SendKeys ".01"

'thick3
SendKeys "%3"
SendKeys ".014"

'thick4
SendKeys "%4"
SendKeys ".017"

'thick5
SendKeys "%5"
SendKeys ".02"

'thick6
SendKeys "%6"
SendKeys ".06"

'save settings
SendKeys "{ENTER}"

'close print window
SendKeys "{ESC}"


End Sub