马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Lispboy 于 2018-5-25 15:29 编辑
- ;|
- 增强的对话框图层选择函数
- 参数:无
- 返回值:字符串
- 说明:选择的图层供后续的函数如SSGET等做过滤。
- |;
- (setq XD-DCL-GetLyr-Data
- '("YWt6A8c9AAChV2PeBuKTJBUSaitqQKVoRMolVm5gVG9qbnvVE8kxNn4l6x4ldNKkHjPkCCWlrKzU"
- "OyWXcc9BdPwozDiq1LpKpOa4eUAurWYThP3WLzwyuj5yQABund3kXGvVkoviRU1FDbEQyRJXU8UM"
- "SQmQAg1hDcEFwA2YsMq3vFm+tq2U32Jg/1QGbizeZLWTbn1+OZ1/bGIG/DPo6j1UGv91kP001n5x"
- "SLK8Vev2LV59zM8tWOArPlAgs7hNcdqd3lC6FwZLI+CbnOfC295vLc9RqxicqzSSO50qH0WDUnXR"
- "6Z0ncCA3PeJcubW4QJcm6f8baKivMmKe2jeUF38WcEcH545IN/sAEPsudTO2kwgWOspzyjEf6Kes"
- "ltwT+EbOW5MvjvGDbTAllflXNINS1QBv4BfPcAEB1K5AzpQbhT1ywbGOBXIV8NeYDsoMpMHe8MEm"
- "X2WZxUWRoAflFQgV4eOJXCIRo49LZI9i1gkC75/5Z6C/zh6GJfjlZwDon1lm4LQonmEoodycev2M"
- "7FTa4l27nDzHmt7+NuZnLCpnVmLpX9Ey6uxQpiLCkL9Vmway7OyI3opSvwTa3s0v0lBXPuwF1Ap3"
- "ZE9rAccGKPBd2B3BajrrLNTHDBrEJH+aOHcIv7DBtvzLdwrAHXx6x3WcMyJ7nVOuQGb9PlPp653y"
- "XLZ7YCZ3XbHYcvTff6gd0LvVy6bQYPFFzhPGPAuwus2nbLGfZDamUrvJY/kRvv4i8VZT1osdPo0l"
- "uBgHP+jxzTxrS6n004TL+m3mm4ZEp+oN6o5ida0zy/NogO6OWCjB6p9zaDBYW2hOG2tMIrqOY3LV"
- "dHwTZ50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13OwFnmnuyx4AS67B/pJi31kDf0+VOFJjmSmI"
- "j0zo67hh2IUYZps8w4Jx0mWO/Q=="
- )
- )
- (defun XD::Layer:Get (/ lyrl lyr1 lyr2 $xdob_layer_hadlayerlist)
- (defun c:LayerListForm_OnInitialize (/ a all b n pos)
- (dcl_Control_SetValue SelAllCheck 0)
- (setq all (XD::Layer:GetUnFrozen))
- (setq all (vl-sort all '(lambda (a b) (< (ascii a) (ascii b)))))
- (dcl_ListBox_Clear LayerList)
- (dcl_ListBox_AddList LayerList all)
- (if $xdob_layer_hadlayerlist
- (progn (foreach n $xdob_layer_hadlayerlist
- (setq pos (- (length (dcl_control_getlist LayerList))
- (length (member n (dcl_control_getlist LayerList)))
- )
- )
- (if (>= pos 0)
- (dcl_ListBox_SelectItem LayerList pos t)
- )
- )
- (dcl_Control_SetCaption
- Get_Lyr_Nums
- (itoa (length (dcl_ListBox_GetSelectedItems LayerList)))
- )
- )
- )
- (if (= (length (dcl_control_getlist LayerList))
- (length (dcl_ListBox_GetSelectedItems LayerList))
- )
- (dcl_Control_SetValue SelAllCheck 1)
- )
- )
- (defun c:LayerList_OnSelChanged (ItemIndexOrCount Value / len)
- (if (= ItemIndexOrCount
- (length (dcl_Control_GetList LayerList))
- )
- (dcl_Control_SetValue SelAllCheck 1)
- (dcl_Control_SetValue SelAllCheck 0)
- )
- (dcl_Control_SetCaption
- Get_Lyr_Nums
- (itoa (length (dcl_ListBox_GetSelectedItems LayerList)))
- )
- (dcl_Control_SetValue UnSelCheck 0)
- )
- (defun c:SelAllCheck_OnClicked (Value /)
- (if (= 1 value)
- (dcl_ListBox_SelItemRange
- LayerList
- 0
- (1- (length (dcl_Control_GetList LayerList)))
- T
- )
- (dcl_ListBox_SelItemRange
- LayerList
- 0
- (1- (length (dcl_Control_GetList LayerList)))
- nil
- )
- )
- (dcl_Control_SetCaption
- Get_Lyr_Nums
- (itoa (length (dcl_ListBox_GetSelectedItems LayerList)))
- )
- (dcl_Control_SetValue UnSelCheck 0)
- )
- (defun c:UnSelCheck_OnClicked (Value / n selindexlist)
- (setq selIndexList (dcl_ListBox_GetSelectedNths LayerList))
- (dcl_ListBox_SelItemRange
- LayerList
- 0
- (1- (length (dcl_Control_GetList LayerList)))
- T
- )
- (foreach n selIndexList
- (dcl_ListBox_SelectItem LayerList n nil)
- )
- (setq selIndexList (dcl_ListBox_GetSelectedNths LayerList))
- (dcl_Control_SetCaption
- Get_Lyr_Nums
- (itoa (length (dcl_ListBox_GetSelectedItems LayerList)))
- )
- (cond ((= 0 (length selIndexList))
- (dcl_Control_SetValue SelAllCheck 0)
- )
- ((= (length (dcl_Control_GetList LayerList))
- (length selIndexList)
- )
- (dcl_Control_SetValue SelAllCheck 0)
- )
- )
- )
- (defun c:PickSel_OnClicked (/)
- (setq $xdob_layer_hadlayerlist (dcl_ListBox_GetSelectedItems LayerList))
- (dcl_Control_SetValue UnSelCheck 0)
- (dcl_form_close LayerListForm 5)
- )
- (defun c:CQuit_OnClicked (/)
- (dcl_Form_Close LayerListForm 4)
- )
- (defun c:ok_OnClicked (/)
- (if (> (dcl_ListBox_GetSelCount LayerList) 0)
- (progn (dcl_Form_Close LayerListForm 3)
- (setq lyrl (dcl_ListBox_GetSelectedItems LayerList))
- )
- (dcl_MessageBox "请选择图层。" "晓东温馨提示" 2 3)
- )
- )
- (defun point_selection (/ e i lyr lyrl tf)
- (setq lyrls "")
- (if $xdob_layer_hadlayerlist
- (progn (setq i 0)
- (foreach n $xdob_layer_hadlayerlist
- (if (= i 0)
- (setq lyrls n)
- (setq lyrls (strcat lyrls "," n))
- )
- (setq i (1+ i))
- )
- (xdrx_pickset_redraw (ssget "x" (list (cons 8 lyrls))))
- )
- )
- (setq doContinue T)
- (setq tf t
- i 0
- )
- (while (setq e (car (entsel "\n拾取实体确定图层<返回>:")))
- (xdrx_setenttodb e)
- (setq lyr (xdrx_getentdxf 8))
- (if (not (member (strcase lyr) $xdob_layer_hadlayerlist))
- (progn (xdrx_pickset_redraw (ssget "x" (list (cons 8 lyr))))
- (if (= i 0)
- (setq lyrl lyr)
- (setq lyrl (strcat lyrl "," lyr))
- )
- (setq i (1+ i))
- )
- )
- )
- (if lyrl
- (xdrx_pickset_redraw (ssget "x" (list (cons 8 lyrl))) t)
- )
- (if (/= "" lyrls)
- (progn (xdrx_pickset_redraw (ssget "x" (list (cons 8 lyrls))) t)
- (if lyrl
- (strcat lyrls "," lyrl)
- lyrls
- )
- )
- (progn lyrl)
- )
- )
- (xdrx_sysvar_push "osmode" "cmdecho")
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (XD::Doc:AutoLoadOpenDCL)
- (dcl_Project_Import XD-DCL-GetLyr-Data)
- (setq doContinue T)
- (while doContinue ; However, to avoid an endless loop, the condition for repeating the loop, must
- ; negate at first
- ; The condition will be "activated" again after dcl_form_show for some cases.
- (setq doContinue nil) ; if the dialog get closed, the function returns a value
- ; This is 1 for OK (reserved value), 2 for ESC or Cancel (reserved value)
- ; or the value, which was given to dcl_form_close
- (setq intResult (dcl_form_show LayerListForm))
- ; This is a modal form, so (dcl_Form_Show) does not return until
- ; the modal form is closed. In the meantime, the event handlers
- ; manage the form.
- ; Now the return value can be interpreted
- (cond ; close-button
- ; Here something can be done with the selected points ans objects
- ((= intResult 1) (setq doContinue nil)) ; ESC key
- ((= intResult 2) (setq doContinue nil)) ; point selection
- ((= intResult 3) (setq doContinue nil))
- ((= intResult 4) (setq doContinue nil))
- ((= intResult 5)
- (setq $xdob_layer_hadlayerlist (xdrx_string_split (point_selection) ","))
- )
- ) ; cond
- ) ; while
- (xdrx_end)
- (xdrx_sysvar_pop)
- (if lyrl
- (progn (setq lyr1 (car lyrl)
- lyr2 ""
- )
- (foreach n (cdr lyrl) (setq lyr2 (strcat lyr2 "," n)))
- (setq lyrl (strcat lyr1 lyr2))
- )
- (setq lyrl "")
- )
- lyrl
- )
|