After hours of trials, here is my workaround:
First I'd like to state some facts:
- Parameter 'ComponentLinknURL' can accept either absolute file path (local/network) or website address.
- If you enter a file name, AD will start looking for it in DXP.exe path or C:\.
- Windows environment variables was my first idea, but unfortunately they are not recognizable by AD. (at least in this context)
The only way I see is to modify the parameter's value each time you move your workspace, which is a nightmare of course.
I wrote a VB script to do the job and now I'm able to port my workspace on different computers.
My workspace hierarchy:
Level1----> Workspace[Dir.]
Level2----> LIB[Dir.] ScriptsProj[Dir.] PCBProj1[Dir.] PCBProj2[Dir.] ... PCBProjn[Dir.]
Level3----> Datasheets[Dir]
I've used a VB script form with 4 labels to display process summery, you only need to run it once on the new computer.
since both ComponentLinknURL and HelpURL parameters can be used for datasheet reference, I've picked HelpURL for the F1 key feature. (pressing F1 is easier than 3 mouse clicks)
The script will:
1- construct the current datasheet directory path.
2- extract datasheet file names from HelpURL for each part in all schematic documents in workspace.
3- modify HelpURL for each part in all schematic documents in workspace.
4- display process summery.
If some documents got modified, you must save them manually (I didn't get there yet).
////////////////////////////////////////////////////////////////////////////////////////
Sub Form1Create(Sender)
Dim Project
Dim Doc
Dim Sheet
Dim Components
Dim Parameters
Dim Array
Dim Path
Dim DocCount
Dim SchCount
Dim Count
Dim ParVal
' Get Current Workspace Path (full path includes workspace name, I had to split it to get parent dir, no substring here!!)
Array = Split(GetWorkSpace.DM_WorkspaceFullPath,"\")
For i=0 To UBound(Array)-1
Path = Path & Array(i) & "\"
Next
Path = Path & "LIB\Datasheets\"
Count = 0
DocCount = 0
SchCount = 0
Label1.Caption = "Total Projects: " & GetWorkSpace.DM_ProjectCount
For i=0 To GetWorkSpace.DM_ProjectCount-1
Project = GetWorkSpace.DM_Projects(i)
' Check if Project is flattened (if project is flattened (compiled before) we don't need to show the schmatic document, only loading it is ok)
Set flatHierarchy = Project.DM_DocumentFlattened
If flatHierarchy Is Nothing Then
Project.DM_Compile
End If
DocCount = DocCount + Project.DM_LogicalDocumentCount
For j=0 To Project.DM_LogicalDocumentCount-1
Doc = Project.DM_LogicalDocuments(j)
IF Doc.DM_DocumentKind = "SCH" Then
SchCount = SchCount + 1
Client.OpenDocument "Sch",Doc.DM_FullPath
Set Sheet = SchServer.GetSchDocumentByPath(Doc.DM_FullPath)
SchServer.ProcessControl.PreProcess Sheet,""
Components = Sheet.SchIterator_Create
Components.AddFilter_ObjectSet(MkSet(eSchComponent))
Set Component = Components.FirstSchObject
While Not (Component IS Nothing )
Parameters = Component.SchIterator_Create
If Not (Parameters Is Nothing) Then
Parameters.AddFilter_ObjectSet(MkSet(eParameter))
Set Parameter = Parameters.FirstSchObject
While Not (Parameter IS Nothing)
If Parameter.Name = "HelpURL" Then
ParVal = Trim(Parameter.Text)
If ParVal <> "" And InStr(ParVal, "www.") < 1 And InStr(ParVal, ":\\") < 1 Then
Array = Split(ParVal, "\")
ParVal = Path & Array(UBound(Array))
If Parameter.Text <> ParVal Then
SchServer.RobotManager.SendMessage Parameter.I_ObjectAddress, c_BroadCast, SCHM_BeginModify, c_NoEventData
Parameter.Text = Path & Array(UBound(Array))
SchServer.RobotManager.SendMessage Parameter.I_ObjectAddress, c_BroadCast, SCHM_EndModify , c_NoEventData
Count = Count + 1
End If
End If
End If
Set Parameter = Parameters.NextSchObject
WEnd
Component.SchIterator_Destroy(Parameters)
End If
Set Component = Components.NextSchObject
WEnd
Sheet.SchIterator_Destroy(Components)
End If
SchServer.ProcessControl.PostProcess Sheet,""
Next
Next
Set Component = Nothing
Set Parameter = Nothing
Label2.Caption = "Total Documents: " & DocCount
Label3.Caption = "Total Schematics: " & SchCount
Label4.Caption = "Modified Parts: " & Count
End Sub
////////////////////////////////////////////////////////////////////////////////////////
Sorry for the mess, it's my first VB script.
I really hope there is an easier way.
Notes and remarks are welcomed
