Link excel cells to Inventor Drawing Text

Link excel cells to Inventor Drawing Text

kjb
Participant Participant
2,669 Views
8 Replies
Message 1 of 9

Link excel cells to Inventor Drawing Text

kjb
Participant
Participant

This should be an easy answer though perhaps not.

 

I have a piece part with a sketch on it. I would like the sketch text to read from an excel spreadsheet cell ... that's it

 

Do I need to use iLogic and iProperties? If so then I am in deep doo doo as I have no experience with either.

 

Can someone please be of assistance. If I can get one done, I can then finish the rest myself as there are quite a few to be done in this fashion.

 

Thanking you in advance.

 

Karl 

 

0 Likes
Accepted solutions (1)
2,670 Views
8 Replies
Replies (8)
Message 2 of 9

Lewis.Young
Collaborator
Collaborator

Here's a way that i think will work:

1. In the model, create a user text paramater, lets say "Excel_Text".

2. Use iLogic to read the value of a specific cell,  then set the "Excel_Text" parameter value to equal the cell value

3. In the drawing file, create a text box and then where it says "Model Parameters", click it and the drop down should show "User Parameters". Then just select the "Excel_Text" parameter and click the "Add Parameter" button

 

I haven't had time to write the code myself, but this method should work. Hope this is of help!

Message 3 of 9

johnsonshiue
Community Manager
Community Manager

Hi Karl,

 

Indeed, Lewis is right. iLogic is needed in this workflow. But, you can also reference directly from the Excel spreadsheet within drawing environment. You don't have to port it to a part. iLogic is one of the most powerful tools in Inventor. It is not that difficult to use. Certainly, it takes some time to master it but to use it for simple task like this, it should not be overwhelming. Curtis @Curtis_Waguespack, our iLogic guru on the forum might have an example.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 4 of 9

Curtis_Waguespack
Consultant
Consultant

Hi kjb,

 

Do you really need the Excel file? Or is that just what's familiar?

 

Often folks are used to using Excel simply as an input form, so the question comes out as "how do I do _____ with an Excel spreadsheet?", but in the end, we can often do it all in Inventor (with iLogic), and it's a bit simpler than using the Excel file.

 

But we can do it with Excel if needed.

 

Post back with more info about:

  • what information the Excel contains
  • what you're attempting to do as the overall goal
  • what version of Inventor are you using
  • etc.

 

And I'll try and have a look.

 

In the mean time here is a real basic iLogic video, to demonstrate how we'd used parameters and a form to get our input (without the Excel).

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

Message 5 of 9

Curtis_Waguespack
Consultant
Consultant

Hi @kjb,

 

I realized after posting earlier that your subject says "Drawing", so maybe you're just wanting to read in some project info to use in a Titleblock, etc?

 

If that's the case, then something like this will work:

 

GoExcel.Open("C:\TEMP\Test.xlsx", "Sheet1")
iProperties.Value("Project", "Project") = GoExcel.CellValue("B1") 
iProperties.Value("Summary", "Company") = GoExcel.CellValue("B2")  
iProperties.Value("Custom", "Location") = GoExcel.CellValue("B3")  

iLogicVb.UpdateWhenDone = True

 

Where the Excel file looks like this:

 

iLogic Excel Data Source.PNG

 

And the title block is set up to use the specified iproperties like this:

Title Block Setup.PNG

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 6 of 9

kjb
Participant
Participant

Hi Curtis,

 

Yes, I did mention the word Drawing in my subject line but realized later that it is incorrect, I really meant Inventor Part text. I viewed the article you sent me and I find it most interesting but that is not what I need at the moment. Thank you just the same

 

Regards,

 

Karl

 

0 Likes
Message 7 of 9

kjb
Participant
Participant

Hi Curtis,

 

To answer your question, the Excel file contains persons names only. For example:

 

Cell A1 might contain the Name: John Brown

Cell A2 might contain the Name: Michael Potter

and so on.

 

Cell B1 might contain the Name: Brian Mercer

Cell B2 might contain the Name: Jerry MacFee

and so on.

 

I am using Inventor Pro 2013

 

My overall goal:

 

I have piece parts in an assembly each sporting  3 or 4 names embedded in each part ( kind of like a tombstone ). I will constrain the parts showing their respective names from that point on wards.

 

My though was to add a sketch with text onto the part and have the excel file feed the text with info. That way I could update the spreadsheet as needed and it would update the assembly piece parts when I re-open the assembly.

 

Perhaps there is a better way to do this but the Excel file already exists with quite a few names already in it. Of course Inventor could import the file s a csv file if need be.

 

Your thoughts ?

 

 

0 Likes
Message 8 of 9

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi kjb,

 

Here's a quick video of how to set a list in a part file, it's pretty straight forward, but using this approach you'd have to have a list in each part file:

 

 

 

 

Working with an assembly is a bit more involved, here's a video (since I can't provide a example file set that you can open with your version) as well as the example rules. Note the one rule is just one line.

 

If this still doesn't meet your needs we can do the same thing using Excel. 

 

 

Get List of Components rule:

 

iLogicVb.UpdateWhenDone = True

' Get the active document.  Assumes a part document is active.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

' Get the UserParameters collection
Dim userParams As UserParameters
userParams = oDoc.ComponentDefinition.Parameters.UserParameters

'check For Parameter And create If Not found
Try
	oTest = Parameter("Component_List") 
Catch
	oParam = userParams.AddByValue("Component_List","", UnitsTypeEnum.kTextUnits)
End Try

'set reference to assembly definition
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oDoc.ComponentDefinition

'create temporary list to hold component names
Dim MyArrayList As New ArrayList

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)  
	MyArrayList.add( oOccurrence.Name )
Next

MultiValue.List("Component_List") = MyArrayList

 

Set Name to Selected Component rule:

 

Parameter(Component_List, "Engraved_Text") = Name_List

 

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 9 of 9

kjb
Participant
Participant

Hi Curtis,

 

This is precisely what I am looking for. Thank you x1000

 

My hope is that one day, I can return this favor.

 

Kindest Regards,

 

Karl