Hi
Ich habe in C# ein Programm geschrieben, um Catia-Modelle extern zu steuern. Dazu verwende ich
(INFITF.Application)Marshal.GetActiveObject("CATIA.Application")
und
(PartDocument)catiaApp.ActiveDocument
um ein offenes Part Dokument mit Viewer3D und Viewpoint3D (rotate, zoom, translate zu bewegen.
Nun möchte ich das ganze nicht nur für offene Part-Dateien, sondern für ganze Product-Dateien machen. Jedoch sind meine Versuche bisher gescheitert.
Code:
INFITF.Application catiaApp;
PartDocument part_doc = null;
MECMOD.PartDocument activedocpart;
ProductStructureTypeLib.ProductDocument activedocproduct;
ProductStructureTypeLib.Product product1;
Part part = null;
Viewer3D oViewer;
Viewpoint3D oViewPoint;
try
{
catiaApp = (INFITF.Application)Marshal.GetActiveObject("CATIA.Application");
}
catch
{
return false;
}
try
{
part_doc = (PartDocument)catiaApp.ActiveDocument;
}
catch
{
try
{
activedocproduct = (ProductStructureTypeLib.ProductDocument)catiaApp.ActiveDocument;
product1 = activedocproduct.Product;
}
catch
{
return false;
}
}
part = part_doc.Part;
oViewer = (Viewer3D)catiaApp.ActiveWindow.ActiveViewer;
oViewPoint = oViewer.Viewpoint3D;
oViewPoint.ProjectionMode = CatProjectionMode.catProjectionCylindric;
zoomWert = oViewer.Viewpoint3D.Zoom;
return true;
Jedoch funktioniert meine Steuerung so nicht, wenn ich eine offene .CATProduct Datei habe. Mit einer .CATPart Datei geht es wunderbar.
Was mache ich falsch?
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP