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

Printmanager CopyNumber Bug?

12 REPLIES 12
Reply
Message 1 of 13
PaulCollins7972
324 Views, 12 Replies

Printmanager CopyNumber Bug?

I have written an addin for Revit that exports and / or prints selected sheets. All works OK except that when I submit the print the value set for CopyNumber seems to be ignored. I am setting the number of copies by reading the value from a form and then using Apply:

 

                        MyPrintMgr.CopyNumber = FormPrint.updnCopies.Value

                        MyPrintMgr.Apply()

 

Then I have a loop which submits each selected view in turn so that they come out in the correct order:

 

                            vw = doc.GetElement(Autodesk.Revit.DB.Reference.ParseFromStableRepresentation(doc, DrgList(n)))

                            If vw.CanBePrinted Then MyPrintMgr.SubmitPrint(vw)

 

I only seem to get one copy whatever the number set by .CopyNumber.

 

After this the R>Print dialog shows the number set by my addin so I am confident that I am setting the value correctly. Other aspects such as papersize, orientation etc are all being applied correctly.

 

Is this a known issue or have I missed something?

 

Thanks.

12 REPLIES 12
Message 2 of 13

Dear Paul,

 

I am not aware of any such issue. Could you please provide a minimal reproducible sample case for me to pass on to the development team for further exploration?

 

  • A complete yet minimal Revit sample model to run a test in.
  • A complete yet minimal Visual Studio solution with add-in manifest so that we can compile, load and run the application with a single click and explore its behaviour live in the sample model you provide.
  • Detailed step-by-step instructions for reproducing the issue.
  • Specification of the exact behaviour you observe versus what you expect.

Thank you!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 13

Dear Jeremy

 

Thank you for your quick response.

 

I am using VS 2010 VB.Net. and have tested the code against Revit 2012, 2013 and 2014.

 

What is the best way to send you the sample data?

 

(For commercial confidentiality I don't want to post the code on a public forum)

 

Regards

 

Paul Collins

Message 4 of 13

Hi Paul,

 

Thank you for the clarification and offer.

 

Unfortunately, for commercial reasons, we cannot accept any confidential code for testing purposes.

 

The standard ADN request for sample code includes this passage:

 

When sending us sample material, please do not include any information that you consider to be confidential or a trade secret to your company. Thank you!

I omitted it in this case, since we are in public here anyway.

 

As far as I understand the issue you describe, it should be pretty easy to put together a sample demonstrating the problem.

 

You are aware of my Visual Studio Revit add-in wizard, I hope?

 

http://thebuildingcoder.typepad.com/blog/2013/06/sun-direction-shadow-calculation-and-wizard-update....

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 13

Dear Jeremy

 

Cut down VS2010 VB.Net project, addin manifest and sample data attached.

  

In the sample data zip file are screen shots of the addin, the addin manifest and a sample RVT file which has been saved in R2014.

 

When the addin is run it displays a listview containing a list of all the Sheets in the project.

 

Check the sheets required and then click the "Print" icon.

 

Change the number of copies and click OK. I only ever get one copy but if you then print with Revit the print dialog will show the number of copies chosen in the addin.

 

The full code includes export to PDF, DWG and DWF allowing the user to choose the output folder and filename format derived from the sheet details.

 

Regards

 

Paul Collins

Message 6 of 13

Dear Paul,

 

Thank you for your sample code.

 

unfortunately, this is absolutely not what I consider a minimal reproducible sample.

 

I spent an hour or so migrating this to Revit 2014 and debugging it.

 

I am now giving up.

 

I do see the main Export Sheets dialogue and the Print button shows the Print form.

 

However, whatever I enter there, I get an exception saying

 

---------------------------
Export
---------------------------
PrintSelection

This property is not available.
---------------------------
OK   
---------------------------

After spedning much too much time fiddling in the debugger now, jumping over this abnd that property setting, I am giving up now.

 

I am sorry, but you cannot prove a problem in one specific method with so much else going on around it.

 

A minimal reproducible sample is much smaller and simpler than this.

 

Thank you for your understanding.

 

Even if I was able to get this to work, the development team would not have the time and resources to go through the same process again.

 

If you can provide a real minimal reproducible case, I will be happy to take another look.

 

But definitely not today  🙂

 

I have attached my Revit 2014 migration of your add-in in its present form in ExportCopyJt.zip, if you would like to take that as a starting point for continued simplification.

 

Thank you for your understanding.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 13

Ok

 

I will do you a really cutdown version compiles against 2014.

 

Understood!

Message 8 of 13

This really cut down sample has been compiled against R2014 using VS2010.

 

If you open the sample project (which only has one view in it) and run the addin it is supposed to print 2 copies of the current view to the default printer.

 

I only ever get one copy from the API but if I then choose R>Print from Revit the copynumber has been set to 2 and I get 2 copies out of the printer.

 

I must be doing something wrong

 

(If I run the ViewPrinter sample the same thing happens)

Message 9 of 13

Dear Paul,

Thank you for your query and sample code.

I compiled, installed and executed it in Revit 2014 with no problems at all.

Unfortunately, it behaves in the same manner as the earlier complex sample and displays the error message "This property is not available.":

<<<property_not_available.png>>>

I debugged to see what statement is throwing this exception, and it happens to be the very call to set the copy number:

  MyPrintMgr.CopyNumber = 2

I have no idea why this call fails on my system.

I discovered that you had the /viewer command line argument specified in the startup call to revit.exe set in the Visual Studio debugger, but removing that made no difference to this behaviour.

The updated source code and solution is appended here in PrintSampleJt.zip.

Do you have any idea what might be causing this?

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 10 of 13

Dear Jeremy

 

That is very odd.

 

The .copynumber property is coming up on the autocomplete, I am not just typing it in.

 

I don't get that error here.

 

We have about 50 seats of Revit and everyone has access to the addin and nobdy has mentioned that error.

 

The behaviour that I get is that when the addin is run in a new Revit session only 1 copy comes out (no error). If you then use the Revit print dialog then the copynumber has been set to 2 which is what I would expect, and 2 copies come out if you choose to print.

 

We are in the UK, wouldn't be a different version of Revit to the one you have?

 

I assume that all the commands are in the api dll that the code is referenced to?

 

Regards

 

Paul Collins

Message 11 of 13

Dear Paul,

Yes, odd indeed. I see the property in the API as well, and on autocomplete.

It still throws that exception.

It is not due to Revit or the API.

Since I have no printer and never print anything, my print manager may be strangely set up, or not at all.

Best regards,



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 12 of 13

Dear Jeremy

 

That'll be why then!

 

I set my printer to "Microsoft XPS Document Writer" and then I get your "property not available" error.

 

To test this code there will need to be a physical printer available, print devices such as the above don't like multiple copies. If you print from Revit to this kind of device the number of copies control is unavailable.

 

Regards,

 

Paul Collins

Message 13 of 13

Dear Paul,

Good that it is clear now.

I logged the change request REVIT-21452 [PrintManager.CopyNumber fails -- 08845206] with our development team for this issue on your behalf as it requires exploration and possibly a modification to our software. Please make a note of this number for future reference.

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community