We encountered an issue during our CATIA macro development.
We get an error when we try to read the value of an attribute on VPMReference (attribute name: PLMReference.V_hasConfigContext) in the macro. The error we received is attached (see error.png).
When we try to read a different attribute (attribute name: PLMReference.V_isLastVersion) on the same interface, we can read it without any problems.
The full code is below (macro.cs).
How can I read the value of the V_hasConfigContext attribute?
Thanks in advance.
Code: macro.cs
using System;
using VPMEditorContextIDL;
namespace Macro_library_VSTA00000042_vst00000042_1
{
public sealed partial class ThisApplication : ObjectModelAgentLib.CATIAEntryPoint
{
// public static void CATMain()
// {
// // Debug entry point, not visible from the host
// CATIA.SystemService.PrintToStdout("Hello, World! C#");
// }
public static void Macro1()
{
try
{
var productService = (PLMProductService)CATIA.ActiveEditor.GetService("PLMProductService");
var root = productService.RootOccurrence.PLMEntity;
System.Windows.Forms.MessageBox.Show((bool)root.GetAttributeValue("V_isLastVersion") + "");
System.Windows.Forms.MessageBox.Show((bool)root.GetAttributeValue("V_hasConfigContext") + "");
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
}
}
}