Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

measure minimum distance

michielXWZ7U
Enthusiast

measure minimum distance

michielXWZ7U
Enthusiast
Enthusiast

Hi there!

 

I get a lot of sheet metal parts send to me as .step file. Now i manually measure the minimal thickness and add it to the bom list.

 

Is there an option that enables me to create a variable that scans the Part i am working with, and fetches the mimimum distance within the part, which always should display the material thickness.

 

With kind regards,

Michiel

0 Likes
Reply
343 Views
3 Replies
Replies (3)

vpeuvion
Advocate
Advocate

Hi,

Maybe something like this with iLogic.

Dim Thickness As Double  = MinOfMany(Measure.ExtentsLength, Measure.ExtentsWidth, Measure.ExtentsHeight)
MessageBox.Show(Thickness)

Hoping it helps.

Vincent.

0 Likes

michielXWZ7U
Enthusiast
Enthusiast

thanks for youre reply, unfurtunatly it is not sufficient for my question. When i sketch for example a tube of 10x20x2 and 1000 mm long, It gives me only the shortest outter size. In the case of the tube in the example this will be 20.

 

With kind regards,

 

Michiel

0 Likes

vpeuvion
Advocate
Advocate

Hi,

You can try that for a tube.

Sub main()
	'Measures the minimum distance between plane faces that have a parallel normal
	Dim oPart As PartDocument = ThisApplication.ActiveDocument
	Dim oPartCompDef As PartComponentDefinition = oPart.ComponentDefinition
	Dim oMeasure As Double = 12 'Maximum thickness

		For Each oFace As Face In oPartCompDef.SurfaceBodies(1).Faces
			If oFace.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then
				Dim params(3) As Double
				Dim Normals(2) As Double
				oFace.Evaluator.GetNormal(params, Normals)
				Dim oUnitNormal As UnitVector = ThisApplication.TransientGeometry.CreateUnitVector(Normals(0),Normals(1),Normals(2))
				
				For Each oFace2 As Face In oPartCompDef.SurfaceBodies(1).Faces
					If oFace2.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then
						Dim params2(3) As Double
						Dim Normals2(2) As Double
						oFace2.Evaluator.GetNormal(params2, Normals2)
						Dim oUnitNormal2 As UnitVector = ThisApplication.TransientGeometry.CreateUnitVector(Normals2(0),Normals2(1),Normals2(2))
						If oUnitNormal.IsParallelTo(oUnitNormal2) Then
						oMeasure2 = ThisApplication.MeasureTools.GetMinimumDistance(oFace, oFace2.PointOnFace) * 10
							If oMeasure2 > 0 And oMeasure2 < oMeasure Then oMeasure = oMeasure2
						End If
					End If
				Next
			End If
		Next
	MessageBox.Show(Round(oMeasure))	
End Sub

There may be simpler. To develop.

 Vincent.

0 Likes