首页/文章/ 详情

DTAS Python脚本自动化自定义测量,突破软件限制,实现建模自由!

3小时前浏览2


在上期内容中,我们对DTAS Python脚本自动化建模-专治建模界的 "二高" 问题(高重复、高耗时)进行了深入探讨。DTAS可以自由编写Python脚本,开发自己特定场景的虚拟装配与虚拟测量 ,成功将用户从繁琐的重复建模中解放出来,不仅大幅提升了建模效率,还让脚本能够重复利用,真正实现了建模的自动化与智能化。

而本期,我们将继续深入探索DTAS Python脚本的——自定义测量功能,看看它是如何为复杂应用场景提供定制化解决方案的。


   

Python脚本应用场景举例

   


       

场景举例

如图所示:6块马蹄状的零件通过两孔销装到绿色圆盘,6块马蹄状内表面围成的最小圆的直径是如何变化的?

软件中是没有此类型测量,DTAS软件可以通过编写脚本来实现此场景下的测量。

   


       

软件操作

准备好了吗?让我们开始这段自动化测量的探索之旅,一起解锁DTAS 3D公差仿真分析的新技能吧!



       

案例脚本

如下:  







































































# DTAS Soft# zjy 20241104# Function:求xy平面上24个点算出的最大外接圆半径及x,y坐标## 获取24个点的坐标参数p1 = [features[0][0], features[0][1], features[0][2]]p2 = [features[1][0], features[1][1], features[1][2]]p3 = [features[2][0], features[2][1], features[2][2]]p4 = [features[3][0], features[3][1], features[3][2]]p5 = [features[4][0], features[4][1], features[4][2]]p6 = [features[5][0], features[5][1], features[5][2]]p7 = [features[6][0], features[6][1], features[6][2]]p8 = [features[7][0], features[7][1], features[7][2]]p9 = [features[8][0], features[8][1], features[8][2]]p10 = [features[9][0], features[9][1], features[9][2]]p11 = [features[10][0], features[10][1], features[10][2]]p12 = [features[11][0], features[11][1], features[11][2]]p13 = [features[12][0], features[12][1], features[12][2]]p14 = [features[13][0], features[13][1], features[13][2]]p15 = [features[14][0], features[14][1], features[14][2]]p16 = [features[15][0], features[15][1], features[15][2]]p17 = [features[16][0], features[16][1], features[16][2]]p18 = [features[17][0], features[17][1], features[17][2]]p19 = [features[18][0], features[18][1], features[18][2]]p20 = [features[19][0], features[19][1], features[19][2]]p21 = [features[20][0], features[20][1], features[20][2]]p22 = [features[21][0], features[21][1], features[21][2]]p23 = [features[22][0], features[22][1], features[22][2]]p24 = [features[23][0], features[23][1], features[23][2]]# 求24个点在xy平面上的投影点facePos1 = [1,0,0]facePos2 = [0,1,0]facePos3 = [1,1,0]p1Pos = PointProjectionOntoThePlane(p1,facePos1,facePos2,facePos3)p2Pos = PointProjectionOntoThePlane(p2,facePos1,facePos2,facePos3)p3Pos = PointProjectionOntoThePlane(p3,facePos1,facePos2,facePos3)p4Pos = PointProjectionOntoThePlane(p4,facePos1,facePos2,facePos3)p5Pos = PointProjectionOntoThePlane(p5,facePos1,facePos2,facePos3)p6Pos = PointProjectionOntoThePlane(p6,facePos1,facePos2,facePos3)p7Pos = PointProjectionOntoThePlane(p7,facePos1,facePos2,facePos3)p8Pos = PointProjectionOntoThePlane(p8,facePos1,facePos2,facePos3)p9Pos = PointProjectionOntoThePlane(p9,facePos1,facePos2,facePos3)p10Pos = PointProjectionOntoThePlane(p10,facePos1,facePos2,facePos3)p11Pos = PointProjectionOntoThePlane(p11,facePos1,facePos2,facePos3)p12Pos = PointProjectionOntoThePlane(p12,facePos1,facePos2,facePos3)p13Pos = PointProjectionOntoThePlane(p13,facePos1,facePos2,facePos3)p14Pos = PointProjectionOntoThePlane(p14,facePos1,facePos2,facePos3)p15Pos = PointProjectionOntoThePlane(p15,facePos1,facePos2,facePos3)p16Pos = PointProjectionOntoThePlane(p16,facePos1,facePos2,facePos3)p17Pos = PointProjectionOntoThePlane(p17,facePos1,facePos2,facePos3)p18Pos = PointProjectionOntoThePlane(p18,facePos1,facePos2,facePos3)p19Pos = PointProjectionOntoThePlane(p19,facePos1,facePos2,facePos3)p20Pos = PointProjectionOntoThePlane(p20,facePos1,facePos2,facePos3)p21Pos = PointProjectionOntoThePlane(p21,facePos1,facePos2,facePos3)p22Pos = PointProjectionOntoThePlane(p22,facePos1,facePos2,facePos3)p23Pos = PointProjectionOntoThePlane(p23,facePos1,facePos2,facePos3)p24Pos = PointProjectionOntoThePlane(p24,facePos1,facePos2,facePos3)# 求xy平面上24个点算出的最大内接圆半径及x,y坐标listPos = [p1Pos[0],p1Pos[1],p2Pos[0],p2Pos[1],p3Pos[0],p3Pos[1],p4Pos[0],p4Pos[1],\p5Pos[0],p5Pos[1],p6Pos[0],p6Pos[1],p7Pos[0],p7Pos[1],p8Pos[0],p8Pos[1] ,\p9Pos[0],p9Pos[1],p10Pos[0],p10Pos[1],p11Pos[0],p11Pos[1],p12Pos[0],p12Pos[1],\p13Pos[0],p13Pos[1],p14Pos[0],p14Pos[1],p15Pos[0],p15Pos[1],p16Pos[0],p16Pos[1],\p17Pos[0],p17Pos[1],p18Pos[0],p18Pos[1],p19Pos[0],p19Pos[1],p20Pos[0],p20Pos[1],\p21Pos[0],p21Pos[1],p22Pos[0],p22Pos[1],p23Pos[0],p23Pos[1],p24Pos[0],p24Pos[1]]# 0:半径; 1: x; 2:y#dtas底层函数FittingMaxCircleIn-最大内接圆res = FittingMaxCircleIn(listPos) SetHolePinCenter('monitor', DTASPoint(res[1],res[2], 30),False)SetHolePinDiameter('monitor', 2*res[0],False)measureValue = 2*res[0]# end
 


       

总结

DTAS创造性的将CAE脚本自动化技术、二次开发等引入CAT领域

1.开放底层API、支持宏录制、编写Python脚本,将用户从繁琐重复的建模中解放,使用脚本自动化技术可以提高建模效率,并且脚本等可以重复使用;

2.支持用户开发自定义的公差分析模型如虚拟装配虚拟测量等,大大增强了软件面对复杂应用场景的拓展性与中高级、专家及用户使用软件的自由性;

3.构建软件用户生态、公差自动化智能化分析的前提。  


 


来源:DTAS棣拓科技
二次开发python装配
著作权归作者所有,欢迎分享,未经许可,不得转载
首次发布时间:2025-04-24
最近编辑:3小时前
获赞 29粉丝 29文章 41课程 5
点赞
收藏
作者推荐
未登录
还没有评论
课程
培训
服务
行家
VIP会员 学习计划 福利任务
下载APP
联系我们
帮助与反馈