Reloading Sheet format with API

Discussion in 'SolidWorks' started by Craig T, Nov 4, 2004.

  1. Craig T

    Craig T Guest

    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
     
    Craig T, Nov 4, 2004
    #1
  2. '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
     
    Sean Phillips, Nov 4, 2004
    #2
  3. Craig T

    Craig T Guest

    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
     
    Craig T, Nov 14, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.