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

Hi @p.kaminskiG7KX4 . Here is an example of code that searches all sketches for ellipses and measures their dimensions along the X and Y axes:

Private Sub Main()
	Dim oDoc As Document = ThisApplication.ActiveDocument
	If Not TypeOf oDoc Is PartDocument Then Exit Sub
	Dim oPDoc As PartDocument = oDoc
	Dim oUOfM As UnitsOfMeasure = oPDoc.UnitsOfMeasure
	Dim oSketches As PlanarSketches = oPDoc.ComponentDefinition.Sketches
	Dim dMinX, dMinY, dMaxX, dMaxY As Double
	For Each oSketch As PlanarSketch In oSketches
		If oSketch.SketchEllipses.Count = 1 Then
			Dim oEllipse As SketchEllipse = oSketch.SketchEllipses.Item(1)
			dMinX = oUOfM.ConvertUnits(oEllipse.RangeBox.MinPoint.X, kCentimeterLengthUnits, oUOfM.LengthUnits)
			dMinY = oUOfM.ConvertUnits(oEllipse.RangeBox.MinPoint.Y, kCentimeterLengthUnits, oUOfM.LengthUnits)
			dMaxX = oUOfM.ConvertUnits(oEllipse.RangeBox.MaxPoint.X, kCentimeterLengthUnits, oUOfM.LengthUnits)
			dMaxY = oUOfM.ConvertUnits(oEllipse.RangeBox.MaxPoint.Y, kCentimeterLengthUnits, oUOfM.LengthUnits)
			MessageBox.Show("X = " & Abs(Round(dMaxX - dMinX, 3)), oSketch.Name & ", Size X")
			MessageBox.Show("Y = " & Abs(Round(dMaxY - dMinY, 3)), oSketch.Name & ", Size Y")
		End If
	Next
End Sub

 You can see how to create an excel file and write information in it here.

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature