![]() |
|
Bitte drücken Sie nicht mehrfach auf "Antwort speichern".
*Ist HTML- und/oder UBB-Code aktiviert, dann können Sie HTML und/oder UBB Code in Ihrem Beitrag verwenden.
Beiträge: 1710 / 0 Windows 10 x64, AIP 2021 Automatisch werden sich die Texte nicht aktualisieren. Reicht auch ein Makro (UpdatePointInfo) für das Aktualisieren aller Punktinfos auf einem Blatt? Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Do While oRes = vbYes Set oPointMark = ThisApplication.CommandManager.Pick(kDrawingCentermarkFilter, "Mittelpunkt wählen...") Dim oInsertPoint As Point2d Dim oTG As TransientGeometry Dim oLeaderPoints As ObjectCollection Call oLeaderPoints.Add(oTG.CreatePoint2d(oInsertPoint.X + 1, oInsertPoint.Y + 1)) Dim oGeometryIntent As GeometryIntent Call oLeaderPoints.Add(oGeometryIntent) Dim sText As String Dim oLeaderNote As LeaderNote Dim oFirstNode As LeaderNode End Sub Dim oDrawDoc As DrawingDocument Dim oSheet As Sheet Dim oLeaderNote As LeaderNote For Each oLeaderNote In oSheet.DrawingNotes.LeaderNotes End Sub ------------------rkauskh Hallo
Die Fehlermeldung beim ESC Drücken sollte jetzt weg sein.
EDIT:
Als Automatismus könnte man eine iLogic-Regel erstellen, die nur ein InventorVb.RunMacro("projectName", "moduleName", "macroName") enthält. Dazu noch einen Ereignisauslöser "Vor dem Speichern" oder "Änderung der Zeichnungsansicht". Code:
Private Sub PointInfoDemo2()
Dim oPointMark As Centermark
Dim oPoint As WorkPoint
Dim dX, dY, dZ As Double
Dim oRes As VbMsgBoxResult
oRes = vbYes
If oPointMark Is Nothing Then Exit Do
If Not TypeOf oPointMark.AttachedEntity Is WorkPoint Then
MsgBox "Es sind nur eingeschlossene Arbeitspunkte zulässsig."
GoTo 1
End If
Set oPoint = oPointMark.AttachedEntity
Set oInsertPoint = oPointMark.Position
Set oTG = ThisApplication.TransientGeometry
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection
Set oGeometryIntent = oDrawDoc.ActiveSheet.CreateGeometryIntent(oPointMark)
sText = "X: " & Round(oPoint.Point.X * 10, 2) & " mm" & vbCrLf & _
"Y: " & Round(oPoint.Point.Y * 10, 2) & " mm" & vbCrLf & _
"Z: " & Round(oPoint.Point.Z * 10, 2) & " mm" & vbCrLf & vbCrLf & _
"Name: " & oPoint.Name
Set oLeaderNote = oDrawDoc.ActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, sText)
Set oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1)
Call oLeaderNote.AttributeSets.Add("PointInfo")
oRes = MsgBox("Weiteren Punkt abfragen?", vbYesNo, "Punktinfos")
1:
LoopCode:
Private Sub UpdatePointInfo()
Set oDrawDoc = ThisApplication.ActiveDocument
Set oSheet = oDrawDoc.ActiveSheet
Dim oAttrSet As AttributeSet
Dim oPoint As WorkPoint
For Each oAttrSet In oLeaderNote.AttributeSets
If oAttrSet.Name = "PointInfo" Then
Set oPoint = oLeaderNote.Leader.AllLeafNodes.Item(1).AttachedEntity.Geometry.AttachedEntity
Dim sText As String
sText = "X: " & Round(oPoint.Point.X * 10, 2) & " mm" & vbCrLf & _
"Y: " & Round(oPoint.Point.Y * 10, 2) & " mm" & vbCrLf & _
"Z: " & Round(oPoint.Point.Z * 10, 2) & " mm" & vbCrLf & vbCrLf & _
"Name: " & oPoint.Name
oLeaderNote.Text = sText
End If
Next
Next
MfG
Ralf