Documents.ItemByName does not work?

Documents.ItemByName does not work?

oransen
Collaborator Collaborator
1,134 Views
4 Replies
Message 1 of 5

Documents.ItemByName does not work?

oransen
Collaborator
Collaborator

I'm trying to use the Documents.ItemByName as follows:

 

Document Doc = m_Inventor.Documents.ItemByName (sFullDocName) ;

But the complier complains about a non invocable member.

 

I also poticed In this post, the VB example shows ItemByName commented out and a for loop substitued.

 

According to the API docs my call is correct I think, so what is wrong?

 

 

 

0 Likes
Accepted solutions (1)
1,135 Views
4 Replies
Replies (4)
Message 2 of 5

bradeneuropeArthur
Mentor
Mentor

The file "sFullDocName" must be (already) open in inventor!

Than it will return....

 

otherwise the code runs crash..

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 5

oransen
Collaborator
Collaborator

Maybe I was not clear enough. The C# compiler does not accept the syntax. And by the post which I linked to from my original email neither does VB.

 

0 Likes
Message 4 of 5

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@oransen,

 

Need to specify the type of object before assigning to an object.

 

Document Doc = (Document)m_Inventor.Documents.ItemByName (sFullDocName) ;

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 5

oransen
Collaborator
Collaborator

Many thanks for that!

 

(You should moonlight and correct all the strange ambiguous mysterious error messages in the Microsoft C# compiler!)

 

 

0 Likes