乐筑天下

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

[编程交流] 查找轴承lisp。(贝金纳)

[复制链接]

2

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:12:44 | 显示全部楼层 |阅读模式
大家好,
第一个帖子,但希望你能善待我,我已经潜伏了一段时间,但这是我第一次需要发布!
 
我正在学习Lisp例程,但还没有时间!我想要一个非常基本的,我希望。
 
我需要找到两点点击之间的方位。
 
因此,基本上,单击一次以设置原点,然后在目标位置进行第二次单击,然后给出输出,表示第一个点的X、Y、Z,以及第二次单击的弧度方向。
 
有没有一个基本的图坦卡门来制作这样的东西?或者,如果有人能举一个例子并发表评论,那就太好了。
干杯
布林
回复

使用道具 举报

6

主题

249

帖子

247

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-6 12:17:15 | 显示全部楼层
 
我们可以假设您希望零引用是直接的还是传统的“北”吗?我们可以问一下“为什么弧度是轴承”?
回复

使用道具 举报

2

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:23:23 | 显示全部楼层
您好,谢谢您的回复,是的,北方应该是笔直的,它需要是弧度,因为这些数据将用于另一个只接受弧度的程序。如果我可以像上面那样获得数据,那么我可以在程序员文件编辑器中运行宏,将其转换为正确的格式。基本上是眼点加上方位,然后另一个程序知道“看”的方向
 
我假设弧度不是问题,因为我可以很快从CAD中获得这些信息,但它有点重复。
回复

使用道具 举报

15

主题

46

帖子

31

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 12:26:22 | 显示全部楼层
嗨,布林,
 
我不确定这是否能让你开始,我希望能。我写它是为了得到水平距离和斜率,以及坐标和方向角。它使用了一个警报函数,而您可能希望去掉它,只使用变量。它可能仍然需要一些错误捕捉,但由于我也是一个新手,我不知道如何做所有的“这些东西”。
 
  1. (defun c:hzdplus (/ angtype oldir factp actp sdist hdist mang Nchar1 Nchar2 Echar1 Echar2 Zchar1 Zchar2)
  2. (setq angtype (getvar "AUNITS"))    ;;; Get current user Units
  3. (setq oldir (getvar "ANGDIR"))     ;;;; Get current user Direction
  4. (setq factp (getpoint "\nPick Point 1: ")      ;;; Store Point 1
  5. actp  (getpoint factp "\nPick Point 2: ") ;;; Store Point 2
  6. )
  7. (setq sdist (rtos (distance factp actp)2 3))  ;;; Get slope Distance and store as string
  8. (setq coor1y (cadr factp)    ;;; Get Northing of Point 1
  9. coor1x (car factp)    ;;; Get Easting of Point 1
  10. coor1z (caddr factp)    ;;; Get Height of Point 1
  11. )
  12. (setq afact (list coor1x coor1y 0))    ;;; Store Easting and Northing with Height as 0 (for horizontal distance) of Point 1
  13. (setq coor2y (cadr actp)    ;;; Get Northing of Point 2
  14. coor2x (car actp)    ;;; Get Easting of Point 2
  15. coor2z (caddr actp)    ;;; Get Height of Point 2
  16. )
  17. (setq aact (list coor2x coor2y 0))    ;;; Store Easting and Northing with Height as 0 (for horizontal distance) of Point 2
  18. (setq Nchar1 (rtos coor1y 2 3)   ;;; Store North coordinate of Point 1 as String in decimal format
  19. Echar1 (rtos coor1x 2 3)   ;;; Store East coordinate of Point 1 as String in decimal format
  20. Zchar1 (rtos coor1z 2 3)   ;;; Store Height coordinate of Point 1 as String in decimal format
  21. )
  22. (setq Nchar2 (rtos coor2y 2 3)   ;;; Store North coordinate of Point 2 as String in decimal format
  23. Echar2 (rtos coor2x 2 3)   ;;; Store East coordinate of Point 2 as String in decimal format
  24. Zchar2 (rtos coor2z 2 3)   ;;; Store Height coordinate of Point 2 as String in decimal format
  25. )
  26. (if (< (strlen Nchar2)     ;;; <---- From here, Just error trapping for formatting in alert box,
  27.    (setq Nchar2 (strcat "\t" Nchar2)))   ;;; not totally correct but works for my coordinate system!
  28. (if (< (strlen Echar2)
  29.    (setq Echar2 (strcat "\t" Echar2)))
  30.   (if (< (strlen Zchar2)
  31.    (setq Zchar2 (strcat "\t" Zchar2)))   ;;; <---- To here
  32. (setq mang (angle factp actp))   ;;; Get Angle in Radians
  33. (cond ((= angtype 0) (setq mang (angtos mang 0 4))) ;;; <--- From here
  34. ((= angtype 1) (setq mang (angtos mang 1 4)))
  35. ((= angtype 2) (setq mang (angtos mang 2 4)))
  36. ((= angtype 3) (setq mang (angtos mang 3 4)))
  37. ((= angtype 4) (setq mang (angtos mang 4 4))))  ;;; <---To here, Set angle to user Unit settings and convert to string
  38. (setq hdist (rtos (distance afact aact) 2 3))  ;;; Get horizontal distance from ht=0 point stored variable and convert to string
  39. (alert (strcat "\n\         RESULT\t"   ;;; Display the stuff
  40.   "\n"
  41.   "\n\Angle = " mang
  42.   "\n"
  43.   "\n\Slope Distance = " sdist
  44.   "\n"
  45.   "\n\Horizontal Distance = " hdist
  46.   "\n\n"
  47.   "\Point 1\t\tPoint 2"
  48.   "\n"
  49.   Nchar1
  50.   "\t"
  51.   Nchar2
  52.   "\n"
  53.   Echar1
  54.   "\t"
  55.   Echar2
  56.   "\n"
  57.   Zchar1
  58.   "\t"
  59.   Zchar2
  60. )
  61. )
  62. (princ)
  63. )


  1. (setq hdist (rtos (distance afact aact) 2 3))  ; Get horizontal distance from ht=0 point stored variable and convert to string

 
~'J'~
回复

使用道具 举报

2

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:29:26 | 显示全部楼层
看看这个:
 
http://www.cadtutor.net/forum/showthread.php?t=42128
回复

使用道具 举报

15

主题

46

帖子

31

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 12:33:00 | 显示全部楼层
谢谢大家,这看起来像一个简单的Lisp程序,这是一个很好的开始,我开始学习!
 
好的,我已经到了其他程序“quirk”的底部,它给出了一个预期的xyz,然后也给出了0-1 0形式的旋转。每个图形给出了一个角度来旋转视图,在每个xyz平面上,加上-1告诉它顺时针或逆时针旋转。只要我将-1设置为+1,一个较大的数字将给出正确的激发。这对从事3D cad工作的人来说可能意义非凡?但这对我来说是全新的。。。要一次学会很多东西!为Alanjt干杯。我会张贴在你的线程以及。。。
回复

使用道具 举报

2

主题

13

帖子

11

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:38:46 | 显示全部楼层
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:41:27 | 显示全部楼层
 
Hi Scu,
Sorry, I don't know what is the bearing
but after I did run your code there are both distance
equal :
Slope distance = Horizontal distance
Is that right?
 
~'J'~
回复

使用道具 举报

15

主题

46

帖子

31

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
75
发表于 2022-7-6 12:47:56 | 显示全部楼层
 
Ah.. I think if both points are the same height e.g. both Z = 0 then horizontal = slope as there is no slope. I changed this program from my first simple version cause I used initget 64 to ignore Z values but then I couldn't get the Slope from the picked points.
 
If this isn't the case and they have different heights then I'm not sure why?!! Let me know if this is the case. Although you might have a better go at figuring it out as I'm still new at Lisp.
 
oh and Bearing.. Angle or azimuth people call it different things but this program suppose to work in relation to your angle direction (angdir = 0 or 1, = anti-clockwise or clockwise) and angle base in _units/direction setup. So if you set base angle to North it will be the angle from north in either clockwise or anti clockwise direction. I work in the southern hemisphere with North being up and clockwise.. not normal for CAD! I think I notice if using Land Desktop too.. it stuffs up all my programs I don't know why..database maybe?
 
Also my question is, why when you type angbase at command line (showing 90d on my computer), it is different to the menu.. format/ units/ direction/ angle base North = 270d? Are they different system variables?
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 12:49:05 | 显示全部楼层
Both point have the different heights...
Ok, as they said here, I need time to chew it
Will be back at tomorrow
 
~'J'~
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 10:20 , Processed in 0.477927 second(s), 72 queries .

© 2020-2025 乐筑天下

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