I am trying to automate a drawing document to turn off sheets according to which configuration the assembly/ parts are. The problem is when I exclude a sheet from the count it will change the order of sheets after that one.
If anyone knows of a solution to this or if there is a better way of doing what im trying to acheive please let me know. Am I better off supressing/ enabling views instead of exlcuding from count/ printing?
And then to disable the exclude the count/ printing on a sheet that is already excluded from the count, how am i supposed to do this? because the code needs the sheet number in its code to know which one to modify this option.
A simple example of program that returns with errors below. and attached .idw file.
ThisDoc.Document.Sheets.Item("Sheet:1").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:1").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:3").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:3").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:4").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:4").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:5").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:5").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:6").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:6").ExcludeFromCount = True
I am trying to automate a drawing document to turn off sheets according to which configuration the assembly/ parts are. The problem is when I exclude a sheet from the count it will change the order of sheets after that one.
If anyone knows of a solution to this or if there is a better way of doing what im trying to acheive please let me know. Am I better off supressing/ enabling views instead of exlcuding from count/ printing?
And then to disable the exclude the count/ printing on a sheet that is already excluded from the count, how am i supposed to do this? because the code needs the sheet number in its code to know which one to modify this option.
A simple example of program that returns with errors below. and attached .idw file.
ThisDoc.Document.Sheets.Item("Sheet:1").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:1").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:2").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:3").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:3").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:4").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:4").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:5").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:5").ExcludeFromCount = True ThisDoc.Document.Sheets.Item("Sheet:6").ExcludeFromPrinting = True ThisDoc.Document.Sheets.Item("Sheet:6").ExcludeFromCount = True
Hi @JACKW5PE3
It sounds like you would be better having
a different drawing for the assembly configuration you have and keep the parts out of this drawing also. Maybe your workflow is fixed already and you can’t modify?
A few more details of what your workflow is and the variables would help to offer more advice.
Hi @JACKW5PE3
It sounds like you would be better having
a different drawing for the assembly configuration you have and keep the parts out of this drawing also. Maybe your workflow is fixed already and you can’t modify?
A few more details of what your workflow is and the variables would help to offer more advice.
Drawing Setup as follows:
xxxxx-001 (assembly)
xxxxx-002 (parts list)
I have all the parts on seperate sheets in xxxxx-002. I have the assembly file configurable with ilogic which suppresses/ unsupresses parts and part quantity changes.
Drawing Setup as follows:
xxxxx-001 (assembly)
xxxxx-002 (parts list)
I have all the parts on seperate sheets in xxxxx-002. I have the assembly file configurable with ilogic which suppresses/ unsupresses parts and part quantity changes.
What's your criteria for excluding the sheet from printing or count?
Maybe you can use those criteria to toggle the exclude from printing/count instead.
Something like below to get you started. that doesn't rely on the Sheet's name
edit: i can't really open the attached IDW (in 2024) so can't really see what's inside
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
For Each oSheet As Sheet In oDrawDoc.Sheets
Dim oViewDoc As Document
If oSheet.DrawingViews.Count = 0 Then
'What to do if No drawing view in Sheet
Else
'there's at least one drawing view on sheet
oViewDoc = oSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
If YourExclusionCriteriaIsMetBasedFromoViewDoc Then
oSheet.ExcludeFromCount = True
oSheet.ExcludeFromPrinting = True
Else
oSheet.ExcludeFromCount = False
oSheet.ExcludeFromPrinting = False
End If
End If
Next
What's your criteria for excluding the sheet from printing or count?
Maybe you can use those criteria to toggle the exclude from printing/count instead.
Something like below to get you started. that doesn't rely on the Sheet's name
edit: i can't really open the attached IDW (in 2024) so can't really see what's inside
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
For Each oSheet As Sheet In oDrawDoc.Sheets
Dim oViewDoc As Document
If oSheet.DrawingViews.Count = 0 Then
'What to do if No drawing view in Sheet
Else
'there's at least one drawing view on sheet
oViewDoc = oSheet.DrawingViews(1).ReferencedDocumentDescriptor.ReferencedDocument
If YourExclusionCriteriaIsMetBasedFromoViewDoc Then
oSheet.ExcludeFromCount = True
oSheet.ExcludeFromPrinting = True
Else
oSheet.ExcludeFromCount = False
oSheet.ExcludeFromPrinting = False
End If
End If
Next
Hi @JACKW5PE3. I would also suggest that you should rename all of your sheets to unique, meaningful names, instead of the default "Sheet", if you need to be able to get specific sheets by code. This action will 'stabilize' that process, so that even after you have excluded a sheet from the count, you can still access that specific sheet using the first part of its name (before ":" and the index number). Even uniquely named sheets will still have the ":" and index number at the end of their names though, because that is managed automatically by Inventor. And the index number will always be according to the order those sheets are in the model browser tree.
Wesley Crihfield
(Not an Autodesk Employee)
Hi @JACKW5PE3. I would also suggest that you should rename all of your sheets to unique, meaningful names, instead of the default "Sheet", if you need to be able to get specific sheets by code. This action will 'stabilize' that process, so that even after you have excluded a sheet from the count, you can still access that specific sheet using the first part of its name (before ":" and the index number). Even uniquely named sheets will still have the ":" and index number at the end of their names though, because that is managed automatically by Inventor. And the index number will always be according to the order those sheets are in the model browser tree.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.