明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3247|回复: 15

重写plot的问题

  [复制链接]
发表于 2006-2-10 13:01 | 显示全部楼层 |阅读模式
我想重新定义cad的plot命令,将其成为plot+line(只是举个例子)的命令。
  1. ;
  2. (defun S::STARTUP ()
  3. (setvar "cmdecho" 0)
  4. (command "undefine" "plot");;取消plot命令
  5. (defun c:plot (/ )
  6.    
  7.    
  8.    (command "redefine" "plot");;回复plot命令
  9.   ;(command "plot"  )   
  10.   (command "line" "0,0" "10,10" "")
  11.    
  12.   (command "undefine" "plot");;取消plot命令
  13.    
  14. )
  15. )
可是我将  ;(command "plot"  )  这一句的分号去掉,我发现还是不能以对话框的方式运行plot命令。有没有什么办法可以将cad的plot命令重写成先运行对话框的plot命令,紧接着再画一条线呢?谢谢
用undefine和redefine可以使cad的内部命令失去作用,有没有什么命令可以将cad的内部命令重新命名啊?比如将plot变成plott,如果可以问题也可以解决
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2006-2-10 13:32 | 显示全部楼层
  1. ;; This routine is amended from a similar one found
  2. ;;; on web (www.cad-manager.com)
  3. ;;; Note: Load the code ONCE then start plotting.
  4. ;;; Remember to remove all reactors when finish: (Clear_All_Reactors)
  5. (vl-load-com)
  6. (defun DoThisAfterCommand (Caller CmdSet)
  7.   (if (= (car Cmdset) "PLOT")
  8.     (entmake '((0 . "LINE")(10 0 0 0)(11 10 10 0)))
  9.   )
  10.   (princ)
  11. )
  12. (setq MyReactor1
  13.        (vlr-command-reactor
  14.   nil
  15.   '(
  16.     (:vlr-CommandEnded . DoThisAfterCommand)
  17.    )
  18.        )
  19. )
  20. (defun Clear_My_Reactors ()
  21.   (if (and MyReactor1 (vlr-added-p MyReactor1))
  22.     (vlr-remove MyReactor1)
  23.   )
  24. )
  25. (defun Clear_All_Reactors (/ TMP)
  26.   (vlr-remove-all :vlr-Command-reactor)
  27. )
 楼主| 发表于 2006-2-10 16:27 | 显示全部楼层
本帖最后由 作者 于 2006-2-11 8:29:26 编辑

多谢alin,再请教一个问题。在plot对话框显示时,我选择window窗选打印,能不能将我窗选的这两点坐标值获取,同时获得打印机的名称和打印的数量呢?:)

发表于 2006-2-13 07:06 | 显示全部楼层

Check out Window Xmax, XMin, YMax and YMin from

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R16.0\ACAD-202:409\Profiles\YOUR_PROFILE_NAME\Previous plot settings\Layout

 楼主| 发表于 2006-2-13 11:32 | 显示全部楼层

alin版主给的是网址吗?还是注册码地址?怎么察看啊?

发表于 2006-2-13 12:09 | 显示全部楼层

That's a string specifying a Windows registry key.

Use function vl-registry-read can retrieve its value, but not sure if it works properly immediate after the plot command.

 楼主| 发表于 2006-2-13 13:24 | 显示全部楼层

Thanks. I will try it.

 楼主| 发表于 2006-2-14 09:25 | 显示全部楼层

Dear,

I try it. But unfortunately, the value of Window Xmax, XMin, YMax and YMin only be updated after close AutoCAD. Actually, what I want to do is get some plot informaton just as printer name, print area, quantity... after plot. Then we can know the print cost for different department and control it. Is it possible? Thanks again.

 楼主| 发表于 2006-2-14 18:52 | 显示全部楼层

我顶

 楼主| 发表于 2006-2-17 09:02 | 显示全部楼层

我再顶啊,诸位大侠有没有什么办法啊???thanks,thanks,thanks...

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

本版积分规则

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

GMT+8, 2024-5-9 17:37 , Processed in 0.166523 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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