AnsweredAssumed Answered

Traversing doesn't work when the file is not visible

Question asked by Rafael Veiga on Jan 29, 2019
Latest reply on Feb 14, 2019 by Rafael Veiga

Hi all,

 

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)

Else

GetSheetMetalBoundingBox = "0:0"

End If

 

 

Thank yor for your help!

 

Rafael

Outcomes