User's Guide > Interface: Data Exchange > Exporting 2D Models > Example 1 Publishing a Drawing
Example 1 Publishing a Drawing
The sample code in UgDwgPublishContext.c located at <creo_toolkit_loadpoint>/protk_appls/pt_userguide/ptu_dwg shows how to publish a drawing in the given context.
The functions Pro2dExportdataAlloc() and Pro2dExportdataFree() allocate and free the memory for the Pro2dExportdata object containing the 2D export options and flags.
The function Pro2dExportdataSheetoptionSet() assigns the sheet export option for export to the specified 2D format. The sheet export option can take one of the following values:
PRO2DEXPORT_CURRENT_TO_MODEL_SPACE—Specifies that only the drawing’s current sheet will be exported as model space into the specified 2D format. This is the default value.
PRO2DEXPORT_CURRENT_TO_PAPER_SPACE—Specifies that only the drawing’s current sheet will be exported as paper space into the specified 2D format. This value is only available for formats that support the concept of model space and paper space, for example, DXF and DWG.
PRO2DEXPORT_ALL—Specifies that all the sheets in a drawing will be exported into the specified 2D format as paper space, if applicable to the format type.
PRO2DEXPORT_SELECTED—Specifies that selected sheets in a drawing will be exported as paper space and one sheet will be exported as model space.
The function Pro2dExportdataSheetsSet() assigns the sheet numbers to be exported as paper space to the specified 2D export format file. Use this function only if the sheet export option is set to PRO2DEXPORT_SELECTED.
The function Pro2dExportdataModelspacesheetSet() assigns the sheet number to be exported as model space. Use this function only if the export format supports the concept of model space and paper space, and if the sheet export option is set to PRO2DEXPORT_SELECTED.
The functions ProProductviewexportoptsAlloc() and ProProductviewexportoptsFree() allocate and free the memory assigned to the ProProductviewExportOptions object containing the Creo View export formats.
The function ProProductviewexportoptsFormatSet() assigns the flag specifying the Creo View export format.
The function ProProductviewFormattedMdlnameExport() exports a drawing to one of the following user-defined Creo View formats:
PRO_PV_FORMAT_PVS
PRO_PV_FORMAT_ED
PRO_PV_FORMAT_EDZ
PRO_PV_FORMAT_PVZ
Use the function ProPrintPrinterOptionsGet() to get the options for a specified printer. Specify the printer type as the input argument for this function. The supported printer types are:
POSTSCRIPT—Generic Postscript
COLORPOSTSC—Color Postscript
MS_PRINT_MGR—MS Print Manager
Note:
 
For a list of all supported printers, please refer to the Add Printer Type list in the Printer Configuration dialog box of .
The function gets the initialized printer options. The options include the file related options, print command options and printer specific options as follows:
File Related:
save_to_file—Saves a plot to a file.
save_method—Specifies if the plot is to be appended to a file, saved to a single file, or saved to multiple files.
filename—Specifies the name of the file to which the plot is saved.
delete_after—Deletes the plot file after printing.
Print Command:
send_to_printer—Sends the plot directly to the printer.
print_command—Specifies the complete command that you want to use for printing.
pen_table—Specifies the complete path to the file containing the pen table.
paper_size—Specifies the size of the paper to be printed.
quantity—Specifies the number of copies to be printed.
Printer Specific:
sw_handshake—Specifies the type of the handshake initialization sequence. Specify the value as True to set the initialization sequence to Software and as False to set it to Hardware.
Note:
 
Consult your system administrator for more information on handshaking.
roll_media—Specifies whether to use roll-media or cut-sheet.
use_ttf—Specifies whether to use TrueType font or stroked text.
slew—Specifies the speed of the pen in centimeters per second in X and Y direction.
rotate_plot—Specifies that the plot is to be rotated by 90 degrees.
Use the function ProPrintMdlOptionsGet() to get the initialized model options for the model to be printed. The available model options are:
mdl—Specifies the model to be printed.
quality—Determines the quality of the model to be printed. It checks for no line, no overlap, simple overlap, and complex overlap.
The model options specific to drawing objects are:
use_drawing_size—Overrides the size of the paper specified in the Printer options.
draw_format—Prints the drawing format used.
segmented—If true, that is the value is set to a boolean of 1, the printer prints drawing full size, but in segments that are compatible with the selected paper size. This option is available only if you are plotting a single page.
layer_only—Prints the specified layer only.
layer_name—Prints the name of the layer.
sheets—Prints the current sheet, all sheets, or selected sheets.
range—An array of two integers specifying the start and end sheet numbers.
The model option specific to solid objects is:
use_solid_scale—Prints using the scale used in the solid model.
Use the function ProPrintPlacementOptionsGet() to get the current print placement options such as print scale, offset, zoom, and so on. The options available for the object placement are:
Placement Options:
scale—Specifies the scale used for the selected plot.
offset—An array of two doubles representing the offset from the lower-left corner of the plot.
keep_panzoom—Maintains the pan and zoom values of a window.
Clipping Options:
clip_plot—Specifies whether you want to clip the plot.
shift_to_ll_corner—Shifts the clip area to the lower-left corner of the plot
clip_area—Two dimensional array of four double representing the area that is clipped. The range of the values of this option is 0.0 through 1.0.
Label Options:
place_label—Specifies whether you want to place the label on the plot.
label_height—Height of the label in inches.
Use the function ProPrintPCFOptionsGet() to get the print options from a specified Plotter Configuration File. Specify the name of the plotter configuration file and the name of the model to be printed. The function gets the printer options, model options and placement options.
Use the function ProPrintExecute() to print a window using the specified printer options, model options and placement options. The drawing must be displayed in a window to be successfully printed.
这对您有帮助吗?