明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: aroom

TeaScript 编程(二次开发AutoCAD、Lisp写windows应用程序)

    [复制链接]
 楼主| 发表于 2012-5-28 07:44 | 显示全部楼层
cabinsummer 发表于 2012-5-28 06:26
发邮件可以吗?

加QQ群,不是更简单吗?
 楼主| 发表于 2012-5-28 08:33 | 显示全部楼层
本帖最后由 aroom 于 2012-5-28 08:34 编辑

;;; 写个OpenGL的例子

(importAll "opengl32.dll")
(importAll "freeglut.dll")

(setq GL_COLOR_BUFFER_BIT  0x00004000
      GL_TRIANGLES         0x0004
      GLUT_DOUBLE 0x0002
      GLUT_SINGLE 0x0000
      GLUT_RGB 0x0000
      GLUT_RGBA 0x0000
      PI (* (acos 0) 2)      
                  rotx 0.0 roty 0.0)

(defun draw ()
        (glClear GL_COLOR_BUFFER_BIT )
        (glRotated rotx 0.0 1.0 0.0)
        (glRotated roty 1.0 0.0 0.0)
        (glutWireTeapot 0.5)
        (glutSwapBuffers)
)

(defun rotation ()
        (setq rotx (% (- (float rotx) .01) PI)
         roty (% (- (float roty) .012) PI))
        (sleep 30)
        (glutPostRedisplay)
)

(defun keyboard (key x y)
        (if (= (& key 0xFF) 27) (exit))
        (println "key:" (& key 0xFF) " x:" x  " y:" y)
        (println "you press a key")
)

(defun mouse (button state x y)
        (if (= state 0)
                (glutIdleFunc 0) ; auto-motion off on button press
                (progn
                        (println "you click mouse button")
                        (glutIdleFunc (callback 5 'rotation))) ; auto-motinn on
        )
        (println "button: " button " state:" state " x:" x " y:" y)        
)

(defun motion (x y)
        (setq rotx (* (/ 200.0 x) PI)
              roty (* (/ 150.0 y) PI))
        (glutPostRedisplay)
        (println "x:" x  " y:" y))

(defun main (argc argv)
        (glutInit (address argc) (address argv))
        (glutInitDisplayMode (| GLUT_RGB GLUT_DOUBLE ))
        (glutInitWindowSize 800 600)
        (glutInitWindowPosition 80 80)
        (setq id (glutCreateWindow "算子语言调用OpenGL示例 - 拖动鼠标 - 按ESC键退出"))
        (glClearColor (flt 0.5) (flt 0.3) (flt 0.3) (flt 0.0))
        (glColor3d 1.0 0.85 0.35)
        (glutDisplayFunc (callback 0 'draw))
        (glutKeyboardFunc (callback 1 'keyboard))
        (glutMouseFunc (callback 2 'mouse))
        (glutMotionFunc (callback 3 'motion))
        (glutIdleFunc (callback 4 'rotation))
        (glutMainLoop)
)

(main 0 "")

本帖子中包含更多资源

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

x
回复 支持 1 反对 0

使用道具 举报

发表于 2012-5-28 08:45 | 显示全部楼层
不如在论坛上传一份
 楼主| 发表于 2012-5-28 11:23 | 显示全部楼层
本帖最后由 aroom 于 2012-8-23 12:46 编辑

【TeaScript软件下载】



【文件列表】

TeaScript.exe                       算子脚本引擎(控制台界面)
TeaScript_w.exe                  算子脚本引擎(图形界面链接库)


TSIDE.exe                           算子语言程序设计开发环境(图形界面)
IDE.dll                                 用于加载IDE组件的动态链接库


更多源代码共享,请加入 TeaScript 算子编程交流QQ群:7326594 (已满), 255433035

更多详细介绍,请参阅近期出版的《算子》(Programming In TeaScript)一书。

本帖子中包含更多资源

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

x
发表于 2012-5-28 11:46 | 显示全部楼层
aroom 发表于 2012-5-28 11:23

不知道程序通用性如何,是否象lisp那样对各个版本cad的通用性那样。
 楼主| 发表于 2012-5-28 11:51 | 显示全部楼层
zdqwy19 发表于 2012-5-28 11:46
不知道程序通用性如何,是否象lisp那样对各个版本cad的通用性那样。

支持 AutoCAD 2000 及 更高的各个版本
发表于 2012-5-28 12:41 | 显示全部楼层
等待教程............
发表于 2012-5-28 14:17 | 显示全部楼层
aroom 发表于 2012-5-28 11:23
梦醒才知原是梦 发表于 2012-5-28 08:45

多谢分享~~~~~~
发表于 2012-5-28 19:52 | 显示全部楼层
本帖最后由 不死猫 于 2012-5-29 12:18 编辑

大家可以这样理解一下
这个类似COM接口  什么语言都可以用的
这样就很清楚了。
发表于 2012-5-28 20:16 | 显示全部楼层
aroom 发表于 2012-5-27 22:52
TeaScript不但可以扩展AutoCAD二次开发
还可以用 Lisp 来写windows 平台下的各种应用程序

听起来好强悍。。学习研究下。。感谢分享。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-3-29 03:58 , Processed in 0.142994 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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