乐筑天下

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

[编程交流] 加速代码。使用comman

[复制链接]

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 16:34:59 | 显示全部楼层
如果您将这两个块附加在DWG上也会很好。。。
但从我的角度来看,理论上,你需要乘以2个矩阵才能得到正确的变换矩阵。。。乘法应按正确的顺序执行(变换矩阵x当前块方向和位置的矩阵)-顺序必须始终与实际变换过程相反。。。当你们得到正确的矩阵时,将我的(c:变换)示例应用到所需的块/实体并不难。。。但我在这里看到的问题是如何确定正确的变换矩阵。。。也许,如果你可以写下你将使用什么命令来获得结果,那么你可以根据你使用的命令创建这些变换矩阵,但要得到最后一个,请记住,你必须按实际顺序的相反顺序将它们逐个相乘,你将应用这些命令。。。
回复

使用道具 举报

49

主题

177

帖子

130

银币

后起之秀

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

铜币
243
发表于 2022-7-5 16:38:23 | 显示全部楼层
这幅画只是一个例子。我甚至没有保存它。在WCS中,只有一条从0,0,0到3,4,5的线。红线绘制在xy平面上,并上升到点3,4,5。但出于示例的考虑,请将红线视为一个区块。我使用的命令是
 
  1. 9

 
其中,pt1和pt2是白线的两端,pt3是垂直于另一条红线的短红线的自由端。希望这是清楚的。
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 16:44:45 | 显示全部楼层
根据您发布的图片,尝试以下操作:
 
基于我的(c:变换),这个要简单得多,我想你会更喜欢它,因为很明显矩阵实际上是如何表示各种坐标系的。。。假设主向量是已知的向量(0,0,0 ptpos),或者仅仅是ptpos,则该向量使用2个子(单位)和(v^v)-叉积来构造。。。其他轴通过任意计算确定-首先是x轴-实际主矢量(单位ptpos),然后是z轴-(单位(v^v’(0.0 0.0 1.0)x))-WCS的x轴(主矢量)和z矢量的法向量,最后,y轴-(单位(v^v x z))-上一步计算的x轴(主向量)和z轴的法向量(注意,通过在计算中切换x轴和z轴{(单位(v^v z x))}将产生y轴方向向下-右手三指规则必须始终为真-坐标系必须始终为规则。。。
 
  1. 11
HTH。,M、 R。
 
回复

使用道具 举报

28

主题

317

帖子

292

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2022-7-5 16:46:42 | 显示全部楼层
 
第一点是,在您的图像中,您似乎处于WCS中。我不知道这些线是如何以及何时创建的。你最初说你停止使用entmake是因为它不“尊重”ucs,我不知道的另一件事是ucs是否与线路有关。从这些图像中,我认为假设直线代表插入的X轴是正确的,但从UCS中,我们也可以提取Y轴。当我们不完全了解需要什么、所采取的步骤时,很难提供有效的解决方案(或任何东西)。ie:ye
回复

使用道具 举报

49

主题

177

帖子

130

银币

后起之秀

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

铜币
243
发表于 2022-7-5 16:51:45 | 显示全部楼层
Thank you Marko. It seems to be working fine although I haven't implemented it in my code yet. One thing I do not understand how is the angle around the white line is defined. In other words, how is the block oriented around the axis '(0 0 0) and ptpos.
In my model the tip of the block is known (see image). How could that be fed as a variable to orient it as desired?
 

                               
登录/注册后可看大图

165650zoe5lufw3tt2owew.jpg
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 16:53:07 | 显示全部楼层
I would suggest that you always insert block in 0,0,0 with rotation  0.0... Then you only have to apply correct matrix that represent your  new position/orientation coordinate system, and for finding that matrix I  suggest that you look into my second example... You need to visualize  relation of new block position/orientation with WCS main CS as you've  inserted block just in WCS origin with angle 0.0, so basically your  block has matrix ((1 0 0) (0 1 0) (0 0 1)) - ((Xaxisort Yaxisort  Zaxisort)), but in transformation matrix that's transposed :  ((XcoordXaxisort XcoordYaxisort XcoordZaxisort Xcoordorigin)  (YcoordXaxisort YcoordYaxisort YcoordZaxisort Ycoordorigin)  (ZcoordXaxisort ZcoordYaxisort ZcoordZaxisort Zcoordorigin) (0.0 0.0 0.0  1.0))... So if block is in WCS and has WCS matrix ((1 0 0 0) (0 1 0 0)  (0 0 1 0) (0 0 0 1)), you need to find new matrix using scheme of  transformation matrix 4x4 matrix according to my description of  coordinates of orts and origin... When you find that matrix either using  vector calculus like my second example or multiplication of matrices in  reversed order than you would apply them like in my first example, you  just have to apply it to that block with (vla-transformby  (vlax-ename->vla-object block) (vlax-tmatrix matrix))... I hope it's  clear enough, and for orientation of while line - it's just simple  vector ort (unit (mapcar '- ptpos '(0.0 0.0 0.0))) and that's equal to  just (unit ptpos), so you don't need to know angles of that white line -  everything is defined by vector ort coordinates in 3d space...
回复

使用道具 举报

49

主题

177

帖子

130

银币

后起之秀

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

铜币
243
发表于 2022-7-5 16:57:53 | 显示全部楼层
Understood, more or less in theory, although it s been quite many years since the last time I was dealing with vector theory. The issue here is that this matrix must be generated based on specific topology and orientation. Take a look at the picture below where you can see my intent. The 'tee' in the circle (right) will need to get oriented in accordance with the perpendicular line. But that would need to define the rotation angle around the main line (white line in my previous post).
 

                               
登录/注册后可看大图

165654fom522rrjoizat2r.jpg
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 20:56 , Processed in 0.743937 second(s), 66 queries .

© 2020-2025 乐筑天下

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