Hi @will_roe
The only way to add a workplane in assembly environment by iLogic/API is to add a fixed plane. For example AddPlaneAndOffset doesn't work. If you have a look at a workplane created that way (manually) in an assembly, you'll see that a plane is created and then constrained with a Flush constraint with offset.
You can do this by code, but not using AddByPlaneAndOffset.
Try this 🙂
Sub Main
oDef = ThisDoc.Document.ComponentDefinition
Dim oWPlane As WorkPlane
oWPlane = AddWorkPlaneInAssemblyOffset(oDef.WorkPlanes("XY Plane"), 20)
oWPlane.Name = "My_New_Work_Plane"
End Sub
Function AddWorkPlaneInAssemblyOffset(oFace As Object, oOffset As Double) As WorkPlane
Dim uOM As UnitsOfMeasure = ThisDoc.Document.UnitsOfMeasure
Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oOriginPnt As Point
Dim oXaxis As UnitVector
Dim oYaxis As UnitVector
oOriginPnt = ThisApplication.TransientGeometry.CreatePoint(0#, 0#, 0#)
oXaxis = ThisApplication.TransientGeometry.CreateUnitVector(1#, 0#, 0#)
oYaxis = ThisApplication.TransientGeometry.CreateUnitVector(0#, 1#, 0#)
Dim oPlane As WorkPlane = oDef.WorkPlanes.AddFixed(oOriginPnt, oXaxis, oYaxis)
oPlane.AutoResize = True
oDef.Constraints.AddFlushConstraint(oFace, oPlane, uOM.ConvertUnits(oOffset, uOM.LengthUnits, UnitsTypeEnum.kDatabaseLengthUnits))
oPlane.AutoResize = False
Return oPlane
End Function