明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 11128|回复: 20

分享几个VL程序

  [复制链接]
发表于 2007-1-6 11:18 | 显示全部楼层 |阅读模式
DisplayProperties
  1. ;;; Copyright (C) 1997-2006 JTB World, All Rights Reserved
  2. (vl-load-com)
  3. ; Get Model Space Background Color
  4. (defun getMoBgColor()
  5.   (ole_color
  6.     (vla-get-GraphicsWinModelBackgrndColor
  7.       (vla-get-display (vla-get-preferences (vlax-get-acad-object)))))
  8. )
  9. ; Get Layout Space Background Color
  10. (defun getLaBgColor()
  11.   (ole_color
  12.     (vla-get-GraphicsWinLayoutBackgrndColor
  13.       (vla-get-display (vla-get-preferences (vlax-get-acad-object)))))
  14. )
  15. ; Put Model Space Background Color
  16. (defun putMoBgColor(bgc)
  17.   (vla-put-GraphicsWinModelBackgrndColor
  18.     (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
  19.     bgc
  20.   )
  21. )
  22. ; Put Layout Space Background Color
  23. (defun putLaBgColor(bgc)
  24.   (vla-put-GraphicsWinLayoutBackgrndColor
  25.     (vla-get-display (vla-get-preferences (vlax-get-acad-object)))
  26.     bgc
  27.   )
  28. )
  29. (defun ole_color(olec)
  30.   (vlax-variant-value
  31.     (vlax-variant-change-type olec vlax-vbDouble)
  32.   )
  33. )
  34. ; Get the display of the Plot Setup dialog when a new layout is created.
  35. (defun getLayoutShowPlotSetup()
  36.   (vla-get-LayoutShowPlotSetup
  37.     (vla-get-display (vla-get-preferences (vlax-get-acad-object))))
  38. )
  39. ; Put the display of the Plot Setup dialog when a new layout is created.
  40. (defun putLayoutShowPlotSetup(state)
  41.   (vla-put-LayoutShowPlotSetup
  42.     (vla-get-display (vla-get-preferences (vlax-get-acad-object))) state)
  43. )
  44. ; Toggles the display of the Plot Setup dialog when a new layout is created.
  45. (defun toggleLayoutShowPlotSetup()
  46.   (if (= (getLayoutShowPlotSetup) :vlax-true)
  47.     (putLayoutShowPlotSetup :vlax-false)
  48.     (putLayoutShowPlotSetup :vlax-true)
  49.   )
  50. )
[code] ;;; Change all text styles on all objects to specified text style;;; (ax:ChangeTextStyleName "ISOCPEUR")(defun ax:ChangeTextStyleName (style / sset ename i)  (vl-load-com)  (setq i 0)  (setq sset (ssget "X" '((-4 . "<OR") (0 . "MTEXT") (0 . "TEXT") (-4 . "OR>"))))  (if sset    (repeat (sslength sset)      (setq ename (ssname sset i))      (setq i (1+ i))      (vla-put-stylename (vlax-ename->vla-object ename) style)    )  )) [/code]Zoom extents in all viewports
  1. (defun c:zoome (/ oldcmdecho vplist curcvport nr vpss ms en x)
  2.   (setq oldcmdecho (getvar "cmdecho"))
  3.   (setvar "cmdecho" 0)
  4.   (setq vplist (mapcar 'car (vports)))
  5.   (setq curcvport (getvar "cvport"))
  6.   (if (= (getvar "tilemode") 0)
  7.     (progn
  8.       (if (= (setq ms (getvar "cvport")) 1)
  9.         (command "._mspace")
  10.       )
  11.       (setq vpss (ssget "_x"
  12.                         (list '(-4 . "<AND")
  13.                               '(0 . "VIEWPORT")
  14.                               (cons 410 (getvar "ctab"))
  15.                               '(-4 . "<NOT")
  16.                               '(69 . 1)
  17.                               '(-4 . "NOT>")
  18.                               '(-4 . "AND>")
  19.                         )
  20.                  )
  21.       )
  22.       (setq nr 0)
  23.       (if vpss                          ; in case there are no viewports
  24.         (repeat (sslength vpss)
  25.           (setq en (entget (ssname vpss nr)))
  26.           (if (and (= 0 (logand 1 (cdr (assoc 90 en))))
  27.                                         ; not perspective
  28.                    (< 0 (cdr (assoc 68 en))) ; on and active
  29.                    (/= 16384 (logand 16384 (cdr (assoc 90 en))))
  30.                                         ; not locked
  31.               )
  32.             (progn
  33.               (setvar "cvport" (cdr (assoc 69 en)))
  34.               (command "._zoom" "_e")
  35.             )
  36.           )
  37.           (setq nr (+ 1 nr))
  38.         )
  39.       )
  40.       (if (= ms 1) (command "._pspace"))
  41.     )
  42.     (foreach x vplist
  43.       (setvar "cvport" x)
  44.       (command "._zoom" "_e")
  45.     )
  46.   )
  47.   (setvar "cvport" curcvport)
  48.   (setvar "cmdecho" oldcmdecho)
  49.   (princ)
  50. )


发表于 2020-7-12 09:46 | 显示全部楼层

是啥程序?请介绍一下。
发表于 2007-1-15 11:40 | 显示全部楼层
谢谢分享!!!!
发表于 2007-9-4 15:03 | 显示全部楼层

不错, 谢谢楼主分享

发表于 2007-10-7 20:06 | 显示全部楼层
谢谢楼主!
发表于 2008-3-23 20:33 | 显示全部楼层
我试一下,不错, 谢谢楼主分享!!
发表于 2008-9-21 11:02 | 显示全部楼层
是啥程序?请介绍一下。
发表于 2008-10-11 17:02 | 显示全部楼层

不错, 谢谢楼主分享

发表于 2008-10-11 17:04 | 显示全部楼层
干什么用的程序啊?
发表于 2009-6-26 10:22 | 显示全部楼层

不错, 谢谢楼主分享

发表于 2009-6-30 12:29 | 显示全部楼层
谢谢分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-26 14:39 , Processed in 0.238239 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表