乐筑天下

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

[编程交流] 奇怪的行为

[复制链接]

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 08:29:51 | 显示全部楼层 |阅读模式
有人能告诉我为什么这有时会引起人们的关注吗。125条长线,有时它会把它们画在。25长。
 
旋转半径:
参见图片。第一个结果围绕WCS轴,第二个结果围绕重心
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 08:40:46 | 显示全部楼层
非常感谢这些富有洞察力的回复。Fixo,我肯定会用\\P来整合多行文字的方法。我知道一定有更好的方法,但网络上的许多搜索证明LISP和text并不是线程中常见的。
 
Stephan MBR-我正在使用另一个名为stl的lisp例程。lsp。这是伟大的钢细节,虽然我在这个项目的主要原因是与铝工作。我最终会在代码中放置一个提示,询问用户形状是钢还是铝,并根据输入计算重量/英尺和其他。Stl。lsp相当准确地绘制了配置文件,至少是我能够检查到的。我必须将形状转化为一个区域,但然后我运行MASSPROP并获得许多信息,我正在对照AISC手册进行交叉检查。我确信像SolidWorks这样的软件可以自动并且更准确地完成这项工作,但我没有SolidWorks的许可证,而且在可预见的将来也不会。
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 08:52:47 | 显示全部楼层
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 09:03:06 | 显示全部楼层
Sorry Bill, I missed a second "_non", the code should be:
 

[code](command "_.circle" "_non" ip "0.125")(command "_.line"   "_non" ip "_non" "@0.25
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 09:10:30 | 显示全部楼层
As sloppy as this may be I almost have it where it will be. The text is not an easy thing to do. I have about 50 LISP programs in my collection and it wasn't until I started looking for some text examples that I realized I don't have any. I guess it makes sense that LISP is not really the correct tool for entering text. But this routine is an exception to that rule. Here is what I have so far. You will need a shape like an extrusion of some kind to run this on. I don't think I have the weight thing right just yet and I'm still seeing about a 2% discrpency between the Ix figures I get and the published ones for steel shapes in the AISC manual.
 

[code](defun c:test ( / e o f d l )   (if       (and           (setq e (car (entsel)))           (setq o (vlax-ename->vla-object e))           (eq "AcDbRegion" (vla-get-objectname o))           ;(setq f (vl-filename-mktemp nil (getvar 'dwgprefix) ".txt"))           ;(setq d (open f "w"))       )       (progn           (princ               (strcat                   "Area: "                   (rtos (vlax-get o 'area)) "  Wt/Ft = " (rtos (* (vlax-get o 'area) 1.18) 2 2)     "\nPerimeter: "                   (rtos (vlax-get o 'perimeter))     "\nCentroid: "                   (progn                       (setq l (mapcar 'rtos (vlax-get o 'centroid)))         (strcat (car l) "," (cadr l))         (setq ip (strcat (car l) "," (cadr l)))     )     "\nRadii of Gyration: "                   (progn                       (setq l (mapcar 'rtos (vlax-get o 'radiiofgyration)))         (strcat (car l) "," (cadr l))                   )     "\nPrincipal Moments: "     (progn         (setq l (mapcar 'rtos (vlax-get o 'principalmoments)))         (strcat (car l) "," (cadr l))     ) )             ;   d           )           ;(close d)(setq l1 (strcat "Area:  " (rtos (vlax-get o 'area) 2 4) " Sq In"))(setq l2 (strcat "Wt/Ft:  " (rtos (* (vlax-get o 'area) 1.18) 2 2) " lbs"))(setq l3 (strcat "Perimeter: " (rtos (vlax-get o 'perimeter) 2 2) " In"))(setq l4 (strcat "Ix:  " (cadr l)))(setq l5 (strcat "Iy:  " (car l)))(princ l)  ; Draw the Center of Gravity Point  (command "_.circle" "_non" ip "0.125" "")  (command "_.line" "_non" ip "@0.25
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 09:18:21 | 显示全部楼层
Just on the quick glance
any command do not require double quotes at the end of expression, e.g:

[code] (command "_.circle" "_non" ip "0.125" );
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-6 09:23:10 | 显示全部楼层
Hi Bill
 
About 2% differences, is the shape double symmetric? If it's not (and you can see that next to Principal Moments, if directions are different than [1.00 0.00]) then you need another method to get the correct values. I know two methods:
1) First, run _massprop and collect the centroid coordinates; then set UCS to centroid. Run _massprop once again and compare Moments Of Inertia (and not Principal moments) with AISC manual.
2) Second method required to run _massprop once and no UCS settings:
- read area A
- read centroid from _massprop  -  (xg, yg)
- read Moments of Inertia - (Ix, Iy)
The moments around centroid an parallel  to x and y axis:
   
  1. Ixg = Ix - A*yg^2Iyg = Iy - A*xg^2
Radii of gyration:
   
  1. rxg = sqrt (Ixg / A)ryg = sqrt (Iyg / A)
See the picture. First results are around WCS axis and second around Center of gravity. 092954ao6uoo8oa6ro7a88.jpg
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 09:36:11 | 显示全部楼层
Many thanks for these insightful replies. Fixo, I will certainly incoporate that method for mtext using \\ P. I knew there had to be a better way but many searches on the net proved that LISP and text are not that common of a thread.
 
Stephan MBR - I am using another lisp routine called stl.lsp. It's great for steel detailing, although the main reason I'm working on this project is for working with aluminum. I will eventually place a prompt in the code which asks the user whether the shape is steel or aluminum and it will calculate weight/foot and others based on that input. Stl.lsp draws up the profiles quite accurately, at least what I've been able to check. I have to turn the shape into a REGION but then I run MASSPROP and get lots of information which I'm cross-checking against the AISC manual. I'm sure something like SolidWorks does this automatically and with greater accuracy, but I don't have a license for SolidWorks and will not in the forseeable future.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-7 08:56 , Processed in 0.619850 second(s), 70 queries .

© 2020-2025 乐筑天下

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