## [Function] Demonstrate that two planes are equal

## [Function] Demonstrate that two planes are equal

(OP)

Hi everyone,

I struggle to create a function that allow to determine whether or not two planes are parallel and on the same level. Bellow I managed to get the angle between the two planes and the idea is to return true or false in fonction of the angle between them. However, I don't know how to handle the case when the two planes are paralalel but not on the same level. Any idea ?

Function AngleBetweenPlanes(oFirstPlane, oSecondPlane)

Dim reference1 As Reference

Set reference1 = oPart.CreateReferenceFromObject(oFirstPlane)

Dim reference2 As Reference

Set reference2 = oPart.CreateReferenceFromObject(oSecondPlane)

Dim TheSPAWorkbench As Workbench

Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")

Dim TheMeasurable As Measurable

Set TheMeasurable = TheSPAWorkbench.GetMeasurable(reference1)

Dim MinimumDistance As Double

MinimumDistance = TheMeasurable.GetAngleBetween(reference2)

MsgBox ("Angle=" & CStr(MinimumDistance))

End Function

I struggle to create a function that allow to determine whether or not two planes are parallel and on the same level. Bellow I managed to get the angle between the two planes and the idea is to return true or false in fonction of the angle between them. However, I don't know how to handle the case when the two planes are paralalel but not on the same level. Any idea ?

Function AngleBetweenPlanes(oFirstPlane, oSecondPlane)

Dim reference1 As Reference

Set reference1 = oPart.CreateReferenceFromObject(oFirstPlane)

Dim reference2 As Reference

Set reference2 = oPart.CreateReferenceFromObject(oSecondPlane)

Dim TheSPAWorkbench As Workbench

Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")

Dim TheMeasurable As Measurable

Set TheMeasurable = TheSPAWorkbench.GetMeasurable(reference1)

Dim MinimumDistance As Double

MinimumDistance = TheMeasurable.GetAngleBetween(reference2)

MsgBox ("Angle=" & CStr(MinimumDistance))

End Function

## RE: [Function] Demonstrate that two planes are equal

Eric N.indocti discant et ament meminisse periti## RE: [Function] Demonstrate that two planes are equal

## RE: [Function] Demonstrate that two planes are equal

I believe what Eric was trying to say is after checking if the planes are parallel, check if distance between them is 0.

Regards

Fernando

https://picasaweb.google.com/102257836106335725208 - Romania

https://picasaweb.google.com/103462806772634246699... - EU

## RE: [Function] Demonstrate that two planes are equal

Eric N.indocti discant et ament meminisse periti## RE: [Function] Demonstrate that two planes are equal

## RE: [Function] Demonstrate that two planes are equal

Calculate and compare the A,B,C,D coefficients of both planes. (Ax + By + Cz + D = 0)

## RE: [Function] Demonstrate that two planes are equal

It is really frustrating, my angle function doesn't work anymore. @itsmyjob I can't even try to get the distance to (0,0,0)...

@jackk I am really new to VBA, I don't really know from where to start to get the planes equations and then compare coefficients...

So here is my code.

What the code do : During a loop, you have to select a circle edge of a body part and then it create a reference plane based on this circular edge.

What I need to do : create a new reference plane if the next circular edge is not on the "same plane". For that I need my function that allow me to compare planes...

Any ideas ?

## CODE -->

## RE: [Function] Demonstrate that two planes are equal

## RE: [Function] Demonstrate that two planes are equal

## CODE -->

Hope I will share again with all of us.

Pharys