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:ย 

Linking Drawing Template to other document types such as Word & Excel.

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
patrickJ7ELM
542 Views, 11 Replies

Linking Drawing Template to other document types such as Word & Excel.

patrickJ7ELM
Contributor
Contributor

I'm wondering if it's possible to pull text/data from other documents and into Drawing Templates.

 

Example:

I have a drawing for a pipe and i want to pull data from a WPS (Welding procedure Specification). Lets say this document gets created by a different person but always in the same path as the output drawing. is it possible to create a dedicated field in the WPS, which again can be pulled into the dwg?

 

I would like it to show as source in "Format text" dialog.

patrickJ7ELM_0-1674216903998.png

 

i have no clue on where to begin on this and i would appreciate any inputs ๐Ÿ™‚

 

 

0 Likes

Linking Drawing Template to other document types such as Word & Excel.

I'm wondering if it's possible to pull text/data from other documents and into Drawing Templates.

 

Example:

I have a drawing for a pipe and i want to pull data from a WPS (Welding procedure Specification). Lets say this document gets created by a different person but always in the same path as the output drawing. is it possible to create a dedicated field in the WPS, which again can be pulled into the dwg?

 

I would like it to show as source in "Format text" dialog.

patrickJ7ELM_0-1674216903998.png

 

i have no clue on where to begin on this and i would appreciate any inputs ๐Ÿ™‚

 

 

Labels (6)
11 REPLIES 11
Message 2 of 12
patrickJ7ELM
in reply to: patrickJ7ELM

patrickJ7ELM
Contributor
Contributor

Update.

 

I'm able to extract information to a custom Iproperty and then use it on the sheet. the text does not display for some reason. and im not sure how i will make the path change for different documents. 

 

GoExcel.Open("C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\TEST-WPS.xlsx", "Ark1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True

patrickJ7ELM_1-1674222156732.png

The iproperties does get information from excel sheet here.

patrickJ7ELM_2-1674222221726.png

but this plot does not work. 

 

 

 

 

0 Likes

Update.

 

I'm able to extract information to a custom Iproperty and then use it on the sheet. the text does not display for some reason. and im not sure how i will make the path change for different documents. 

 

GoExcel.Open("C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\TEST-WPS.xlsx", "Ark1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True

patrickJ7ELM_1-1674222156732.png

The iproperties does get information from excel sheet here.

patrickJ7ELM_2-1674222221726.png

but this plot does not work. 

 

 

 

 

Message 3 of 12
patrickJ7ELM
in reply to: patrickJ7ELM

patrickJ7ELM
Contributor
Contributor

this works now. but i need to be able to change Reference excel document.

0 Likes

this works now. but i need to be able to change Reference excel document.

Message 4 of 12
tyler.warner
in reply to: patrickJ7ELM

tyler.warner
Advocate
Advocate

Would it work for you to just add another custom iProperty that specifies the source?

 

For both of these examples, you would just create that additional custom iProperty called "StandardSource".

 

This example you would change the property to be the title of the source file.

StandardSource = TEST-WPS.xlsx

GoExcel.Open("C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\" & iProperties.Value("User Defined Properties", "StandardSource"), "Ark1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True

 

 

This example you would change the property to be the full path & title of the source file.

StandardSource = C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\TEST-WPS.xlsx

GoExcel.Open(iProperties.Value("User Defined Properties", "StandardSource"), "Sheet1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True
If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes

Would it work for you to just add another custom iProperty that specifies the source?

 

For both of these examples, you would just create that additional custom iProperty called "StandardSource".

 

This example you would change the property to be the title of the source file.

StandardSource = TEST-WPS.xlsx

GoExcel.Open("C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\" & iProperties.Value("User Defined Properties", "StandardSource"), "Ark1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True

 

 

This example you would change the property to be the full path & title of the source file.

StandardSource = C:\Users\Patrick\OneDrive - Rรธrtek As\Desktop\TEST-WPS.xlsx

GoExcel.Open(iProperties.Value("User Defined Properties", "StandardSource"), "Sheet1")

iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  

iLogicVb.UpdateWhenDone = True
If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 5 of 12
patrickJ7ELM
in reply to: tyler.warner

patrickJ7ELM
Contributor
Contributor

Thanks 

 

This is better than what i had. But i want it for look for documents in the same folder as drawings. so that as long as there is a WPS-XXX.xlsx file in that folder it will use the one that is available. i dont know what will happen if there ar two different files though. 

 

to be honest, im just experimenting and trying to find ways for improvement. if you have any other ilogic/VB tips for drafts i would much appreciate. 

 

Thanks in advance ๐Ÿ™‚

0 Likes

Thanks 

 

This is better than what i had. But i want it for look for documents in the same folder as drawings. so that as long as there is a WPS-XXX.xlsx file in that folder it will use the one that is available. i dont know what will happen if there ar two different files though. 

 

to be honest, im just experimenting and trying to find ways for improvement. if you have any other ilogic/VB tips for drafts i would much appreciate. 

 

Thanks in advance ๐Ÿ™‚

Message 6 of 12
A.Acheson
in reply to: patrickJ7ELM

A.Acheson
Mentor
Mentor

If you supply the filename and extension then go excel will search the directory of the document  you launched the rule from. 

 

GoExcel.Open("TEST-WPS.xlsx")

 

Or alternatively use ilogic function ThisDoc.Path and filename. 

 

GoExcel.Open(ThisDoc.Path & "\TEST-WPS.xlsx)

 

If this solved a problem, please click (accept) as solution.โ€Œโ€Œโ€Œโ€Œ
Or if this helped you, please, click (like)โ€Œโ€Œ
Regards
Alan
0 Likes

If you supply the filename and extension then go excel will search the directory of the document  you launched the rule from. 

 

GoExcel.Open("TEST-WPS.xlsx")

 

Or alternatively use ilogic function ThisDoc.Path and filename. 

 

GoExcel.Open(ThisDoc.Path & "\TEST-WPS.xlsx)

 

If this solved a problem, please click (accept) as solution.โ€Œโ€Œโ€Œโ€Œ
Or if this helped you, please, click (like)โ€Œโ€Œ
Regards
Alan
Message 7 of 12
tyler.warner
in reply to: patrickJ7ELM

tyler.warner
Advocate
Advocate
Accepted solution

You can try something like this that will search the folder of the current document for a file that has "WPS" & ".xlsx" & then opens that one.

 

Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)

For Each oFile In oFiles
	If oFile.Contains("WPS") And oFile.Contains(".xlsx")
		GoExcel.Open(oFile, "Ark1")
		iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  
		iLogicVb.UpdateWhenDone = True
		Exit For
	End If
Next

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes

You can try something like this that will search the folder of the current document for a file that has "WPS" & ".xlsx" & then opens that one.

 

Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)

For Each oFile In oFiles
	If oFile.Contains("WPS") And oFile.Contains(".xlsx")
		GoExcel.Open(oFile, "Ark1")
		iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  
		iLogicVb.UpdateWhenDone = True
		Exit For
	End If
Next

 

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 8 of 12
patrickJ7ELM
in reply to: tyler.warner

patrickJ7ELM
Contributor
Contributor

This is close to what i want. i am just experimenting as previously stated. but i will get a problem with multiple files named WPS.xlsx, right?

 

Thanks alot for your help ๐Ÿ™‚

0 Likes

This is close to what i want. i am just experimenting as previously stated. but i will get a problem with multiple files named WPS.xlsx, right?

 

Thanks alot for your help ๐Ÿ™‚

Message 9 of 12
tyler.warner
in reply to: patrickJ7ELM

tyler.warner
Advocate
Advocate

It will just go with the first file that it finds which fits the search criteria. You can add a prompt or something if you want to do a check.

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes

It will just go with the first file that it finds which fits the search criteria. You can add a prompt or something if you want to do a check.

If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 10 of 12
patrickJ7ELM
in reply to: patrickJ7ELM

patrickJ7ELM
Contributor
Contributor

Any suggestion to how that prompt would look? 

0 Likes

Any suggestion to how that prompt would look? 

Message 11 of 12
tyler.warner
in reply to: patrickJ7ELM

tyler.warner
Advocate
Advocate
Accepted solution

You could do something like this with a basic message box if you want user interaction.

Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)

For Each oFile In oFiles
	If oFile.Contains("WPS") And oFile.Contains(".xlsx")
		Dim oResult = MessageBox.Show("Is this the correct file?" & vbNewLine & oFile, "File Selection", MessageBoxButtons.YesNo)
		If oResult = DialogResult.Yes
			GoExcel.Open(oFile, "Ark1")
			iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  
			iLogicVb.UpdateWhenDone = True
			Exit For
		End If
	End If
Next
If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
0 Likes

You could do something like this with a basic message box if you want user interaction.

Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)

For Each oFile In oFiles
	If oFile.Contains("WPS") And oFile.Contains(".xlsx")
		Dim oResult = MessageBox.Show("Is this the correct file?" & vbNewLine & oFile, "File Selection", MessageBoxButtons.YesNo)
		If oResult = DialogResult.Yes
			GoExcel.Open(oFile, "Ark1")
			iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")  
			iLogicVb.UpdateWhenDone = True
			Exit For
		End If
	End If
Next
If this solved your problem or answered your question, please click ACCEPT SOLUTION.
If this helped you, please click LIKE.
Message 12 of 12
patrickJ7ELM
in reply to: tyler.warner

patrickJ7ELM
Contributor
Contributor

Good job, i can see there are many possibilities to achieve my goal. 

 

thanks alot, i'll try to be more active on ilogic/vba as this is a very interesting subject.

0 Likes

Good job, i can see there are many possibilities to achieve my goal. 

 

thanks alot, i'll try to be more active on ilogic/vba as this is a very interesting subject.

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

Post to forums  

Autodesk Design & Make Report