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: 

Dear Gurus :)

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
144 Views, 4 Replies

Dear Gurus :)

To start this thread, I'm going to ask a simple question 🙂

How complicated is it to pass a text value from excel into a custom
iproperty in Inventor?

It stinks that parameters have to be numbers. I can't link parameters to the
spreadsheet because some of the values are text.

Replies are much appreciated!
4 REPLIES 4
Message 2 of 5
joeri.tuyn
in reply to: Anonymous

It is pretty simple when you use VB/VBA/.Net, BUT excel spreadsheets use different objects with each version. So to make an application universal and work in the long run, it is easier to use TAB delimited files containg all needed information. They can be opened by Excel straight away for editing if you like, and are easy to read/handle by your app.
Message 3 of 5
Anonymous
in reply to: Anonymous

Thanks for the pointer. I really appreciate it. Would you happen to know of
any good resources for Inventor VBA? Tutorials, WEBinars, books, etc.?

Thanks again.

wrote in message news:5867970@discussion.autodesk.com...
It is pretty simple when you use VB/VBA/.Net, BUT excel spreadsheets use
different objects with each version. So to make an application universal and
work in the long run, it is easier to use TAB delimited files containg all
needed information. They can be opened by Excel straight away for editing if
you like, and are easy to read/handle by your app.
Message 4 of 5
joeri.tuyn
in reply to: Anonymous

These groups and the Inventor help should do it. To get started (not tested):

Private Sub GetText()
'create a textfile that has multiple lines
'each line starts with the property name
'then a TAB (chr(9)) then the property value

Dim FileContents As String
FileContents = ReadFile("c:\Myfile.txt")

Dim Lines() As String
Dim Vals() As String
Lines = Split(FileContents, vbCrLf)

For Each Line In Lines
Vals = Split(Line, Chr(9))
If Vals(0) = "MyPropName" Then
Debug.Print "Prop value: " & Vals(1)
'grab the property in inventor and fill in the value
End If
Next
End Sub


Private Function ReadFile(FileName As String) As String
'requires a reference to the Windows Script Host Object Model
Dim FSO As New FileSystemObject
Dim tsInput As TextStream
Dim strLine As String

Set tsInput = FSO.OpenTextFile(FileName, 1)
Dim FileStr As String
Do While Not tsInput.AtEndOfStream
strLine = tsInput.ReadLine
FileStr = FileStr & strLine
Loop
tsInput.Close
Set FSO = Nothing

ReadFile = FileStr
End Function
Message 5 of 5
Anonymous
in reply to: Anonymous

Thanks again!

wrote in message news:5868237@discussion.autodesk.com...
These groups and the Inventor help should do it. To get started (not
tested):

Private Sub GetText()
'create a textfile that has multiple lines
'each line starts with the property name
'then a TAB (chr(9)) then the property value

Dim FileContents As String
FileContents = ReadFile("c:\Myfile.txt")

Dim Lines() As String
Dim Vals() As String
Lines = Split(FileContents, vbCrLf)

For Each Line In Lines
Vals = Split(Line, Chr(9))
If Vals(0) = "MyPropName" Then
Debug.Print "Prop value: " & Vals(1)
'grab the property in inventor and fill in the value
End If
Next
End Sub


Private Function ReadFile(FileName As String) As String
'requires a reference to the Windows Script Host Object Model
Dim FSO As New FileSystemObject
Dim tsInput As TextStream
Dim strLine As String

Set tsInput = FSO.OpenTextFile(FileName, 1)
Dim FileStr As String
Do While Not tsInput.AtEndOfStream
strLine = tsInput.ReadLine
FileStr = FileStr & strLine
Loop
tsInput.Close
Set FSO = Nothing

ReadFile = FileStr
End Function

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

Post to forums  

Autodesk Design & Make Report