乐筑天下

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

[编程交流] Lisp, Blocks & Box

[复制链接]

62

主题

466

帖子

404

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
310
发表于 2022-7-6 11:09:23 | 显示全部楼层 |阅读模式
I'm looking for a simple lisp that puts a block (name: corner) in all corners of a rectangle. it needs to turn with the box. the block is at 0º in the upper left hand corner. I know there's something out there like this but I couldn't find it.
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
310
发表于 2022-7-6 11:16:30 | 显示全部楼层
I meant to upload a pic
120928db00bsb44brtda94.jpg
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 11:21:39 | 显示全部楼层
Sounds like someone needs to learn LISP. :wink:
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:26:59 | 显示全部楼层
In the language of pseudocode...
 


  • Prompt for Block Selection [selection/getstring ~ check validity (findfile)]


  • Prompt for box Selection (check object validity)


  • Get Vertices of Box (dxf group code 10 - multiple entries)


  • Sort Points by x then y, or vice versa and insert block with correct rotation at each point. (Alternatively, perhaps get First Derivative of curve near vertex to determine rotation.
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 11:29:51 | 显示全部楼层
Don't forget to check for direction of polygon.
 
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:36:32 | 显示全部楼层
Haha nice one Alan
 
You're such a tease lol
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 11:37:40 | 显示全部楼层
 
HaHa, thanks.
I was looking for Gile's Clockwise routine, but then I remembered I could just use the formula to check the area of a triangle (given 3 points), so I just used that.
回复

使用道具 举报

62

主题

466

帖子

404

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
310
发表于 2022-7-6 11:44:31 | 显示全部楼层
It goes along with the the code you helped me with the first time. When I create this I want the corners to fill in. I'd like them to come in automatically but if I have to select them than that's fine
 
  1. (defun c:COMP1 (/ blockname p1 p2 d d1) ;; modified by Reid b. (vl-load-com) (setq blockname "1compartment") (if (and (or (tblsearch "block" blockname)              (findfile (strcat blockname ".dwg"))              (alert (strcat blockname " cannot be found!"))          )          (setq p1 (getpoint "\nSpecify block insertion point: "))          (setq d (getdist p1 "\nSpecify box width: "))          (setq d1 (getdist p1 "\nSpecify box length: "))     )   ((lambda (block)      (foreach x (vlax-invoke block 'GetDynamicBlockProperties)        (cond ((eq (vla-get-propertyname x) "DISTANCE")               (vla-put-value                 x                 (cond                   ((>= 0.125 (/ d 0.125)) 0.125)                   ((< 0.125 (setq num (/ d 0.125))) (* 0.125 (fix num)))                   (0.125)                 )               )              )              ((eq (vla-get-propertyname x) "DISTANCE1")               (vla-put-value                 x                 (cond                   ((>= 0.125 (/ d1 0.125)) 0.125)                   ((< 0.125 (setq num (/ d1 0.125))) (* 0.125 (fix num)))                   (0.125)                 )               )              )        )      )      (vl-catch-all-apply (function (lambda () (vla-explode block) (vla-delete block))))    )     (vla-insertblock       (if         (or (eq acmodelspace                 (vla-get-activespace                   (cond (*AcadDoc*)                         ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))                   )                 )             )             (eq :vlax-true (vla-get-mspace *AcadDoc*))         )          (vla-get-modelspace *AcadDoc*)          (vla-get-paperspace *AcadDoc*)       )       (vlax-3d-point (trans p1 1 0))       blockname       1.       1.       1.       0.     )   ) ) (princ))
 
http://www.cadtutor.net/forum/showthread.php?t=47619
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 11:48:31 | 显示全部楼层
It's really nice of you to completely remove my name from my code.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 11:54:52 | 显示全部楼层
I can't believe that...
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-6 11:16 , Processed in 0.369330 second(s), 74 queries .

© 2020-2025 乐筑天下

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