ThisDoc.Document is not defined error

ThisDoc.Document is not defined error

j3scat
Enthusiast Enthusiast
616 Views
2 Replies
Message 1 of 3

ThisDoc.Document is not defined error

j3scat
Enthusiast
Enthusiast

I am trying to create a rule that uses ThisDoc.Document

 

A.Acheson has been helping me troubleshoot my rule here ->https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/link-excel-file-to-parameters-via-fi...

 

But I think the error I am dealing with is external to my initial question

 

I am unable to

Dim xDoc As ThisDoc.Document

 or i get a 'ThisDoc.Document is undefined' when i attempt to run the rule.  Within the last month I had a number of rules break and I have been continually messing with 'ActiveDocument'/'ActiveEditDocument' to fix the issue, but I currently can't use ThisDoc.Document on an External or an Internal Ilogic Rule.

 

I am not attempting to run a VB.net routine. This is through the inventor rule editor. ( I do have rubber duck installed)

0 Likes
Accepted solutions (1)
617 Views
2 Replies
Replies (2)
Message 2 of 3

J-Camper
Advisor
Advisor
Accepted solution

@j3scat,

 

You are combining the task of defining and casting an object to an objectvariable. Do this:

Dim xDoc As Document =  ThisDoc.Document

This also works, but I would recommend the former:

xDoc =  ThisDoc.Document

 Also since it is a local rule, you could be more specific with the document type:

Dim aDoc As AssemblyDocument =  ThisDoc.Document
     'or
Dim pDoc As PartDocument =  ThisDoc.Document
     'or
Dim dDoc As DrawingDocument =  ThisDoc.Document

 

0 Likes
Message 3 of 3

j3scat
Enthusiast
Enthusiast

Sigh, yes you are right.

 

I'm getting tired and not seeing things correctly.

(applying your correction does not fix my initial issue however. Hopefully a rest and restart tomorrow will see something equally obvious)

 

BTW, nice description. I wish I had found something this simple and straightforward months (years?) ago.

0 Likes