以下是我的一些基本代码模块。可能会有帮助。。
确保在代码中添加(vl load com)。
- ;------------------------------------------------------------------------------
- ;pp_GetCurrPlotRotation:
- ;------------------------------------------------------------------------------
- (defun pp_GetCurrPlotRotation()
- (vla-get-plotrotation (pp_GetActiveLayout))
- )
- ;------------------------------------------------------------------------------
- ;pp_GetActiveLayout: Returns active layout object
- ;------------------------------------------------------------------------------
- (defun pp_GetActiveLayout ()
- (vla-get-ActiveLayout (pp_GetActiveDocument))
- )
- ;------------------------------------------------------------------------------
- ;pp_GetActiveDocument: Returns active AutoCAD drawing document object
- ;------------------------------------------------------------------------------
- (setq *active-document* nil) ; Initialize global variable
- (defun pp_GetActiveDocument ()
- (cond (*active-document*) ; Return the cached object
- (T
- (setq *active-document* (vla-Get-ActiveDocument (pp_GetAcadObject)))
- )
- )
- )
- ;------------------------------------------------------------------------------
- ;pp_GetAcadObject: Returns active AutoCAD object
- ;------------------------------------------------------------------------------
- (setq *acad-object* nil) ; Initialize global variable
- (defun pp_GetAcadObject ()
- (cond (*acad-object*) ; Return the cached object
- (T
- (setq *acad-object* (vlax-Get-Acad-Object))
- )
- )
- )
|