Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Great Code - Thank you @Cadline. Now I need it to work with Vault!

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
tracey_prior8CZVC
244 Views, 4 Replies

Great Code - Thank you @Cadline. Now I need it to work with Vault!

I tweaked a Cadline Code and created an external rule and a global form (shown here).  From Inventor, it Checks if a document exists and if not creates it or opens it. (a word template), autofill's Name and Description. and gives it the same name as the cad file and saves it into the same folder.  ( I may have to change that but that's for another day.)

This is all on my local drives.  I will now get it saved into the company vault, ext rules area.  I also need to save the template in the vault templates file.  I am wondering how (I have replaced the path with xxx for this forum - confidentiality and all that.) I point to the template in vault.  Not done this before.  And have the subsequent word doc which is created in my local, be checked in to vault.  

tracey_prior8CZVC_0-1715938798055.png

 

'Code orginally Cadline Code - modified.
'set the folder name from the template report 
folder = "xxx" 
'Create the Word Application Object 
wordApp = Interaction.CreateObject("Word.Application") 
'Add the template document to the Word Session 
wordDoc = wordApp.Documents.Add(folder & "ilogic_report_template.docx", Visible:= False) 
'Write to the Bookmarks in the template 
wordDoc.Bookmarks("FNAME").Range.Text = ThisDoc.FileName(False) 

'without extension 
wordDoc.Bookmarks("DESC").Range.Text = iProperties.Value("Project", "Description")
'wordDoc.Bookmarks("PNUM").Range.Text = iProperties.Value("Project", "Part Number") 
'wordDoc.Bookmarks("DES").Range.Text = iProperties.Value("Summary","Author") 
'wordDoc.Bookmarks("RNUM").Range.Text = iProperties.Value("Project","Revision Number") 

'save iso view to jpg 
imagedoc = ThisDoc.PathAndFileName(False) & ".jpg" 
oCamera = InventorVb.Application.ActiveView.Camera 
'current iso view oCamera.fit oCamera.apply 
InventorVb.Application.ActiveView.SaveAsBitmap(imagedoc,1200,800)  
'Insert an image at the end of the document 
wordDoc.Bookmarks.Item("\endofdoc").Range.InlineShapes.AddPicture(imagedoc) 
'Save the Word file with a new name and close the document 
wordDoc.SaveAs(ThisDoc.PathAndFileName(False) & ".docx") 
wordDoc.Close() 
wordDoc = Nothing 
'Quit Word session 
wordApp.Application.Quit()  
wordApp = Nothing 
'Message box prompt – Added by Clint Brown @ Cadline 
i = MessageBox.Show("Would you like to see the Report?", "Cadline Community",MessageBoxButtons.YesNo,MessageBoxIcon.Question) 
If i = vbYes Then ThisDoc.Launch(ThisDoc.PathAndFileName(False) & ".docx") 

 

4 REPLIES 4
Message 2 of 5

Also, \iLogic\UI\ Design Data is where Global forms are stored.  I think mine is local.  If that folder is placed in vault would all machines have to download it?  Seems like an issue for the tech guys.

Message 3 of 5

I forgot to mention for anyone wanting to use the code - The template that you create in word needs to have bookmarks added so the code can place the info in the word doc.  So for this line: 

'wordDoc.Bookmarks("PNUM").Range.Text = iProperties.Value("Project", "Part Number") 

PNUM is the bookmark name in word. 

Message 4 of 5

Everything need to check in to Vault and everyone need to "get" them.

They should be under "Vault Workspace".

They should not expire and delete from local.

Message 5 of 5

Many thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report