open next idw/ipt file in directory

open next idw/ipt file in directory

Anonymous
Not applicable
1,362 Views
5 Replies
Message 1 of 6

open next idw/ipt file in directory

Anonymous
Not applicable

I am looking for a command that would open the NEXT drawing or part in a folder.

 

This was available when I used Microstation a while back and found it very useful.

Example:

You have file A.idw you just type "open-next" it opens B.idw
You have file C.idw you just type "open-next" it opens D.dwg, and so on.

 

Does something like this already exist?

Thanks in advance.

 

note: Using Inventor Pro 2017

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

Mark.Lancaster
Consultant
Consultant

@Anonymous

 

Welcome to the Autodesk User's Community..

 

Out of the box, no..  But some coding can be done to do this for you.

 

Update:  Or log it as an Inventor idea and have others vote on it.

Mark Lancaster


  &  Autodesk Services MarketPlace Provider


Autodesk Inventor Certified Professional & not an Autodesk Employee


Likes is much appreciated if the information I have shared is helpful to you and/or others


Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.

0 Likes
Message 3 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

Sure.

 

Use this as a rule. Uses the folder's indexing as found in GetFiles to determine the next file to open.

 

Doesn't save or close the previous file.

 

Sub Main()
	oCurrFile = ThisApplication.ActiveDocument.FullFileName
	oCurrDir = System.IO.Path.GetDirectoryName(oCurrFile)
	
	oFiles = System.IO.Directory.GetFiles(oCurrDir, "*.idw", System.IO.SearchOption.TopDirectoryOnly)
		
	If oFiles.Length < 1
		MsgBox("No Drawings Found in current directory!" & vbLf & vbLf & "Current Directory: " & oCurrDir)
		Exit Sub
	End If
	
	For j = 0 To oFiles.Length - 1
		If oFiles(j) = oCurrFile Then
			If j >= oFiles.Length - 1 Then
				MsgBox("Currently Opened File is Last File in Folder!")
			Else
				ThisApplication.Documents.Open(oFiles(j+1), True)
			End If
		End If
	Next
End Sub

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 4 of 6

Anonymous
Not applicable

Hello,

 

This is exactly what I was looking for.

 

However, I was pasting in the rule and received some errors shown in the screenshot below

 

I want to thank you in advance for you help.

 

Capture.JPG

0 Likes
Message 5 of 6

MechMachineMan
Advisor
Advisor
Accepted solution

Dude. Look at the code I posted, then look at what you pasted in your the iLogic window.

 

You double pasted it all in there.

 

Try pasting ONLY as it shows in my last post.

 

Also, the Error Traces read like plain english, from the bottom up. So that's a pretty quick way to get to the bottom of the error.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 6 of 6

Anonymous
Not applicable

My mistake...It Worked!

 

Thank you very much

0 Likes