Operation Guide
DTAS Python Scripts: Automate Custom Measurements
In a previous article, we introduced DTAS Python‑driven automated modeling to solve repetitive, time‑consuming modeling tasks. By scripting custom virtual assemblies and measurements, users gain freedom from manual work—improving efficiency, enabling reuse, and achieving true modeling automation.
Now, we explore DTAS Python’s custom measurement capability and how it supports tailored solutions for complex engineering scenarios.

Example: Python Script for Custom Measurement
Scenario
Six horseshoe parts are mounted on a disc using two‑hole pins. To track
variation in the diameter of the smallest circle formed by
their inner surfaces—a measurement not predefined in the
software—you can write a DTAS Python script.
Ready to start?
Explore automated measurement and extend your DTAS 3D simulation skills.
▶ Try it now:
Python Script for Custom Automated Measurement
Case script
As follows:
# DTAS Soft
# zjy 20241104
# Function: Calculate the maximum circumscribed circle radius and x, y coordinates of 24 points on the xy plane
# # Get the coordinate parameters of 24 points
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]]
# Find the projection points of 24 points on the xy plane
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)
# Calculate the maximum inscribed circle radius and x, y coordinates of 24 points on the xy plane
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: radius; 1: x; 2: y
#dtas underlying function FittingMaxCircleIn - maximum inscribed circle
res = FittingMaxCircleIn(listPos)
SetHolePinCenter('monitor', DTASPoint(res[1],res[2], 30),False)
SetHolePinDiameter('monitor', 2*res[0],False)
measureValue = 2*res[0]
Summary
DTAS innovatively integrates CAE‑style script automation and API‑based extensibility into Computer‑Aided Tolerancing (CAT), enabling:
1.Automated Modeling – Via macro recording and Python scripting, freeing users from repetitive tasks, improving efficiency, and supporting script reuse.
2.Custom Model Development – Users can build virtual assemblies and custom measurements, extending DTAS to complex scenarios and offering flexibility for all skill levels.
3.Foundation for Intelligence – Paving the way for an ecosystem of automated, intelligent tolerance‑analysis workflows.
Next, we’ll explore the third application scenario—stay tuned!
Get Detailed Info: Pricing, Specs & Support
Please contact our team for more information on product pricing, technical data, project support, and more
Request A Trial