I have developed a set of add-ins in CADmep 2019 (Fabrication 2019 API). They work fine. But CADmep 2019 is getting old. We are thinking of switching to CADmep 2023. During the transition period, we need to have both CADmep 2019 and 2023 to co-exist for quite a long while.
I have fixed the incompatible data types in the source code to have it compiled correctly in both CADmep 2019 and 2023. But my program always fails in CADmep 2023 as soon as it needs to use any object/function related to Fabrication API, such as Job.Items, Database.CustomItemData, Job.GetFabricationItemFromACADHandle(). The program still works fine in CADmep 2019.
This has nothing to do with AutoCAD API, they work fine. The problem has to do with Fabrication API -- specifically related to the version of Fabrication API.
I have traced the problem to the possibility that both versions of my program "seem" to use Fabrication 2019 API regardless it is running in CADmep 2019 or 2023. This explains why the program works fine in CADmep 2019, but not in 2023. This is odd because I have purposefully built a version of my program for each CADmep -- one for CADmep 2019 and another one for 2023. And I know for a fact that I am using the 2023 version of my program (because I have added a special command called "JayTest2023" in the 2023 version of my program that is not available in the 2019 version of my program).
I can work around this problem by renaming the Fabrication 2019 folder from this:
C:\Program Files\Autodesk\Fabrication 2019
into something like this:
C:\Program Files\Autodesk\Temp_Disabled_Fabrication 2019
After I have renamed that folder, seems like this "forces" CADmep 2023 not to use Fabrication 2019 API. And all the suddenly, everything works.
Obviously this is not a good solution because this prevents someone from using CADmep 2019 and 2023 in the same computer.
Please let me know if you have any suggestion that I can try.
By the way, my add-ins are deployed through PackageContents.xml in C:\ProgramData\Autodesk\ApplicationPlugins\MyCadLib.bundle folder. Not sure if this matters or not.
If you need some sample source code to look at, please let me know and I will prepare it.
Jaysom