本帖最后由 nzl1116 于 2015-4-30 02:41 编辑

[code="lisp]

(vl-load-com)

(defun AYL-binary (Import / AdoObj BytLst)

(if (setq AdoObj (Vlax-Get-Or-Create-Object "ADODB.Stream"))

(progn

(Vlax-Put-Property AdoObj 'Type 1)

(Vlax-Invoke AdoObj 'Open)

(Vlax-Invoke-Method AdoObj 'LoadFromFile Import)

(Vlax-Put-Property AdoObj 'Position 0)

(setq BytLst (Vlax-Invoke-Method AdoObj 'Read (Vlax-Get-Property AdoObj 'Size)))

(Vlax-Invoke-Method AdoObj 'Close)

(vlax-release-object AdoObj)

(vlax-safearray->list (vlax-variant-value BytLst))

)

)

)

(defun AYL-list->variant (ptsList / arrayspace sArray)

(setq  arrayspace (vlax-make-safearray 17 (cons 0 (1- (length ptsList))))

sArray     (vlax-safearray-fill arrayspace ptsList)

)

(vlax-make-variant sArray)

)

(defun AYL-write-binary (Export DatLst / AdoObj)

(if (setq AdoObj (Vlax-Get-Or-Create-Object "ADODB.Stream"))

(progn

(Vlax-Put-Property AdoObj 'Type 1)

(Vlax-Invoke AdoObj 'Open)

(Vlax-Put-Property AdoObj 'Position 0)

(Vlax-Invoke-Method AdoObj 'Write (AYL-list->variant DatLst))

(vl-file-delete Export)

(Vlax-Invoke AdoObj 'SaveToFile Export 1)

(Vlax-Invoke-Method AdoObj 'Close)

(princ (strcat "\n成功创建 " Export " 文件!"))

(vlax-release-object AdoObj)

)

)

)

(defun AYL-E->D  (ELst / n s e)

(setq  s 0)

(while (= (car ELst) 0)

(setq ELst (cdr ELst))

)

(if (< 0 (setq n (length ELst)) 5)

(foreach Item ELst

(setq n (1- n)

e (expt 256 n)

s (+ s (* Item e))

)

)

)

s

)

(defun AYL-null (TmpLst)

(princ)

)

(defun AYL-Umvlx (Import / BytLst TmpLst Number Int0 Int1 Int2 Int3 Fname Export)

(if (setq BytLst (AYL-binary Import))

(progn

(setq TmpLst nil Number (length BytLst))

(princ "\n文件大小:")

(princ Number)

;;提取前8个字节 VRTLIB-1

(repeat 8

(setq TmpLst (cons (car BytLst) TmpLst)

BytLst (cdr BytLst)

)

)

(if (= (vl-list->string (reverse TmpLst)) "VRTLIB-1")

(setq TmpLst nil)

(progn (princ "\n无效的vlx文件") (VL-EXIT-WITH-VALUE ""))

)

;;提取4个字节,这四个字节表示的整数指除最后16个字节外的所有字节的总数,包括开头的八个字节

(repeat 4

(setq TmpLst (cons (car BytLst) TmpLst)

BytLst (cdr BytLst)

)

)

(setq Int0 (- (AYL-E->D TmpLst) 12) TmpLst nil)

(while (> (rem Int0 4) 0) (setq Int0 (1+ Int0)))

(setq Fname (substr Import 1 (- (strlen Import) 4 (strlen (vl-filename-base Import)))))

(while (> Int0 6)

(setq TmpLst nil Export Fname)

(repeat  4

(setq  TmpLst (cons (car BytLst) TmpLst)

BytLst (cdr BytLst)

)

)

(setq Number (AYL-E->D TmpLst))

(while (> (rem Number 4) 0) (setq Number (1+ Number)))

(setq Int0   (- Int0 Number)

Int1   (car BytLst)

Int2   (cadr BytLst)

Int3   (caddr BytLst)

BytLst (cdddr BytLst)

)

(if (and (member Int1 '(50 55 70 216 0)) (member Int2 '(0 4 5)))

(progn

(setq TmpLst nil Number (- Number 7 Int3))

(repeat Int3

(setq TmpLst (cons (car BytLst) TmpLst)

BytLst (cdr BytLst)

)

)

(setq Export (strcat Export (vl-list->string (reverse TmpLst))))

(setq TmpLst nil)

(if (> Number 0)

(repeat Number

(setq TmpLst (cons (car BytLst) TmpLst)

BytLst (cdr BytLst)

)

)

)

(while (= (car TmpLst) 0) (setq TmpLst (cdr TmpLst)))

(setq TmpLst (reverse TmpLst))

(cond

((= Int1 216)

(if (= Int2 4)

(AYL-null TmpLst)

(progn (princ "文件信息错误") (VL-EXIT-WITH-VALUE ""))

)

)

((= Int1 50)

(if (/= Int2 5) (progn (princ "文件类型错误50") (VL-EXIT-WITH-VALUE "")))

(setq Export (strcat Export ".fas"))

(if TmpLst

(progn (AYL-write-binary Export TmpLst) (princ "  ") (princ Number))

(close (open Export "w"))

)

)

((= Int1 0)

(if (/= Int2 0) (progn (princ "文件类型错误0") (VL-EXIT-WITH-VALUE "")))

(princ "\n这个类型的文件要根据实际情况更改后缀名")

(setq Export (strcat Export ".ayl"))

(if TmpLst

(progn (AYL-write-binary Export TmpLst) (princ "  ") (princ Number))

(close (open Export "w"))

)

)

((= Int1 55)

(if (/= Int2 5) (progn (princ "文件类型错误55") (VL-EXIT-WITH-VALUE "")))

(setq Export (strcat Export ".txt"))

(if TmpLst

(progn (AYL-write-binary Export TmpLst) (princ "  ") (princ Number))

(close (open Export "w"))

)

)

((= Int1 70)

(if (/= Int2 5) (progn (princ "文件类型错误70") (VL-EXIT-WITH-VALUE "")))

(setq Export (strcat Export ".dcl"))

(if TmpLst

(progn (AYL-write-binary Export TmpLst) (princ "  ") (princ Number))

(close (open Export "w"))

)

)

(t (princ "文件类型错误") (VL-EXIT-WITH-VALUE ""))

)

)

(progn (princ "文件类型错误") (VL-EXIT-WITH-VALUE ""))

) ;_ end if

) ;_ end while

(princ "\n")

) ;_ end progn

) ;_ end if

)

(defun c:Umvlx (/ file)

(if (setq file (getfiled "" "" "vlx" 0))

(AYL-Umvlx file)

)

(princ)

)

(princ "\n命令名: Umvlx")

(princ "  作者:晨语  QQ:1024045011")

(princ)[/code]

lisp怎么改成vlx_分解vlx - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...相关推荐

  1. CAD牙孔lisp_分解vlx - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    本帖最后由 nzl1116 于 2015-4-30 02:41 编辑 [code="lisp] (vl-load-com) (defun AYL-binary (Import / AdoOb ...

  2. fas怎么翻译成lisp_fas文件格式研究 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    本帖最后由 baitang36 于 2018-11-2 09:08 编辑 先看一个小程序 gys.lsp ;改任何实体的颜色 (c)SYZ 1995.3.18 (defun c:gys () (set ...

  3. lisp调用qleader端点_常用函数.lsp - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    本帖最后由 自贡黄明儒 于 2013-11-11 12:57 编辑 ;;各位,把你们收藏都拿出秀一秀呀,放在箱底会生霉的 ;;我的收集是在caoyin发布的通用函数基础上扩展的----自贡黄明儒 20 ...

  4. 方孔分段的lisp_常用函数.lsp - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    本帖最后由 自贡黄明儒 于 2013-11-11 12:57 编辑 ;;各位,把你们收藏都拿出秀一秀呀,放在箱底会生霉的 ;;我的收集是在caoyin发布的通用函数基础上扩展的----自贡黄明儒 20 ...

  5. 特别行政区界线lisp_CAD 系统变量参数大全 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    本帖最后由 1291500406 于 2019-1-29 20:52 编辑 CAD 系统变量参数大全 一.数学运算功能函数 1.1(十  数值 数值-)返回:累计实数或整数数值 1.2(一  数值 数 ...

  6. 块内拉升lisp_多重插入块的炸开问题? - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    很多个cad文件,被别人加了密,每个cad文件都生成了很多个多重插入块,在论坛找了个xxi的程序,可以炸开多重插入块,但是,文件太多,块也太多,不能一个一个炸,而且,每个多重插入块执行一下xxi命令之 ...

  7. lisp批量生成轴线_求批量插入图纸的程序 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    不明白的是这样一个程序和解密有什么关联 归档文件合并.lsp 1.需要doslib函数库支持 2.需要手动建立c:\QGY_temp文件夹 (defun c:insdwgs() (princ &quo ...

  8. lisp文字上标源码_删除重叠文字源码 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - 源码,程序 - Powered by Discuz!...

    [code="lisp] (defun C:DUPREM (/ F1 SLE SA CA TA LA LB ENTA EA TYPA A1 A2 A3 A4 SC LTEST TES ) ( ...

  9. 天正电气lisp是什么文件_模仿天正电气低压系统图 - AutoLISP/Visual LISP 编程技术 - CAD论坛 - 明经CAD社区 - Powered by Discuz!...

    [code="lisp] (defun c:lea-dyxtt (/ dcl_id Dcl_File k1 lst n show_lst lst1 lst2 lst3 rb1 rb2 tem ...

最新文章

  1. Linux模块机制浅析
  2. java应用cpu使用率过高问题排查
  3. 如何使用War包部署Tomcat
  4. 众辰变频器参数设定_变频器被加密了怎么办?这20个品牌都可以解密
  5. 快捷登录PHP,phpcms 微信快捷登陆
  6. popupwindow使用之异常:unable to add window -- token null is not valid
  7. 再谈“颠覆”冯.诺依曼计算机体系结构 —— 计算机的未来发展方向:去内存化...
  8. 三级分类用sql语句怎么写(多级分类的写法)
  9. Dreamweaver自动生成的垃圾代码
  10. 编译nginx源码包
  11. pjsip 录音生成wav文件声音一直很小
  12. Wap模拟器,用电脑浏览器浏览手机wap网站
  13. android接收红外传感器发送的脉冲信号,Arduino红外传感器-IR Receiver Module红外接收模块...
  14. C语言 isdigit、isalnum、isalpha、islower、issupper用法及其示例
  15. 深兰科技亮相2022世界人工智能大会:AI创新,共话未来城市建设
  16. Springer出版社旗下投稿word模板
  17. 从中国AI的“直道超车”时刻,看百度何以奔赴星辰大海
  18. 27习题幼儿园买玩具
  19. 并发包大神Doug Lea
  20. 上海证券综合指数统计分析及挖掘(一)

热门文章

  1. 企业4+1核心竞争力模型
  2. 开关电源spice仿真与实用设计_十年电源研发工程师的30条开关电源设计实用经验...
  3. https 中的SSL/TLS 加密
  4. 2016年全国研究生数学建模竞赛华为杯A题多无人机协同任务规划求解全过程文档及程序
  5. 关于Linux的开元及命令介绍
  6. 计算机里没有摄像这个程序,我的电脑里咋没摄像头图标?
  7. 微信小程序实现多个页面
  8. 请各位大咖指点一下备考全国通信技术职业水平考试(初级)的考试经验
  9. CentOS7 Hadoop 2.7.3 Hive 2.1.1
  10. python篮球比赛预测数据分析统计服_用python基于2015-2016年的NBA常规赛及季后赛的统计数据分析...