I am making a small auto drawing ilogic rule to make custom parts read from a excel file and export to PDF.
Problem is that inventor does not fully calculate the views after changing dimensions of the part and updating the view, instead going straight ahead and exporting the PDF. Before the PDF export code I have:
InventorVb.DocumentUpdate()
It appears that the PDF is exported only with the rasterized view:
However if I put in a MsgBox before the PDF export it works fine, as it seems to have time to update the views even if I smash the OK button as fast as possible:
There are quite a few drawings to do so I'd like to avoid pressing that OK button.
I have already tried this instead:
System.Threading.Thread.CurrentThread.Sleep(2000)
Which is much slower but does not help the views to update, as it seems to pause the view update process too.
Is there some other code to allow the view to complete the update before exporting?
Thanks!
Solved! Go to Solution.
Solved by AlexanderVokes. Go to Solution.
Hoping that below options would help to line visibility in PDF.
oOptions.Value("All_Color_AS_Black") = 1 oOptions.Value("Remove_Line_Weights") = 0
For further investigation, can you please share sample drawing to test?
Please make sure that files are non confidential.
Thanks and regards,
Thanks for your reply!
I have already set those options the way I like, with remove line weights=0.
As my second picture shows, the pdf export works fine if the model and views are properly updated before export. The only problem is when the view update is not completed before export.
I found a solution here: https://forums.autodesk.com/t5/inventor-forum/drawing-view-events-ilogic/td-p/7216317
Thanks to @martin.jacko and @lmc.engineering!
Basically the code checks if the views are updated, and waits if they are not until they are completed. It proceeeds to the PDF export which then works correctly.
Can't find what you're looking for? Ask the community or share your knowledge.