Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Darkforce_the_ilogic_guy
528 Views, 4 Replies

Change view back to aktive view before running ilogic(Add colur to all View)

I am making a complex illogic code... one thing that I want it to do it to add a colour to all view on the file.

 

for now it work on part(Ipt)...

 

It change colour on all the view .. my problem is that I want it that o go want to the view that you where working on before running the code... I have a other code that do this ... but it is for assembly only ..... so I can´t just copy past that part of the code....but it work for assembly ... that I will have to make my code later paint a colour as well

 

 

the code below create some standard view .. and go back to the view I work on ... how to I go back to the active view before I run the code on a part?

 


' get Manager of Representations
 Dim dViewRepMgr As RepresentationsManager
 dViewRepMgr = oAsmCompDef.RepresentationsManager
 
 'Get active Representation View
 Dim dViewRep As DesignViewRepresentation
 dViewRep = dViewRepMgr.ActiveDesignViewRepresentation


'Dim AktivVeiw As String
'AktivVeiw = "Master"
'MessageBox.Show(AktivVeiw, "Info")

 

 

 

Try

'create a list of view reps
For Each oViewRep In oViewReps
 NameList.Add(oViewRep.Name)
Next

'check names
'-----------------------------------Tilføje Asset view ----------------------
'If NameList.Contains("Asset") = False Then
 ''set View Rep active
 'oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Asset")
 'StandardViewCreate = True
    'MessageBox.Show("Veiw Asset was created", "Info")

 'End If
'-----------------------------------Tilføje Asset view ----------------------
If NameList.Contains("Complete") = False Then
 'set View Rep active
 oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Complete")
 StandardViewCreate = True
 'MessageBox.Show("Veiw Complete was created", "Info")
 End If
If NameList.Contains("Simplified") = False Then
 oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("Simplified")
 StandardViewCreate = True
 'MessageBox.Show("Veiw Simplified was created", "Info")
End If


If StandardViewCreate = True Then
 
 'Return to orginal aktiv veiw
  dViewRep.Activate
 'Tilføj denne nedestående kode igen hvis man ønsker en beked om at de sandard views er blevet lavet
 'MessageBox.Show("Standard veiws was created", "Info")
StandardViewCreate = False
End If
Catch
 
 End Try

 
 End If
 
 Catch
 
 End Try
 

Tags (3)