📄 dimex.lsp
字号:
;;; Arguments: ;
;;; vla-circle = a valid vla circle object. ;
;;; vla-leader = a valid vla leader object. ;
;;; ;
;;; Returned Value: An updated circle object. ;
;;; ;
;;; Usage: ;
;;; (update-circle-for-rdim ;
;;; vla-circle vla-leader ;
;;; ) ;
;;;--------------------------------------------------------------------;
(defun update-circle-for-rdim (vla-circle vla-mtext / rad center)
(if (set-circle-params-for-mdim vla-mtext)
(progn
(if (and rad (> rad 0))
(update-parameter-mdim vla-circle "Radius" rad)
)
)
)
)
;;;--------------------------------------------------------------------;
;;; Function: REACTOR-CIRCLE->LEADER ;
;;; ;
;;; Description: This function will be called inside ;
;;; :vlr-modified event. ;
;;; ;
;;; Required Functions: ;
;;; update-leader-for-circle ;
;;; ;
;;; Arguments: ;
;;; notifier = a valid vla object. Filled in by the calling ;
;;; reactor. ;
;;; reactor = a valid vlr object reactor. Filled in by the ;
;;; calling reactor. ;
;;; arg-list = argument list filled in by the calling reactor. ;
;;; Filled in by the calling reactor. ;
;;; ;
;;; Returned Value: A valid vla leader object. ;
;;; ;
;;; Usage: Intended to be called from a reactor call back. ;
;;; (reactor-circle->leader notifier reactor arg-list) ;
;;;--------------------------------------------------------------------;
(defun reactor-circle->leader (notifier reactor arg-list)
(update-leader-for-circle (vlr-data reactor) notifier)
)
;;;--------------------------------------------------------------------;
;;; Function: REACTOR-LEADER->MTEXT ;
;;; ;
;;; Description: This function will be called inside ;
;;; :vlr-modified event. ;
;;; ;
;;; Required Functions: ;
;;; update-mtext-for-leader ;
;;; ;
;;; Arguments: ;
;;; notifier = a valid vla object. Filled in by the calling ;
;;; reactor. ;
;;; reactor = a valid vlr object reactor. Filled in by the ;
;;; calling reactor. ;
;;; arg-list = argument list filled in by the calling reactor. ;
;;; Filled in by the calling reactor. ;
;;; ;
;;; Returned Value: A valid vla mtext object. ;
;;; ;
;;; Usage: Intended to be called from a reactor call back. ;
;;; (reactor-leader->mtext notifier reactor arg-list) ;
;;;--------------------------------------------------------------------;
(defun reactor-leader->mtext (notifier reactor arg-list)
(update-mtext-for-leader (vlr-data reactor) notifier)
)
;;;--------------------------------------------------------------------;
;;; Function: REACTOR-RDIM->CIRCLE ;
;;; ;
;;; Description: This function will be called inside ;
;;; :vlr-modified event. ;
;;; ;
;;; Required Functions: ;
;;; update-circle-for-rdim ;
;;; ;
;;; Arguments: ;
;;; notifier = a valid vla object. Filled in by the calling ;
;;; reactor. ;
;;; reactor = a valid vlr object reactor. Filled in by the ;
;;; calling reactor. ;
;;; arg-list = argument list filled in by the calling reactor. ;
;;; Filled in by the calling reactor. ;
;;; ;
;;; Returned Value: A valid vla circle object. ;
;;; ;
;;; Usage: Intended to be called from a reactor call back. ;
;;; (reactor-rdim->circle notifier reactor arg-list) ;
;;;--------------------------------------------------------------------;
(defun reactor-rdim->circle (notifier reactor arg-list)
(update-circle-for-rdim (vlr-data reactor) notifier)
)
;;;--------------------------------------------------------------------;
;;; Function: C:DIMEX-TST ;
;;; ;
;;; Description: This function aids in the creation of a circle ;
;;; object which will contain reactors for: ;
;;; COPY, MIRROR or ARRAY ;
;;; ;
;;; Required Functions: ;
;;; reactor-circle->leader ;
;;; reactor-rdim->circle ;
;;; reactor-leader->mtext ;
;;; add-circle ;
;;; create-dim-for-circle ;
;;; ;
;;; Arguments: none ;
;;; ;
;;; Returned Value: A list of vlr object reactors: ;
;;; ( ;
;;; #<VLR-Object-reactor> ;
;;; #<VLR-Object-reactor> ;
;;; #<VLR-Object-reactor> ;
;;; ) ;
;;; ;
;;; Usage: (C:DIMEX-TST) or DIMEX-TST from ;
;;; the ACAD Command: prompt. ;
;;;--------------------------------------------------------------------;
(defun C:DIMEX-TST (/ vla-circle vla-dim vla-mtext vla-leader r1 r2 r3)
(function reactor-circle->leader)
(function reactor-rdim->circle)
(function reactor-leader->mtext)
(setq vla-circle (ADD-CIRCLE))
(if vla-circle
(progn
(vla-put-Color vla-circle acRed)
(setq vla-dim (create-dim-for-circle vla-circle)
vla-mtext (car vla-dim)
vla-leader (cadr vla-dim)
r1 (VLR-Object-reactor
(list vla-circle)
vla-leader
'((:vlr-modified . reactor-circle->leader))
)
r2 (VLR-Object-reactor
(list vla-leader)
(list vla-mtext vla-circle)
'((:vlr-modified . reactor-leader->mtext))
)
r3 (VLR-Object-reactor
(list vla-mtext)
vla-circle
'((:vlr-modified . reactor-rdim->circle))
)
)
(list r1 r2 r3)
)
)
)
;;;--------------------------------------------------------------------;
;;; Function: C:DIMEX-INFO ;
;;; ;
;;; Description: This function displays a help file in the ACAD ;
;;; Command: prompt. ;
;;; ;
;;; Arguments: none ;
;;; ;
;;; Returned Value: none ;
;;; ;
;;; Usage: (C:DIMEX-INFO) or DIMEX-INFO from ;
;;; the ACAD Command: prompt. ;
;;;--------------------------------------------------------------------;
(defun C:DIMEX-INFO ()
(princ "\nActive DIMENSION example.")
(princ "\nThis program creates a red circle and an associated dimension.")
(princ "\nYou will be prompted to select the center and radius of the circle.")
(princ "\nWhen the circle radius changes, the MTEXT dimension also changes.")
(princ "\nConversely, when you change the value of the MTEXT dimension, the")
(princ "\ncircle radius will change.")
(princ "\n\nRun DIMEX-TST command for test.")
(princ)
)
;;;--------------------------------------------------------------------;
;;; Add the functions within this file to the global functions list ;
;;; to be used by the C:REACT-TEST-INFO function in R-INFO.LSP ;
;;;--------------------------------------------------------------------;
(setq *REACT-TEST-COMMANDS-INFO*
(cons (list "DIMEX-TST" "DIMEX-INFO")
*REACT-TEST-COMMANDS-INFO*
)
)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -