Replace old style

Replace old style

alessandro_m1991
Explorer Explorer
338 Views
2 Replies
Message 1 of 3

Replace old style

alessandro_m1991
Explorer
Explorer

Hi, I am replacing some old drawing using "drawing resource transfer wizard", the problem is that I also have to replace the old styles with the new ones.

Both styles are already present in the idw file.

I am doing it manually as in the attached figure, is there a way to automate the procedure through ilogic?

Use inventor 2021.

Thank you!

0 Likes
339 Views
2 Replies
Replies (2)
Message 2 of 3

alessandro_m1991
Explorer
Explorer

I found this function, could it be used to do what I explained?

 

ThisDrawing.Document.StylesManager.ReplaceStyles

 

Can anyone help me?

Thank you!

0 Likes
Message 3 of 3

If you want to update your styles then use this code

 

Sub Main()
	Dim currentDocPath2
	currentDocPath2 = ""
	Try 
		 currentDocPath2 = ThisDoc.PathAndFileName(False)
		Logger.Info("er gemt i " &  currentDocPath)
Logger.Info("Er gemt før")

		Catch
			Exit Sub
		End Try
		Logger.Info("Se om den lægge i factory mappen", "Title")

		Logger.Info("er gemt i " &  Left(currentDocPath2, 40))
	

 
	Logger.Info("Kør purge og Update Style")

	UpdateStyle3d
	PurgeStyle3d
	
		
	
End Sub

Sub UpdateStyle3d()'Try
Logger.Info("update")

Dim oCM As CommandManager
     oCM = ThisApplication.CommandManager
    Dim oCD As ControlDefinitions
     oCD = oCM.ControlDefinitions
    Dim oUpdateStyles As ControlDefinition
     oUpdateStyles = oCD.Item("PurgeStylesCmd")
    oUpdateStyles.Execute2 (False)
    AppActivate(ThisApplication.Caption)
	
	'SendKeys.Send("y")
	SendKeys.SendWait("y" & "{Enter}")
   ' SendKeys.Send("{Enter}")
    
    ThisApplication.UserInterfaceManager.DoEvents
	 ThisApplication.UserInterfaceManager.DoEvents
	'Catch
		Logger.Info("fejl")

	'End Try
	
End Sub


Sub PurgeStyle3d()'Try
Logger.Info("Purge")

Dim oCM As CommandManager
     oCM = ThisApplication.CommandManager
    Dim oCD As ControlDefinitions
     oCD = oCM.ControlDefinitions
    Dim oUpdateStyles As ControlDefinition
     oUpdateStyles = oCD.Item("UpdateStylesCmd")
    oUpdateStyles.Execute2 (False)
    AppActivate(ThisApplication.Caption)
	
	'SendKeys.Send("y")
	SendKeys.SendWait("y" & "{Enter}")
   ' SendKeys.Send("{Enter}")
    
    ThisApplication.UserInterfaceManager.DoEvents
	 ThisApplication.UserInterfaceManager.DoEvents
	'Catch
		Logger.Info("fejl")

	'End Try
	
End Sub
0 Likes