Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suppress drawing view and drawing sheet with ilogic rule

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
5388 Views, 12 Replies

Suppress drawing view and drawing sheet with ilogic rule

Hi everyone,

I am stuck trying to find a way to suppress drawing views and drawing sheets. I have a model that consists of several parts and with ilogic in the model, I can suppress the components if i don't need them and that's all good. My drawing consists of several sheets with several views, the suppressed parts are remaining active even though the parts are suppressed in the model.

Q1- Why are the views not turned off or suppressed with the model part suppression?
Q2- When I try to use ilogic to suppress a view or the sheets I get the errors below.

Drawing view suppression rule:

If Parameter("105088 Shelves & Dividers Assembly.iam.s2sp2") = 0 Then
ActiveSheet.View("VIEW12") = False
End If

Rule Compile Errors in viewoff, in 105088 Shelves & Dividers Assembly.idw
Error on Line 2 : Property 'View' is 'ReadOnly'.

****************************************************************************************
Sheet suppression rule:

If Parameter("105088 Shelves & Dividers Assembly.iam.s2sp2") = 0 Then
ActiveSheet = ThisDrawing.Sheet("Sheet DP Shelf 1&2 :2") = False

End If

Rule Compile Errors in viewoff, in 105088 Shelves & Dividers Assembly.idw
Error on Line 2 : Operator '=' is not defined for types 'Autodesk.iLogic.Interfaces.ICadDrawingSheet' and 'Boolean'.

************************************
Drawing parameter rule:

If Suppress_Sheets = True Then
ActiveSheet.View("VIEW1") = False
End If

Rule Compile Errors in Rule2, in 105088 Shelves & Dividers Assembly.idw
Error on Line 2 : Property 'View' is 'ReadOnly'.

Thanks,
Eric
12 REPLIES 12
Message 2 of 13
MjDeck
in reply to: Anonymous

Eric,

To turn off a view, use a statement like this:

ActiveSheet.View("VIEW12").View.Suppressed = True

This is in the Snippets under Advanced Drawing API -> Suppress A View

You can't suppress or hide a sheet.

> the suppressed parts are remaining active even though the parts are suppressed in the model.

It sounds like your drawing is referencing the Master Level of Detail. It should be using your custom Level of Detail. That is where the parts are suppressed in the assembly.

To change this, you can right-click on the view and choose Edit View to change the Level of Detail that it uses.

Mike Deck
Autodesk

Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 13
Anonymous
in reply to: Anonymous

Mike,

Thank you for the reply. I will try the code tomorrow to try to suppress the drawing view. On the other question please see the attached word document showing screen shots of my model and drawing.

You are correct about the custom view, however the level detail is only available on the assembly view as you can see in the attached screen shot. I don't know if I am missing something, but I tried placing several different views and still do not see that option on the different individual views. If we can't suppress a sheet can we exclude it from print & count with ilogic?

Thanks,
Eric
Message 4 of 13
swordmaster
in reply to: Anonymous

Mike,
I see that this snippet is not available in INV 2009.....can i use the code anyway or will it complain?
Inventor 2010 Certified Professional
Message 5 of 13
MjDeck
in reply to: Anonymous

Eric,

No, you're not missing anything. The level of detail is only available in an assembly view. If you make a drawing of a part (.ipt file) directly then it's independent of the assembly. But you can use a View.Suppressed = True statement in a rule to hide it.

You should be able to create a custom iProperty in the model to store a virtual sheet count. Then text in the title block or elsewhere could link to that property instead of the actual sheet count. But I tried it, and unfortunately it doesn't work too well when you're working in a level of detail.

I can't find a way to set the number of sheets that the Print command sees.

It would be useful to be able to configure the number of sheets using rules. You could possibly do radical surgery using the API to delete sheets and re-create them. But then you couldn't edit them by hand at all, because edits would be lost. It wouldn't be very fast if you have a lot of views, or complex models.

Mike

Mike Deck
Software Developer
Autodesk, Inc.

Message 6 of 13
MjDeck
in reply to: Anonymous

Sorry, these drawing functions are new in Inventor 2011. In 2009, you can use the Inventor API directly. I can post code to suppress a view if you want.

Mike

Mike Deck
Software Developer
Autodesk, Inc.

Message 7 of 13
Anonymous
in reply to: Anonymous

Mike,

You are correct the individual parts have no idea that they are suppressed in the assembly model. I was thinking about suppressing the drawing views, but if I suppress the views then when printing the drawing package I will print several wasted blank sheets.

Q- Can I link excel or other user parameters to the drawing (idw) in the parameters like I can to a part or assembly?

Thanks,
Eric
Message 8 of 13
MjDeck
in reply to: Anonymous

It turns out that you can exclude a sheet from printing with an iLogic rule. Thanks for providing the impetus to find this out.

Here's a statement that will do it:

ThisDrawing.Sheet("Sheet:2").Sheet.ExcludeFromPrinting = True

There is also a way to exclude a sheet from the count. Unfortunately it changes the name of the sheet. This makes it hard to use in a rule, because iLogic relies on the names to find the sheets. There might be a workaround, but it would make for more complex rules. If you want to try to use it in a particular drawing, please let me know:
- the names of all the sheets
- which ones do you want to conditionally exclude?

In a drawing, you can't link parameters from other documents or Excel files. We might add this capability in the future.

Mike Deck
Autodesk

Mike Deck
Software Developer
Autodesk, Inc.

Message 9 of 13
swordmaster
in reply to: Anonymous

Mike,
If you could post the API code for supressing a view thaat would be useful, thanks
Inventor 2010 Certified Professional
Message 10 of 13
MjDeck
in reply to: Anonymous

Here's a sample rule for Inventor 2009 or 2010. It uses a function to find the view by name. All your rule logic should go in Sub Main()

{code}
Sub Main()
FindView("VIEW2").Suppressed = True
End Sub

Function FindView(viewName As String) as DrawingView
Dim doc As DrawingDocument = ThisDoc.Document
For Each view as DrawingView in doc.ActiveSheet.DrawingViews
If (view.Name = viewName) Then
Return view
End If
Next
Throw New ArgumentException(" No view named " & viewName & " was found")
End Function
{code}

Mike Deck
Software Developer
Autodesk, Inc.

Message 11 of 13
Baishihu
in reply to: MjDeck

My company has a lot of drawings including sheet1 (we may name it customer) for clients to approve, sheet 2, sheet 3.....for production. When we activate sheet1, we would like the rest sheets to exclud from count and print. If we activate the rest sheets, we would like to exclude sheet1.

 

I have searched on the Internet to try to get some help, but there is not much for me. Could you please give me a hand?

 

Regards

Message 12 of 13
Baishihu
in reply to: Baishihu

Finally I figured it out after a long hour study. Please see below the iLogic

 

Thanks

 

 

'Exclude from printing and count sheet(s)
oDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet

If (ActiveSheet.Name = "abcd") Or (ActiveSheet.Name = "abcd:1") Then

    For Each oSheet In oDoc.Sheets
    If i = 0 Then
    oSheet.ExcludeFromCount = 0
    oSheet.ExcludeFromPrinting = 0
    i = i + 1
    Else
    oSheet.ExcludeFromCount = 1
    oSheet.ExcludeFromPrinting = 1
    End If
    Next

Else 
    For Each oSheet In oDoc.Sheets
    If i = 0 Then
    oSheet.ExcludeFromCount = 1
    oSheet.ExcludeFromPrinting = 1
    i = i + 1
    Else
    oSheet.ExcludeFromCount = 0
    oSheet.ExcludeFromPrinting = 0
    End If
    Next

End If
Message 13 of 13
Baishihu
in reply to: Baishihu

I have changed above code to use CASE.

 

Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report