TBC Macros and Extensions

 View Only

 Error in ViewProjectData.py: "Cannot import name IFeatureManager"

Jump to  Best Answer
Lance Crumbliss's profile image
Lance Crumbliss posted 10-22-2024 09:35

Hello all,  I'm just getting started with macros and have run some samples, but this one is causing the error outlined in the Subject line of this post.  Does anyone know why it could be happening?  I'm pretty sure it's the latest version of that macro.  TBC v2024.01, VS2019, IronPython v3.4(64-bit) 

The line causing the error is the bolded one below:  

try:
    clr.AddReference("Trimble.Sdk") # new for version 5.50
except:
    clr.AddReference("Trimble.Vce.Core")
    clr.AddReference("Trimble.Vce.Interfaces")
    clr.AddReference("Trimble.DiskIO")
 
from Trimble.Vce.Core.Components import SnapInAttributeExtension, Project
from Trimble.Vce.Interfaces.SnapIn import IMemberManagement, IName, ISnapIn
from Trimble.Vce.Interfaces.Client import CommandGranularity
from Trimble.Vce.Interfaces.Feature import IFeatureManager
from Trimble.Vce.Interfaces.FeatureCoding import IFeatureCodeManager
from Trimble.Vce.Interfaces.FeatureDefinitions import IFeatureCodeDefinitionContainer, IFeatureDefinitionBlock
Ronny Schneider's profile image
Ronny Schneider  Best Answer

Try the attached version. Can't tell when exactly the namespace for this particular line changed.

This section looks now like this.

try:
    clr.AddReference("Trimble.Sdk") # new for version 5.50
except:
    clr.AddReference("Trimble.Vce.Core")
    clr.AddReference("Trimble.Vce.Interfaces")
    clr.AddReference("Trimble.DiskIO")

from Trimble.Vce.Core.Components import SnapInAttributeExtension, Project
from Trimble.Vce.Interfaces.SnapIn import IMemberManagement, IName, ISnapIn
from Trimble.Vce.Interfaces.Client import CommandGranularity
from Trimble.Sdk.Interfaces import IFeatureManager
from Trimble.Vce.Interfaces.FeatureCoding import IFeatureCodeManager
from Trimble.Vce.Interfaces.FeatureDefinitions import IFeatureCodeDefinitionContainer, IFeatureDefinitionBlock

Not sure which version you have. There is an older one where you can only view the tree, and a newer one (the attached one) which features a search field, i.e. serial numbers or object names.