Hi there,
I was wondering if there was a command that will get the file name of the model referenced in a drawing?
The reason I want to do this is because I have various programs to automate drawings, but I have to manually edit the code if i want to switch between using the code on assembly drawings and part drawings.
If i can get the model reference, I can then use a bit of extra programming to extract the extension. (i.e. .ipt or .iam)
Thanks in advance,
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi waynehelley,
You can use this:
doc = ThisDoc.ModelDocument
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis, I am still having a bit of trouble. I have tried the following but I can't seem to be able to get the command to give me the document name as text. If I run the following...
modeldoc = ThisDoc.ModelDocument
test = modeldoc.FileName(True)'with extension
MessageBox.Show(test, "Title")
I get the error...
Error in rule: Get Model Reference, in document: Get Model Reference.iLogicVb
Public member 'FileName' on type 'AssemblyDocument' not found.
I am not sure if I got a bit confused about what your code was intended to be used for. I will attach my code. You will be able to see that I get to a section where my program replaces the model reference (within a for function) and needs to know the extension
Just to clarify, my program is intended to be ran from a drawing, hence I need to know if the drawing is of a part or assembly.
I can make do with this for now...
extension = InputBox("Please state the file extension. '.ipt' for parts and '.iam' for assemblies", "Drawing Generator",".ipt")
Hi waynehelley,
I think this will work for you to check the file type:
doc = ThisDoc.ModelDocument 'check file type If doc.DocumentType = kPartDocumentObject Then MessageBox.Show("This is a part file.", "iLogic") Else if doc.DocumentType = kAssemblyDocumentObject Then MessageBox.Show("This is an assembly file.", "iLogic") End if
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com