- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am working with Inventor 2019 and one of my iLogic rules routinely stops working and displays the error message below (the .ddl file changes everytime you run the rule).
If I copy the code to a new rule it works fine for a couple of days before resulting in the same error again.
Does anyone know how to fix that?
Error Message:
More info:
System.IO.FileNotFoundException: Could not find file 'C:\Users\RockePh\AppData\Local\Temp\comonaxy.dll'.
File name: 'C:\Users\RockePh\AppData\Local\Temp\comonaxy.dll'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
at Autodesk.iLogic.Exec.AppDomExec.CompileCodeHere()
at Autodesk.iLogic.Exec.AppDomExec.CompileCodeInOtherDomain(AppDomain otherDomain, String codeName, String codeText, Boolean checkUnsafeCode)
at iLogic.RuleEvalContainer.ExecRuleCompile(String execRule)
My code automatically creates dimensions from workpoints in the model:
Public Sub Main()
'Active view
Dim oView As DrawingView
Dim oViewName As String
Dim oViewNo As Integer
'Scale
Dim oViewScale As Double
'get the name of the referenced model
ModelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'Section number
Dim oSection As Integer
'Activate all detail views
iLogicVb.RunRule("View - Suppress Views")
For i = 1 To Parameter(ModelName, "MaxSections") - 1
oViewName = i
oView = ActiveSheet.View(oViewName).View
oViewNo = i + 2
oViewScale = ActiveSheet.View(oViewName).Scale
oSection = i
'Total lining thickness
viewNo = oViewNo
dimPt1 = "Point_r_0-" & oSection
dimPt2 = "Point_r_8-" & oSection
dimType = "Horizontal"
dimText = ""
DimXOffset = 0 'in cm
DimYOffset = - oView.Height / 2 - 2 'in cm
ArrowHeadInside = True
Call AddLinearDim(viewNo, dimPt1, dimPt2, dimText, dimType, DimXOffset, DimYOffset, ArrowHeadInside)
Next
End Sub
Private Sub AddLinearDim(viewNo As Integer,
dimPt1 As String,
dimPt2 As String,
dimText As String,
Optional dimType As String = "Aligned",
Optional DimXOffset As Integer = 0,
Optional DimYOffset As Integer = 0,
Optional ArrowHeadInside As Boolean = True,
Optional FirstArrowHead As ArrowheadTypeEnum = kAsStyleArrowheadType,
Optional SecondArrowHead As ArrowheadTypeEnum = kAsStyleArrowheadType)
Dim sDimText As String = dimText & "<DimensionValue/>"
'Set reference to drawing document
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
'Set reference to view and sheet
Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(viewNo)
Dim oSheet As Sheet = oDoc.ActiveSheet
'Get reference to document in view
Dim viewDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim viewDocDef As ComponentDefinition = viewDoc.ComponentDefinition
'Get workpoints from the assembly document
Dim oWP1 As WorkPoint = viewDocDef.WorkPoints.Item(dimPt1)
Dim oWP2 As WorkPoint = viewDocDef.WorkPoints.Item(dimPt2)
'Place Centermarks where the Work Points reside
Dim oCM1 As Centermark = oSheet.Centermarks.AddByWorkFeature(oWP1, oView)
Dim oCM2 As Centermark = oSheet.Centermarks.AddByWorkFeature(oWP2, oView)
oCM1.Visible = False
oCM2.Visible = False
'Create Geometry Intent of the Centermarks
Dim oGeomIntent1 As GeometryIntent = oSheet.CreateGeometryIntent(oCM1)
Dim oGeomIntent2 As GeometryIntent = oSheet.CreateGeometryIntent(oCM2)
'Define Dimension Orientation variables
Dim dimTypeEnum As DimensionTypeEnum = Nothing
'Filter by dimension type
Select Case dimType
Case "Vertical"
dimTypeEnum = 60163
Case "Horizontal"
dimTypeEnum = 60162
Case "Aligned"
dimTypeEnum = 60161
Case Else
dimTypeEnum = 60161
End Select
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
'Declare variables for dimension endpoints
Dim oShtPt1 As Point2d = oView.ModelToSheetSpace(oWP1.Point)
Dim oShtPt2 As Point2d = oView.ModelToSheetSpace(oWP2.Point)
'Control where the Dimension Text is located
Dim oDimX As Double = oShtPt1.X + DimXOffset
Dim oDimY As Double = oShtPt1.Y + DimYOffset
Dim oPtText As Point2d = oTG.CreatePoint2d(oDimX, oDimY)
'Create the Dimension
Dim oDimension As DrawingDimension
oDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPtText, oGeomIntent1, oGeomIntent2, dimTypeEnum, ArrowHeadInside)
oDimension.CenterText
'Set the arrowheadtype
oDimension.FirstArrowheadType = FirstArrowHead
oDimension.SecondArrowheadType = SecondArrowHead
'Add text to dimension
Dim MyDimText As DimensionText = oDimension.Text
MyDimText.FormattedText = sDimText
End Sub
Solved! Go to Solution.

