0

I'm trying to update XAxis on Active CATIA document using C#. Anyone knows how to do that? somehowGetActiveAxisSysObject() is placeholder in pseudo code:

                Array xMatrix = Array.CreateInstance(typeof(double), 3);
                xMatrix.SetValue(5.0, 0);
                xMatrix.SetValue(0.0, 1);
                xMatrix.SetValue(0.0, 2);
                MECMOD.AxisSystem targetAxisSys = **somehowGetActiveAxisSysObject();**
                targetAxisSys.PutXAxis(xMatrix);

THANK YOU!

ArunPratap
  • 4,816
  • 7
  • 25
  • 43
Admus
  • 1
  • 3
  • Do you want to manipulate the "axis system" (Position/transformation matrix) of a Part in it's parent assembly? Or do you want to create/manipulate an axis system feature in a part which is marked "Current", meaning it will be used for the next point object created. A part is not required to have any Axis System features at all. – C R Johnson Mar 22 '19 at 10:39

1 Answers1

0

It's been a while since I worked with Catia in C# so the code below may not run properly.

First, I will assume you are working in a part document and that you have created an axis system from the menu: Insert->AxisSystems->AxisSystem (or named something similar). Next, I will also assume that you went into this items properties and renamed it to "Larry".

MECMOD.AxisSystems thisPartsAxisSysCollection = (MECMOD.AxisSystems)Part.AxisSystems;
MECMOD.AxisSystem oneAxisSys = thisPartsAxisSysCollection(1); //Index is name unknown
//or
MECMOD.AxisSystem oneAxisSys = thisPartsAxisSysCollection("Larry");
oneAxisSys.PutXAxis("your data");

If this is not what you are trying to do, but instead are trying to move the part's origin then you will need to access Part.OriginElements instead and use that object's PlaneXY, PlaneYZ, and PlaneZX. Unfortunately those are read only if I remember correctly.

Nathan
  • 188
  • 4
  • 10