Here is an iLogic rule I created which will allow you to retrieve the source work plane or face, that the offset work plane was based off of, and retrieve the parameter that it created (and is using) where the offset amount is stored. Then it shows you the current offset, and asks you to input a new offset. I included several comments within the code to make it easier to follow.
(You will need to change the name I'm specifying in my code for the WorkPlane it is getting, so it matches the name of your WorkPlane before using. If you need to get the WorkPlane a different way, and don't know how, just post back and let me know.)
Here's the code:
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("A Part Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oWP As WorkPlane = oPDef.WorkPlanes.Item("Split Tool")
Dim oColl As ObjectCollection 'to hold objects which are 'driving' this WorkPlane
Dim oDefType As String 'to hold the name of the Type of object it is
Dim oDWP As WorkPlane 'to hold the WorkPlane this one was offset from
Dim oDFace As Face 'to hold the Face, if this WorkPlane was offset from a Face instead of a WorkPlane
Dim oDParam As Inventor.Parameter 'to hold the 'driving' Parameter where the offset length is stored
If oWP.DefinitionType = WorkPlaneDefinitionEnum.kPlaneAndOffsetWorkPlane Then
oColl = oWP.DrivenBy
For Each oObj In oColl
oDefType = [Enum].GetName(GetType(ObjectTypeEnum), oObj.Type)
'MsgBox(oDefType)
If oDefType = "kWorkPlaneObject" Then
oDWP = oObj
ElseIf oDefType = "kFaceObject" Then
oDFace = oObj
ElseIf oDefType = "kModelParameterObject" Or _
oDefType = "kUserParameterObject" Then
oDParam = oObj
End If
Next
'here's where you can change the offset value.
'the value retrieved/shown and the value you supply here are understood as Centimeters (database units not document units)
'so you may need to convert them to the desired units
'I'm dividing/multiplying by 2.54 to get Inches
oNewOffset = InputBox("The offset is currently " & (oDParam.Value/2.54) & "." & vbCrLf & _
"What would you like to change it to?", "")
If oNewOffset = "" Then Exit Sub
oDParam.Value = CDbl(oNewOffset)*2.54
End If
oPDoc.Update
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield

(Not an Autodesk Employee)