0

I am writing CATIA VBA code to manipulate and swap planes in an assembly. I'm having trouble finding the correct CATIA API to read a specific plane's Ax+By+Cz=D equation. I am aware of CATIA's HybridShapePlaneEquation and HybridShapeAxistoAxis objects, but there's no documentation on how to derive the objects from the CATIA.ActiveDocument object, and i'm not even sure if these are the correct APIs to use.

CATIA Screenshot

Given an assembly, how can I allow a user to:

  1. Select a plane by clicking on it under the Geometric Set or External Reference section
  2. Display the plane equation in a MsgBox()
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • Only the HybridShapePlaneEquation has the A, B, C and D parameters. Other Plane types don't have them. The usual way to get those parameters for any type of Plane ist to use Measurable.GetPlane() from the Space Analysis Interface. With this method you get the two direction vectors and a point on the plane. With that information you can easily compute A, B, C and D yourself. – gdir Jul 19 '19 at 11:49

1 Answers1

1

I have to add to gdir's comment that methods to get two direction vectors and origin also exist for any HybridShapePlane* object. They are GetOrigin, GetFirstAxis and GetSecondAxis. The two axes will be given as two orhogonal unit vectors lying on the plane. Note that the mentioned methods are Subs (the value is returned in the value passed by reference). You can use basic vector geometry to obtain the plane's normal [A,B,C] and then calculate D using the information from the Origin point.

Don't want to steal gdir's attribution but I can't post comment and I'm confused about why the answer has been provided as a comment.

Dewydd
  • 81
  • 5