明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4477|回复: 5

[讨论] lsp文件在CAD里加载了如何调用出来

[复制链接]
发表于 2009-11-27 12:12:00 | 显示全部楼层 |阅读模式

lsp文件在CAD里加载了如何调用出来

在加载应用程序里加载了

但是不自动如何使用

是别人给我的的程序谢谢

 楼主| 发表于 2009-11-27 12:25:00 | 显示全部楼层

(defun c:dxfplt ()
  (dxf_batchinsert)
)
(defun dxf_batchinsert (/      fn     j      k     l    m
   s1     rows   cols   pt0    pt1    pt2     rowdist
   coldist     goahead
  )
  (setq olderr *ERROR*
 *ERROR* myerror
  ) ;_ setq
  (setq fn " "
 j 0
 k 0
 l 0
 m 0
 goahead nil
 cols 10
 rows 10
  ) ;_ setq
  (command "undo"  "group")
  (if (= (getvar "dwgtitled") 1)
    (progn
      (setq goahead "N")
      (while (= (strcase goahead) "N")
 (setq fn (getstring "\nEnter search keyword. <*.dxf>:"))
 (if (= fn "")
   (setq fn "*.dxf")
 )
 (setq s1 (vl-directory-files (getvar "dwgprefix") fn))
 (setq m (length s1))
 (prompt (strcat "\n" (itoa m) " files found."))
 (setq goahead "Y")
 (if (< m 1)
   (setq goahead "N")
 )
 (if (> m 40)
   (progn
     (textscr)
     (INITGET "Y N y n")
     (setq goahead
     (getkword
       " maybe take too long time, Goahead? [Y/N] <Y>:"
     )
     )
     (if (= goahead nil)
       (setq goahead "Y")
     )
   )
 )
          )
      (graphscr)
      (setq pt0 (getpoint "\nInsert point:"))
      (setq pt1 (getcorner pt0 " another point to set the dist:"))
      (setq coldist (- (car pt1) (car pt0))
     rowdist (- (cadr pt1) (cadr pt0))
      )
      (setq j 0)
      (prompt "\n")
      (repeat (length s1)
 (setq fn (strcase (nth j s1)))
 (setq pt1 (list (+ (car pt0) (* k coldist))
   (+ (cadr pt0) (* l rowdist))
   (caddr pt0)
    )
 )
 (command "insert" (strcat "*" fn) pt1 "1" "0")
 (setq j (1+ j)
       k (1+ k))
 (if (= k cols)
   (progn
     (setq k 0)
     (setq l (1+ l))
   )
 )
 (prompt (strcat (itoa j) "/" (itoa m) " " fn "\n"))
      ) ;_ repeat
      (prompt "\nDone")
    )
    (princ
      "\nplease save me first,I want to know where to find those dxf files.")
  ) ;_ if
  (command "undo" "e")
  (setq *ERROR* olderr)
  (princ)
)

(setq n-pllst2 0)
(setq x_scale 1.0)
(setq y_scale 1.0)
(defun c:lll (/ ss e pt j l_list x1 x2 o_file ptlist temp_y_sc)
  (setq j  0
 tmplayer "tmplayer"
  )
  ;;; (setq temp_y_sc (getreal (strcat "Input the scale of Y value:<"
  ;;;  (rtos y_scale 2 4)
  ;;;  ">"
  ;;;     )
  ;;;   )
  ;;; )
  (if (/= temp_y_sc nil)
    (setq y_scale temp_y_sc)
  )
  ;;; (setq filename
  ;;; (strcat (getvar "dwgprefix") (getvar "dwgname") ".gf.txt")
  ;;; );_ setq
  ;;; (setq o_file (open filename "a"))
  ;;; (setq clayer (getvar "CLAYER"))
  ;;; (command "layer" "m" tmplayer "s" clayer "off" tmplayer "")
  (if (= n-pllst nil)
    (progn
  ;;;    (setq n-pllst (getint "Enter the number of first line <1>:"))
      (setq n-pllst 1)
      (if (= n-pllst nil)
 (setq n-pllst 0)
 (setq n-pllst2 (1-n-pllst))
      )
    )
  )
  (princ "\nSelect polylines one by one:")
  (setq ss (ssget '((-4 . "<OR")
      (0 . "LWPOLYLINE")
      (0 . "POLYLINE")
      (-4 . "OR>")
     )
    )
  )
  (if (/= ss nil)
    (repeat (sslength ss)
      (setq ptlist nil)
      (setq n-pllst2 (1+ n-pllst2))
      (setq e (ssname ss 0))
      (ssdel e ss)
      (setq d (entget e))
    ;;;  (setq d (subst (cons 8 tmplayer) (assoc 8 d) d))
      (redraw e 1)
      (entmod d)
      (entupd e)
      (if (= (fld 0) "POLYLINE")
 (progn
   (setq e (entnext e))
   (setq d (entget e))
   (while (/= (fld 0) "SEQEND")
     (setq ptlist (append ptlist (list (trans (fld 10) 0 1))))
     (setq e (entnext e))
     (setq d (entget e))
    ) ;_ while
 ) ;_ progn
 ) ;_ if 
      (if (= (fld 0) "LWPOLYLINE")
 (progn
   (setq d (entget e))
   (setq l_list (length d))
   (setq j 2)
   (while (< j l_list)
     (if (= (car (setq pt (nth j d))) 10)
       (setq ptlist (append ptlist (list (trans (cdr pt) 0 1))))
    ) ;_ if
     (setq j (1+ j))
      ) ;_ while
 ) ;_ progn
 ) ;_ if  
      (setq x1 (car (car ptlist)))
      (if (> (abs x1) 5.0)
 (setq ptlist (reverse ptlist))
     )
      (princ "aaaaa")

      (command "_pline" (foreach pt ptlist (command pt)))

      (command "_matchprop" e (entlast) "")
      (entdel e)
      (princ "bbbbb")
      ;;; (princ "\n\n" o_file)
      ;;; (princ (rtos n-pllst2 2) o_file)
      ;;; (princ " " o_file)
      ;;; (foreach pt ptlist
      ;;; (princ (rtos (abs (car pt)) 2 1))  'X car
      ;;; (princ ",")
      ;;; (princ (rtos (cadr pt) 2 1))  'Y cadr
      ;;; (princ  ",")
      ;;; (princ (rtos (* (cadr pt) y_scale) 2 4) o_file)
      ;;; (princ " @" o_file)       
      ;;; (princ (rtos (* (car pt) x_scale) 2 4) o_file)
      ;;; (princ " ;" o_file)
      ;;; (princ (rtos (* (cadr pt) y_scale) 2 4) o_file)
      ;;; (princ " @ " o_file)     
      ;;; (princ (rtos (* (car pt) x_scale) 2 4) o_file)
      ;;; (princ "," o_file)
      ;;;) ;_   foreach
      ;;; (princ "\nline ")
      ;;; (princ (rots n-pllst2 2))
      ;;; (princ " output to ")
      ;;; (ptinc  filename )
      )
    )
    ;;; (close o_file)
    ;;; (textpage) 
    (princ
  )) ;_ defun
  Do NOT add text below the comment!

发表于 2009-11-27 12:46:00 | 显示全部楼层

关闭后再重新开启autocad,输入dxfplt回车就可以呀

 楼主| 发表于 2009-11-27 19:59:00 | 显示全部楼层

请问这个是说可以批量把单个DXF导入到一个图里

然后排页码 但是我没成功

可以导进去就是无法修改页码 请问是不是跟什么有关系 能看懂的请帮帮忙

 楼主| 发表于 2009-11-30 14:39:00 | 显示全部楼层

顶一下哦

 楼主| 发表于 2009-12-12 21:25:00 | 显示全部楼层

请问着套程序是什么意思呢

能不能实现自动编号呢?

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

本版积分规则

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

GMT+8, 2024-10-1 19:23 , Processed in 0.249733 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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