June 18, 2013

Cài đặt thư mục support trong AutoCAD bằng VisualLISP


Đến một lúc nào đó, rất có thể chương trình của bạn sẽ phát triển đến mức cần có những thư mục riêng để làm việc.

Việc tạo thư mục riêng, sẽ giúp cho đường dẫn đến file, folder sẽ ngắn gọn hơn, giúp cho chương trình tốn ít bộ nhớ, cấu trúc sáng sủa, mạch lạc.

Vậy tạo thư mục support riêng bằng cách nào?

Hãy xem các cấu trúc hàm sau được xây dựng bằng ngôn ngữ VisualLISP.



(vl-load-com)
; Tạo thư mục TEMP tạm thời theo đường dẫn
;(vl-mkdir "c:\\ACADTEMP")
(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-acad-object))))
; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\ACADTemp")
; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS")
; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011")
; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles")
; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv")
; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\ACADTemp\\")
; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\cogg.dwt")
;Thêm mới đường dẫn đến support mới
(setq paths (vla-get-SupportPath *files*))

 (setq newpaths

  "P:\\autodesk\\supportfiles;
  P:\\autodesk\\lisp;
  P:\\autodesk\\fonts;
  P:\\autodesk\\hfs fonts;"
  )
(setq newpath (strcat newpaths paths))
(vla-put-SupportPath *files* newpath)

; Thư mục tạm thời
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\ACADTemp\\")
; template  path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates")
; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\ACADTemp\\")
; Kết thúc sử dụng *files*
(vlax-release-object *files*)
; Thoát ra một cách nhẹ nhàng
(princ "All Done")
Hãy nâng cao độ chuyên nghiệp cho ứng dụng bằng cách cài đặt thư mục làm việc riêng cho nó!

Featured Post

Lisp Copy tăng số trong AutoCAD | AutoLISP That la don gian

Ứng dụng được phát triển bởi đội ngũ AutoLISP Thật là đơn giản       Thông tin thêm: 👉👉👉

Popular Posts