明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: lxjtlisp

帮人写程序,欢迎大家提出要求!

  [复制链接]
发表于 2010-4-25 21:02 | 显示全部楼层

樣式

本帖子中包含更多资源

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

x
发表于 2010-5-1 12:52 | 显示全部楼层

大家好  我这有一个非常好的LISP程序  可以自动改变直线,圆等的线形比例   但不能改变矩形及多段线的的   哪位大大修改一下

 

(defun c:df ()    ;自動變換成適當比例的虛線
  (ltchange "dashed"  3 "bylayer")
  (princ)
)

(defun ltchange (type1 scale color /  oce   lin   n    nam  tab
   pt1   pt2   x1    x2  y1    y2    len   leg  sca
   otyp  ocol  osca  col  typ   lts   rad
  )   ;自動變換成適當比例的中心線
  (setq oce (getvar "cmdecho")
 lts (getvar "ltscale")
  ) ;_ end of setq
  (setvar "cmdecho" 0)
  (setq n 0)
  (print
    (strcat "Select object change to " type1 ":")
  ) ;_ end of print
  (setq lin (ssget '((-4 . "<OR")
       (0 . "LINE")
       (0 . "CIRCLE")
       (0 . "ELLIPSE")
       (0 . "ARC")
       (0 . "polyline")
       (-4 . "OR>")
      )
     ) ;_ end of ssget
  )     ;end setq
  (if (not lin)
    (progn

      (alert "\nNo selection!")
      (exit)
    ) ;_ end of progn
  )     ;end if
  (repeat (sslength lin)
    (setq nam (ssname lin n))
    (setq tab (entget nam))
;;;;;;;;;;circle
    (if (= (cdr (assoc 0 tab)) "CIRCLE")
      (progn
 (setq rad (cdr (assoc 40 tab)))
 (setq len (* 2 (* 3.14 rad)))
      )     ;如是圓實體取周長為"len"
;;;;;;;;;;ARC
      (if (= (cdr (assoc 0 tab)) "ARC")
 (progn
   (setq rad (cdr (assoc 40 tab)))
   (setq len (* 3.14 rad))
 )    ;end progn;如是圓弧取其圓周長半

;;;;;;;;;;ellipse
    (if (= (cdr (assoc 0 tab)) "ellipse")
      (progn
 (setq rad (cdr (assoc 40 tab)))
 (setq len (* 2 (* 3.14 rad)))
      )
;;;;;;;;;LINE
 (progn
   (setq pt1 (cdr (assoc 10 tab))
  pt2 (cdr (assoc 11 tab))
  len (distance pt1 pt2)
   )    ;end setq
 )    ;end progn
      )     ;end if  
    )
   );end if

    (cond ((and (> len 0) (<= len 2))
    (setq leg 2)
   )
   ((and (> len 2) (<= len 5))
    (setq leg 6)
   )
   ((and (> len 5) (<= len 30))
    (setq leg 20)
   )
   ((and (> len 30) (<= len 50))
    (setq leg 40)
   )
   ((and (> len 50) (<= len 100))
    (setq leg 75)
   )
   ((> len 100)
    (setq leg 100)
   )
    )     ;end cond
    (setq sca (/ leg scale lts 2))

    (command "-linetype" "l" type1 "acad.lin" "" "")
    (command "change" nam "" "p" "c" color "lt" type1 "s" SCA "") ;_ end of command
 ;_ end of command
 ;_ end of command
    (setq n (+ n 1))
  )     ;end repeat
  (setvar "cmdecho" oce)
  (princ)
) ;_ end of defun

发表于 2010-5-29 16:33 | 显示全部楼层

请帮个忙:

  在VBA中,我想把一个实体设置成光源,用代码实现。

发表于 2010-5-30 10:15 | 显示全部楼层
很多好东西,学习了
发表于 2010-5-30 19:42 | 显示全部楼层

想请你写个程序,选择一个线段,移动线段的同时,线段旁边指定距离的文字随之拖动,请问可以吗?

发表于 2010-6-18 16:03 | 显示全部楼层
新人报到,呵呵
发表于 2010-6-28 13:54 | 显示全部楼层

利用AutoCAD2006绘制若干管线,并建立有一简易的access数据库。想实现以下功能:

(1)点击某管线,就能弹出(显示出)其管道相关属性(管径,管材等);
(2)点击某管连接点,也能弹出其相关属性(阀门)
(3)可以对这些管道的长度或管材进行查询和统计。
发表于 2010-10-8 09:18 | 显示全部楼层

请帮个忙,

在VBA中,想实现字符串统计功能。

具体细节:在输入要统计的字符串后,单击“统计”命令按钮,即显示要统计的字符串的数量。

             单击“重置”命令按钮,之前输入的要统计的字符串跟统计完毕的字符串数量清零,以备再次统计其他的字符串数量。

 

谢谢了!

发表于 2010-10-13 07:31 | 显示全部楼层

请教:
  我写了编辑序号的步骤如下:
  (COMMAND "LAYER" "M" "序号" "c" "1" "" "")
  (if (not (setq k (getint "\n请输入当前序号 <1>: ")))
           (setq k 1)
           )
  (setq k (1+ k))

在cad图形编辑物体连续序号时,由于数量多,常常中途要中断,怎样才能实现在中断后,继续操作时,
序号能连接起来?
例如:图上已经编辑了100个号,重新运行编辑时,能自动从101号接着编辑。
求高手指教,要如何修改上面的语句?
在此先谢了

发表于 2010-10-13 08:57 | 显示全部楼层
支持一下,能否做一个批量插入块,按文件名排序阵列到一张图内?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 00:30 , Processed in 0.167683 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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