Define a general dynamic drag move (copy) function (xd::drag:simplemove)Here is a simple DRAG MOVE:;|
Function name: XD::Drag:SimpleMove
Call format: (XD::Drag:SimpleMove ss info baseptflag tf)
Parameter description: ss --- selection set or entity
info -- prompt string
baseptflag -- (1-9) the base point of dragging, the 9 feature points of the bounding box
tf --- t move nil copy
Return value: selection set
Function introduction: basic implementation of moving, copying and dragging
Function source: original
Function author: Lispboy
Applicable versions: XDRX API
Last updated: 2016-05-12
|;
(defun XD::Drag:SimpleMove
(ss info baseptflag tf
/ dynpt lastpnt myerr olderr pnt
) ;|
The callback function only performs a simple operation
Call the MOVE function to move the selection set
|;
(xdrx_entity_move ss lastpnt dynpt)
)
(if (or (< baseptflag
1) (> baseptflag
9)) )
(setq lastpnt
(trans (xd::geom:get9pt ss baseptflag
) 1 0)) )
baseptflag
)
)
(setq lastpnt baseptflag
) )
(t
(setq lastpnt
(trans (xd::geom:get9pt ss
5) 1 0))) )
(setq ss
(xdrx_entity_copy ss
)) )
(xdrx_pointmonitor "_callback" ss)
)
(xdrx_pointmonitor)
pnt
)
The following is a more complex drag move general function,
Allows you to customize your own callback function and handle your events in the general drag move function.(defun XD::Drag:SimpleMove
(ss info baseptflag tf / dynpt lastpnt myerr olderr pnt mlastpnt)
(defun _tmpmovecallback
(dynpt
) (= (type #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBack
) 'STR
) 'SUBR
)
(= (type (eval (read #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBack
))) 'USUBR
)
)
)
)
)
)
(if (setq pnt
(XD::Drag:CallBackGetDynPnt
)) )
(xdrx_entity_move ss #xd-var-global-drag-basepoint dynpt)
(setq #xd
-var
-global
-drag
-basepoint dynpt
) )
(xdrx_end)
)
((= (type baseptflag
) 'INT
) (if (or (< baseptflag
1) (> baseptflag
9)) )
(setq lastpnt
(trans (xd::geom:get9pt ss baseptflag
) 1 0)) )
baseptflag
)
)
(setq lastpnt baseptflag
) )
(t
(setq lastpnt
(trans (xd::geom:get9pt ss
5) 1 0))) )
(xd::drag:setbasepoint lastpnt)
(setq #xd
-var
-global
-drag
-basepoint lastpnt
) (setq ss
(xdrx_entity_copy ss
)) )
(while (and tf
(xdrx_pointmonitor
"_tmpmovecallback" ss
)(xd::doc:getkeyword
) (setq pnt
(getpoint info
))) (xdrx-pointmonitor)
(xd::drag:setbasepoint #xd-var-global-drag-basepoint)
(= (type #XD
-VAR
-FUNC
-DRAG
-KeyWord
-CallBack
) 'STR
) 'SUBR
)
'USUBR
)
)
)
)
)
)
(setq #xd
-var
-global
-drag
-basepoint
(xd::drag:getbasepoint
)) )
)
)
(xdrx_pointmonitor)
)
pnt
)
;|
Function name: XD::Drag:CallBackSetMouseMove
Call format: (XD::Drag:CallBackSetMouseMove func)
Parameter description: func --- String function name
Return value: Successfully returns the function name string
No returns NIL
Function introduction: Set the mouse movement callback processing function of the drag series function
Function source: original
Function author: XDSoft
Applicable versions: XDRX API
Last updated: 2016-07-08
Note: The callback function has one parameter, the point parameter. The value of the point parameter is the point where the mouse moves on the dynamic point monitor. The callback function performs processing operations based on this point.
|;
(defun XD::Drag:CallBackSetMouseMove
(func
) (setq #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBack
nil) (setq #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBackDynPnt
nil) )
)
(setq #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBack func
) )
#XD-VAR-FUNC-DRAG-MOUSEMove-CallBack
)
(defun XD::Drag:CallBackSetDynPnt
(pnt
) (setq #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBackDynPnt pnt
) )
(defun XD::Drag:CallBackGetDynPnt
() #XD-VAR-FUNC-DRAG-MOUSEMove-CallBackDynPnt
)
(defun XD::Drag:CallBackSetKeyWord
(str
) (setq #XD
-VAR
-FUNC
-DRAG
-MOUSEMove
-CallBackKeyWord str
) )
(defun XD::Drag:CallBackSetKeyWord
(func
) (setq #XD
-VAR
-FUNC
-DRAG
-KeyWord
-CallBack
nil) )
)
(setq #XD
-VAR
-FUNC
-DRAG
-KeyWord
-CallBack func
) )
#XD-VAR-FUNC-DRAG-KeyWord-CallBack
)
(defun XD::Drag:CallBackGetKeyWord
() #XD-VAR-FUNC-DRAG-KeyWord-CallBack
)
;|
Function name: XD::Drag:CallBackSetMouseLeftClick
Call format: (XD::Drag:CallBackSetMouseLeftClick func)
Parameter description: func ---- callback function name string
Return value: Successfully returns the function name string
Otherwise return NIL
Function introduction: Set the left mouse button click callback processing function of the dynamic drag series function
Function source: original
Function author: XDSoft
Applicable versions: XDRX API
Last updated: 2016-07-08
Note: How to write the callback function:
There is one parameter, the point parameter. The value of the point parameter is the point where the mouse moves on the dynamic point monitor. The callback function performs processing operations based on this point.
|;
(defun XD::Drag:CallBackSetMouseLeftClick
(func
) (setq #XD
-VAR
-FUNC
-DRAG
-MOUSELeftClick
-CallBack
nil) )
)
(setq #XD
-VAR
-FUNC
-DRAG
-MOUSELeftClick
-CallBack func
) )
#XD-VAR-FUNC-DRAG-MOUSELeftClick-CallBack
)
=============
The above LISP code uses the XDRX-API, which can be downloaded from
https://github.com/xdcad/XDrx-API and is updated at any time.
The XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.
Modify message