Suppress drawing views in multiple sheets

Suppress drawing views in multiple sheets

erik
Contributor Contributor
538 Views
4 Replies
Message 1 of 5

Suppress drawing views in multiple sheets

erik
Contributor
Contributor

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

 

0 Likes
Accepted solutions (1)
539 Views
4 Replies
Replies (4)
Message 2 of 5

JhoelForshav
Mentor
Mentor

Hi @erik 

Would this work for you? 🙂

 

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
0 Likes
Message 3 of 5

erik
Contributor
Contributor

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. 😉 

0 Likes
Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @erik 

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

 

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
0 Likes
Message 5 of 5

erik
Contributor
Contributor

@JhoelForshav This works great. Thank you! 🙂