乐筑天下

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

[编程交流] To show 'princ' valu

[复制链接]

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 07:40:54 | 显示全部楼层 |阅读模式
I have the adoptation of a function suggested by a person in this forum and I have given the file his name. How can I get the 'princ' value in the command window?
The code is:
  1. (defun x nil(setq r 2000);Fictitious value(setq r1 1500);Fictitious valur(while (> r r1)        (setq devx 4.7); From previous calc.        (setq ip '(707.7 432.2));From previous calc.        (setq b -0.84);From previous calc.       ;(setq ip(car (reverse lx)))        (setq s 7);Given by user previously        (setq v 120);Given by user previously        (setq pr(polar ip devx 400))        (command "_line" "_non" ip "_non" pr)              (while (> (getvar 'cmdactive) 0) (command "")               (setq x (getpoint "\nGive nearest point to ip on curve"))); best location North of 706,321 on line ip pr for this case              (setq del(abs b))              (setq a(/ del 2))              (setq tan(/ (sin a) (cos a)))              (setq y(* tan tan))              (setq r(* (/ (distance ip x) y) (+ 1 (sqrt (+ 1 y)))))              (setq s1(/ (* v v) (* r 2.828)));according to UK's TD 9              (cond ((and (< s1 s) (> s1 2.5)) (setq s s1)))              (setq r1(/ (* v v) (* s 2.828)))                     (while (< r r1)                              (load "F:\Marko")                                (princ "\nRadius less than minimum, select point further from ip");This line appears only in text window                              (x)                    )             ))
Can anyone help please?
This can be run within 0,0 and 1300,900 limits.
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 07:48:49 | 显示全部楼层
Can not test since I don't have "F:\Marko" (btw, shouldn't be Marko.lsp?).
Try
  1. (while (setq q (< r r1))(load "F:\Marko") ; it have to be loaded every time????(x))
Then
  1. (setq x (getpoint (strcat (if q "\nRadius less than minimum, select point further from ip" "") "\nGive nearest point to ip on curve")))
x is defined as a function on the top of your code. I think it is better (or even mandatory) to use another variable name in (setq x (getpoint...
回复

使用道具 举报

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 07:53:06 | 显示全部楼层
Hi Stefan,
This code may be copied to a file wih .lsp extension and saved at location 'F' (in my case pendrive) with name Marko as a lisp file. It runs ok with point assigned to x. The program will load it and enter (x) on its own and does the rest as expected, only problem is that the text does not appear for the user to know what is happening.
I will try what you have suggested later.
Regards,
Aloy
回复

使用道具 举报

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 07:59:25 | 显示全部楼层
Hi Stefan,
I tried what you suggested. When I hit the wrong place if gives the Strucat phrase, after that even if I hit the wrong place it accept the wrong value. Perhaps the code needs adjustment a bit and I do not know how.
Regards,
Aloy
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 08:05:07 | 显示全部楼层
aloy,
I would be glad to help you, only if I know what you want to do.
I tried to understand from your lisp but I gave up quickly.
All I understand is that if you pick a wrong point, the program reloads and starts over again and draw the same line in the same place.
A more complete and better explanation would help us to give you a proper solution.
回复

使用道具 举报

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 08:16:56 | 显示全部楼层
Stefan,
I will give the problem as follows:
There are two lines p1, p2 and p3, p4. They intersect at ip. I am trying to fix an arc touching these two lines. For that, I draw a bisector of these lines passing through the center of the arc. I am trying to get a point, that suits certain  criteria on that line. This is a typical problem I get in road alignment design. The arc should pass through an unrestricted area and also meet the minimum radius in conformity with restrictions of maximum superelivation and also consider speed. I believe the code I have given does all that except giving the princ value in the window for the user to see and take appropriate action. It however apears in the text window, which the user cannot see. If I select the wrong points the routine draws lines repeatedly whithout giving an indication what I should do.
Regards,
Aloy
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 08:22:53 | 显示全部楼层
I still can not test your function. I believe is just a piece of a larger routine, so I don't have the entire picture...
For this part, you may try to inhibit what (command "line" ... is prompting at execution time.
Use
  1. (setvar 'cmdecho 0)
somewhere before calling (x) function.
回复

使用道具 举报

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 08:26:31 | 显示全部楼层
Stefan,
I  think I have solved the problem by defining another function by the name Mako1 and entering it after the first try as follows:
  1. defun x1 nil(setq r 2000);Fictitious value(setq r1 1500);Fictitious valur(while (> r r1)      (setq devx 4.7); From previous calc.      (setq ip '(707.7 432.2));From previous calc.      (setq b -0.84);From previous calc.     ;(setq ip(car (reverse lx)))      (setq s 7);Given by user previously      (setq v 120);Given by user previously      (setq pr(polar ip devx 400))      (command "_line" "_non" ip "_non" pr)      (while (> (getvar 'cmdactive) 0) (command "")       (setq x (getpoint "\nRadius less than minimum, select point further from ip" )))      (setq del(abs b))      (setq a(/ del 2))      (setq tan(/ (sin a) (cos a)))      (setq y(* tan tan))      (setq r(* (/ (distance ip x) y) (+ 1 (sqrt (+ 1 y)))))      (setq s1(/ (* v v) (* r 2.828)));according to UK's TD 9      (cond ((and (< s1 s) (> s1 2.5)) (setq s s1)))      (setq r1(/ (* v v) (* s 2.828)))           (while (< r r1)                  (load "F:\Marko1")                  (x1)           )))
Thanks,
Aloy
回复

使用道具 举报

53

主题

302

帖子

249

银币

后起之秀

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

铜币
265
发表于 2022-7-6 08:34:15 | 显示全部楼层
Stefan,
Sorry it is not the name of the function, it is the file name of the file that was changed.
Also I need to inform what happened after I clicked the email sent by Adesk with your message. My computer got reset. Few hours later there was an international call out of the blue (as advised by adesk) giving me the price of Civil 3D. Very strange indeed.
Aloy
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 08:36:35 | 显示全部楼层
I'm very sorry to hear that.
I've just answered your post here at CADTutor, and you probably received an email informing you about it. But what does this have to do with Adesk?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 05:01 , Processed in 1.282943 second(s), 72 queries .

© 2020-2025 乐筑天下

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