明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: QWQWQWQ

尺寸等分

  [复制链接]
 楼主| 发表于 2013-3-22 13:33 | 显示全部楼层
E:\GIF动画录制
 楼主| 发表于 2013-3-22 13:37 | 显示全部楼层
要 这 样 的

本帖子中包含更多资源

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

x
发表于 2013-3-24 07:46 | 显示全部楼层
可能的效果:

本帖子中包含更多资源

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

x
发表于 2013-3-25 20:46 | 显示全部楼层
院长无所不能啊,强悍,但是还是太飘忽了,远在高端仰望
发表于 2013-3-25 21:10 | 显示全部楼层
论坛早就有了:
;等分尺寸(dwg001)
(defun c:dfcc(/ ang dist dxf ent i j obj p0 p1 p2 r)
(command "undo" "be")
(setq J (getint "\n请输入等分数:")
obj (entsel "\n请选择需等分的标注:")
ent (car obj)
dxf (entget ent))
(if (and obj (> J 1) (= (cdr (assoc 0 dxf)) "DIMENSION"))
(progn (setq i 0 r 0)
(setq P0 (cdr (assoc 10 dxf))
P2 (cdr (assoc 13 dxf))
P1 (cdr (assoc 14 dxf)))
(setq ang (angle P1 P2))
(setq dist (/ (distance P1 P2) J))
(setq P2 (polar P1 ang dist))
(command "dim1" "ali" P1 P2 P0 "")
(while (< r (- J 1))
(setq P2 (polar P2 ang dist))
(command "dim" "con" P2 "" "e")
(setq r (1+ r)))
(setq i (1+ i))
(entdel ent)))
(command "undo" "e")
(princ))
回复 支持 1 反对 0

使用道具 举报

发表于 2013-3-25 22:41 | 显示全部楼层
本帖最后由 cable2004 于 2013-3-25 22:42 编辑

楼上的太简单了,只能对起点 终点都平行尺寸线的情况下使用!
发表于 2013-3-25 23:44 | 显示全部楼层
defun c:df (/  ang ang1-0 dimstl dist dxf ent i inter j l lay obj oldecho oldla oldmode oldsty p0 p0- p1 p2 p2- r)

  (setq oldmode (getvar 'osmode)
oldla (getvar 'clayer)
oldecho (getvar 'cmdecho)
oldsty  (getvar 'dimstyle)
  )
  (setvar 'osmode  0)
  (setvar 'cmdecho 0)
  (while (setq obj (entsel "\n...选择需等分的标注> "))
    (setq
      J   (getint "\n...输入等分标注数> ")
      ent (car obj)
      dxf (entget ent)
      lay (cdr (assoc 8 dxf))
      dimstl (cdr (assoc 3 dxf))
      )
   
    (if (and obj (> J 1) (= (cdr (assoc 0 dxf)) "DIMENSION"))
      (progn
(setq i 0
       r 0
)
(command "-layer" "s" lay "")
(command "dimstyle" "r" dimstl)
(setq P0 (cdr (assoc 10 dxf))
       P2 (cdr (assoc 13 dxf))
       P1 (cdr (assoc 14 dxf))
)
        

(setq L (distance p1 p0)
           ang1-0 (angle P1 P0)
              p0- (polar p0  (- ang1-0  (/ pi 2)) 50)
       p2- (polar p2  ang1-0   50)
       inter (inters p0 p0-  p2 p2- nil))
        

        (if (/= L (distance p2 inter))(progn
         (setq dxf (subst
     (cons 13 (polar inter (- ang1-0 pi) L))
     (assoc 13 dxf)
     dxf  )   )
          (entmod dxf)
        (setq  P2 (cdr (assoc 13 dxf)))
  ) );end_ if

  (setq ang  (angle P1 P2)
              dist (/ (distance P1 P2) J)
       P2   (polar P1 ang dist)
)
(command "dim1" "ali" P1 P2 P0 "")

(while (< r (- J 1))
   (setq P2 (polar P2 ang dist))
   (command "dim" "con" P2 "" "e")
   (setq r (1+ r))
)
(setq i (1+ i))
(entdel ent)
      )
    )
    (setvar 'clayer oldla)
    (command "dimstyle" "r" oldsty)
  )
  (princ "\n...等分标注数=")
  (princ J)
  (princ "\n...[学lisp练习: 尺寸标注等分]")
  (setvar 'osmode oldmode)
  (setvar 'cmdecho oldecho)
  (princ)
)
 楼主| 发表于 2013-3-26 08:03 | 显示全部楼层
tianyi1230 发表于 2013-3-25 23:44
defun c:df (/  ang ang1-0 dimstl dist dxf ent i inter j l lay obj oldecho oldla oldmode oldsty p0 p0 ...

出现错误了?D:/等分标注线DF.lsp") 错误 : 参数类型错误: numberp: nil
 楼主| 发表于 2013-3-26 08:07 | 显示全部楼层
669423907 发表于 2013-3-25 21:10
论坛早就有了:
;等分尺寸(dwg001)
(defun c:dfcc(/ ang dist dxf ent i j obj p0 p1 p2 r)

谢谢,可以用了
发表于 2013-3-26 09:37 | 显示全部楼层
留个记号先!还不到七个字!打够七个字!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-27 12:05 , Processed in 0.272269 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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