Rule Compile Error ".dll not found"

Rule Compile Error ".dll not found"

philipp.rockenschaubDDSYJ
Contributor Contributor
1,477 Views
15 Replies
Message 1 of 16

Rule Compile Error ".dll not found"

philipp.rockenschaubDDSYJ
Contributor
Contributor

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:

philipprockenschaubDDSYJ_0-1669202768427.png

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

 

0 Likes
Accepted solutions (1)
1,478 Views
15 Replies
Replies (15)
Message 2 of 16

bradeneuropeArthur
Mentor
Mentor

Is the file still on the place mentioned %appdata%/......when the error rises?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor

No, the only files in the temp folder with that name have the extensions .cmdline, .err, .out and .tmp 

0 Likes
Message 4 of 16

JMGunnar
Collaborator
Collaborator

I can't  see thats you 

 

AddReference "comonaxy.dll"

in you rule  ? 

 

and mapp in searchpath  ilogic preference 

 

Johan 

0 Likes
Message 5 of 16

WCrihfield
Mentor
Mentor

Hi @philipp.rockenschaubDDSYJ.  The thing in your code that catches my eye as being especially error prone, is that you are using several different ways of specifying which document the code is supposed to be working on.  In your Sub Main area, you are using the term 'ThisDrawing', and the term 'ActiveSheet', both of which point to certain documents by default, but then in your 'AddLinearDim' Sub routine, you are using the term 'ThisApplication.ActiveDocument' to define it.  I would suggest that you also pass the DrawingDocument object you are working with in the Sub Main area, down to the AddLinearDim Sub routine, so you can be sure you are working with the same document reference.  The term 'ThisDrawing.Document" can definitely be referring to a different document than ThisApplication.ActiveDocument', which may be part of the problem.  I used to use that 'ThisApplication.ActiveDocument' term all the time, for nearly everything, but have since switched to using 'ThisDoc.Document' for almost everything...at least within my iLogic rules, because it is a more dynamic reference, and most often works better in more places.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor

@JMGunnar 

I do not know what the .dll file is and it changes everytime I run the rule

 

>and mapp in searchpath  ilogic preference 

I do not understand what you you mean by that

0 Likes
Message 7 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor
Thank you for the advice. I am quite new to this and most of it is copying from examples and trying to find a way to adapt it to what I want it to do
0 Likes
Message 8 of 16

WCrihfield
Mentor
Mentor

Hi @philipp.rockenschaubDDSYJ@JMGunnar just made a good point too, if I am understanding the last part of his comment correctly.  I see that you are running an iLogic rule within the early part of your Sub Main area.  The line of code you are using to run that rule suggests that the rule you are trying to run is an 'internal' or 'local' rule (saved within that same document that you are working with), not an external rule, and not an internal rule saved within a different document.  If that is not the case, that might also be throwing an error.  If that is an external iLogic rule, then you would need to use a different line of code to run it properly (iLogicVb.RunExternalRule()), plus you would have to have that rule located within one of the directories specified within your iLogic configuration settings.  Those iLogic configuration settings can be found on the Tools tab > Options panel (you may have to expand that panel to see it) > click iLogic Configuration.  When you click that, it brings up a dialog labeled "Advanced iLogic Configuration".  In the top part of that dialog is where you add the directories where your external iLogic rules are stored.  Then below that is where you specify which file extension you want your external iLogic rule files to have.  If the rule you are trying to run is an external rule, and it is not located in on of those listed directories, or has a different file extension than what is specified there, that may be causing problems.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor

@WCrihfield it is an internal rule and the error also comes up if the only thing I put in the Sub Main area is the definition of the variables and calling the function.

 

Also the rule works fine at first. I can run it one moment without any problems and then I try it again seconds later and only get the error

0 Likes
Message 10 of 16

JMGunnar
Collaborator
Collaborator

Explain this rule 

 

1. First you call oViewName  = i  
name på first view  "1"

 

2. Then you change too oViewNo = i = i +2  => 3 

you try too dimension 3 view in drawings in AddDimension() ? 

'Set reference to view and sheet
	Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(viewNo)

 

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

 

 

 

0 Likes
Message 11 of 16

JMGunnar
Collaborator
Collaborator

This is my solution 

 

1. I access view1 in Main Sub ()

 

2. and AddLinearDim(oViewName As String)

 

Best Regards Johan G

 

 

Public Sub Main()
'Active view
Dim oView As DrawingView
Dim oViewName As String
Dim oViewNo As String

'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 = "view" & i
	oView = ActiveSheet.View(oViewName).View
	
	oViewScale = ActiveSheet.View(oViewName).Scale
	oSection = i

	'Total lining thickness
		oViewName = oViewName
		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(oViewName, dimPt1, dimPt2, dimText, dimType, DimXOffset, DimYOffset, ArrowHeadInside)
Next
End Sub


Private Sub AddLinearDim(oViewName As String,  
			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 oSheet As Sheet = oDoc.ActiveSheet
	Dim oView As DrawingView = ActiveSheet.View(oViewName).View
	

	'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

 

0 Likes
Message 12 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor

I have 4 views on the drawing:

  1. Top
  2. Side
  3. Detail 1 (Name: "1")
  4. Detail 2 (Name: "2")

According to company standard the name for detail views are numbers starting from 1.

I am trying to add a dimension to Detail 1 (view number 3)

 

The reason I defined both the number and the name is because ActiveSheet.View(Index).View allows for the index to be the name of the view while the index for ActiveSheet.DrawingViews(Index) has to be an integer. 

 

You think that the error is because I referenced the view with two separate methods?

0 Likes
Message 13 of 16

JMGunnar
Collaborator
Collaborator

 

 

Hi ! Philips /  @philipp.rockenschaubDDSYJ 

 

you can build detail name  string 

 

oViewName =  "Detail" & " " & i 

or  

oViewName =  "Detail" & " " & 1 

 

if the drawingview is not found "the third view" it maybe not get the right info.

 

I replace Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(viewNo)

 

 

Dim oView As DrawingView = ActiveSheet.View(oViewName).View

 

Johan G

 

 

 

'Set reference to view and sheet
	Dim oView As DrawingView = oDoc.ActiveSheet.DrawingViews(viewNo)

 

Dim oView As DrawingView = ActiveSheet.View(oViewName).View

 

0 Likes
Message 14 of 16

arkelec
Collaborator
Collaborator

Did you resolve this @philipp.rockenschaubDDSYJ ?

 

I was having similar issues with a simple bit of code, it was a daft typo, well more of a copy/paste thing, getting doc & oDoc mixed (protection level).

 

I went to the C:\Users\XXXX\AppData\Local\Temp & found a file named "t4jnhk1a.out", where t4jnhk1a would be the equivalent to the "comomaxy.dll" in the file mentioned in the error message.

I opened that with notepad & it indicated what the errors were.

Hope this helps.

0 Likes
Message 15 of 16

philipp.rockenschaubDDSYJ
Contributor
Contributor

@arkelec No, I have not resolved it yet.
Thanks, I will check it out the next time the error occurs

0 Likes
Message 16 of 16

dirk.vanbenthum
Participant
Participant
Accepted solution

Have a look here:
Looks like Inventor iLogic compiler is just confused:

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Error-Rule-Compile...

For me it happened when i tried to use and had its arguments the wrong way around. I just had a code error, that the iLogic Editor Syntax Checker was not able to identify correctly.

System.String.Format()

 

0 Likes