Is it me or c sharp? I'm leaning towards me... AddUsingSheetFormat -->2026

Is it me or c sharp? I'm leaning towards me... AddUsingSheetFormat -->2026

Tiffany_Hayden_
Collaborator Collaborator
156 Views
3 Replies
Message 1 of 4

Is it me or c sharp? I'm leaning towards me... AddUsingSheetFormat -->2026

Tiffany_Hayden_
Collaborator
Collaborator

I'm having an issue not "having" to give the model doc in AddUsingSheeetFormat in 2026. 

If I don't give it the modeldoc it will give me an error parameter incorrect. 

 

               object missing = Type.Missing;

               string activeDocPath = ActiveDrawing.ReferencedDocuments[1].FullFileName;

               Document modelDoc = (Document)invApp.Documents.Open(activeDocPath, false) ;
               Sheet newSheet = drawingSheets.AddUsingSheetFormat(sheetFormat, modelDoc, "", null, null, null);

But if I use the model doc it adds a view to the sheet and a Parts list automatically. Is this new functionality? Or am I just using the API wrong. 

 

I'd like to do this. 

                Sheet newSheet = drawingSheets.AddUsingSheetFormat(sheetFormat, null, "", null, null, null);

 

Before you ask. 🙂 I have validated that my sheetformat exists and is pointing to the correct one. There are no prompts when adding a sheet manually. 

 

Thanks for any help! 

 

Tiffany

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Accepted solutions (1)
157 Views
3 Replies
Replies (3)
Message 2 of 4

hollypapp65
Collaborator
Collaborator

2026-09-01_16-02-15.jpg

Try:

Sheet newSheet = drawingSheets.AddUsingSheetFormat(sheetFormat)
0 Likes
Message 3 of 4

Tiffany_Hayden_
Collaborator
Collaborator
Accepted solution

I've tried that too. I read that but I'm not sure how you go about not using the model doc as the second input. Is there a workaround?

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 4 of 4

Tiffany_Hayden_
Collaborator
Collaborator

It looks as though this pops up when you create a sheet from the sheet format; the model doc is required. The API documentation doesn't make this clear. But that's how it goes sometimes. 

Tiffany_Hayden__0-1788297832483.png

 

The fix is to create a sheet format off of a blank sheet created from the original format, doing that will no longer require the model document as input. 

 

Steps: 

Create new sheet from drawing right click create sheet. 

Right click on new sheet

Create Sheet format

Rename new Sheet format

Save

In code use new sheet format. 

 

 

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes