I am using iLogic to create a new drawing sheet:
dim oDoc as DrawingDocument = ThisApplication.ActiveDocument
dim oFormat as SheetFormat
try
oFormat = oDoc.SheetFormats.Item("CNC Format")
catch
MessageBox.Show("Error: CNC Format might not exist.", "iLogic")
end try
Dim newSheet As Sheet = oDoc.Sheets.AddUsingSheetFormat(oFormat) newSheet.Activate()
This worked in Inventor 2022, however recently upgraded to 2024.
The rule does not error, instead it produced an empty workspace??
If I Save and Close and reopen the document then the sheet is there like so:
I have tried Zoom All (Home)
I know the scale is wrong, could this be causing the issue?
Any help would be appreciated, thanks 🙂
Solved! Go to Solution.
Solved by zoe.baker-bushby. Go to Solution.
Hi @zoe.baker-bushby. Did it create the new sheet within the active drawing? Does the SheetFormat you are specifying contain any drawing views for a model? If the view is getting created way bigger than the sheet, due to scaling issues, then you can try adding this line of code at the end of what you have there.
ThisApplication.ActiveView.Fit
That should cause all geometry of the active view on your screen at the time to be fitted within the active view frame. Also, due to the way you are using the Try...Catch statement, the code will continue past that point, even if no SheetFormat was found, instead of exiting the rule, so I would probably recommend adding another line of code in there that checks if it was found, like the following:
If oFormat Is Nothing Then Return
The following is just a link to the online help documentation for that API Function.
Wesley Crihfield
(Not an Autodesk Employee)
Rule is being run within active drawing, with the sheet being added to active drawing.
Sheet format specified does not specify any drawing views. My rule is adding the drawing view.
Tried both your suggestions, still the same outcome:
Fixed it this morning.
It does seem to have been a scale issue.
My rule is creating a detail view of a view on sheet 1, creating a new page and placing the detail view on this new page.
I was not correctly specifying the scale for this detail view, so Scale was actually left blank.
Don't understand why this would stop it from displaying a page but it did.
Something like it can't render something when it doesn't know the size of it...?
The rule now correctly specifies the scale when creating the detail view, and now the page shows up.
Thanks 🙂
Can't find what you're looking for? Ask the community or share your knowledge.