Here again . I am trying to get the bounding box of a sheet metal part through traversing the feature tree. It works fine when the file is visible but it is not when it is not. Any idea how could I solve it?
This is the code:
swApp.DocumentVisible False, GetswFileType(Filename)
Set swModel = swApp.OpenDoc6(Filename, GetswFileType(Filename), swOpenDocOptions_e.swOpenDocOptions_Silent + swOpenDocOptions_ReadOnly, "", longstatus, longwarnings)
If Not swModel Is Nothing Then
Set swFeatureManager = swModel.FeatureManager
If Not swFeatureManager Is Nothing Then
Set swRootNode = swFeatureManager.GetFeatureTreeRootItem2(swFeatMgrPane_e.swFeatMgrPaneBottom) --> When the file is not visible swRootNode is Nothing.
If Not swRootNode Is Nothing Then
GetSheetMetalBoundingBox = GetSheetMetalBoundingBox_TraverseNode(swRootNode)
GetSheetMetalBoundingBox = "0:0"
Thank yor for your help!