Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic check if drawing view is rendered

4 REPLIES 4
Reply
Message 1 of 5
m.Bongartz
408 Views, 4 Replies

iLogic check if drawing view is rendered

I have a rule, which open selected idw-Files, export them to pdf and dwg and close them.

 

For big drawings, some views don't look fully drawn:

mBongartz_0-1623661851462.png

I guess, it's because the exports starts right after opening and the views are not rendered completly (green borders). I need to  check, if every view is rendered.

 

Any ideas?

Labels (1)
4 REPLIES 4
Message 2 of 5

Hi @m.Bongartz 

 

You could have the code check for raster views first.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument


For Each oSheet In oDrawDoc.Sheets
	For Each oView In oSheet.DrawingViews		
		If oView.IsRasterView = True Then
			MsgBox("Warning one or more views is a raster view", , "iLogic")
			Return
		End If
	Next
Next

 

Message 3 of 5

This work so far. Thanks!!
This issue is not reproduceable, therefore debugging and testing is not that easy. I will test it for a while and share my results.

Here my code:

'load drawing
For Each oSheet In oDrawing.Sheets
	oSheet.Activate()
	'check if every view is not in rasterView
	While (checkRasterViews(oSheet))
		oSheet.Update()
	End While
Next
'export drawing
'close drawing

Function checkRasterViews(oSheet As Sheet) As Boolean
	'return True if all views are not on RasterMode
	checkRasterView = True
	For Each oView In oSheet.DrawingViews
		If oView.IsRasterView Then
			'View is in Raster Mode --> check unsuccessful
			checkRasterView = False
			Logger.Warn(oView.Name & "is in RasterView")
			Exit For
		End If
	Next
End Function

 

Message 4 of 5
WCrihfield
in reply to: m.Bongartz

The DrawingView object also has a couple other Properties you may want to check also, like 'DrawingView.UpToDate' & 'DrawingView.IsUpdateComplete'.  But I think maybe the one that may be the best fit would be the Sheet's Property called 'Sheet.Status', which uses the 'DrawingSheetStatusBits' enumerator to help you, obviously,  determine the current 'status' the sheet.  You can add these to your arsenal/toolbox for making sure the sheet/views are up to date, before publishing/exporting.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

I use DrawingOptions.EnableBackgroundUpdates = false just before opening the drawing. It has worked flawlessly in a PDF Exporter app I wrote to export all component PDFs from an assembly.

 

You can store the current setting before starting any exporting, set to false before doing work, then finally change the setting to what it was when you're done. This way, you don't have to iterate over each View, Sheet, Drawing, etc. Every drawing will always be ready for PDF export. If you're only doing one drawing at a time, maybe the above suggestions work better for you.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report