Search

CN-121981882-A - Drawing coordinate conversion method, device, equipment and storage medium

CN121981882ACN 121981882 ACN121981882 ACN 121981882ACN-121981882-A

Abstract

Establishing a self-defined coordinate system, and determining a first coordinate transformation relation from the PDF coordinate system to the self-defined coordinate system according to the coordinate range of the self-defined coordinate system and the PDF page size specification; and according to the first coordinate transformation relation and the coordinate data of the boundary frame, carrying out bidirectional conversion on the coordinates in the PDF drawing to obtain corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and the DWG coordinate system. According to the method, the DWG coordinate association information is reserved in the PDF file, so that the accurate conversion between the PDF drawing and the DWG coordinate system and the accurate conversion between the PDF drawing and the DWG coordinate system are realized, and the problem of coordinate information loss after drawing format conversion is solved.

Inventors

  • HE QIANGHUI
  • ZHANG ZHAOYONG

Assignees

  • 深圳瑞信建筑科技有限公司

Dates

Publication Date
20260505
Application Date
20260302

Claims (10)

  1. 1. The drawing coordinate conversion method is characterized by comprising the following steps of: establishing a self-defined coordinate system, and determining a first coordinate transformation relation from the PDF coordinate system to the self-defined coordinate system according to the coordinate range of the self-defined coordinate system and a preset PDF page size specification; In the process of exporting a DWG drawing into a PDF drawing, acquiring coordinate data of a boundary frame of the DWG drawing in a DWG coordinate system and a PDF coordinate system, and storing the coordinate data of the boundary frame into file attributes of the PDF drawing; And according to the first coordinate transformation relation and the coordinate data of the boundary box, carrying out bidirectional conversion on the coordinates in the PDF drawing to obtain the corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and a DWG coordinate system.
  2. 2. The drawing coordinate conversion method according to claim 1, wherein the establishing a custom coordinate system, and determining a first coordinate transformation relationship from a PDF coordinate system to the custom coordinate system according to a coordinate range of the custom coordinate system and a preset PDF page size specification includes: Setting a coordinate range for the self-defined coordinate system to obtain a coordinate upper limit value and a coordinate lower limit value of the self-defined coordinate system; And calculating the scaling and translational offset of the PDF coordinate system to the self-defined coordinate system according to the coordinate upper limit value, the coordinate lower limit value and the preset PDF page size specification to obtain the first coordinate transformation relation.
  3. 3. The drawing coordinate conversion method according to claim 2, wherein the calculating a scaling and a translational offset of a PDF coordinate system to the custom coordinate system according to the coordinate upper limit value, the coordinate lower limit value, and the preset PDF page size specification, to obtain the first coordinate conversion relationship includes: acquiring a page width value and a page height value in the preset PDF page size specification, and calculating the maximum value of the page width value and the page height value to obtain a PDF page characteristic size; Calculating a coordinate span of the self-defined coordinate system according to the coordinate upper limit value and the coordinate lower limit value, and carrying out ratio operation on the coordinate span and the PDF page feature size to obtain the scaling; Determining a coordinate offset vector between the two coordinate systems according to the coordinate origin position of the self-defined coordinate system and the coordinate origin position of the PDF coordinate system to obtain the translation offset; and combining the scaling with the translation offset to obtain the first coordinate transformation relation.
  4. 4. The drawing coordinate conversion method according to claim 1, wherein the obtaining the coordinate data of the bounding box of the DWG drawing in the DWG coordinate system and the PDF coordinate system, and storing the coordinate data of the bounding box in the file attribute of the PDF drawing includes: Before the DWG drawing is exported, extracting boundary coordinates of the DWG drawing to obtain a first coordinate value of the boundary coordinates in a DWG coordinate system; after the DWG drawing is exported to be a PDF drawing, positioning a position corresponding to the boundary coordinate in the PDF drawing to obtain a second coordinate value of the boundary coordinate in a PDF coordinate system; and associating the first coordinate value with the second coordinate value and storing the first coordinate value and the second coordinate value into the file attribute of the PDF drawing.
  5. 5. The drawing coordinate conversion method according to claim 4, wherein extracting the boundary coordinates of the DWG drawing before the DWG drawing is derived, to obtain the first coordinate values of the boundary coordinates in the DWG coordinate system includes: before the DWG drawing is exported, carrying out boundary range analysis on a display window of the DWG drawing, traversing geometric elements in the display window, and counting the coordinate positions of the geometric elements to obtain a geometric element coordinate set; The geometric element coordinate set is subjected to coordinate comparison operation, the minimum value of the x coordinate and the minimum value of the y coordinate in the geometric element coordinate set are extracted, and the minimum coordinate point is obtained through combination; And taking the minimum coordinate point and the maximum coordinate point as the boundary coordinates, and recording the coordinate values of the minimum coordinate point and the maximum coordinate point in a DWG coordinate system to obtain the first coordinate value.
  6. 6. The drawing coordinate conversion method according to claim 1, wherein bi-directionally converting coordinates in a PDF drawing according to the first coordinate transformation relation and the coordinate data of the bounding box, to obtain corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and a DWG coordinate system includes: acquiring a target coordinate point in a PDF drawing, and obtaining a coordinate value of the target coordinate point in a PDF coordinate system; Applying the first coordinate transformation relation to the coordinate value of the target coordinate point to obtain a corresponding coordinate of the target coordinate point in a custom coordinate system; When an instruction for feeding back the target coordinate point to a design end is received, a scaling coefficient and a coordinate offset between a DWG coordinate system and a PDF coordinate system are calculated according to the coordinate data of the boundary box, a second coordinate transformation relation between the DWG coordinate system and the PDF coordinate system is obtained, and the second coordinate transformation relation is applied to the coordinate value of the target coordinate point, so that the corresponding coordinate of the target coordinate point in the DWG coordinate system is obtained.
  7. 7. The drawing coordinate conversion method according to claim 6, wherein calculating a scaling factor and a coordinate offset between a DWG coordinate system and a PDF coordinate system according to the coordinate data of the bounding box to obtain a second coordinate transformation relationship between the DWG coordinate system and the PDF coordinate system, and applying the second coordinate transformation relationship to the coordinate values of the target coordinate point to obtain the corresponding coordinates of the target coordinate point in the DWG coordinate system includes: extracting coordinate values of the first boundary point and the second boundary point in a DWG coordinate system and coordinate values in a PDF coordinate system from coordinate data of the boundary frame; Calculating a scaling coefficient and a coordinate offset from a PDF coordinate system to a DWG coordinate system according to the coordinate value difference relation between the first boundary point and the second boundary point in the DWG coordinate system and the PDF coordinate system, so as to obtain the second coordinate transformation relation; and sequentially carrying out coordinate offset operation and scaling operation on the coordinate values of the target coordinate point according to the second transformation relation to obtain the corresponding coordinates of the target coordinate point in a DWG coordinate system.
  8. 8. The utility model provides a drawing coordinate conversion equipment which characterized in that, drawing coordinate conversion equipment includes: the transformation establishing module is used for establishing a self-defined coordinate system, and determining a first coordinate transformation relation from the PDF coordinate system to the self-defined coordinate system according to the coordinate range of the self-defined coordinate system and the preset PDF page size specification; The data storage module is used for acquiring coordinate data of a boundary frame of the DWG drawing in a DWG coordinate system and a PDF coordinate system in the process of exporting the DWG drawing into the PDF drawing, and storing the coordinate data of the boundary frame into file attributes of the PDF drawing; And the coordinate conversion module is used for carrying out bidirectional conversion on the coordinates in the PDF drawing according to the first coordinate transformation relation and the coordinate data of the boundary box to obtain corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and a DWG coordinate system.
  9. 9. The drawing coordinate conversion equipment is characterized by comprising a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the drawing coordinate conversion apparatus to perform the steps of the drawing coordinate conversion method as claimed in any one of claims 1 to 7.
  10. 10. A computer readable storage medium having instructions stored thereon, which when executed by a processor, implement the steps of the drawing coordinate conversion method of any one of claims 1-7.

Description

Drawing coordinate conversion method, device, equipment and storage medium Technical Field The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for converting drawing coordinates. Background Along with the development of building informatization and digital management, engineering drawings need to be converted and applied among different coordinate systems in the design, construction and operation and maintenance stages. In actual engineering, designers typically use CAD drawings in DWG format for design, whereas in project management and field applications, drawings are often converted to PDF format for distribution and viewing. Meanwhile, in order to realize the positioning and display of the drawing in the geographic information system or the map application, the drawing coordinate needs to be mapped into a self-defined coordinate system. However, there is a lack of efficient methods in the prior art to achieve coordinate correlation and conversion between DWG drawings, PDF drawings, and custom coordinate systems. After the drawing is exported from the DWG format to the PDF format, original DWG coordinate information is often lost, so that the labeling position on the PDF drawing cannot be accurately fed back to the DWG coordinate system of the design end, and the spatial position of the drawing content cannot be accurately positioned in map application. This presents difficulties in design change feedback, site problem localization, and multi-system collaboration. Disclosure of Invention The invention mainly aims to solve the technical problem that accurate conversion between PDF coordinates and DWG coordinates and a custom coordinate system cannot be realized after a DWG drawing is exported as a PDF drawing in the prior art; the invention provides a drawing coordinate conversion method, which comprises the following steps: establishing a self-defined coordinate system, and determining a first coordinate transformation relation from the PDF coordinate system to the self-defined coordinate system according to the coordinate range of the self-defined coordinate system and a preset PDF page size specification; In the process of exporting a DWG drawing into a PDF drawing, acquiring coordinate data of a boundary frame of the DWG drawing in a DWG coordinate system and a PDF coordinate system, and storing the coordinate data of the boundary frame into file attributes of the PDF drawing; And according to the first coordinate transformation relation and the coordinate data of the boundary box, carrying out bidirectional conversion on the coordinates in the PDF drawing to obtain the corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and a DWG coordinate system. The invention also provides a drawing coordinate conversion device, which comprises: the transformation establishing module is used for establishing a self-defined coordinate system, and determining a first coordinate transformation relation from the PDF coordinate system to the self-defined coordinate system according to the coordinate range of the self-defined coordinate system and the preset PDF page size specification; The data storage module is used for acquiring coordinate data of a boundary frame of the DWG drawing in a DWG coordinate system and a PDF coordinate system in the process of exporting the DWG drawing into the PDF drawing, and storing the coordinate data of the boundary frame into file attributes of the PDF drawing; And the coordinate conversion module is used for carrying out bidirectional conversion on the coordinates in the PDF drawing according to the first coordinate transformation relation and the coordinate data of the boundary box to obtain corresponding coordinates of the coordinates in the PDF drawing in a custom coordinate system and a DWG coordinate system. The invention also provides a drawing coordinate conversion device which comprises a memory and at least one processor, wherein the memory is stored with instructions, the memory is connected with the at least one processor through a line, and the at least one processor calls the instructions in the memory so that the drawing coordinate conversion device can execute the steps of the drawing coordinate conversion method. The present invention also provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the steps of the drawing coordinate conversion method described above. The drawing coordinate conversion method, the drawing coordinate conversion device, the drawing coordinate conversion equipment and the storage medium are characterized in that a user-defined coordinate system is established, a first coordinate conversion relation from a PDF coordinate system to the user-defined coordinate system is determined according to the coordinate range of the