Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Solved! Go to Solution.
Use below available J-Link functions (OTK Java):
Note: Above functions will need OTK Java licenses to use in Creo Parametric. For J-Link users, macros can be used as a workaround.
Thanks for the help, but I'm stuck with the function:
voidSetSheetFormat(int SheetNumber, DrawingFormat Format, /*optional*/ Integer FormatSheetNumber, /*optional*/ Model DrawingModel)
How do I define parameter Format ? I need a variable sheet, and there is no format defined for that. And null does not work
Below sample code changes the format of sheet# 1 in session and uses an existing .frm stored in the working directory
ModelDescriptor desc = null;
session.GetCurrentWindow().Activate();
desc = pfcModel.ModelDescriptor_CreateFromFileName("a0_iso.frm");
desc.SetPath (""); //frm file is stored in the working directory, set your own format folder path here
DrawingFormat format = (DrawingFormat) session.RetrieveModelWithOpts(desc, pfcSession.RetrieveModelOptions_Create());
cur_drw.SetSheetFormat(1, format, null, null); //applies to the first sheet
Note:
The Method SetSheetFormat() is designed only to insert a new format sheet in a drawing sheet This method is not designed to replace or remove existing drawing tables that are copied in to drawing from previous format.
Users should identify and remove the old drawing tables using pfcTable.CheckIfIsFromFormat() and DeleteTable() Example Code Snippet: Tables tables = drw.ListTables(); System.out.println("tables info" + tables.toString()); for (int i = 0; i < tables.getarraysize(); i++) { Table table = tables.get(i); System.out.println("table" + table); if (table.CheckIfIsFromFormat(drwSheetNum) == true) { drw.DeleteTable(table, Boolean.FALSE); } }
Thank you again but this does not solve my problem.
I want to assign a Variable format with size 1x1, without using any ".frm" for that
I tried:
DrawingFormat drawingFormat = null;
drawing.SetSheetFormat(2, drawingFormat, null, null); // this fails
I changed the format manually to variable and read it:
DrawingFormat drawingFormat = drawing.GetSheetFormat(2);
Interestingly the value of drawingFormat is null
And I tried to set the value of width and height to 1:
drawing.GetSheetData(2).SetHeight(1);
drawing.GetSheetData(3).SetWidth(1);
But it does not work (documentation says GetSheetData is deprecated)
If I don't find a way to do this JLink I will try to do it with mapkeys
I would suggest to log a case with PTC Technical Support explaining your use case and share details of what you tried. So that, it can further investigated.
I have done so, thank you!
Use below available J-Link functions (OTK Java):
Note: Above functions will need OTK Java licenses to use in Creo Parametric. For J-Link users, macros can be used as a workaround.