Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
xenocatalyst
285 Views, 3 Replies

Help with iLogic error - Plane.isParallelto/iscoplanarto

Hi,

 

I am writing some automation code in iLogic and am having an issue with using IsCoplanarto and IsParallelto 

These methods create an error when used with face or face.geometry ie.: 

oPlane1.IsParallelTo(oFace.Geometry)  or oPlane1.IsCoplanarTo(oFace.Geometry)

The code seems to work fine if i use "On Error Resume Next" or "Try Catch" to handle the error, but i will be needing to debug in the future so i would like to find a way that will not generate an error.

 

Attached is a file with 2 rules, one with error handling on to show how it should work, the other with error handling off to show the error.

 

here is my code

 

'On Error Resume Next

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPlane1 As Plane = Nothing
Dim oPlane2 As Plane = Nothing

Dim oFaces As Faces = oDoc.ComponentDefinition.SurfaceBodies.Item(1).Faces 'gets too many results but works, using worksurfaces doesnt give me the correct result
MessageBox.Show(oFaces.Count.ToString, "Check No. of faces in Surface body")

Dim oFace1 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select a face")
Dim oFace2 As Face = Nothing
oPlane1 = oFace1.Geometry	

For Each oFace As Face In oFaces	
	If oPlane1.IsCoplanarTo(oFace.Geometry) Then 
	ElseIf oPlane1.IsParallelTo(oFace.Geometry) Then 
			oFace2 = oFace
	End If
Next

DistPoints = ThisApplication.MeasureTools.GetMinimumDistance(oFace1, oFace2)
Distmm = Round(DistPoints * 10).ToString() + "mm Thick"
MessageBox.Show(Distmm, "Title")