Visual Basic – Gewinde im DXF Gruppieren

provided that you agree that Center4CNC has no warranty obligations ‚ or liability whatsoever for any of the sample code files, the result ‚ from your use of them or for any modifications you may make. This notice ‚ must be included on any reproduced or distributed file or modified file.

Sub GroupTapInDXF()

' Diese Makro gruppiert alle Kreise und die dazugehörigen Bohrungen,
   ' wenn es sich wie bei DXF-Zeichnungen üblich um Gewindedarstellungen handelt
   ' Danach können diese dann auf einen separaten Layer gelegt werden
   ' und mit der Featureerkennung Bohrung fortgefahren werden
   
   
   Const PI = 3.14159265358979
   
   Dim A As Esprit.Arc
   Dim C As Esprit.Circle
   
   
   For Each C In Document.Circles
       For I = 1 To Document.Arcs.Count
           Set A = Document.Arcs(I)
           If A.Length > (3 / 2 * A.Radius * PI) Then              ' Arc is 3/4 Circle then Tap sign
               If Abs(C.Radius - A.Radius) / C.Radius < 0.3 Then   ' difference Arc Circle not more than 30%
                   If ((C.CenterPoint.X = A.CenterPoint.X) And _
                      (C.CenterPoint.Y = A.CenterPoint.Y) And _
                      (C.CenterPoint.Z = A.CenterPoint.Z)) Then
                           C.Grouped = True                        ' Circle is Tap
                           A.Grouped = True                        ' Arc is Tap
                   End If
               End If
           End If
       Next
   Next
   
   Set A = Nothing
   Set C = Nothing
   
   Document.Refresh

End Sub

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert