cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

VBA-API change active sheet

ppandarkar-2
15-Moonstone

VBA-API change active sheet

 Hello.

 

I would like to change the active sheet on a drawing using VBA-API, but I can't find any way to do it, I'm new to VBA-API. The best I cold manage was to use macro to change sheets, which worked, but did produce somr undesired effect.

 

The documentation states "You can regenerate a sheet only if it is displayed.", so it must be possible to change  the displayed sheet.

 

My code so far

Public Sub change_sheet_parameter()
     
        Dim conn As IpfcAsyncConnection
        Dim cAC As CCpfcAsyncConnection
        Dim session As IpfcBaseSession
        Dim model1 As IpfcModel
        Dim sheetData As IpfcSheetData
        Dim sheetowner As IpfcSheetOwner
        Dim sheetInfo As IpfcSheetInfo


Set cAC = New CCpfcAsyncConnection
Set conn = cAC.Connect("", "", ".", 5)

Set session = conn.session



Dim oModelDescriptorCreate As New CCpfcModelDescriptor
Dim oModelDescriptor As IpfcModelDescriptor

name_w = "SHM-7457-004.drw" 'Name of the drawing

 Set oModelDescriptor = oModelDescriptorCreate.Create(EpfcMDL_DRAWING, name_w, Null)
 Set model1 = session.RetrieveModel(oModelDescriptor)
 Set sheetowner = model1

    Dim oWindow As pfcls.IpfcWindow
    Set oWindow = session.OpenFile(oModelDescriptor)

    oWindow.Activate


Set sheetInfo = sheetowner.GetSheetInfo(1)
test_ = sheetInfo.Height
MsgBox test_

'The part where I would like to change the displayed sheet.

sheetowner.RegenerateSheet (1)

End Sub
1 REPLY 1

The .x_b is the binary format of a .x_t file. My guess is that PTC is only licensing the text format and not the binary format so you will only get the .x_t files. The only difference would be in the size of the exported file.

The results when imported into another system should be the same.

Top Tags