Message 1 of 21
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hello?
This is a post I made previously on the forum.
https://forums.autodesk.com/t5/inventor-programming-ilogic/please-tell-me-how-to-make-tab-countsink-...
There are two things I want to change in the code below.
1. The count sink holes of the tab’s circular pattern, square pattern, and linked pattern are not hidden.
2. In the drawing, the rule is applied to the first view of the sheet, but I want to select the view to apply it.
Can you help me?
Sub Main() Dim drawing As DrawingDocument = ThisDoc.Document Dim drawingView As DrawingView = drawing.ActiveSheet.DrawingViews(1) Dim part As PartDocument = drawingView.ReferencedDocumentDescriptor.ReferencedDocument Dim partDef As PartComponentDefinition = part.ComponentDefinition For Each holeFeature As HoleFeature In partDef.Features.HoleFeatures If holeFeature.HoleType <> HoleTypeEnum.kCounterSinkHole Then Continue For 'Get the biggest circles of holeFeature in drawing view Dim biggestCircles As New List(Of DrawingCurveSegment) Dim biggestCircleRadius As Double = 0 Dim holeDrawingCurves = drawingView.DrawingCurves(holeFeature) For Each holeDrawingCurve As DrawingCurve In holeDrawingCurves For Each drawingCurveSegment As DrawingCurveSegment In holeDrawingCurve.Segments Dim circle2d = TryCast(drawingCurveSegment.Geometry, Circle2d) If circle2d Is Nothing Then Exit For If circle2d.Radius > biggestCircleRadius Then biggestCircles.Clear() biggestCircleRadius = circle2d.Radius biggestCircles.Add(drawingCurveSegment) ElseIf circle2d.Radius = biggestCircleRadius Then biggestCircles.Add(drawingCurveSegment) End If Next Next 'Hide For Each biggestCircle As DrawingCurveSegment In biggestCircles biggestCircle.Visible = False Next Next End Sub
Solved! Go to Solution.