Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

save as for all open documents

Anonymous

save as for all open documents

Anonymous
Not applicable

i have managed to create ilogic to save the document on the format that i want but i want to do this for all open documents please.

 

strFolder = "S:\01 - Temp Drawing PG\" & ThisDoc.FileName(False) & "_S4_" & iProperties.Value("Project", "Revision Number")
 
ThisDoc.Document.SaveAs(strFolder & (".jpg") , True)
ThisDoc.Document.SaveAs(strFolder & (".pdf") , True)
0 Likes
Reply
Accepted solutions (1)
503 Views
3 Replies
Replies (3)

Anonymous
Not applicable
Sub Main

Dim oDoc As Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments
	If (oDoc.DocumentType = kDrawingDocumentObject) Then
		oDoc.Activate

		Dim map As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
		map.Add("oDoc", oDoc)
		
		iLogicVb.RunExternalRule("Drawing Conversion", map)
		
		End If
Next oDoc
MessageBox.Show("THATS WHAT SHE SAID!!", "Michael Scott")
End Sub

i have used this for the loop but it does not work. it save the original file again and
again rather than save a new document every time it switches to the open documents
i know it has to do with choosing active document rather than the document that was used to
execute the ilogic. but i got nowhere with it so please help.
0 Likes

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Anonymous 

Try changing your external rule "Drawing Conversion" to this:

Dim oDoc As Document = RuleArguments("oDoc")
strFolder = "S:\01 - Temp Drawing PG\" & IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName) & "_S4_" & oDoc.PropertySets("Inventor Summary Information")("Revision Number").Value
oDoc.SaveAs(strFolder & (".jpg") , True)
oDoc.SaveAs(strFolder & (".pdf") , True)
0 Likes

Anonymous
Not applicable

that's amazing, solve my issue right away.

the code did not work on if if wanted to do it on only one document thought,

but i figure it out and here is the code.

I replaced  

Dim oDoc As Document = RuleArguments("oDoc")

with this 

Dim oDoc As Document
If RuleArguments.Exists("oDoc") Then
	oDoc = RuleArguments("oDoc")
Else
	oDoc = ThisApplication.ActiveDocument
End If

 

0 Likes