Print ViewSheet vs Nested RevitLinkInstance

Print ViewSheet vs Nested RevitLinkInstance

lwlXUTTT
Advocate Advocate
1,379 Views
8 Replies
Message 1 of 9

Print ViewSheet vs Nested RevitLinkInstance

lwlXUTTT
Advocate
Advocate

Dear Community,

 

Here is the case. Model A.rvt and Model B.rvt are Linked to Model Main.rvt with the option as Attachment.

Model Main contains all ViewSheets from the Project. Model Main.rvt is linked to Model BatchPrint.rvt.

Model BatchPrint is used to run API command that would print content from Model Main and its nested RevitLinkInstances. Only Model BatchPrint is open.

Unfortunately only content of literally Model Main is visible in printed output(both on pdf and dwg), content of Model A and Model B is not present, as if there were unloaded, which is not the case (always loaded as Attachment).

Output should be printed from BatchPrint Model, because the method will be used by non-Revit users which should not play with Main Model....

 

Problem Sheets.JPG

 

 

 

 

 

 

 

 

Method used:
Document.Export(string folder, IList(ElementId) viewIds, PDFExportOptions options)

Main Model Document is used as a variable from which Export method is fired

 

Does anyone know how to deal with/solve this issue?

/Lukasz

1,380 Views
8 Replies
Replies (8)
Message 2 of 9

dtartaglia_PYEBEB5KA84W
Enthusiast
Enthusiast

How are you opening Model BatchPrint? User? Code? If your opening the model via the API I use: Application.OpenDocumentFile() with all worksets open. My prints (to PDF) are correct.

0 Likes
Message 3 of 9

lwlXUTTT
Advocate
Advocate

Hi @dtartaglia_PYEBEB5KA84W ,

 

thank you for the input.

I have tried opening both via GUI and API - in both cases nested Models (A & B) are not printed in pdf.

My implementation looks like this:

string localPath = "mypath.rvt" // local disk path to Model BatchPrint.rvt
OpenOptions openOptions = new OpenOptions();

//Specify which worksets should be opened
IList<WorksetId> worksetIds = WorksharingUtils.GetUserWorksetInfo(localPath).Select(x => x.Id).ToList();
//worksetsIds returns only worksets from Model BatchPrint.rvt

// Setup config to open all worksets by default
WorksetConfiguration openConfig = new WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets);
openConfig.Open(worksetIds);
openOptions.SetOpenWorksetsConfiguration(openConfig);

//open Document in Background
UiApp.Application.OpenDocumentFile(localPath, openOptions);

 Do you any other method which would open worksets also from nested RevitLinkInstances? Do you loop through nested Documents?

I am suprised that it works for you, so I would be grateful for any feedback,

 

Best, Lukasz

0 Likes
Message 4 of 9

dtartaglia_PYEBEB5KA84W
Enthusiast
Enthusiast

Hi,

 

I'll test my routine again to verify (for my sanity). My code is a little different than yours mostly because of BIM 360:

 

// Get the ModelPath
oModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(projectGuid, modelGuid);

 

// Set the OpenOptions to open the RVT Detached from Central
OpenOptions oOpenOpts = new OpenOptions();

 

// Open all worksets
WorksetConfiguration oWSConfig = new WorksetConfiguration(WorksetConfigurationOption.OpenAllWorksets);

 

// Set the OpenOptions object
oOpenOpts.SetOpenWorksetsConfiguration(oWSConfig);

 

// Open the RVT
doc = uiApp.Application.OpenDocumentFile(oModelPath, oOpenOpts);

0 Likes
Message 5 of 9

lwlXUTTT
Advocate
Advocate

Hi @dtartaglia_PYEBEB5KA84W ,

Thank you for your response. Our codes are almost identical, I removed the following line form mine:

openConfig.Open(worksetIds);

Which makes our codes identical apart from the ModelPath:

oModelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(projectGuid, modelGuid);

So the question would be - is this possible that ModelPath location (local drive / cloud-based) makes a difference?

For me this code still doesn't work. So:

-RevitLinkInstances are printed

-Nested RevitLinkInstances(Attachment) in RevitLinkInstances are not printed...

 

Have you tried your approach on local drive as well?

Thank you in advance for the feedback,

Lukasz

0 Likes
Message 6 of 9

TripleM-Dev.net
Advisor
Advisor

Hi @lwlXUTTT ,

 

How do you print sheets which exist in "Model Main" from "Model BatchPrint", without opening "Model Main"?

 

"Document.Export(string folder, IList(ElementId) viewIds, PDFExportOptions options)"

Document = "Model Main" document reference?

 

I don't think this is possible, the loaded (not opened) "Model Main" doesn't know about the nested links, only "Model BatchPrint" knows about these nested links.

 

Why not just open Model Main detached and then print and close model after printing?

Message 7 of 9

dtartaglia_PYEBEB5KA84W
Enthusiast
Enthusiast

Hi @lwlXUTTT ,

 

I do print from the "Model Main" as @TripleM-Dev.net mentioned. Have you tried this?

Message 8 of 9

lwlXUTTT
Advocate
Advocate

HI @dtartaglia_PYEBEB5KA84W ,

hi @TripleM-Dev.net ,

 

Thank you for your contribution. Yes I have tried to print from 'Main Model' and it works for me as well - no issues with that.

However, I have a concept to create a ""wrapper" BatchPrint Model, which:

- would open faster

- in which, all model elements will be stored in RevitLinkInstances, so non-Revit users cannot destroy it

- would be opened by non-Revit users just for the sake of printing (mostly Project Leader), so the user traffic on workshared Main Model is not overloaded.

 

That was the concept behind BatchPrint Model. Suprisingly for me, having loaded Main Model (which contains all the sheets) into BatchPrint Model, I still have access to all the sheets, with just BatchPrint Model opened...

However apparently, there is a drawback that nested RevitLinkInstances in MainModel (e.g. Surroundings Model) would not printed on pdfs, if print is fired from "wrapper" BatchPrint Model. - maybe could someone from Autodesk confirm this limitation?

 

thank you for any sort of support,

Lukasz

Message 9 of 9

dtartaglia_PYEBEB5KA84W
Enthusiast
Enthusiast

I haven't had a chance to test, I'll try today or tomorrow. Have you tried opening the batch print model using the: UIApplication.OpenAndActivateDocument() Method?