Khi phát triển và sử dụng các công cụ lập trình bổ trợ cho AutoCAD (như file AutoLISP .lsp, file .dcl, hay các file ứng dụng .NET .dll), việc quản lý đường dẫn file là vô cùng quan trọng. Nếu không cấu hình đúng, AutoCAD sẽ không tìm thấy các file hỗ trợ hình ảnh, file giao diện hoặc các thư viện phụ thuộc.
Bài viết này sẽ hướng dẫn bạn cách cấu hình Support File Search Path chuẩn hóa để các công cụ luôn hoạt động mượt mà, đồng thời cung cấp một bộ công cụ tương tác bên dưới để tự động tạo file LISP giúp tự động tải ứng dụng DLL và định nghĩa lệnh tắt của riêng bạn.
1. Support File Search Path là gì?
Support File Search Path là danh sách các thư mục mà AutoCAD sẽ tự động tìm kiếm khi bạn gọi một file bên ngoài (như nạp mã Lisp, file hình ảnh cho block, file menu tùy biến,...). Thay vì phải nhập đường dẫn tuyệt đối rất dài và dễ lỗi, bạn chỉ cần đưa thư mục chứa công cụ vào Support Path, AutoCAD sẽ tự tìm thấy nó.
2. Các bước cấu hình trong AutoCAD
- Mở AutoCAD, nhập lệnh
OPhoặcOPTIONSvà nhấn Enter để mở hộp thoại Options. - Tại tab Files, nhấp chọn dấu cộng
+để mở rộng mục Support File Search Path đầu tiên. - Nhấp vào nút Add ở thanh menu bên phải, sau đó nhấn Browse.
- Tìm và chọn thư mục chứa công cụ của bạn (ví dụ:
C:\iViDLab\Tools\) rồi nhấn OK. - Nhấn Apply rồi OK để lưu cấu hình.
3. Cách Autoload file DLL và thiết lập Lệnh Tắt
Để nạp một file .NET DLL, thông thường bạn phải gõ lệnh NETLOAD và tìm chọn file thủ công. Để tự động hóa việc này, cách chuyên nghiệp nhất là sử dụng một file **AutoLISP (.lsp)** nhỏ nạp lúc khởi động:
- Tự động thực hiện lệnh
NETLOADđến file DLL của bạn ngay khi mở bản vẽ. - Định nghĩa một lệnh tắt cực ngắn (ví dụ:
VBL) để gọi lệnh gốc dài trong file DLL (ví dụ:iViDBlockLibrary).
When developing and using customized programming add-ons for AutoCAD (such as AutoLISP .lsp scripts, .dcl dialog forms, or C# .NET .dll plugins), file path management is extremely vital. Without a proper setup, AutoCAD will fail to locate resources like slide images, dialog structures, or dependency libraries.
This article guides you through setting up a standardized Support File Search Path to ensure your tools always run smoothly, and offers an interactive web tool below to instantly generate a custom AutoLISP loader script for your .NET DLLs with customized shortcut commands.
1. What is Support File Search Path?
The Support File Search Path tells AutoCAD which directories it should look into when loading external assets (such as executing Lisp routines, loading icon slides, custom menus, etc.). Instead of typing long, error-prone absolute file paths, you simply add your tool's folder to this list, and AutoCAD finds the files instantly.
2. Step-by-Step Configuration in AutoCAD
- Open AutoCAD, type
OPorOPTIONSin the command line and press Enter to launch the Options window. - In the Files tab, click the plus sign
+next to the very first item: Support File Search Path. - Click the Add button on the right, and then click **Browse**.
- Select the folder containing your tools (e.g.,
C:\iViDLab\Tools\) and click **OK**. - Click Apply and then OK to save your changes.
3. Autoloading DLLs and Assigning Shortcut Commands
To load a C# .NET DLL in AutoCAD, you traditionally type the NETLOAD command and browse for the file. To automate this, the professional approach is using a tiny **AutoLISP (.lsp)** helper script executed at startup which:
- Automatically runs `NETLOAD` pointing to your target DLL on drawing initialization.
- Creates a very short command alias (e.g. `VBL`) to run the actual command defined inside the DLL (e.g. `iViDBlockLibrary`).
Chọn công cụ của bạn bên dưới, hệ thống sẽ tự động quét thông tin từ ổ đĩa máy tính, tạo mã LISP và cho phép tải về dùng ngay! Select your CAD tool below. The system will load local parameters, write the LISP code, and let you download it instantly!
;; Live Preview will render here