Drawing view needs updating

Drawing view needs updating

FINET_Laurent
Advisor Advisor
773 Views
5 Replies
Message 1 of 6

Drawing view needs updating

FINET_Laurent
Advisor
Advisor

Morning eveyrone,

 

I whould like to know where I can find if a view needs it's model to be updated or not.. as a boolean if possible.

I mean this :

 

Seeupdate.JPG

Regards,

 

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Accepted solutions (1)
774 Views
5 Replies
Replies (5)
Message 2 of 6

dutt.thakar
Collaborator
Collaborator

Hello @FINET_Laurent ,

 

Just a quick code, which indicates which view needs updating in a message box. If this is something you are looking for.

 

Try this code, Which Iterates through all the views in drawing and checks whether they are updated or not. 

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument

Dim oSheet As Sheet = oDoc.ActiveSheet

For Each oView As DrawingView In oSheet.DrawingViews
	If oView.UpToDate = True
		MessageBox.Show(oView.Name)
	End If
Next

You can modify this code to suit your requirements, like showing all the views in one Message box, currently I have not done that, but this will give you idea probably on what you are looking for, If I have understood correctly.

 

If this has answered your question, please accept this as solution.

 

Regards,

Dutt Thakar

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 3 of 6

FINET_Laurent
Advisor
Advisor

The code isn't making a difference between up to date views and not up to date views.

I already looked through the view object but I don't think this is the place to search.. 🤔

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes
Message 4 of 6

AlexKorzun
Autodesk
Autodesk
Accepted solution

Hi,

 

Maybe you need checking DrawingView.ReferencedDocumentDescriptor.ReferencedDocument.RequiresUpdate ?
Some of the components in the chain above could result in null (Nothing) for the particular drawing view type or state.

 

Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

0 Likes
Message 5 of 6

ernis
Advocate
Advocate

@AlexKorzun   or maybe you could write iLogic code to update all the ones you need to update? Maybe it would be better than getting a list and updating manually. Thank you in advance

0 Likes
Message 6 of 6

FINET_Laurent
Advisor
Advisor

I Managed this code with @AlexKorzun 's help. 🙂

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView 

For Each oView In oDoc.ActiveSheet.DrawingViews
	
	Dim bBoolean As Boolean = oView.ReferencedDocumentDescriptor.ReferencedDocument.RequiresUpdate
	
	If bBoolean = True Then
		
		Dim Pathfile As String = oView.ReferencedDocumentDescriptor.FullDocumentName
		Dim xDoc As Document
	
			xDoc = ThisApplication.Documents.Open(Pathfile, True)
			xDoc.Update
			xDoc.Save
			xDoc.Close 

	End If
Next 

MessageBox.Show("All drawing views are up do date", "Baguette",Nothing,MessageBoxIcon.Asterisk )

 Regards,


FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill