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

Suppress drawing views in multiple sheets

Hello

 

I have a multiple sheet drawing and i want to replace views by suppress and unsuppress them according to different model configurations e.g "1" or "2". 

I used the rule below and this worked well on a single sheet drawing, but when I got more sheets this only works on the active sheet.

How to solve this on a multiple sheet drawing? I have searched the forum without any luck. 

If Parameter("30627.iam.Deling") = "2" Then 
	
	ActiveSheet.View("VIEW1").View.Suppressed = True
	ActiveSheet.View("VIEW2").View.Suppressed = True
	ActiveSheet.View("VIEW3").View.Suppressed = False
	ActiveSheet.View("VIEW4").View.Suppressed = False
Else 
	ActiveSheet.View("VIEW1").View.Suppressed = False
	ActiveSheet.View("VIEW2").View.Suppressed = False
	ActiveSheet.View("VIEW3").View.Suppressed = True
	ActiveSheet.View("VIEW4").View.Suppressed = True
	
End If

 

JhoelForshav
in reply to: erik

Hi @erik 

Would this work for you? :slightly_smiling_face:

 

Dim oDoc As DrawingDocument = ThisDoc.Document
For Each oSheet As Sheet In oDoc.Sheets
oSheet.Activate
If Parameter("30627.iam.Deling") = "2" Then 
	
	ActiveSheet.View("VIEW1").View.Suppressed = True
	ActiveSheet.View("VIEW2").View.Suppressed = True
	ActiveSheet.View("VIEW3").View.Suppressed = False
	ActiveSheet.View("VIEW4").View.Suppressed = False
Else 
	ActiveSheet.View("VIEW1").View.Suppressed = False
	ActiveSheet.View("VIEW2").View.Suppressed = False
	ActiveSheet.View("VIEW3").View.Suppressed = True
	ActiveSheet.View("VIEW4").View.Suppressed = True
	
End If
Next
erik
in reply to: JhoelForshav

Hi @JhoelForshav Thanks for your answer.

Unfortunately it does not work. As long as "View1" is not on the active sheet, it returns error message "No drawing named "View1" was found. 

 

I am quite a novice in iLogic and are not so familiar with text coding. I use most boolean functions. :winking_face: 

JhoelForshav
in reply to: erik

Hi @erik 

By adding On Error Resume Next I think it should work then :slightly_smiling_face:

 

Dim oDoc As DrawingDocument = ThisDoc.Document
For Each oSheet As Sheet In oDoc.Sheets
On Error Resume Next
oSheet.Activate
If Parameter("30627.iam.Deling") = "2" Then 
	
	ActiveSheet.View("VIEW1").View.Suppressed = True
	ActiveSheet.View("VIEW2").View.Suppressed = True
	ActiveSheet.View("VIEW3").View.Suppressed = False
	ActiveSheet.View("VIEW4").View.Suppressed = False
Else 
	ActiveSheet.View("VIEW1").View.Suppressed = False
	ActiveSheet.View("VIEW2").View.Suppressed = False
	ActiveSheet.View("VIEW3").View.Suppressed = True
	ActiveSheet.View("VIEW4").View.Suppressed = True
	
End If
Next
erik
in reply to: JhoelForshav

@JhoelForshav This works great. Thank you! :slightly_smiling_face: