Code:
Private Sub cmdPunkteSetzen_Click()Dim hPoint As HybridShapePointCoord
Dim axisSystem1 As AxisSystem
Dim refAxis As Reference
Dim refPoint As Reference
Dim anno As Annotation
Dim v As Viewpoint3D
Dim annotationSet1 As AnnotationSet
Dim hybridShapePointCoord1 As HybridShapePointCoord
Dim userSurface1 As UserSurface
Dim dx As Double, dy As Double, dz As Double
Dim pd As PartDocument
Dim I As Integer
Dim Sel As Selection
dx = tbX.Value
dy = tbY.Value
dz = tbZ.Value
If oPart.AnnotationSets.Count = 0 Then
Set annotationSet1 = oPart.AnnotationSets.Add("MeinAnnotationSet")
Else
Set annotationSet1 = oPart.AnnotationSets.Item(1)
End If
If oPart.HybridBodies.Count = 0 Then
oPart.HybridBodies.Add
End If
For I = 0 To AnzPunkte - 1
If Me.cbIgnorZU.Value = True And Punkte(I).NahtEnde <> "" Then
Else
Set hPoint = oPart.HybridShapeFactory.AddNewPointCoord(Punkte(I).X + dx, Punkte(I).Y + dy, Punkte(I).z + dz)
hPoint.Name = preMK & "Punkt;" & Punkte(I).KlebeName & ";" & Punkte(I).RobName & ";" & Punkte(I).ProgNummer & ";" & Punkte(I).NahtName & ";" & Punkte(I).NahtNummer & ";" & Punkte(I).X & ";" & Punkte(I).Y & ";" & Punkte(I).z & ";" & dx & ";" & dy & ";" & dz & ";" & Punkte(I).PunktArt
oPart.HybridBodies.Item(1).AppendHybridShape hPoint
oPart.Update
Set refPoint = oPart.CreateReferenceFromObject(hPoint)
Set userSurface1 = oPart.UserSurfaces.Generate(refPoint)
Set anno = annotationSet1.AnnotationFactory.CreateEvoluateText(userSurface1, Punkte(I).X + dx, Punkte(I).Y + dy, Punkte(I).z + dz, False)
anno.Text.Text = Format(Punkte(I).KlebeName, "00")
anno.Text.Get2dAnnot.SetFontSize 1, Len(anno.Text.Text), 2.5
anno.Text.Get2dAnnot.ActivateFrame (catCircle)
anno.Text.Get2dAnnot.AnchorPosition = catMiddleCenter
anno.Text.Get2dAnnot.TextProperties.Justification = catCenter
If CATIA.SystemConfiguration.IsProductAuthorized("FTA.prd") = True Then
anno.Text.TPSParallelOnScreen.ParallelOnScreen = True
anno.Name = preMK & "Text;" & Punkte(I).KlebeName
End If
End If
Next I
oPart.Update
CATIA.ActiveWindow.ActiveViewer.Reframe
End Sub