I’m working on CATIA V5 drawing automation and have already automated several repetitive drafting tasks, but I’m still having trouble with projected view orientation.
Problem
If a 3D product/model is angled relative to the standard/global coordinate system, the generated 2D view is also angled. I then have to manually rotate or adjust the drawing view.
I’d like to determine the correct orientation automatically before creating the view.
I tried getting the product transformation using:
Product.Position.GetComponents()
and using the first 9 values from that transformation matrix as the basis for:
DrawingViewGenerativeBehavior.DefineFrontView(V1x, V1y, V1z, V2x, V2y, V2z)
However, this does not produce the expected view orientation.
For example, GetComponents() gives a transformation in the form:
[R11, R12, R13, R21, R22, R23, R31, R32, R33, Tx, Ty, Tz]
My understanding is that the first 9 values describe the product's orientation, while DefineFrontView() expects two 3D vectors defining the viewing plane/orientation.
Question
What is the correct way to convert the orientation returned by Position.GetComponents() into the two vectors V1 and V2 required by DefineFrontView()?
Ultimately, I want to automatically generate a properly aligned front view regardless of how the CATProduct or component is oriented in 3D space.
I’m using CATIA V5 Automation/COM, currently from C#.
Any explanation of the coordinate transformation involved—or a working example—would be greatly appreciated.
