myfrankie 发表于 2014-10-28 08:57:02

请问如何加入其它的脚本,如lsp vlx arx 等

恕放之生命 发表于 2014-10-28 09:19:30

myfrankie 发表于 2014-10-28 08:57 static/image/common/back.gif
请问如何加入其它的脚本,如lsp vlx arx 等

这是很基础的修改阿,请看下面图片说明。



根据实际需要修改对话框后,上面的内容相应修改一下就行了,如果还不懂就先学一下基础教程吧。

lpl 发表于 2014-10-28 12:28:52

恕放之生命 发表于 2014-10-28 09:19 static/image/common/back.gif
这是很基础的修改阿,请看下面图片说明。




位图的像素您是怎么提取出来的代码
(list26 147 147262628 145 1452828 14586 101 101 101 123 113868686 115 101)
    (list15158686151717848417636317252125257469796363)
    (list 147 147262626 145 1452828288686 101 145 145 123 113 145 145 145 115 101)
    (list15868615151784841717638425252117177469798484)
    (list   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7   7)

恕放之生命 发表于 2014-10-28 13:40:04

lpl 发表于 2014-10-28 12:28 static/image/common/back.gif
位图的像素您是怎么提取出来的代码
(list26 147 147262628 145 1452828 14586 101 101 10 ...

描点阿,在论坛上找。

lpl 发表于 2014-10-28 14:03:09

恕放之生命 发表于 2014-10-28 13:40
描点阿,在论坛上找。

我用高飞鸟的提取像素,不知道怎么搞

love1030312 发表于 2014-10-29 09:36:11

支持啊

lyqiezi 发表于 2014-10-29 12:56:50

love1030312 发表于 2014-10-29 09:36 static/image/common/back.gif
支持啊

感谢分享,收藏备用(还没弄过对话框)

恕放之生命 发表于 2014-10-29 13:39:52

lpl 发表于 2014-10-28 14:03 static/image/common/back.gif
我用高飞鸟的提取像素,不知道怎么搞

讨论可以加入明经群,以下是描点程序:(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 <" (itoa *X) ">: ")))) (setq X *X))
(if (not (setq Y (getint (strcat "\nEnter dimy_tile value <" (itoa *Y) ">: ")))) (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? <Y>: "))
(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? <Y>: "))
(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.")
描完后的文件保存在c:\temp,也可以自己修改路径。

lpl 发表于 2014-10-29 13:58:23

恕放之生命 发表于 2014-10-29 13:39 static/image/common/back.gif
讨论可以加入明经群,以下是描点程序:描完后的文件保存在c:\temp,也可以自己修改路径。

这个描点程序,没有高飞鸟的像素专家好,可以提取图片的像素

zh74 发表于 2014-10-29 22:20:34

学习一下,感谢分享
页: 1 [2] 3 4 5 6 7 8 9 10
查看完整版本: 自己做的DCL工具面板(源码) 免币分享