# CrownCAD Secondary development
Through the secondary development of CrownCAD, users can automate tasks and complete complex operations that are difficult to achieve by manual interactive modeling; introduce mathematical functions and geometric operations to support more accurate line fitting; parametrically generate models, and make programs with input The commands are shared with other users of the platform; the API is flexibly organized to realize the modeling functions that are not provided by the system by default; you can also use the query commands to understand and explore the working mechanism of the kernel.Different from the traditional CAD secondary development method, C rownCAD is a product of B /S architecture. The platform-based secondary development fully considers the characteristics of the B/S architecture and has the following characteristics.
Users develop online based on the platform, start quickly, and do not need to build a development environment.
It's easy to use and doesn't require a lot of programming skills. The language forms supported by the platform are close to JavaScript/Java, minimizing additional learning costs. In terms of language mechanism, the interference with the user is minimized, so that the user can focus on the modeling logic and API calls, rather than tangling with language rules and forms. The platform will support features to enhance the development experience, including auxiliary development functions such as instruction list selection and automatic filling of code snippets.
During development, the system can be tested and used by many users at the same time. No need to compile and package, no need to restart the server.
Programs can be shared with other users on the platform.
Perform security. The code executes in a system-specified environment without exposing how the system works inside; The internal components of the system were not modified. The language category is system-defined and controllable, and supports syntax checking, semantic checking, runtime checking, etc.
Theoretically, all open kernel APIs can be used.
Supports operations on multiple documents, batch processing, etc.
# Development process
CrownCADCrownCAD provides a convenient development process: "New Program - Edit Code - Save Program - Publish Program", all through simple interaction.
- New:: Creates a new program.
- Users can click on the "Program List" on the right side of the document, click "+", and enter the development UI interface.
- Development UI interface, click " New " to prompt whether to save the current program. After selecting, you can directly create a new program.
- Enter code: The user can enter the code in the " Code Editor" area of the UI interface.
- Save: Save the entered code.
- Publishing: A saved program can be published, generating commands; the published program can be reused in other documents.
# Development environment
Interface of CrownCAD secondary development platform is shown in the figure below, which mainly includes toolbar, document editor and console.

# Toolbar
The toolbar of CrownCAD secondary development platform provides commands related to secondary development and programming.
- New: Create a new program.
- API list: The user can quickly generate the code block corresponding to the API by selecting the API.
- Execute (overwrite): After executing the program, the generated model covers the model of the current interface.
- Execute (append): After executing the program, the generated model is added on the basis of the model in the current interface, and the original model is still displayed.
- Save: Save the entered code, and you can continue to edit it on this basis.
- Formatting: Format the code with one click to ensure the standardization of the code format.
- Release Preview: Display the execution status after release to test the correctness of the UI.
- Release: Release the program. The released program can be viewed in "Published Program ". The released program is equivalent to a command and can be directly applied.
# Code editor
Code editor is the core area for writing code in secondary development. It supports syntax highlighting, formatting, and features automatic code prompts and code folding.
Rich auto-fill function, auto-fill instructions/statements, support for user-defined variables and functions, etc.
When the function is selected by the mouse, it will be highlighted. At this time, the API can prompt information such as parameter types, input conditions, etc.
# Console console console
Console console displays various information generated during the execution process, and supports additional output and clearing . For example : Print( )