fix(silo): pull assembly dependencies on all open paths (#337)
SiloOrigin.openDocument() bypassed open_item() when a local file existed, skipping dependency pulling for assemblies. Silo_Pull also skipped dependency pulling when no revisions had files but a local file existed. Changes: - SiloOrigin.openDocument(): remove local-file shortcut, route all opens through open_item() which already handles dependency pulling - Silo_Pull.Activated(): add _pull_dependencies() call before opening existing local assembly files in the no-revisions-have-files path Closes #337
This commit is contained in:
@@ -1894,6 +1894,13 @@ class Silo_Pull:
|
|||||||
if not has_any_file:
|
if not has_any_file:
|
||||||
if existing_local:
|
if existing_local:
|
||||||
FreeCAD.Console.PrintMessage(f"Opening existing local file: {existing_local}\n")
|
FreeCAD.Console.PrintMessage(f"Opening existing local file: {existing_local}\n")
|
||||||
|
# Pull assembly dependencies before opening (#337)
|
||||||
|
try:
|
||||||
|
item = _client.get_item(part_number)
|
||||||
|
except Exception:
|
||||||
|
item = {}
|
||||||
|
if item.get("item_type") == "assembly":
|
||||||
|
_pull_dependencies(part_number)
|
||||||
FreeCAD.openDocument(str(existing_local))
|
FreeCAD.openDocument(str(existing_local))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -315,13 +315,8 @@ class SiloOrigin:
|
|||||||
FreeCAD.Console.PrintError(f"Silo open failed: {e}\n")
|
FreeCAD.Console.PrintError(f"Silo open failed: {e}\n")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Try to find existing local file by part number
|
# Route through open_item() which pulls assembly dependencies
|
||||||
# (UUID lookup would require API enhancement)
|
# before opening, ensuring PropertyXLink references resolve (#337)
|
||||||
local_path = find_file_by_part_number(identity)
|
|
||||||
if local_path and local_path.exists():
|
|
||||||
return FreeCAD.openDocument(str(local_path))
|
|
||||||
|
|
||||||
# Download from Silo
|
|
||||||
try:
|
try:
|
||||||
doc = _sync.open_item(identity)
|
doc = _sync.open_item(identity)
|
||||||
return doc
|
return doc
|
||||||
|
|||||||
Reference in New Issue
Block a user