Reloading Sheet format with API

  • Follow


Hi

I've been tring to reload a sheet format using the API but it doesn't
appear to work - no error messages just doesn't do it . What am I
missing?

Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc
Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False,_
 "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", 0.297, 0.21,
"Default"
Part.EditSketch
End Sub

Cheers

Craig
0
Reply swatoscmar 11/4/2004 3:55:10 AM

I think your paper size constants are wrong

Your code

Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False,_
>  "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", 0.297, 0.21,

My code that works
Part.SetupSheet4 "Sheet1", 1, 1, 1, 1, False, "B portrait.slddrt", 0.297,
0.21, "Default"

Look in the swconst.bas for details on  the constants.  Also it may cause
problems to split the code line.
If the sheet name is different i.e. "sheet 2" the code would not work.

Goood luck

Warren

"Craig T" <swatoscmar@yahoo.co.nz> wrote in message
news:6638b876.0411031955.97e9240@posting.google.com...
> Hi
>
> I've been tring to reload a sheet format using the API but it doesn't
> appear to work - no error messages just doesn't do it . What am I
> missing?
>
> Dim swApp As Object
> Dim Part As Object
> Dim boolstatus As Boolean
> Dim longstatus As Long
> Dim Annotation As Object
> Dim Gtol As Object
> Dim DatumTag As Object
> Dim FeatureData As Object
> Dim Feature As Object
> Dim Component As Object
> Sub main()
>
> Set swApp = Application.SldWorks
>
> Set Part = swApp.ActiveDoc
> Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False,_
>  "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", 0.297, 0.21,
> "Default"
> Part.EditSketch
> End Sub
>
> Cheers
>
> Craig


0
Reply Warren 11/4/2004 4:21:23 PM


'this has been tested and it works. make sure STA4 2004.slddrt is in folder
'G:\SolidWorks\Sheet Formats.

'hope this helps you out.

Option Explicit

Dim swApp As SldWorks.SldWorks
Dim Part As Object

Sub main()

Set swApp = New SldWorks.SldWorks
Set Part = swApp.ActiveDoc
Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False, _
"G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", _
0.297, 0.21, "Default"
Part.EditSketch
End Sub



swatoscmar@yahoo.co.nz (Craig T) wrote in message news:<6638b876.0411031955.97e9240@posting.google.com>...
> Hi
> 
> I've been tring to reload a sheet format using the API but it doesn't
> appear to work - no error messages just doesn't do it . What am I
> missing?
> 
> Dim swApp As Object
> Dim Part As Object
> Dim boolstatus As Boolean
> Dim longstatus As Long
> Dim Annotation As Object
> Dim Gtol As Object
> Dim DatumTag As Object
> Dim FeatureData As Object
> Dim Feature As Object
> Dim Component As Object
> Sub main()
> 
> Set swApp = Application.SldWorks
> 
> Set Part = swApp.ActiveDoc
> Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False,_
>  "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", 0.297, 0.21,
> "Default"
> Part.EditSketch
> End Sub
> 
> Cheers
> 
> Craig
0
Reply sldprt 11/4/2004 5:01:09 PM

Found my problem, the sheet format file name must be different from
the existing one to trigger a reload. (I was trying to reload the old
sheet format again). If
you want to do that you can use

Sheet.SetTemplateName "Some dummy name"
Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False, _
 "Old sheet format file and path", _
 0.297, 0.21, "Default"

Craig


sldprt@hotmail.com (Sean Phillips) wrote in message news:<edcc2afe.0411040901.4bd488a5@posting.google.com>...
> 'this has been tested and it works. make sure STA4 2004.slddrt is in folder
> 'G:\SolidWorks\Sheet Formats.
> 
> 'hope this helps you out.
> 
> Option Explicit
> 
> Dim swApp As SldWorks.SldWorks
> Dim Part As Object
> 
> Sub main()
> 
> Set swApp = New SldWorks.SldWorks
> Set Part = swApp.ActiveDoc
> Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False, _
> "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", _
> 0.297, 0.21, "Default"
> Part.EditSketch
> End Sub
> 
> 
> 
> swatoscmar@yahoo.co.nz (Craig T) wrote in message news:<6638b876.0411031955.97e9240@posting.google.com>...
> > Hi
> > 
> > I've been tring to reload a sheet format using the API but it doesn't
> > appear to work - no error messages just doesn't do it . What am I
> > missing?
> > 
> > Dim swApp As Object
> > Dim Part As Object
> > Dim boolstatus As Boolean
> > Dim longstatus As Long
> > Dim Annotation As Object
> > Dim Gtol As Object
> > Dim DatumTag As Object
> > Dim FeatureData As Object
> > Dim Feature As Object
> > Dim Component As Object
> > Sub main()
> > 
> > Set swApp = Application.SldWorks
> > 
> > Set Part = swApp.ActiveDoc
> > Part.SetupSheet4 "Sheet1", 6, 12, 1, 1, False,_
> >  "G:\SolidWorks\Sheet Formats\STA4 2004.slddrt", 0.297, 0.21,
> > "Default"
> > Part.EditSketch
> > End Sub
> > 
> > Cheers
> > 
> > Craig
0
Reply swatoscmar 11/14/2004 11:58:43 PM

3 Replies
402 Views

(page loaded in 0.145 seconds)

Similiar Articles:













7/23/2012 8:07:31 AM


Reply: