CN115061980A - Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings - Google Patents
Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings Download PDFInfo
- Publication number
- CN115061980A CN115061980A CN202210989631.5A CN202210989631A CN115061980A CN 115061980 A CN115061980 A CN 115061980A CN 202210989631 A CN202210989631 A CN 202210989631A CN 115061980 A CN115061980 A CN 115061980A
- Authority
- CN
- China
- Prior art keywords
- dwg
- drawings
- canvas
- kernel program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/116—Details of conversion of file system types or formats
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
- G06F16/162—Delete operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
Abstract
The invention relates to a method for converting a plurality of drawings in the same canvas of DWG into a plurality of pages of PDF drawings, belonging to the technical field of intelligent conversion of drawing formats, comprising the steps of uploading DWG drawings to a PLM system and simultaneously uploading DWG drawing information to a queue server; obtaining DWG drawing information from the queue server, obtaining the storage position of the DWG drawing in the PLM from the DWG drawing information, and downloading the DWG drawing file to a local cache directory of the image transfer server; and the mapping server calls a DWG-PDF kernel program to execute conversion, and outputs the converted PDF file to a cache directory. The invention supports that a plurality of drawings with different drawings in the same canvas are identified according to the sequence and converted and output into a multi-page PDF file, so that the drawings can be reviewed without being based on an AutoCAD design tool, and the transmission, protection and universality of the drawings are improved.
Description
Technical Field
The invention relates to a method for converting multiple drawings in the same canvas of DWG into multiple pages of PDF drawings, belonging to the technical field of intelligent conversion of drawing formats.
Background
The drawings designed by the professional design tool can be opened and browsed only by depending on the professional design tool, and the circulation and application of the drawings are not facilitated. Drawing transmission and browsing in the PLM field belong to common services, such as: the client must install AutoCAD software to open in the DWG drawing transmission process of the AutoCAD, and the drawing transmission process is easy to be tampered; the PDF format has excellent readability, transferability and protectiveness, so the PLM field usually converts DWG drawings into the PDF format for transferring and reviewing; tools capable of automatically converting DWG drawings into PDF formats are also developed in the industry; however, the conventional conversion tool can only convert the drawing of a single drawing, the situation of multiple drawings in multiple pieces of cloth cannot be supported, and the drawing drawn in equal proportion cannot be converted in proportion.
Disclosure of Invention
In order to solve the technical problem, the invention provides a method for converting a plurality of drawings in the same canvas of DWG into a plurality of PDF drawings, which has the following specific technical scheme:
a method for converting a plurality of drawings in the same canvas of DWG into a plurality of PDF drawings comprises the following steps:
step 1: uploading the DWG drawing to a PLM system, and simultaneously uploading DWG drawing information to a queue server;
step 2: obtaining DWG drawing information from the queue server, obtaining the storage position of the DWG drawing in the PLM from the DWG drawing information, and downloading the DWG drawing file to a local cache directory of the image transfer server;
and step 3: and the mapping server calls a DWG-PDF kernel program to execute conversion, and outputs the converted PDF file to a cache directory.
Further, the DWG to PDF kernel program comprises the following steps:
step 3.1: firstly, adding a virtual printer in a mapping server, setting a standard drawing size into the printer, and setting the upper, lower, left and right margins of printing contents;
step 3.2: when the DWG-PDF kernel program is executed, firstly, an AutoCAD main program is called to open a DWG drawing, then a block object started by an 'AP _' character string in the drawing is searched through an API (application programming interface) through a selector, the coordinate position of the block object in a canvas is obtained after the block object is found, and a rectangular area where the drawing is located is obtained through two-point positioning;
step 3.3: sequentially acquiring all drawing positions in the canvas, sequencing according to the n value in the AP _ n in the drawing name, and sequentially printing the drawings to output PDF;
step 3.4: for the condition that the standard drawing is designed after being scaled in the microcircuit design, the DWG-PDF kernel program supports the definition of the drawing block name as AP _ n _ A3, wherein A3 represents the size of the drawing which is output in a standard mode, so that the drawing is scaled to the size of the standard drawing for output in the virtual printing output process;
step 3.5: the DWG-PDF kernel program calls a virtual printing interface of the AutoCAD program, and calls a virtual printer to output the virtual printer as a single-page PDF file according to the rectangular position of the coordinate where the picture is located;
step 3.6: and after all the drawings in the canvas are completely executed and PDF conversion is completed, the DWG to PDF kernel program sequentially merges all the single-page PDF files into a multi-page PDF file according to the sequencing result.
The invention has the beneficial effects that:
the conversion tool realizes that the position of the printing coordinate of the drawing is positioned by identifying the special name block object in the DWG file in the conversion process, and the drawing is output into a PDF format based on the virtual printing technology. The invention supports that a plurality of drawings with different drawings in the same canvas are identified according to the sequence and converted and output into a plurality of pages of PDF files, namely: each pdf page contains one drawing. The function is mainly applied to drawing examination and signing and issuing of the PLM system, so that the drawing can be examined without an AutoCAD design tool, and the transmission, protection and universality of the drawing are improved.
Drawings
Figure 1 is a core logic diagram of the DWG to PDF kernel execution diagram of the present invention,
figure 2 is a block object definition schematic of the source drawing in the DWG of the present invention,
fig. 3 is a schematic diagram of a converted PDF file format according to the present invention.
Detailed Description
The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic views illustrating only the basic structure of the present invention in a schematic manner, and thus show only the constitution related to the present invention.
As shown in FIG. 1, the DWG-PDF kernel program of the present invention performs the following steps:
1. the graph turning server acquires the drawing information needing to be processed from the queue server and downloads the drawing to a cache directory of the graph turning server;
2. calling a DWG-PDF kernel program, and transmitting specified parameters (the parameters comprise a DWG file input path and a PDF output path);
starting AutoCAD program code:
IAcadApplication acadApplication = (AcadApplication)Activator.CreateInstance(Type.GetTypeFromProgID(ProgramID), true);
// hidden application
acadApplication.Visible = false;
And 3, starting the AutoCAD main program by the DWG-PDF kernel program, and opening the DWG file specified by the input path through the AutoCAD main program.
The code to open the specified file is as follows:
AcadDocument acadDoc = acadApplication.Documents.Open(dwgFilePath, false);
dwgFilePath is the dwg file path, opens the document and returns a cad document object.
4. The Block objects beginning with "AP _" in the document object are filtered by the selector and the selection set is returned. See fig. 2.
The code is as follows:
///<summary>
// select AP _ Start Block object by selector
///</summary>
///<returns></returns>
publicAcadSelectionSet GetSelectsionSet()
{
AcadSelectionSet sel1 = acadDoc.SelectionSets.Add("Select");
object FilterType = newshort[] { 0, 2 };
object FilterData = newobject[] { "insert", "AP_*" };
sel1.Select(AcSelect.acSelectionSetAll, Type.Missing, Type.Missing, FilterType, FilterData);
return sel1;
}
// obtaining Selection set objects by calling this function
AcadSelectionSet selectionSet = GetSelectsionSet();
5. The Block objects in the selection set are traversed to generate individual PDFs. And storing the data in a hard disk cache area so as to be convenient for unified cleaning after merging.
6. And merging and sorting the temporary PDF files according to the sorting rule. The sorting rule is that the last number of the name is obtained according to the name, and sorting is carried out according to the last number. Such as [ AP _1, AP _ A2_3, AP _2],
the 1, 2, 3 ordering is obtained, with the result: [ AP _1, AP _2, AP _ A2_3 ].
7. Combining the temporary PDF files and outputting the temporary PDF files to a new path; see fig. 3.
8. After PDF is generated, deleting all temporary files;
9. returning to the program execution state code;
10. the image transfer server judges whether the program is executed successfully or not according to the obtained state code; 0 is success, others are failure;
when the status code 0 is obtained, a required PDF file is acquired from the output path specified at the time of calling the command.
Claims (2)
1. A method for converting a plurality of drawings in the same canvas of DWG into a plurality of PDF drawings is characterized in that: the method comprises the following steps:
step 1: uploading the DWG drawing to a PLM system, and simultaneously uploading DWG drawing information to a queue server;
step 2: obtaining DWG drawing information from the queue server, obtaining the storage position of the DWG drawing in the PLM from the DWG drawing information, and downloading the DWG drawing file to a local cache directory of the image transfer server;
and 3, step 3: and the mapping server calls a DWG-PDF kernel program to execute conversion, and outputs the converted PDF file to a cache directory.
2. The method for converting multiple drawings in the same canvas of DWG into multiple PDF drawings according to claim 1, wherein: the DWG-PDF kernel program comprises the following steps:
step 3.1: firstly, adding a virtual printer in a mapping server, setting a standard drawing size into the printer, and setting the upper, lower, left and right margins of printing contents;
step 3.2: when the DWG is converted into the PDF kernel program, firstly calling an AutoCAD main program to open a DWG drawing, searching a block object starting from an 'AP _' character string in the drawing through an API (application programming interface) by a selector, obtaining a coordinate position of the block object in a canvas after finding, and obtaining a rectangular area where the drawing is located through two-point positioning;
step 3.3: sequentially acquiring all drawing positions in the canvas, sequencing according to the n value in the AP _ n in the drawing name, and sequentially printing the drawings to output PDF;
step 3.4: for the condition that the standard drawing is designed after being scaled in the microcircuit design, the DWG-PDF kernel program supports the definition of the drawing block name as AP _ n _ A3, wherein A3 represents the size of the drawing which is output in a standard mode, so that the drawing is scaled to the size of the standard drawing for output in the virtual printing output process;
step 3.5: the DWG-PDF kernel program calls a virtual printing interface of the AutoCAD program, and calls a virtual printer to output the virtual printer as a single-page PDF file according to the rectangular position of the coordinate where the picture is located;
step 3.6: and after all the drawings in the canvas are completely executed and PDF conversion is completed, the DWG to PDF kernel program sequentially merges all the single-page PDF files into a multi-page PDF file according to the sequencing result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210989631.5A CN115061980B (en) | 2022-08-18 | 2022-08-18 | Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210989631.5A CN115061980B (en) | 2022-08-18 | 2022-08-18 | Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115061980A true CN115061980A (en) | 2022-09-16 |
CN115061980B CN115061980B (en) | 2022-11-29 |
Family
ID=83207973
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210989631.5A Active CN115061980B (en) | 2022-08-18 | 2022-08-18 | Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115061980B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116166630A (en) * | 2023-03-14 | 2023-05-26 | 北京安证通信息科技股份有限公司 | DWG drawing format conversion method, system and device |
CN117094288A (en) * | 2023-10-18 | 2023-11-21 | 江西联创精密机电有限公司 | Drawing format conversion method and device, readable storage medium and electronic equipment |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020158886A1 (en) * | 2001-02-23 | 2002-10-31 | Autodesk, Inc., | Measuring geometry in a computer-implemented drawing tool |
CN103793145A (en) * | 2014-02-21 | 2014-05-14 | 湖南省交通规划勘察设计院 | Drawing frame parameter identification and drawing output method based on autoCAD |
CN114239098A (en) * | 2021-12-17 | 2022-03-25 | 北京数码大方科技股份有限公司 | CAD drawing processing method and device, storage medium and processor |
-
2022
- 2022-08-18 CN CN202210989631.5A patent/CN115061980B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020158886A1 (en) * | 2001-02-23 | 2002-10-31 | Autodesk, Inc., | Measuring geometry in a computer-implemented drawing tool |
CN103793145A (en) * | 2014-02-21 | 2014-05-14 | 湖南省交通规划勘察设计院 | Drawing frame parameter identification and drawing output method based on autoCAD |
CN114239098A (en) * | 2021-12-17 | 2022-03-25 | 北京数码大方科技股份有限公司 | CAD drawing processing method and device, storage medium and processor |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116166630A (en) * | 2023-03-14 | 2023-05-26 | 北京安证通信息科技股份有限公司 | DWG drawing format conversion method, system and device |
CN117094288A (en) * | 2023-10-18 | 2023-11-21 | 江西联创精密机电有限公司 | Drawing format conversion method and device, readable storage medium and electronic equipment |
CN117094288B (en) * | 2023-10-18 | 2024-01-26 | 江西联创精密机电有限公司 | Drawing format conversion method and device, readable storage medium and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN115061980B (en) | 2022-11-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115061980B (en) | Method for converting multiple drawings in DWG same canvas into multi-page PDF drawings | |
US5926824A (en) | System and method for retrieving a document by inputting a desired attribute and the number of areas in which the attribute occurs as a retrieval condition | |
US6708189B1 (en) | Computer file transfer system | |
US7424490B2 (en) | System for document management and information processing | |
US5771380A (en) | Method for information retrieval with scaled down images | |
US5428727A (en) | Method and system for registering and filing image data | |
US8380012B2 (en) | Document imaging and indexing system | |
US5282052A (en) | Techniques for automatic form creation by combining partial operations | |
US20020133515A1 (en) | Method and apparatus for synchronizing multiple versions of digital data | |
US5861958A (en) | Multiple-file feature for a fax printer driver | |
JPH0683879A (en) | Method and device for labelling document for preservation, handling and introduction | |
JP2006120125A (en) | Document image information management apparatus and document image information management program | |
TWI604317B (en) | Method for naming image file | |
JP2010035187A (en) | Method and apparatus for determining location of data in open specification environment | |
US7359925B2 (en) | Database system, its control method, and information processing apparatus | |
JPH09325928A (en) | Method and equipment for communicating message | |
JP2001209659A (en) | System and method for annotating object in the case that annotation device is different from viewing device | |
EP0315752A2 (en) | Information processing apparatus for processing both image data and coded data | |
JP2000339327A (en) | System for operating thumbnail image | |
US7577693B2 (en) | Performing multiple actions on a spool file by assigning a particular action to be performed on each segment of the spool file | |
JP2006139676A (en) | Information management system | |
JP2001256256A (en) | Device and method for retrieving electronic document | |
JPH10240724A (en) | Document managing device and system and method therefor | |
JP7154982B2 (en) | Information processing device, control method, and program | |
JPH0581395A (en) | Data processing system and method for treating exchangeable image-object for document having plurality of size |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |