乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 12|回复: 10

[编程交流] Please help! , help me complet

[复制链接]

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 22:15:06 | 显示全部楼层 |阅读模式
Please help! , help me complete this program. many thanks!
 
  1. (defun c:test()[color=red];;Add to improve this program[/color] (princ))(defun make-dcl  (/ lst_str str file f) (setq lst_str '("temp:dialog  ""{label="Dialog learning" ;  "" :boxed_column { label = "test" ;"" :column {"" :row {"" :button { key = "t1" ;label = "test1" ;width = 15 ; }" [color=red];; Want this button to open the system calculator, this dialog box does not exit.[/color] " :button { key = "t2" ;label = "test2" ;width = 15 ; }}";;[color=red] Want this button to perform CAD command "line", after the execution to exit the dialog.[/color]" :column {"" :row {"" :button { key = "t3" ;label = "test3" ;width = 15 ; }" ;; [color=red]Want this  button to call the command "test2", after the execution to exit the dialog.[/color]" :button { key = "t4" ;label = "test4" ;width = 15 ; }}}}}";;[color=red]Want this button to open the website "[/color][url="http://www.cadtutor.net"][color=red]www.cadtutor.net[/color][/url][color=red]", this dialog box does not exit.[/color]"ok_cancel;""}" )   )   (setq file (vl-filename-mktemp "temp3.dcl"))   (setq f (open file "w"))   (foreach str lst_str(princ "\n" f)(princ str f)   )   (close f)   ;;return   file)
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:25:52 | 显示全部楼层
 
  1. (defun c:test (/ dd) (new_dialog "temp" (load_dialog (make-dcl))) (mapcar ''((x) (action_tile x "(done_dialog (atoi(substr $key 2 1)))"))         '("t1" "t2" "t3" "t4") ) (setq dd (start_dialog)) (cond ((= dd 1) (startapp "calc"))       ((= dd 2) (command "Line"))       ((= dd 3) (test2))       ((= dd 4) (command "browser" "http://www.cadtutor.net")) ) (princ))(defun test2 nil (alert "This is test2"))
HTH
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 22:31:04 | 显示全部楼层
 
Thanks HTH,
But , I need two button after performing , the dialog don't exit .
 
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:34:23 | 显示全部楼层
HTH= Hope This Help
 
all actions put in a while loop, if cond 1 or 4
  1. (defun c:test (/ dd dcl_id) (setq dcl_id (load_dialog (make-dcl))) (setq dd 1) (while   (or (= dd 1)(= dd 4))   (new_dialog "temp" dcl_id)   (mapcar ''((x) (action_tile x "(done_dialog (atoi(substr $key 2 1)))"))  '("t1" "t2" "t3" "t4" )  ) ;_ end of mapcar   (action_tile "accept" "(done_dialog 0)")   (setq dd (start_dialog))   (cond ((= dd 1) (startapp "calc"))  ((= dd 2) (command "Line"))  ((= dd 3) (test2))  ((= dd 4) (command "browser" "http://www.cadtutor.net")   )  ) ;_ end of cond   ) ;_ end of while (unload_dialog dcl_id) (princ) ) ;_ end of defun
LOL
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 22:41:04 | 显示全部楼层
 
:lol: I'm Sorry ! .......
 
Your code is very nice, Thanks very much ! this is what I want.
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 22:50:18 | 显示全部楼层
 
Sorry hanhphuc, please help me again.
It took me half a day, but without success .
In this lisp file .
I want "button1", "button2" and "button3" can open web page,   the dialog don't exit .
 
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 22:55:28 | 显示全部楼层
hi duan,
how did you convert logo to vector nice?
you also can add QrCode too
 
your action_tile missing,
add after logo
  1. [color="#696969"](defun c:aboutme        (/ LOGO aboutme FILE STR DC GO LST GO [color="red"]dd[/color]).........     (progn     (LOGO "logo")[/color]     (mapcar ''((x) (action_tile x "(done_dialog (atoi(substr $key 4 1)))"))  '("web1" "web2" "web3" "[color="red"]oki4[/color]") ; *ok_only  ) ;_ end of mapcar     (setq dd (start_dialog))   (cond ((= dd 1) (command "browser" "http://www.cadtutor.net"))  ((= dd 2) (command "browser" "http://www.google.com"))  ((= dd 3) (command "browser" "http://www.lee-mac.com"))   ((= dd 4) (done_dialog 0))  )  ;_ end of cond(UNLOAD_DIALOG DC)(VL-FILE-DELETE DCLF)     )   )   (PRINC) ) [color="#696969"];end of aboutMe[/color]
 
in dcl add modify oki -> oki4 , *note: you can omit this line if use ok_only with (action_tile "accept" "...")
  1. ": button { label = "ok"; key = "[color="red"]oki4[/color]"; height = 1.75; fixed_height = true; alignment = centered; is_default = true; }}"
回复

使用道具 举报

36

主题

161

帖子

125

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
182
发表于 2022-7-5 23:02:34 | 显示全部楼层
 
Thank you very much again, han, very good!
I use "Pixel extraction experts " convert logo to vector nice.
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=95997&extra=page%3D1%26filter%3Dtypeid%26typeid%3D108%26typeid%3D108
 
I know ,some software can make Qrcode ,
231509xjerr52i5zejj5ij.png
 
How  to convert ? and add to DCL?
This ???
  1. (defun c:Mimage (/ BackGround Colors DclFile DclList Dist DxfData Entity Height HeightY Inside LastEntity Line LowerRight LspFile LspList Number Objects Pt SaveOsmode UpperLeft Width WidthX WmfFile X X1s X2s XY Y Y1s Y2s) (princ "\nMimage makes an image file for a dialog image tile.") (setvar "cmdecho" 0) (redraw) (setq UpperLeft (nth 0 (ViewPoints)) LowerRight (nth 1 (ViewPoints)) Width (nth 2 (ViewPoints)) Height (nth 3 (ViewPoints))) (if (not *X) (setq *X (fix (+ 0.5 (* 100 (/ Width (float Height))))))) (if (not *Y) (setq *Y 100)) (if (not (setq X (getint (strcat "\nEnter dimx_tile value : ")))) (setq X *X)) (if (not (setq Y (getint (strcat "\nEnter dimy_tile value : ")))) (setq Y *Y)) (if (or (< X 2) (< Y 2))   (progn (princ "\nThe dimx_tile and dimy_tile values must be greater than 1.") (exit))   (setq *X X *Y Y) ) (if (< (/ X (float Y)) (/ Width Height))   (setq Dist (* Height (/ X (float Y))) Pt (list (+ (car UpperLeft) Dist) (cadr LowerRight)))   (setq Dist (* Width (/ Y (float X))) Pt (list (car LowerRight) (- (cadr UpperLeft) Dist))) ) (grdraw UpperLeft (list (car UpperLeft) (cadr Pt)) 1) (grdraw (list (car UpperLeft) (cadr Pt)) Pt 1) (grdraw Pt (list (car Pt) (cadr UpperLeft)) 1) (grdraw (list (car Pt) (cadr UpperLeft)) UpperLeft 1) (initget "Yes No") (setq Inside (getkword "\nAre the image objects inside the red outline? [Yes/No] : ")) (if (= Inside "No") (progn (princ "\nPan or zoom as required, then run the program again.") (exit))) (initget "Yes No") (setq BackGround (getkword "\nDo you want an image background? [Yes/No] : ")) (setq BackGround (if (= BackGround "No") "    color = -15;" "    color = -2;")) (princ "\nCreating image file...") (princ) (if (setq Objects (ssget "c" UpperLeft Pt))   (progn     (setq WmfFile (vl-filename-mktemp "Temp.wmf") XY (list X (* Y -1)))     (command "wmfout" WmfFile Objects "" "undo" "begin" "zoom" "0,0" XY)     (setq LastEntity (entlast) SaveOsmode (getvar "osmode")) (setvar "osmode" 0)     (command "wmfin" WmfFile "0,0" 2 2 0) (setvar "osmode" SaveOsmode)     (setq Entity (entlast)) (command "explode" Entity)     (while (setq Entity (entnext Entity))       (if (= (cdr (assoc 0 (entget Entity))) "POLYLINE") (command "explode" Entity))     )     (setq Entity LastEntity)     (while (setq Entity (entnext Entity))       (setq DxfData (entget Entity))       (if (= (cdr (assoc 0 DxfData)) "LINE")         (progn           (setq X1s (append X1s (list (fix (cadr (assoc 10 DxfData))))))           (setq Y1s (append Y1s (list (fix (abs (caddr (assoc 10 DxfData)))))))           (setq X2s (append X2s (list (fix (cadr (assoc 11 DxfData))))))           (setq Y2s (append Y2s (list (fix (abs (caddr (assoc 11 DxfData)))))))           (setq Colors (append Colors (list (cdr (assoc 62 DxfData)))))         )       )     )     (command "undo" "end" "undo" 1)   ) ) (setq WidthX (rtos (+ (* (1- X) (/ 1 6.0)) 0.09) 2 2) HeightY (rtos (+ (* (1- Y) (/ 1 13.0)) 0.048) 2 2)) (setq DclList (list "Vimage : dialog {" "  label = "Vimage Preview"; spacer;" "  : image {" "    key = "image1";" "    alignment = centered;" (strcat "    width = " WidthX ";") "    fixed_width = true;" (strcat "    height = " HeightY ";") "    fixed_height = true;" BackGround "  }" "  ok_only;" "}")) (setq DclFile (open (strcat *VimageFolder "Vimage.dcl") "w")) (foreach Line DclList (write-line Line DclFile)) (close DclFile) (setq LspList (list "(defun Vimage (/ DclID)" "  (setq DclID (load_dialog (strcat *VimageFolder "Vimage.dcl")))" "  (new_dialog "Vimage" DclID)" "  (image1)" "  (princ (strcat "\\ndimx_tile = " (itoa (dimx_tile "image1")) ", dimy_tile = " (itoa (dimy_tile "image1")))) (princ)" "  (start_dialog)" "  (unload_dialog DclID)" "  (princ)" ")" "(defun image1 ()" "  (start_image "image1")")) (if Objects   (progn     (setq LspList (append LspList (list "  (mapcar 'vector_image")))     (setq Line "    (list") (foreach Number X1s (setq Line (strcat Line " " (Align Number)))) (setq Line (strcat Line ")"))     (setq LspList (append LspList (list Line)))     (setq Line "    (list") (foreach Number Y1s (setq Line (strcat Line " " (Align Number)))) (setq Line (strcat Line ")"))     (setq LspList (append LspList (list Line)))     (setq Line "    (list") (foreach Number X2s (setq Line (strcat Line " " (Align Number)))) (setq Line (strcat Line ")"))     (setq LspList (append LspList (list Line)))     (setq Line "    (list") (foreach Number Y2s (setq Line (strcat Line " " (Align Number)))) (setq Line (strcat Line ")"))     (setq LspList (append LspList (list Line)))     (setq Line "    (list") (foreach Number Colors (setq Line (strcat Line " " (Align Number)))) (setq Line (strcat Line ")"))     (setq LspList (append LspList (list Line "  )")))   ) ) (setq LspList (append LspList (list "  (end_image)" ")"))) (setq LspFile (open (strcat *VimageFolder "Vimage.lsp") "w")) (foreach Line LspList (write-line Line LspFile)) (close LspFile) (princ " Complete!") (c:Vimage) (princ))(defun c:Vimage () (if (and (findfile (strcat *VimageFolder "Vimage.lsp")) (findfile (strcat *VimageFolder "Vimage.dcl")))   (progn (load (strcat *VimageFolder "Vimage.lsp")) (Vimage))   (princ (strcat "\nRun Mimage first to create the " *VimageFolder "Vimage.lsp file.")) ) (princ))(defun Align (Number) (cond   ((< Number 10) (strcat "  " (itoa Number)))   ((< Number 100) (strcat " " (itoa Number)))   ((itoa Number)) ))(defun ViewPoints (/ Center Height LowerRight UpperLeft Width) (setq Height (getvar "viewsize")) (setq Width (* Height (/ (car (getvar "screensize")) (cadr (getvar "screensize"))))) (setq Center (trans (getvar "viewctr") 1 2)) (setq UpperLeft (trans (list (- (car Center) (/ Width 2.0)) (+ (cadr Center) (/ Height 2.0))) 2 1)) (setq LowerRight (list (+ (car UpperLeft) Width) (- (cadr UpperLeft) Height))) (list UpperLeft LowerRight Width Height))(setq *X nil *Y nil *VimageFolder "C:\\Temp\")(if (not (findfile (strcat *VimageFolder "Vimage.dcl"))) (vl-mkdir *VimageFolder))(princ "\nType Mimage2 to make image file or type Vimage to view image.")
回复

使用道具 举报

26

主题

145

帖子

122

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
130
发表于 2022-7-5 23:04:07 | 显示全部楼层
Hi my best friend hanhphuc , how make Qrcode ? and how add to DCL dialog! expect!
回复

使用道具 举报

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 23:10:09 | 显示全部楼层
Thank you for sharing. This almost same concept with Terry's vector function
 
sorry qrcode algorithm is very complex matrix calculations
not my level can do.
 
as long as the image converted to vector coordinates then its ok.
so you can try alternative:
1. Autodesk Xchange does has Qrcode plugin?
2. 3rd party dlls or .net component
3. create your qrcode by 3rd party app, save as image try using highflybird's "Pixel extraction" to convert.
4. convert to metafile then explode. maybe can use the above vimage.lsp
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 06:36 , Processed in 0.356987 second(s), 74 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表