乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 77|回复: 3

[编程交流] how to create a new lisp(Easy

[复制链接]

2

主题

5

帖子

3

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 11:05:38 | 显示全部楼层 |阅读模式
hi gud evening to all
 
Actually i want to learn Auto Lisp .so pls give me general information guide lines 2 me  :roll::roll:
 
regards,
kpsk
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 11:33:43 | 显示全部楼层
Welcome to the CADTutor forum K P.
 
Your question has been asked and answered a number of times.  I suggest that you see Similar Threads listed below and/or use the Search function above and put the word "autolisp" in the search box.
 
Also, visit the AutoLISP Archive and check out some of the routines there.
 
I suggest you click on the Links button above and go through the list.  Two sites I recommend are AfraLisp and Jeffery P Sanders if you want to learn more about the subject.
回复

使用道具 举报

20

主题

81

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-6 11:53:31 | 显示全部楼层
This one is nice to start with:
  1. (defun c:test2 (/) ; defun is where you put your function name the c: means your can run it from command window.(cond ; cond is just a way to say if condition x is right do this as you see below( (= 3 3) (princ "True") )                       ; princ puts some text in your cmd screen like this will put true in your command windows because 3 is equal to 3 Try it out!( (= 4 2) (princ "True") )                       ;skips because 4 does not equal 2( (= 4 1) (princ "True") )                       ;skips because 4 does not equal 1( T (princ "Nothing") )                             ; prints "Nothing" if nothing is true.) )
You can also try if with this:
  1. (if (tblsearch "BLOCK" "template") (searches for a block called template if it is there it goes to next line)  (progn (must be used if you want to do more then one line after the if)
Since I just started myself I know how hard it is to learn a little bit, so I hope this gets you on your way like it did with me.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 12:23:48 | 显示全部楼层
Here a simple box with a couple of twists pick two points then the side for the box with an offset chucked in.
 
As I have said before to many people who want to learn lisp vba etc get yourself a project to achieve 1st its not much good just reading the tutorials, pick something simple like drawing a box and get more and more complex.
 
The simplest task like drawing a pit we do every day yet we never bothered to do it after years of cad! Did it the other day and it took about 15 minutes.
 
  1. ; draw pits with 100mm walls(setq oldsnap (getvar "osmode"))(setq oldlayer (getvar "clayer")) (command "_layer" "n" "Design-Drainage-Pits" "c" 4 "Design-Drainage-Pits" "")(setvar "clayer" "Design-Drainage-Pits")(setq length (getreal "\nPlease enter length m eg 0.9: "))(setq width (getreal "\nPlease enter width : "))(setq pt1 (getpoint "\npick 1st point to place pit : "))(setq pt2 (getpoint "\nPick 2nd point for orientation"))(setvar "osmode" 0)(setq pt7 (getpoint "\Pick pt on pit side : "))(setq ang (angle pt1 pt2))(setq ang5 (angle pt2 pt7))(setq diffang (- ang ang5))(if (> diffang 1.5707) (setq ang2 (- ang 1.570796))(setq ang2 (+ ang 1.570796)))(setq ang3 (+ ang 3.1415926))(setq ang4 (- ang 1.570796))(setq pt3 (polar pt1 ang length))(setq pt4 (polar pt3 ang2 width))(setq pt5 (polar pt4 ang3 length))(command "pline" pt1 pt3 pt4 pt5 "c")(setq pt6 (polar pt1 ang 50.0))(command "offset" 0.1 pt4 pt6 "")(setvar "osmode" oldsnap)(setvar "clayer" oldlayer)(princ)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-6 11:21 , Processed in 0.645253 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表