Here is a fairly basic iLogic rule code example that is designed to be ran from the 'active' assembly document. It immediately attempts to find/get the associated drawing document. Then attempts to get the sheet, the dimension, and the dimension's model value. There are a lot of assumptions involved in this code, so it very likely won't work for you without any changes, but it lays out the logical process you would have to go though by code to retrieve a drawing dimension's value from an assembly document.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then
MsgBox("An Assembly Document must be active for this rule to work as designed. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
Exit Sub
End If
Dim oADoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oPath As String = System.IO.Path.GetDirectoryName(oADoc.FullFileName)
Dim oDirSep As Char = System.IO.Path.DirectorySeparatorChar
Dim oName As String = System.IO.Path.GetFileNameWithoutExtension(oADoc.FullFileName)
'assumes drawing file has same path and name, but different file extension
'assumes drawing is IDW, not DWG file type
Dim oDDoc As DrawingDocument
Try
oDDoc = ThisApplication.Documents.ItemByName(oPath & oDirSep & oName & ".idw")
Catch
oDDoc = ThisApplication.Documents.Open(oPath & oDirSep & oName & ".idw", True)
Catch
MsgBox("Couldn't find/open the drawing document. Exiting.", , "")
Exit Sub
End Try
'specify which sheet within the drawing to target
'assuming the target dimension is on the first sheet of that drawing
Dim oSheet As Inventor.Sheet = oDDoc.Sheets.Item(1)
'specify which dimension on the sheet to target
'assumes you just want to target the first dimension placed on the sheet
Dim oDim As DrawingDimension = oSheet.DrawingDimensions.Item(1)
'get the dimension's model value
Dim oVal As Double = oDim.ModelValue
'check it, and do something in responce to its value
If oVal < 1 Then
MsgBox("The value is less than one.", , "")
ElseIf oVal >= 1 And oVal <= 25 Then
MsgBox("The value is between 1 and 25.", , "")
ElseIf oVal > 25 Then
MsgBox("The value is greater than 25.", , "")
End If
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 want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)