Hi @Patrick_JohnsonSU3NC. That seems like an odd request, so it is a little odd to do by code without more detailed information than that. There are lots of ways do 'define' a WorkPlane, and which way you used will make a difference in the code used to find them, since we can't just find the ones you want by their name. We must determine how each WorkPlane was defined, then figure out how to get the defining data from its definition, such as an offset value. However, that will be pointing to a Inventor API Parameter object in this case. The Parameter has a 3 main properties for figuring out what its value is, and two of them will always return the value in 'database units' (centimeters for distance/length), instead of the parameter's own units. The other property (Expression) is like what you see in the 'equation' column of the Parameters dialog box, and is a String, including the units specifier text, instead of a true numerical value that you can do math with or compare with other numerical values. So, when you specify what offset value you want to find, you must do so in centimeters (using math if needed), and/or specify the exact String, exactly as you see it in the Parameters dialog equation column.
Below is an example iLogic rule code you can play around with. I put comment in there showing you where to set the values you are looking for.
Sub Main
Dim oInvApp As Inventor.Application = ThisApplication
Dim oPDoc As PartDocument = TryCast(ThisDoc.Document, Inventor.PartDocument)
If oPDoc Is Nothing Then Return
'<<< CHANGE VALUES OF THESE NEXT TWO VARIABLES >>>
Dim dOffsetValueToFind As Double = (12.5 / 2.54) 'specify in centimeters
Dim sOffsetExpressionToFind As String = "12.5 in"
Dim oWPlanes As WorkPlanes = oPDoc.ComponentDefinition.WorkPlanes
For Each oWPlane As WorkPlane In oWPlanes
If oWPlane.IsCoordinateSystemElement Then Continue For
'If Not oWPlane.Consumed Then oWPlane.Delete(False) 'False = Do Not Retain Dependents
If oWPlane.DefinitionType = WorkPlaneDefinitionEnum.kPlaneAndOffsetWorkPlane Then
Dim oPOWPDef As PlaneAndOffsetWorkPlaneDef = oWPlane.Definition
Dim oParam As Inventor.Parameter = oPOWPDef.Offset
Dim dOffSetVal As Double = oParam.Value 'will be in 'database units' (centimeters)
Dim sOffSetExpression As String = oParam.Expression
'<<< HERE IS WHERE THE CHECK IS HAPPENING >>>
If dOffSetVal = dOffsetValueToFind OrElse
sOffSetExpression = sOffsetExpressionToFind Then
Try
oWPlane.Delete(False) 'False = Do Not Retain Dependents
Catch
'what to do if that fail, like a message
End Try
End If
End If
Next
oPDoc.Update2(True)
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)