明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2208|回复: 4

常用公差标注!

[复制链接]
发表于 2011-11-22 20:44 | 显示全部楼层 |阅读模式
本帖最后由 燃烧 于 2011-11-22 21:50 编辑

我写的常用公差标注,我是做检具的,常用以下公差,所以做了个小程序!见下图:源码如下:





(defun c:gc ()
  (if (< (setq index (Load_dialog "D:\\XIANG\\dcl\\gc")) 0)
    (exit)
  )
  (if (not (new_dialog "gc" index "" '(800 50)))
    (exit)
  )
    (start_image "g1")
  (setq x (dimx_tile "g1"))
  (setq y (dimy_tile "g1"))
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g1")
  ;(mode_tile "g1" 4)
  (end_image)
  (action_tile "g1" "(setq dt 1 tp 0.02 tm 0.02)")
  (setq x (dimx_tile "g2"))
  (setq y (dimy_tile "g2"))
  (start_image "g2")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g2")
  (end_image)
  (action_tile "g2" "(setq dt 1 tp 0.02 tm 0)")
  (setq x (dimx_tile "g3"))
  (setq y (dimy_tile "g3"))
  (start_image "g3")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g3")
  (end_image)
  (action_tile "g3" "(setq dt 1 tp 0 tm 0.02)")
  (setq x (dimx_tile "g4"))
  (setq y (dimy_tile "g4"))
  (start_image "g4")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g4")
  (end_image)
  (action_tile "g4" "(setq dt 1 tp 0.01 tm 0.01)")
  (setq x (dimx_tile "g5"))
  (setq y (dimy_tile "g5"))
  (start_image "g5")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g5")
  (end_image)
  (action_tile "g5" "(setq dt 1 tp 0.01 tm 0)")
  (setq x (dimx_tile "g6"))
  (setq y (dimy_tile "g6"))
  (start_image "g6")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g6")
  (end_image)
  (action_tile "g6" "(setq dt 1 tp 0 tm 0.01)")
  (setq x (dimx_tile "g7"))
  (setq y (dimy_tile "g7"))
  (start_image "g7")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g7")
  (end_image)
  (action_tile "g7" "(setq dt 1 tp -0.02 tm 0.03)")
  (setq x (dimx_tile "g8"))
  (setq y (dimy_tile "g8"))
  (start_image "g8")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g8")
  (end_image)
  (action_tile "g8" "(setq dt 1 tp 0.02 tm -0.01)")
  (setq x (dimx_tile "g9"))
  (setq y (dimy_tile "g9"))
  (start_image "g9")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\g9")
  (end_image)
  (action_tile "g9" "(setq dt 1 tp -0.01 tm 0.02)")
  (setq x (dimx_tile "gg"))
  (setq y (dimy_tile "gg"))
  (start_image "gg")
  (slide_image 0 0 x y "D:\\XIANG\\sld\\gg")
  (end_image)
  (action_tile "gg" "(setq dt 0 )")
  (action_tile "tp" "(setq tp $value dt 1)")
  (set_tile "tp" "0.02")
  (action_tile "tm" "(setq tm $value dt 1)")
  (set_tile "tm" "0.02")
  (action_tile "cancel" "(exit)")
(start_dialog)
  (SETVAR "CMDECHO" 0)
  (command "dimtfac" 0.6)
  (command "dimtzin" 8)
  (setq v1 (getvar "dimtol"))
  (setq v2 (getvar "dimtp"))
  (setq v3 (getvar "dimtm"))
  (setq v4 (getvar "dimpost"))
  (setq v5 (getvar "dimstyle"))
  (setq en (entsel "选择一个尺寸:"))
  (command "dimtol" dt)
  (command "dimtp" tp)
  (command "dimtm" tm)
  (command "-dimstyle" "a" en "")
  (command "-dimstyle" "r" v5)
  (unload_dialog index)
  (princ)
)
dcl文件如下:
gc:dialog {
label="公差";
:boxed_row{
label="选择";
fixed_width=true;
width=20;
alignment=centered;
children_fixed_height=6;
fixed_height=true;
height=4;
:column{
:image_button{
key="g1";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
allow_accept=true;
}
:image_button{
key="g2";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}}
:column{
:image_button{
key="g3";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}
:image_button{
key="g4";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}}
:column{
:image_button{
key="g5";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}
:image_button{
key="g6";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
fixed_height=true;
height=3;
aspect_ratio=0.6;
color=164;
}}
:column{
:image_button{
key="g7";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}
:image_button{
key="g8";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}}
:column{
:image_button{
key="g9";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}
:image_button{
key="gg";
fixed_height=true;
height=3;
fixed_width=true;
width=10;
aspect_ratio=0.6;
color=164;
}}}
:boxed_row{
label="手工输入";
alignment=left;
fixed_width=true;
width=20;
:edit_box
{key="tp";
label="上偏差:";
fixed_width=true;
width=10;
alignment=left;
edit_limit=6;
edit_width=5;
}
:edit_box
{key="tm";
label="下偏差:";
fixed_width=true;
width=10;
edit_width=5;
alignment=left;
edit_limit=6;
}
:text{
label="下偏差为正值加负号!";
is_bold=true;
fixed_width=true;
width=10;
}}
:row{
children_alignment=centered;
:spacer{
width=12;
fixed_width=true;}
:button{
key="accept";
label="确认";
is_default=true;
fixed_width=true;
alignment=right;
}
:button{
key="cancel";
label="取消";
is_cancel=true;
fixed_width=true;
alignment=left;
}
:spacer{
width=12;
fixed_width=true;}
}
}
编译成VLX了。因为有幻灯片:见附件:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

点评

很好的程序!!!!!  发表于 2011-11-22 23:12
发表于 2011-11-23 00:20 | 显示全部楼层
很厉害啊 向楼主学习
发表于 2012-4-20 14:02 | 显示全部楼层
很厉害啊 向楼主学习
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-2 09:25 , Processed in 0.485489 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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