static void Skeletize_Executing(object sender, EventArgs e) { double sphereDiameter = cylinderDiameter * 2; Window activeWindow = Window.ActiveWindow; ICollection <ITrimmedCurve> iTrimmedCurves = activeWindow.GetAllSelectedITrimmedCurves(); if (iTrimmedCurves.Count == 0) { return; } Part parent = activeWindow.ActiveContext.Context as Part; if (parent == null) { return; } Part part = Part.Create(parent.Document, "Skeleton"); Component component = Component.Create(parent, part); List <Point> allPoints = new List <Point>(); foreach (ITrimmedCurve iTrimmedCurve in iTrimmedCurves) { if (isCreatingSpheres && !Accuracy.Equals(iTrimmedCurve.StartPoint, iTrimmedCurve.EndPoint)) { allPoints.Add(iTrimmedCurve.StartPoint); allPoints.Add(iTrimmedCurve.EndPoint); } if (iTrimmedCurve.Geometry.GetType().Name == "Line") { if (isCreatingCylinders) { ShapeHelper.CreateCylinder(iTrimmedCurve.StartPoint, iTrimmedCurve.EndPoint, cylinderDiameter, part); } if (isCreatingSausages) { ShapeHelper.CreateSausage(iTrimmedCurve.StartPoint, iTrimmedCurve.EndPoint, cylinderDiameter, part); } } else { if (isCreatingCylinders || isCreatingSausages) { ShapeHelper.CreateCable(iTrimmedCurve, cylinderDiameter, part); } if (isCreatingSausages && !Accuracy.Equals(iTrimmedCurve.StartPoint, iTrimmedCurve.EndPoint)) { ShapeHelper.CreateSphere(iTrimmedCurve.StartPoint, cylinderDiameter, part); ShapeHelper.CreateSphere(iTrimmedCurve.EndPoint, cylinderDiameter, part); // TBD boolean these with cable } } } if (isCreatingSpheres) { List <Point> points = new List <Point>(); while (allPoints.Count > 0) { Point testPoint = allPoints[0]; allPoints.Remove(allPoints[0]); bool isDuplicate = false; foreach (Point point in allPoints) { if (Accuracy.Equals(testPoint, point)) { isDuplicate = true; break; } } if (!isDuplicate) { points.Add(testPoint); } } foreach (Point point in points) { ShapeHelper.CreateSphere(point, sphereDiameter, part); } } }