因此,我的最终目标是将这些AutoLISP函数转换为.NET:
- (vl-load-com)
- (setq CUSTOM_FNAM (strcat "C:/Users/" (getvar 'loginname) "/Desktop/Action_tile.lsp"))
- (defun *error* (msg)
- (princ "Error: ")
- (princ msg)
- (princ)
- )
- (defun readFunctionPrint (str / JO_file)
- (if
- (and
- CUSTOM_FNAM
- (setq JO_file (f_open CUSTOM_FNAM "a"))
- )
- (progn
- (princ str JO_file)
- (f_close JO_file)
- )
- )
- )
- (if (not f_close)
- (progn
- (setq f_close close)
- (and (not f_open) (setq f_open open))
- (setq close
- (lambda (file / JO_file)
- (if
- (and
- CUSTOM_FNAM
- (setq JO_file (f_open CUSTOM_FNAM "a"))
- )
- (progn
- (princ (strcat "(close " (vl-prin1-to-string file) ")") JO_file)
- (princ "\n" JO_file)
- (f_close JO_file)
- )
- )
- (f_close file)
- )
- )
- )
- )
- (if (not f_open)
- (progn
- (setq f_open open)
- (and (not f_close) (setq f_close close))
- (setq open
- (lambda (key action / JO_file)
- (if
- (and
- CUSTOM_FNAM
- (setq JO_file (f_open CUSTOM_FNAM "a"))
- )
- (progn
- (princ (strcat "(open " (vl-prin1-to-string key)) JO_file)
- (princ " " JO_file)
- (princ (strcat (vl-prin1-to-string action) ")") JO_file)
- (princ "\n" JO_file)
- (f_close JO_file)
- )
- )
- (f_open key action)
- )
- )
- )
- )
- (if (not f_action_tile)
- (progn
- (setq f_action_tile action_tile)
- (setq action_tile
- (lambda (key action / JO_file)
- (if
- (and
- CUSTOM_FNAM
- (setq JO_file (f_open CUSTOM_FNAM "a"))
- )
- (progn
- (princ (strcat "(action_tile " (vl-prin1-to-string key)) JO_file)
- (princ "\n\t" JO_file)
- (princ (strcat (vl-prin1-to-string action) "\n)") JO_file)
- (princ "\n" JO_file)
- (f_close JO_file)
- )
- )
- (f_action_tile key (strcat action "(readFunctionPrint (strcat "(set_tile " key " $value) ; " $value "\n"))"))
- )
- )
- )
- )
此代码将读取使用AutoLISP的对话框中的所有代码
AutoLISP的问题在于无法为函数创建可选参数。在.NET中,您可以这样做,这就是我在这里要做的。然而,我不熟悉C#。NET与AutoCAD进行交互,因此我正在努力。我需要找到一种方法,将函数名、参数及其执行后的结果导出为文本文件中的注释
我想要一种方法,可以简单地将函数作为参数提供给.NET函数。以匿名函数作为返回。此匿名函数将存储在原始函数的符号中。此函数将调用原始函数并将数据导出到文件
我正在尝试对.NET中的对象执行此操作,根据您的描述,似乎我无法对对象执行此任务。 |