CN110286901B - CAD-based script generation method, system and storage medium - Google Patents

CAD-based script generation method, system and storage medium Download PDF

Info

Publication number
CN110286901B
CN110286901B CN201910598616.6A CN201910598616A CN110286901B CN 110286901 B CN110286901 B CN 110286901B CN 201910598616 A CN201910598616 A CN 201910598616A CN 110286901 B CN110286901 B CN 110286901B
Authority
CN
China
Prior art keywords
primitive
entity
script
entities
primitive entity
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.)
Active
Application number
CN201910598616.6A
Other languages
Chinese (zh)
Other versions
CN110286901A (en
Inventor
田文龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Guangran Design Co ltd
Guangzhou Development Group Inc
Guangzhou Gas Group Co Ltd
Original Assignee
Guangzhou Guangran Design Co ltd
Guangzhou Development Group Inc
Guangzhou Gas Group Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Guangran Design Co ltd, Guangzhou Development Group Inc, Guangzhou Gas Group Co Ltd filed Critical Guangzhou Guangran Design Co ltd
Priority to CN201910598616.6A priority Critical patent/CN110286901B/en
Publication of CN110286901A publication Critical patent/CN110286901A/en
Application granted granted Critical
Publication of CN110286901B publication Critical patent/CN110286901B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a script generation method, a script generation system and a storage medium based on CAD, wherein the method comprises the following steps: acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity; acquiring element information of the primitive entity according to the type of the primitive entity; generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities; an operation statement connecting the primitive entities; and generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity. According to the method, element information of the primitive entity is acquired according to the primitive entity drawn in advance by a user, operation sentences of the primitive entity are acquired, and then the primitive entity is automatically converted into the script according to the operation sentences and the element information of the primitive entity and the operation functions of the primitive entity, so that a designer can quickly convert the entity object into the script. The invention can be applied to the field of computer aided design.

Description

CAD-based script generation method, system and storage medium
Technical Field
The invention relates to the field of computer aided design, in particular to a CAD-based script generation method, a CAD-based script generation system and a storage medium.
Background
In the secondary development process of the computer aided design software (AutoCAD), the learning of the logic part of the language is easier, but the process of interacting with the computer aided software and generating various entities is complex and complicated, so that the user needs to know the entity objects built in the computer aided design software in depth to be able to take care of the user, and mistakes are made with little carelessness.
In the prior art, the contents such as an object model and a primitive interface of computer-aided software are required to be learned, and then the program of the entity is rewritten according to the specific information of the entity, however, the program is very complicated to write, and most designers are engineering professionals and are not familiar with the program writing, so that the designer needs to first invest a great deal of time to deeply learn the program writing before the entity object can be quickly converted into a script.
Disclosure of Invention
In order to solve the technical problems, the invention aims to: a CAD-based script generation method, system and storage medium are provided, so that a designer can quickly convert an entity object into a script without deep learning of program writing.
The first technical scheme adopted by the invention is as follows:
a CAD-based script generation method, comprising the steps of:
acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity;
acquiring element information of the primitive entity according to the type of the primitive entity;
generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities;
an operation statement connecting the primitive entities;
and generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity.
Further, the acquiring element information of the primitive entity according to the type of the primitive entity includes the following steps:
and acquiring element information of the primitive entities according to the acquisition order of the primitive entities and the types of the primitive entities in turn.
Further, the generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity includes the following steps:
acquiring script module definition and parameters;
and generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity and the script module definition and parameters.
Further, the operation statement includes a coordinate operation statement.
Further, the operation statement includes a layer operation statement.
Further, the operation statement includes a color operation statement.
Further, the interface function is a primitive entity operation interface function on aided design software.
The second technical scheme adopted by the invention is as follows:
a CAD-based script generation system, comprising:
the first acquisition module is used for acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity;
the second acquisition module is used for acquiring element information of the primitive entity according to the type of the primitive entity;
the first generation module is used for generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities;
the third acquisition module is used for connecting the operation sentences of the primitive entity;
and the second generation module is used for generating the script file of the primitive entity according to the script statement and the operation statement of the primitive entity.
The third technical scheme adopted by the invention is as follows:
a CAD-based script generation system, comprising:
at least one memory for storing a program;
at least one processor for loading the program to implement the one CAD-based script generation method.
The fourth technical scheme adopted by the invention is as follows:
a storage medium having stored therein processor-executable instructions which, when executed by a processor, are for implementing the described CAD-based script generation method.
The beneficial effects of the invention are as follows: the method comprises the steps of automatically obtaining a primitive entity to be converted and an operation sentence connected with the primitive entity, which are drawn by a designer on CAD software, obtaining element information of the primitive entity according to the type of the primitive entity, and finally automatically converting the primitive entity into a script file according to the operation sentence and the element information of the primitive entity and combining an operation function of the primitive entity, so that the designer can quickly convert an entity object into a script without deep learning program writing.
Drawings
FIG. 1 is a flowchart of a CAD-based script generation method according to an embodiment of the present invention;
FIG. 2 is a block diagram of a CAD-based script generation system according to an embodiment of the present invention.
Detailed Description
The invention will now be described in further detail with reference to the drawings and to specific examples. The step numbers in the following embodiments are set for convenience of illustration only, and the order between the steps is not limited in any way, and the execution order of the steps in the embodiments may be adaptively adjusted according to the understanding of those skilled in the art.
Referring to fig. 1, a CAD-based script generation method includes the steps of:
s101, acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity; the method comprises the steps of obtaining at least one primitive entity and the type of the corresponding primitive entity through an interface function of the primitive entity in computer aided design software. In some embodiments, the user needs to convert a plurality of primitive entities into the same program file, so that the user can conveniently and quickly call the program files of all the primitive entities, and therefore, all the primitive entities needing to be converted need to be obtained. The primitive entity is an entity object required to be converted by a user, and specifically is a CAD graph which is drawn by a designer on CAD software in advance according to the requirement of the designer. The primitive entity may be of the type straight, circular or multi-line segment. In some embodiments, the interface function of the primitive entity is an entity operation interface function of the aided design software.
S102, acquiring element information of the primitive entity according to the type of the primitive entity; in some embodiments, when the type of the primitive entity obtained in step S101 is a circle, the element information of the primitive entity obtained in this step is the center coordinates and radius, and the layer, line shape, color or line width where the circle is located. When the type of the primitive entity obtained in step S101 is a multi-line segment, the element information of the primitive entity obtained in this step is coordinates, line width, line shape, color and layer of each endpoint. When the type of the primitive entity obtained in the step S101 is an arc, the element information of the primitive entity obtained in the step is a circle center, a radius, a start point angle and an end point angle.
S103, generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities; the script statement is a program statement of an entity object which is required to be converted by a user.
S104, connecting operation sentences of the primitive entities; the operation sentences are coordinate operation sentences, layer operation sentences or color operation sentences, and the user can conveniently rotate or displace the entity object and the like rapidly when applying the operation sentences.
S105, generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity. The script file comprises script sentences and operation sentences obtained by converting all entity objects, and function names, end sentences and the like of the program.
According to the embodiment, the primitive entity which is drawn by a designer and needs to be converted on CAD software and the operation statement connected with the primitive entity are automatically obtained, then the element information of the primitive entity is obtained according to the type of the primitive entity, finally the primitive entity is automatically converted into the script file according to the operation statement and the element information of the primitive entity and the operation function of the primitive entity, so that the designer can quickly convert the entity object into the script without deep learning program writing.
As a preferred embodiment, the acquiring element information of the primitive entity according to the type of the primitive entity includes the following steps:
and acquiring element information of the primitive entities according to the acquisition order of the primitive entities and the types of the primitive entities in turn.
In some embodiments, the primitive entities are also referred to as entity objects. The primitive entity to be converted by the user comprises a plurality of primitive entities, and the types of each primitive entity may be different, if the primitive entity A is a circle and the primitive entity B is a straight line, the element information of the primitive entity A is the center coordinates and the radius, and the layer and the color where the circle is located. When a plurality of primitive entities are acquired, the system automatically records the acquisition order of the primitive entities, sequentially identifies the types of the primitive entities according to the acquisition order of the primitive entities, and acquires element information of the primitive entities according to the types of the primitive entities, wherein the element information is also called key information.
As a preferred embodiment, the generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity includes the following steps:
acquiring script module definition and parameters; the method mainly comprises the step of obtaining the function name of the script file.
And generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity and the script module definition and parameters. And finally adding an end statement according to script statements of all primitive entities to be converted and combining operation statements and function names, so as to generate a script file meeting the requirements of users.
As a preferred embodiment, the operation statement includes a coordinate operation statement. The coordinate operation statement is convenient for a user to input parameters according to prompt contents without re-writing program codes when rotating, displacing or amplifying required entities. For example, a user needs to make a batch of coordinate plug-ins, firstly the user selects the labeling points, then the coordinate information is extracted, and finally the labeling information can be generated at the labeling points only by calling a script generated before the labeling information is used.
As a preferred embodiment, the operation statements comprise layer operation statements and/or color operation statements. The layer operation statement is that when a user modifies the layer of the primitive entity, the user only needs to input parameters according to prompt contents to modify the layer of the primitive entity. The color operation statement is a color which is convenient for a user to modify key information of the primitive entity. The operation statements are not limited to the specific embodiments described above.
The following application process in some embodiments, for example, after the wind rose is drawn in AutoCAD, the layer content is adjusted, then a command obtained by the invention is loaded and operated, the wind rose is selected according to the prompt and the script name is input, so that the lsp file corresponding to the wind rose, such as fmg.lsp, can be generated, wherein the lsp file is an automatic loading mode of a CAD tool box, then fmg.lsp is loaded, and the wind rose can be generated according to the prompt after fmg is input; besides direct loading operation, the generated lsp file can also be matched with other lsp files to realize more complex operation, such as creating a layer line shape after inputting an initialization command.
For example, drawing a flow meter table in AutoCAD, adjusting a layer, loading and running a command obtained by the invention, selecting the drawn meter according to a prompt, inputting a script name, generating a corresponding lsp file, such as a bio.lsp, loading a bio.lsp, inputting the bio, generating the meter according to the prompt, simultaneously generating the lsp file, matching the generated lsp file with other lsp files to realize more complex operations, such as prompt dialog box contents such as types or flow sizes selected by a user, automatically generating the corresponding table, and placing the table at a designated position by the user.
Referring to fig. 2, an embodiment of the present invention further provides a CAD-based script generating system corresponding to the method of fig. 1, including:
the first acquisition module is used for acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity;
the second acquisition module is used for acquiring element information of the primitive entity according to the type of the primitive entity;
the first generation module is used for generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities;
the third acquisition module is used for connecting the operation sentences of the primitive entity;
and the second generation module is used for generating the script file of the primitive entity according to the script statement and the operation statement of the primitive entity.
The content in the method embodiment is applicable to the system embodiment, the functions specifically realized by the system embodiment are the same as those of the method embodiment, and the achieved beneficial effects are the same as those of the method.
The embodiment of the invention also provides a CAD-based script generation system corresponding to the method of FIG. 1, comprising:
at least one memory for storing a program;
at least one processor for loading the program to implement the one CAD-based script generation method.
The content in the method embodiment is applicable to the system embodiment, the functions specifically realized by the system embodiment are the same as those of the method embodiment, and the achieved beneficial effects are the same as those of the method.
In addition, the embodiment of the invention further provides a storage medium, wherein the storage medium stores processor-executable instructions, and the processor-executable instructions are used for realizing the CAD-based script generating method when being executed by a processor.
In summary, the method and the device automatically acquire the primitive entity to be converted and the operation statement connected with the primitive entity, which are drawn by the designer on the CAD software, acquire the element information of the primitive entity according to the type of the primitive entity, and finally automatically convert the primitive entity into the script file according to the operation statement and the element information of the primitive entity and the operation function of the primitive entity, so that the designer can quickly convert the entity object into the script without deep learning program writing; further, through the coordinate operation statement, the layer operation statement and the color operation statement, when the user modifies the element information of the primitive entity, the user can quickly modify the element information only by inputting parameters according to prompt contents.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the embodiments described above, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present invention, and these equivalent modifications and substitutions are intended to be included in the scope of the present invention as defined in the appended claims.

Claims (5)

1. A script generation method based on CAD is characterized in that: the method comprises the following steps:
acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity;
acquiring element information of the primitive entity according to the type of the primitive entity;
generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities;
an operation statement connecting the primitive entities; the operation sentences comprise coordinate operation sentences, layer operation sentences and color operation sentences;
generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity;
the element information of the primitive entity is obtained according to the type of the primitive entity, and the method comprises the following steps:
acquiring element information of the primitive entities according to the acquisition order of the primitive entities and the types of the primitive entities in turn;
the script file of the primitive entity is generated according to the script statement and the operation statement of the primitive entity, and the method comprises the following steps:
acquiring script module definition and parameters;
and generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity and the script module definition and parameters.
2. A CAD-based script generation method as claimed in claim 1, wherein: the interface function is a graphic primitive entity operation interface function on aided design software.
3. A CAD-based script generation system, characterized by: comprising the following steps:
the first acquisition module is used for acquiring at least one primitive entity and the type of the primitive entity through an interface function of the primitive entity;
the second acquisition module is used for acquiring element information of the primitive entity according to the type of the primitive entity;
the first generation module is used for generating script statements of the primitive entities according to element information of the primitive entities and drawing interface functions of the primitive entities;
the third acquisition module is used for connecting the operation sentences of the primitive entity; the operation sentences comprise coordinate operation sentences, layer operation sentences and color operation sentences;
the second generation module is used for generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity;
the element information of the primitive entity is obtained according to the type of the primitive entity, and the method comprises the following steps:
acquiring element information of the primitive entities according to the acquisition order of the primitive entities and the types of the primitive entities in turn;
the script file of the primitive entity is generated according to the script statement and the operation statement of the primitive entity, and the method comprises the following steps:
acquiring script module definition and parameters;
and generating a script file of the primitive entity according to the script statement and the operation statement of the primitive entity and the script module definition and parameters.
4. A CAD-based script generation system, characterized by: comprising the following steps:
at least one memory for storing a program;
at least one processor for loading the program to implement a CAD-based script generation method as claimed in any one of claims 1-2.
5. A storage medium having stored therein instructions executable by a processor, characterized by: the processor-executable instructions, when executed by a processor, are for implementing a CAD-based script generation method as recited in any of claims 1-2.
CN201910598616.6A 2019-07-04 2019-07-04 CAD-based script generation method, system and storage medium Active CN110286901B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910598616.6A CN110286901B (en) 2019-07-04 2019-07-04 CAD-based script generation method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910598616.6A CN110286901B (en) 2019-07-04 2019-07-04 CAD-based script generation method, system and storage medium

Publications (2)

Publication Number Publication Date
CN110286901A CN110286901A (en) 2019-09-27
CN110286901B true CN110286901B (en) 2023-05-30

Family

ID=68020538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910598616.6A Active CN110286901B (en) 2019-07-04 2019-07-04 CAD-based script generation method, system and storage medium

Country Status (1)

Country Link
CN (1) CN110286901B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112163392B (en) * 2020-08-24 2023-05-19 中国电子科技集团公司第二十九研究所 Automatic generation method, medium and equipment for packaging substrate processing file
CN115495807B (en) * 2022-09-26 2024-05-10 上海弘玑信息技术有限公司 Automatic drawing method and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6587746B1 (en) * 1996-12-04 2003-07-01 D'souza Melanius Process and apparatus for facilitating automatic production of drawing using a CAD system
CN1624688A (en) * 2003-12-05 2005-06-08 鸿富锦精密工业(深圳)有限公司 Processing code generating system and method
CN1704941A (en) * 2004-05-29 2005-12-07 鸿富锦精密工业(深圳)有限公司 Wire-electrode cutting path code generation system and method
WO2008096847A1 (en) * 2007-02-09 2008-08-14 Mori Seiki Co., Ltd. Automatic programming method and automatic programming device
CN103197604A (en) * 2013-03-13 2013-07-10 上海维宏电子科技股份有限公司 Numerical control system and control method for achieving automatic optimization of tool paths based on DBF
CN104750913A (en) * 2015-03-05 2015-07-01 中国电建集团昆明勘测设计研究院有限公司 Method for automatically converting DWG three-dimensional model into X three-dimensional model
CN106909123A (en) * 2017-02-10 2017-06-30 昆山同日工业自动化有限公司 One kind control programming auxiliary equipment

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8005886B2 (en) * 2005-05-19 2011-08-23 Jds Uniphase Corporation Systems and methods for generating network messages
CN102124444A (en) * 2008-05-20 2011-07-13 本特利系统公司 System, method and computer program product for replicatable program flow with generative components
CN102868717A (en) * 2011-07-08 2013-01-09 华为软件技术有限公司 Method, device and system for editing and debugging voice extensible markup language script
CN102541730B (en) * 2011-12-08 2014-08-27 北京空间飞行器总体设计部 Semantic identification and automatic generation method for spacecraft test script
CN104268072B (en) * 2014-09-03 2017-02-15 武汉烽火网络有限责任公司 Graphical script editor and method for fast developing communication equipment testing script
CN106445818B (en) * 2016-09-13 2019-05-10 郑州云海信息技术有限公司 A kind of automatized script adjustment method and device based on model-driven
CN108710489A (en) * 2018-05-23 2018-10-26 中国平安人寿保险股份有限公司 Automate derivative scenario generation method, device, computer equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6587746B1 (en) * 1996-12-04 2003-07-01 D'souza Melanius Process and apparatus for facilitating automatic production of drawing using a CAD system
CN1624688A (en) * 2003-12-05 2005-06-08 鸿富锦精密工业(深圳)有限公司 Processing code generating system and method
CN1704941A (en) * 2004-05-29 2005-12-07 鸿富锦精密工业(深圳)有限公司 Wire-electrode cutting path code generation system and method
WO2008096847A1 (en) * 2007-02-09 2008-08-14 Mori Seiki Co., Ltd. Automatic programming method and automatic programming device
CN103197604A (en) * 2013-03-13 2013-07-10 上海维宏电子科技股份有限公司 Numerical control system and control method for achieving automatic optimization of tool paths based on DBF
CN104750913A (en) * 2015-03-05 2015-07-01 中国电建集团昆明勘测设计研究院有限公司 Method for automatically converting DWG three-dimensional model into X three-dimensional model
CN106909123A (en) * 2017-02-10 2017-06-30 昆山同日工业自动化有限公司 One kind control programming auxiliary equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
AutoCAD二次开发中实体的生成;高明涛 等;《鞍山科技大学学报》;第2003卷(第3期);第213-215、220页 *
AutoCAD实体导出Glyph2脚本的实现;罗小美;《现代机械》;第2016卷(第3期);第91-94页 *
Computability evaluation of RESTful API using Primitive Recursive Function;R. Padmanaban 等;《Journal of King Saud University – Computer and Information Sciences》;第34卷(第2期);第457–467页 *

Also Published As

Publication number Publication date
CN110286901A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
US8365135B2 (en) Computer method and apparatus for connection creation in a software modeling system
RU2474874C2 (en) Method and apparatus for generating parametric model associated with geometry of three-dimensional objects
RU2347262C2 (en) Method and system for record of macroses in syntax independent of language
CN110286901B (en) CAD-based script generation method, system and storage medium
CN110955410A (en) Automatic code generation method, device, equipment and medium
CN104484163A (en) Heterogeneous model transformation method based on unified modeling environment
KR20060120539A (en) Graphical programing device and programmable indicator
CN112579679B (en) Method and device for designing heterogeneous data model mapping strategy and automatic conversion
WO2023130933A1 (en) Model processing method and apparatus, code aquisition method and apparatus, and electronic device
JP2007087127A (en) Data generation program, storage medium for storing the program, open source software developmental environment integration program, and storage medium for storing the program
US9311755B2 (en) Self-disclosing control points
CN104503737A (en) Unified modeling platform
KR20140045101A (en) Three-dimensional modeling method using parametric data
CN117215556A (en) Modularized page rapid construction method, system, equipment and medium
US8812965B2 (en) Creation and publishing of virtual components
CN106528946B (en) A kind of method of batch insertion AutoCAD segment
Bocevska et al. An example of application design using solidworks application programming interface
CN112396681A (en) Animation generation method and device and storage medium
CN108241775A (en) Digital finishing material is to the increasingly automated application of 3D data
CN109765838B (en) Method and device for generating configuration file of programmable logic controller
Le Calvar et al. Intensional view definition with constrained incremental transformation rules
CN113010161A (en) View conversion method, view conversion apparatus, and storage medium
US7580962B1 (en) Automatic code generation for co-simulation interfaces
CN118331552A (en) Method for embedding shared library function graphical editing in pipeline editor
CN109062564A (en) While a kind of programmed process device towards hardware and data

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