@itsmyjob It's a "basic" Documents.Add("Part") just to test if my code interacting well with Catia, I don't try more for that, sorry...
But I have always the same problem of "cast" error, when I try to use this code:
...
static PartDocument myPartDocument = null;
static Part...
@itsmyjob Really? It's strange because it works on my PC (Windows 7) with a CATProduct (with or without Design Mode no problem), and now I tried on 2 other PCs (Windows 7 and 8.1) with other CATProducts and it works too...
I don't know why you receive an error... [ponder]
@JeniaL: I succeed in doing translate in C# of your vb.net code!
This is the good code:
...
static ProductDocument productDocBase;
static Product productBase;
...
try
{
productDocBase = (ProductDocument)myCatia.ActiveDocument;
productBase = productDocBase.Product...
For information, I just successfully performed to add a new part with that code, but I always search a solution for my problem...
namespace MacroCatiaTest1
{
public partial class Form1 : Form
{
bool CatiaRunning = false;
static INFITF.Application myCatia;
static...
Thanks for your answer, I just tried it and I have two problems:
- Visual Studio force me to cast myCatia.ActiveDocument in INFITF.Documents but this casting operation launch an exception (HRESULT E_FAIL with a COM composant)! [mad]
- I don't have access to .Product !! But I use "using INFITF"...
Hello everybody, I'm a newbie here... I'm a software developper in C#, I'm not a master of c# but I know enough to code Windows desktop software in WindowsForm (and sometimes in WPF).
I use CATIA v5r22 sp6 (HD2+FS1+KT1 modules) on Windows 7 pro x64 and Microsoft Visual Studio Community 2015...