Hi @tbrausen
Just putting this in the editor to more easily read the code.
Components.ContentCenterLanguage = "en-US"
oPartDoc = ThisDoc.Document
Dim oPick1 As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllCircularEntities, "Pick insert circle 1")
Select Case oPick1.GeometryType
Case CurveTypeEnum.kCircleCurve
MessageBox.Show("Message2", "Title")
Dim circ As Inventor.Circle
circ = oPick1.Geometry
GetCenterPoint = circ.Center
Case Else
MessageBox.Show("Message5", "Title")
GetCenterPoint = Nothing
End Select
oCenter = GetCenterPoint
If Not oCenter Is Nothing Then
MessageBox.Show("Center: " & oCenter.X.ToString() & ", " & oCenter.Y.ToString() & ", " & oCenter.Z.ToString())
End If
Dim oPick2 As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllCircularEntities, "Pick insert circle 2")
'Dim pick2 As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Pick face 2")
Dim entityOneInferredType As InferredTypeEnum = InferredTypeEnum.kNoInference
Dim entityTwoInferredType As InferredTypeEnum = InferredTypeEnum.kNoInference
Dim context As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
Dim distance As Double = ThisApplication.MeasureTools.GetMinimumDistance(
oPick1,
oPick2,
entityOneInferredType,
entityTwoInferredType,
context)
Logger.Debug(distance)
For i As Integer = 1 To context.Count
Dim key = context.Name(i)
Dim value = context.Value(key)
Logger.Debug("{0}: {1}", key, value)
Next
Components.AddContentCenterPart("Pipe:1", "Steel Shapes:Round", "ISTD-PIPE-304SS WIP",
{"LENGTH_ROUNDED_DN", Floor(Round(distance / 2.54, 4) / .0625) * .0625, "SIZE [Custom]", "1/8""", "TYPE [Custom]", "SCH10" },
position := oCenter.X.ToString() & ", " & oCenter.Y.ToString() & ", " & oCenter.Z.ToString(), grounded := False,
visible := True, appearance := Nothing)
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan