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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Change Drawing Sheet format Using VB.NET (Sheet Setup)

bsomasundaram
1-Visitor

Change Drawing Sheet format Using VB.NET (Sheet Setup)

Hi Guys,

I need to change Drawing Sheet format Using VB.NET, I tried with below coding and I am getting error while "fdescr = (New CCpfcModelDescriptor)."

Please help to solve.

Coding:

            If Not lmoddoc Is Nothing Then

                Dim x As Integer

                Dim sheets As Integer

                Dim sheetdata As IpfcSheetData

                Dim sheetformat As IpfcDrawingFormat

                Dim drwonr As IpfcSheetOwner

                Dim fdescr As IpfcModelDescriptor

                Dim drw As pfcls.IpfcDrawing

                Dim drwl As IpfcLayout

                Dim bsession As IpfcBaseSession

                Dim drawing As IpfcDrawing

                lmoddoc.Display()

                session.CurrentWindow.Activate()

                model = session.CurrentModel

                drawing = CType(model, IpfcDrawing)

              fdescr = (New CCpfcModelDescriptor).CreateFromFileName("C:\Program Files\PTC\Creo 2.0\Common Files\F000\creo_standards\formats\a4_format.frm")

                Dim fmt As IpfcDrawingFormat

                fmt = session.RetrieveModel(fdescr)

                drwonr = CType(drawing, IpfcSheetOwner)

                drwonr.SetSheetFormat(1, fmt, 1, Nothing)

            End If


Error:

Please find attached file for error report

Could you Please confirm whether my code is correct or wrong when i try to retrievemodel

if it is possible to update current drawing sheet width and height, its very useful.

2 REPLIES 2

Hi Balaji,

according to the documentation, CreateFromFileName expects the name in this form:

The file name, of the form "<name>.<extension>"

Try to set the working directory to the required path or set search_path to that directory and call CreateFromFileName("a4_format.frm")

Regards,

Tom

Hi Tomas,

Thanks for your reply.

As per your instruction, i have updated my config.pro file for search_path = "C:\Program Files\PTC\Creo 2.0\Common Files\F000\creo_standards\formats"


and updated the code like

fdescr = (New CCpfcModelDescriptor).CreateFromFileName("a4_format.frm")


after updation new error occurred while run the code at line of

fmt = session.RetrieveModel(fdescr)


Error Image:

Drwfrmt-n-err.png

I think i have some problem in retrieve process. Please help.

Regards,

Balaji

Announcements


Top Tags