fix: repair Chinese PDF text and sync native component selection
This commit is contained in:
1 parent
734a10b5c7
commit
12ce0c4140
23 files changed
+988
-5
No files matched your search
@@ -236,7 +236,8 @@ Sub DxBridgeIdleWait()
|
||||
Dim shell
|
||||
On Error Resume Next
|
||||
Set shell = CreateObject("WScript.Shell")
|
||||
shell.Run "%ComSpec% /d /s /c ping -n 2 -w 400 127.0.0.1 > nul", 0, True
|
||||
shell.Run DxToolsQuote(DxToolsHome & "\DxDesignerTools.exe") & _
|
||||
" bridge-wait --milliseconds 150", 0, True
|
||||
Err.Clear
|
||||
On Error GoTo 0
|
||||
Call DxBridgeYield()
|
||||
|
||||
@@ -86,16 +86,22 @@ Function DxBridgeMailboxLoop(process, runRoot, runId, snapshotId, _
|
||||
Dim resultPath
|
||||
Dim claimPath
|
||||
Dim state
|
||||
Dim lastSelection, pageContext, pageKeys
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
resultPath = fso.BuildPath(runRoot, "result.tsv")
|
||||
claimPath = fso.BuildPath(runRoot, "result.processing")
|
||||
state = ""
|
||||
lastSelection = ""
|
||||
pageContext = ""
|
||||
pageKeys = "[]"
|
||||
|
||||
Do While process.Status = 0
|
||||
Call DxBridgeConsumeLocate(runRoot, objectMap)
|
||||
Call DxBridgePumpRefresh(runRoot, runId, objectMap, originalMap, _
|
||||
snapshotId)
|
||||
Call DxBridgePumpBomExport(runRoot)
|
||||
Call DxBridgePublishSelection(runRoot, runId, snapshotId, _
|
||||
lastSelection, pageContext, pageKeys)
|
||||
Call DxWriteProgress(runRoot, "waiting")
|
||||
If fso.FileExists(resultPath) Then
|
||||
If DxBridgeClaimFile(fso, resultPath, claimPath) Then
|
||||
@@ -116,6 +122,98 @@ Function DxBridgeMailboxLoop(process, runRoot, runId, snapshotId, _
|
||||
DxBridgeMailboxLoop = state
|
||||
End Function
|
||||
|
||||
Sub DxBridgePublishSelection(runRoot, runId, snapshotId, _
|
||||
ByRef lastSelection, ByRef pageContext, ByRef pageKeys)
|
||||
Dim designPath, blockName, sheetName, currentContext, selectedKeys
|
||||
Dim text, numberJson, ready, newPageKeys
|
||||
On Error Resume Next
|
||||
designPath = DxBridgeDesignPath()
|
||||
blockName = DxBridgeCurrentBlockName()
|
||||
sheetName = DxBridgeCurrentSheetName()
|
||||
ready = (designPath <> "" And blockName <> "" And sheetName <> "")
|
||||
currentContext = designPath & vbTab & blockName & vbTab & sheetName & vbTab & snapshotId
|
||||
If currentContext <> pageContext Then
|
||||
newPageKeys = DxBridgeSelectionKeys(VD_ALL)
|
||||
If Err.Number = 0 Then
|
||||
pageKeys = newPageKeys
|
||||
pageContext = currentContext
|
||||
Else
|
||||
ready = False
|
||||
Err.Clear
|
||||
End If
|
||||
End If
|
||||
selectedKeys = DxBridgeSelectionKeys(VD_SELECTED)
|
||||
numberJson = DxBridgeCurrentSheetNumberJson()
|
||||
If Err.Number <> 0 Then
|
||||
ready = False
|
||||
Err.Clear
|
||||
End If
|
||||
text = "{""state"":""unavailable"",""run_id"":""" & _
|
||||
DxToolsJson(runId) & """,""snapshot_id"":""" & _
|
||||
DxToolsJson(snapshotId) & """,""design_path"":""" & _
|
||||
DxToolsJson(designPath) & """}"
|
||||
If ready Then
|
||||
text = "{""state"":""ready"",""run_id"":""" & _
|
||||
DxToolsJson(runId) & """,""snapshot_id"":""" & _
|
||||
DxToolsJson(snapshotId) & """,""design_path"":""" & _
|
||||
DxToolsJson(designPath) & """,""active_block_name"":""" & _
|
||||
DxToolsJson(blockName) & """,""current_sheet_name"":""" & _
|
||||
DxToolsJson(sheetName) & """,""current_sheet_number"":" & _
|
||||
numberJson & ",""selected_keys"":" & selectedKeys & _
|
||||
",""current_sheet_keys"":" & pageKeys & ",""selected_nets"":" & _
|
||||
DxBridgeExportSelectedNets() & "}"
|
||||
End If
|
||||
If text <> lastSelection Then
|
||||
Call DxToolsWriteUtf8Atomic(fsoBuildPath(runRoot, "selection.json"), text)
|
||||
If Err.Number = 0 Then lastSelection = text
|
||||
Err.Clear
|
||||
End If
|
||||
On Error GoTo 0
|
||||
End Sub
|
||||
|
||||
Function DxBridgeSelectionKeys(queryMode)
|
||||
Dim keys, component, key, values, index, text
|
||||
Set keys = CreateObject("Scripting.Dictionary")
|
||||
For Each component In ActiveView.Query(VDM_COMP, queryMode)
|
||||
key = DxBridgeComponentIdentity(component)
|
||||
If key <> "" And Not keys.Exists(key) Then keys.Add key, True
|
||||
Next
|
||||
text = ""
|
||||
If keys.Count > 0 Then
|
||||
values = keys.Keys
|
||||
If keys.Count > 1 Then Call DxBridgeSortSelectionKeys(values, 0, UBound(values))
|
||||
For index = 0 To UBound(values)
|
||||
If text <> "" Then text = text & ","
|
||||
text = text & """" & DxToolsJson(values(index)) & """"
|
||||
Next
|
||||
End If
|
||||
DxBridgeSelectionKeys = "[" & text & "]"
|
||||
End Function
|
||||
|
||||
Sub DxBridgeSortSelectionKeys(ByRef keys, first, last)
|
||||
Dim leftIndex, rightIndex, pivot, temporary
|
||||
leftIndex = first
|
||||
rightIndex = last
|
||||
pivot = keys((first + last) \ 2)
|
||||
Do While leftIndex <= rightIndex
|
||||
Do While keys(leftIndex) < pivot
|
||||
leftIndex = leftIndex + 1
|
||||
Loop
|
||||
Do While keys(rightIndex) > pivot
|
||||
rightIndex = rightIndex - 1
|
||||
Loop
|
||||
If leftIndex <= rightIndex Then
|
||||
temporary = keys(leftIndex)
|
||||
keys(leftIndex) = keys(rightIndex)
|
||||
keys(rightIndex) = temporary
|
||||
leftIndex = leftIndex + 1
|
||||
rightIndex = rightIndex - 1
|
||||
End If
|
||||
Loop
|
||||
If first < rightIndex Then Call DxBridgeSortSelectionKeys(keys, first, rightIndex)
|
||||
If leftIndex < last Then Call DxBridgeSortSelectionKeys(keys, leftIndex, last)
|
||||
End Sub
|
||||
|
||||
Function DxBridgeClaimFile(fso, sourcePath, claimPath)
|
||||
DxBridgeClaimFile = False
|
||||
If fso.FileExists(claimPath) Then
|
||||
|
||||
Reference in new issue
Block a user