I prefer instead of .txt linked files use build in equations. Pack & go works fine and no worry about broken external links at all.
Can you provide an example? Do you mean referring to dims in a layout sketch or something like that?
We've tried that way before, and the complaint I got from the other engineers is that they have to model a part at whatever dimensions, and then insert it into the assembly, then edit the dimension to reference the variable (or layout sketch), so they're basically editing every dimension twice.
That's correct if global variable already exists.
But you can also edit part in assembly, then set GV and link it whatever you need to.
Each time this has happened, It's been when I P&G into another directory, or to a .zip file. I should also note that I'm working from a company server. I'm going to try copying the entire folder to my C: drive (not sure what that'll do to the references) before I P&G to the .zip file. Worth a shot anyway.
I'm not sure how this helps me. I know which parts/assemblies are linked to .txt files and I know how to include those .txt files in the P&G procedure. The link you shared seems to be about how to identify those. My problem is that the links break when I P&G the parent assemblies.
Update: If, during the P&G process, I use select/replace to rename all the components & .txt files, then the links DO NOT break, and they're all still linked to the correct .txt files. Which is awesome! However, the parts and assemblies are all still linked to the ORIGINAL .txt files. In other words, pack & go makes copies of the .txt files and puts them where I tell them to go, but it doesn't link the parts & assemblies to the new copies. So the problem still isn't really solved.
I don't know why P&G does it. With SW you need to think flexible. Maybe the code below makes it a bit easier. A second step is required but beats manual labor.
You got the copy and know the new file names.
Below is code that will read the file path of the linked equation. Modify it and relink to your new txt files.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swEqnMgr As SldWorks.EquationMgr
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swEqnMgr = swModel.GetEquationMgr
' Get Equation manager object
Set swEqnMgr = swModel.GetEquationMgr
' List the equations, get whether they're linked
' to files, make sure any equations are up to date,
' and get the paths where they're stored
nCount = swEqnMgr.GetCount
For I = 0 To nCount - 1
Debug.Print " Equation #" & I & " = " & swEqnMgr.Equation(I)
eqnLinked = swEqnMgr.LinkToFile
Debug.Print " Equation linked to file? " & eqnLinked
If eqnLinked Then
'Make sure equations are up to date
'Get path and name of linked equation file
Debug.Print " Path and file name of linked equation: " & swEqnMgr.FilePath
'------------------------- relink path
swEqnMgr.LinkToFile = True
swEqnMgr.FilePath = "I:\$Projects\_PDF\equations - Copy.txt" 'enter new path
Well, our Solidworks distributor found me a workaround:
- Use Pack and Go to save a copy of the assembly and all components in a new folder, keeping the all the original names, unselecting the checkbox beside all the txt file references so they don’t get copied.
- After SolidWorks Pack and Go is complete, shut down all the files without saving any changes.
- Use Windows Explorer to copy and paste all the reference text files into the new folder with the new copy of the assembly.
- The next step is to make sure SolidWorks can’t see the original files either by temporarily renaming the folder the original text files reside in or maybe temporarily changing the mapping on the drive.
- Open the top level assembly from the new folder. When SolidWorks doesn’t find the text files in the original location it will look in the folder with the assembly and load them from there. Verify a few of the files are loading the correct file.
- Use CTRL+Q to fully rebuild and then Save. Once you rebuilt and saved it, the pointers will point to the files in the new folder for future opens.
- Rename the original folder or remap.