Using iLogic to SaveAs a Component and change file path

Using iLogic to SaveAs a Component and change file path

sean.boyle77X79
Contributor Contributor
1,483 Views
3 Replies
Message 1 of 4

Using iLogic to SaveAs a Component and change file path

sean.boyle77X79
Contributor
Contributor

Hi, 

 

Please could somebody help me with an issue we're experiencing. We currently have a standard folder in Vault where we store some iLogic assemblies for quick access to Copy Design to working projects, but we have had some occasions where users have not copy designed everything in the folder, meaning they would be amending parts of our standard folder and not their own.

 

Our folders are set up where you need to copy design everything in the assembly. You cannot restrict a Copy Design in Vault if not everything is selected currently (Why?). So I thought the remedy would be to utilise Inventor as a final security check.

 

Currently I can have the parts that have been erroneously not-copied be identified as such and display a warning box advising the user that they have not copy designed all of the components. However I was wondering if iLogic can automate the process and immediately check and replace any non-copied parts with new ones.

 

Simple example:

Main assembly part has been copy designed, however the raw material part inside the assembly has not. So:

  • iLogic checks the file path of the raw material part and identifies that it is located in the standard library.
  • iLogic Saves As the raw material part.
  • iLogic changes the file path of the new Saved As part and moves it to the working folder of this particular project.
  • iLogic replaces the standard raw material part with the new one.
  • Message box displays explaining what it has done.

Is this possible to do? Any help would be greatly appreciated.

Sean.

 

 

0 Likes
1,484 Views
3 Replies
  • Help
Replies (3)
Message 2 of 4

marcin_otręba
Advisor
Advisor

you can start from this:

 

Dim ass As AssemblyDocument = ThisDoc.Document
Dim doc As Document
Dim ass_path As String = Left(ass.FullFileName, (InStrRev(ass.FullFileName, "\", -1, vbTextCompare) ))
For Each doc In ass.AllReferencedDocuments
If Left(doc.FullFileName, Len(ass_path)).ToLower <> ass_path.ToLower Then
doc.SaveAs(ass_path& Right(doc.FullFileName, Len(doc.FullFileName)-(InStrRev(doc.FullFileName, "\", -1, vbTextCompare))),False)
End If
Next

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 3 of 4

sean.boyle77X79
Contributor
Contributor

Hi Marcin,

 

Thanks for your reply, please could you briefly describe what the code does?

0 Likes
Message 4 of 4

marcin_otręba
Advisor
Advisor

it saves all components which are not in the same folder as parent assembly in parent assembly folder.

If saveascopy is set to false it will replace saved conmponents in parent assembly.

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes