乐筑天下

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

[编程交流] ABC's of Autolisp by Geor

[复制链接]

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-6 07:28:27 | 显示全部楼层
The same could be expressed as:
 
  1. [b][color=BLACK]([/color][/b]cond [b][color=FUCHSIA]([/color][/b][b][color=NAVY]([/color][/b]and                       [b][color=NAVY])[/color][/b]       [b][color=FUCHSIA])[/color][/b]     [b][color=FUCHSIA]([/color][/b][b][color=NAVY]([/color][/b]and            [b][color=NAVY])[/color][/b]       [b][color=FUCHSIA])[/color][/b]     [b][color=FUCHSIA]([/color][/b]      [b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]
 
 
-David
回复

使用道具 举报

2

主题

389

帖子

387

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 07:33:36 | 显示全部楼层
 
In case it was missed, the answer is that you CAN use them, but the point is already a list.  You made it an embedded list, and that doesn't work as straightforwardly.
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-6 07:38:23 | 显示全部楼层
hi
 
for what reasom the main() is not calling to getTotalLength()?
  1. (defun c:main () (setq totLng getTotalLength) (princ) )(defun getTotalLength ( / ptst pten d n6 n8 n1 n2 n k stpt enpt ) (princ "getting the total length of the line") (setq ptst (getpoint "\nStart point of line : ")) (setq pten (getpoint ptst "\nEnd point of line : ")) (setq ptst (trans ptst 1 0) pten (trans pten 1 0)) (setq d (distance ptst pten)) )(defun getSegmentLength () (princ) )
 
Thanks
Shay
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:42:07 | 显示全部楼层
To solve your error:
  1. (defun c:main ( / totLng )   (setq totLng (getTotalLength))   (princ))(defun getTotalLength ( / ptst pten d )   (princ "getting the total length of the line")   (setq ptst (getpoint "\nStart point of line : "))   (setq pten (getpoint ptst "\nEnd point of line : "))   (setq ptst (trans ptst 1 0)         pten (trans pten 1 0)   )   (setq d (distance ptst pten)))(defun getSegmentLength ( )   (princ))
However, for what the code is doing, it could be simply:
  1. (defun c:main ( / totLng )   (setq totLng (getdist "\nPick Distance: ")))
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-6 07:45:14 | 显示全部楼层
Thanks Lee
 
i need the ptst and pted location so i cant use getdist()
 
http://www.cadtutor.net/forum/showthread.php?77725-divide-a-line-equally-but-with-a-few-restrictions&highlight=samifox
回复

使用道具 举报

218

主题

699

帖子

483

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1090
发表于 2022-7-6 07:52:09 | 显示全部楼层
hi
 
im learning how too access element in lists , why its so hard?
 
i tried to write a program that assign 1-10 to a veriable and than  prints all elements one by one. of course i end up with ugly error
 
how to do it right?
 
  1. ;**accessing single element of a list page 17*;(defun c:abcd() (setq pt1(list 1 2 3 4 5 6 7 8 9 0)) (princ (car pt1)) (princ (cdar '(pt1))) )
 
Thanks
Shay
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 14:46 , Processed in 0.364419 second(s), 62 queries .

© 2020-2025 乐筑天下

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