(defun c:mini_create_lsp_image ( / old_cmd dcl dlg ss file_lsp imgList zoom_scale)
	(mini_start nil)
	(mai_last_com "mini_create_lsp_image")
	(setq dcl
			(mai_load_dialog
				(list
					"SaveToLsp:dialog{ label = \"选择实体，保存为Lsp或Wmf图像\" ;"
					"    :image { color = -2 ; height = 30 ; key = \"img_preview\" ; width = 80 ; height = 40 ; }"
					"    :row { "
					"        :column { children_fixed_height = true ; children_fixed_width = true ; fixed_height = true ; ixed_width = true ; width = 3 ;"
					; "            :text { alignment = centered ; label = \"按钮\" ; }"
					"            :image { color = -15 ; height = 8 ; key = \"img_icon\" ; width = 8 ; }}"
					"        :boxed_column { "
					; "            :row { "
					; "                :edit_box { key = \"edt_file\" ; label = \"存储文件名\" ; width = 60 ; }"
					; "                :button { fixed_width = true ; key = \"btn_file\" ; label = \"浏览\" ; }}"
					"            :column { "
					"                :edit_box { key = \"edt_scale\" ; label = \"缩放比例：\" ; width = 10 ; }"
					"                :button { key = \"btn_ssget\" ; label = \"拾取对象\" ; }"
					; "            :row { "
					; "                :toggle { key = \"tog_zoom\" ; label = \"视图放大\" ; }"
					"                :button { key = \"btn_save1\" ; label = \"保存到lsp文件\" ; }"
					; "                :button { key = \"btn_save2\" ; label = \"保存到wmf文件\" ; }"
					"                cancel_button ; }}}}"
				)
			)
	)
	(setq dlg 1)
	(while (= dlg 1)
		(setq dlg nil)
		(or zoom_scale (setq zoom_scale 0.95))
		(or (new_dialog "SaveToLsp" dcl) (exit))
		(mai_filldcl_image "img_preview" -2 (cond (imgList) ("cfonts(noslide)")))
		(mai_filldcl_image "img_icon" -15 (cond (imgList) ("cfonts(noslide)")))
		(set_tile "edt_scale" (rtos zoom_scale 2 0))
		(action_tile
			"edt_scale"
			(vl-prin1-to-string
				'(	(lambda ( )
						(setq dlg (atof $value))
						(if (> dlg 0) (setq zoom_scale (min 1 dlg)))
						(set_tile "edt_scale" (rtos zoom_scale 2 0))
					)
				)
			)
		)
		; (or (mai_SaveToTxt_file (setq mai_SaveToTxt_file (strcat mai_mini_path "输出文件")))
	  
		; (set_tile "edt_file" mai_save_file)
		; (action_tile
			; "edt_file"
			; "(if (vl-file-directory-p (vl-filename-directory $value))
				; (setq mai_save_file $value)
				; (set_tile \"edt_file\" mai_save_file)
			; )"
		; )

		; (set_tile "tog_zoom" (EF:getVar "DCL_SaveToTxt_Zoom"))
		; (action_tile "tog_zoom" "(EF:setVar \"DCL_SaveToTxt_Zoom\" $value)")
	  
		; (action_tile
			; "btn_file"
			; "(if (setq sFileName (getfiled \"选择要保存的文件名\" (EF:getVar \"DCL_SaveToTxt_File\") \"txt\" 1))
				; (set_tile \"edt_file\" (EF:setVar \"DCL_SaveToTxt_File\" sFileName))
			; )"
		; )
	  
		(action_tile "btn_ssget" "(done_dialog 1)")
		(action_tile "btn_save1" "(done_dialog 2)")
		; (action_tile "btn_save2" "(done_dialog 3)")

		; (action_tile
			; "btn_save"
			; "(if (vl-file-directory-p  (vl-filename-directory  (EF:getVar \"DCL_SaveToTxt_File\")))
				; (if (EF:Image-imgList->TXT imgList (EF:getVar \"DCL_SaveToTxt_File\")) (alert \"成功保存\"))
				; (alert \"文件名或路径错误\")
			; )"
		; )
	  
		(setq dlg (start_dialog))
		(cond
			(	(= dlg 0))
			
			(	(= dlg 1)
				(if (setq ss
							(mai_select_firsts
								(list (cons 0 "arc,line,circle,*polyline,ellipse,spline"))
								"选择实体显示到dcl，并获得对话框图像数据:<退出>"
								"没有选择到实体"
								nil
							)
					)
					(setq imgList (mai_image2file ss nil nil 480 zoom_scale))
				)
			)
			
			(	(= dlg 2)
				(or ss
					(setq ss
							(mai_select_firsts
								(list (cons 0 "arc,line,circle,*polyline,ellipse,spline"))
								"选择实体显示到dcl，并获得对话框图像数据:<退出>"
								"没有选择到实体"
								nil
							)
					)
				)
				(or ss (exit))
				(setq file_lsp (mai_dos_tempfile "lsp"))
				(mai_image2file (cond (imgList) (ss)) "mai_save_dcl_image" file_lsp 480 (if imgList 1 zoom_scale))
				(mai_shell_ascii_edit file_lsp nil)
			)
			
			; (	(= dlg 3)
				; (setq ss (mai_select_firsts nil "选择实体显示到dcl，并获得对话框图像数据:<退出>" "没有选择到实体" nil))
				; (or ss (exit))
				; (setq file_lsp (mai_dos_tempfile "wmf"))
				; (mai_wmf_out ss file_lsp zoom_scale )
				; (mai_dos_execute (strcat "\"" file_lsp "\"") nil)
			; )
		)
	)
	(mai_end)
)
