Updating text-attributes takes long on server, not on local computer

Updating text-attributes takes long on server, not on local computer

svcbe_putcal
Observer Observer
436 Views
3 Replies
Message 1 of 4

Updating text-attributes takes long on server, not on local computer

svcbe_putcal
Observer
Observer

I made a macro that updates text-attributes on an Inventor-drawing.

Everything works perfectly, but when I run my code on server, this takes way longer (this was a lot faster before).

Any ideas what can be the cause?


I attached 3 video's:

  • Keramo_Tekstvelden_lokaal-alle velden.mp4: all text-attributes (#129) are filled in, this takes more or less 3s on a local computer. On a server, this takes almost 2 minutes.
  • Keramo_Tekstvelden_server.mp4: only 20 textvalues are filled in, this takes more or less 13s on server
  • Keramo_Tekstvelden_lokaal.mp4: only 20 textvalues are filled in, this takes less than 1s on local computer

 

Sub AlleTekstveldenInvullen()
    Call SetAttribute("ATT100", "ATT100")
    Call SetAttribute("ATT101", "ATT101")
'and 129 more...
End Sub
Public Sub SetAttribute(AttributeNaam, Waarde)
    Dim Drawing As DrawingDocument
    Set Drawing = ThisApplication.ActiveDocument
    
    Dim tb As TitleBlock
    Set tb = Drawing.ActiveSheet.TitleBlock
       
    'Dim textB As TextBox
    'For Each textB In tb.Definition.Sketch.TextBoxes
    '     MsgBox textB.FormattedText & "-" & tb.GetResultText(textB)
    'Next
    
    Dim oPropSets As propertySets
    Set oPropSets = ThisApplication.ActiveDocument.propertySets
    Dim oBlock As PropertySet
    Set oBlock = oPropSets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
    
    Dim oBlockProp As Property
    For Each oBlockProp In oBlock
        Select Case oBlockProp.Name
            Case AttributeNaam
                oBlockProp.Value = Waarde
        End Select
    Next
    
   ' Drawing.Update
End Sub

 

 

0 Likes
437 Views
3 Replies
Replies (3)
Message 2 of 4

C_Haines_ENG
Collaborator
Collaborator

Have you ensured that your connection to the server is still strong? Seems more like a server side issue than an Inventor one. 

0 Likes
Message 3 of 4

svcbe_putcal
Observer
Observer

Thanks for your reply.
I don't think it has something to do with connection. All other VBA-code is running fast (e.g. opening file, updating paramters of 3D-model, saving 3D-model,...).
Only this part, updating text-fields is extremely slow.

0 Likes
Message 4 of 4

marcin_otręba
Advisor
Advisor

How many iproperies do you have inside this document ?

i would try to try this one:

ps. i commented drawing because it is only set but not used.

Public Sub SetAttribute1(AttributeNaam, Waarde)
On Error Resume Next
    'Dim Drawing As DrawingDocument
    'Set Drawing = ThisApplication.ActiveDocument
    
    'Dim tb As TitleBlock
    'Set tb = Drawing.ActiveSheet.TitleBlock
       
    'Dim textB As TextBox
    'For Each textB In tb.Definition.Sketch.TextBoxes
    '     MsgBox textB.FormattedText & "-" & tb.GetResultText(textB)
    'Next
    
    Dim oPropSets As PropertySets
    Set oPropSets = ThisApplication.ActiveDocument.PropertySets
    Dim oBlock As PropertySet
    Set oBlock = oPropSets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")
    Dim name As String
    Dim oBlockProp As Property
    neme = ""
    oBlockProp = oBlock(AttributeNaam)
    name = oBlockProp.name
    If name = AttributeNaam Then
        oBlockProp.Value = Waarde
    End If
   ' Drawing.Update
End Sub

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes