Update Styles with VB6

Update Styles with VB6

Anonymous
Not applicable
537 Views
3 Replies
Message 1 of 4

Update Styles with VB6

Anonymous
Not applicable
Hello,

We use INV 11 Series + SP1 and Vault 5
I want to make a program which loops through all of our idw's and update the drawing styles with the global one
This the code I use but it doesn't seem to work.
Whats wrong?

Regards,

Geert van den Brand

Code:
Dim oDrawDoc As Inventor.DrawingDocument
Set oDrawDoc = oINVDoc
Dim oStylesmanager As Inventor.DrawingStylesManager
Set oStylesmanager = oDrawDoc.StylesManager
Dim oActiveStyle As Inventor.DrawingStandardStyle
Set oActiveStyle = oStylesmanager.ActiveStandardStyle
oActiveStyle.UpdateFromGlobal
Dim oObjectDefault As Inventor.ObjectDefaultsStyle
Set oObjectDefault = oActiveStyle.ActiveObjectDefaults
oObjectDefault.UpdateFromGlobal
0 Likes
538 Views
3 Replies
Replies (3)
Message 2 of 4

Rene-J
Collaborator
Collaborator
Hi
Try This One
In Inventor 10 is there som styles not supported
I have not checked this in INV 11

Regards
René J

Private Sub UpdateFromGlobalStyle()
Dim i As Integer
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument

For i = 1 To oDrawDoc.StylesManager.StandardStyles.Count
Debug.Print oDrawDoc.StylesManager.StandardStyles.Item(i).Name
If oDrawDoc.StylesManager.StandardStyles.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.StandardStyles.Item(i).UpdateFromGlobal
x = 1
End If
Next


For i = 1 To oDrawDoc.StylesManager.ObjectDefaultsStyles.Count
Debug.Print oDrawDoc.StylesManager.ObjectDefaultsStyles.Item(i).Name
If oDrawDoc.StylesManager.ObjectDefaultsStyles.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.ObjectDefaultsStyles.Item(i).UpdateFromGlobal
x = 1
End If
Next

For i = 1 To oDrawDoc.StylesManager.DimensionStyles.Count
Debug.Print oDrawDoc.StylesManager.DimensionStyles.Item(i).Name
If oDrawDoc.StylesManager.DimensionStyles.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.DimensionStyles.Item(i).UpdateFromGlobal
x = 1
End If
Next

For i = 1 To oDrawDoc.StylesManager.TextStyles.Count
Debug.Print oDrawDoc.StylesManager.TextStyles.Item(i).Name
If oDrawDoc.StylesManager.TextStyles.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.TextStyles.Item(i).UpdateFromGlobal
x = 1
End If
Next
For i = 1 To oDrawDoc.StylesManager.Layers.Count
Debug.Print oDrawDoc.StylesManager.Layers.Item(i).Name
If oDrawDoc.StylesManager.Layers.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.Layers.Item(i).UpdateFromGlobal
x = 1
End If
Next
For i = 1 To oDrawDoc.StylesManager.Parent.Layers.Count
Debug.Print oDrawDoc.StylesManager.Layers.Item(i).Name
If oDrawDoc.StylesManager.Layers.Item(i).UpToDate = False Then
oDrawDoc.StylesManager.Layers.Item(i).UpdateFromGlobal
x = 1
End If

End Sub
0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks Rene,

I must just loop through all the different styles to update them all. Thats why my code didn't work.
I'll test it this afternoon, now I'm busy with other programming.

Regards,

Geert
0 Likes
Message 4 of 4

Anonymous
Not applicable
Now it's can be really easier and like this you don't have all new styles.


{code}
Dim i As Integer
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument

For i = 1 To oDrawDoc.StylesManager.Styles.Count
If oDrawDoc.StylesManager.Styles.Item(i).UpToDate = False Then
Call oDrawDoc.StylesManager.Styles.Item(i).UpdateFromGlobal
End If
Next
{code}

Edited by: grinwald on Mar 16, 2009 1:19 PM
0 Likes