Get new part number from Excel with iLogic

Get new part number from Excel with iLogic

LSA-skan
Advocate Advocate
4,327 Views
24 Replies
Message 1 of 25

Get new part number from Excel with iLogic

LSA-skan
Advocate
Advocate

Hi

 

I have made a configurator, that defines my part. Now i would like to add some intelligence for the Save process...

 

When i activate my rule it should.:

1. Go to a Excel spreadsheet and find next Empty cell in a specific collum

2. Place Title from inventor in that empty cell

3. Return the value from the cell next to this cell

3. Use this value as the new filename for my part.

 

Example: here i would like to get the parts tile put into B3 and A3 (103) returned to Inventor as filename to my part

--------------------

     A        B       C

1  101  Title1

2  102  Title2

3  103

 

If possible, i would like to be able to adjust this alittle as i go forward in my work, so if the code could be made easy to understand, then I would be very happy.. Smiley Very Happy

 

If you only know some of the steps, i would be happy to hear about them as well... for every step made automatic i save time..!!

 

/LSA-Skan

0 Likes
Accepted solutions (1)
4,328 Views
24 Replies
Replies (24)
Message 21 of 25

LSA-skan
Advocate
Advocate
Accepted solution

Just to finish of this thread, i bring the solution im using now..

 

It works realy good, and isn't a "beast" at all... actually stating up the VBA first time in inventor take longer time than it takes to open, edit and save the Excel sheet.. 🙂 (i have set a macro for every rule i use, for faster access)

 

Hope someone other than me can benefit from this..!

 

Dim Navn As String
Dim Title As String
Dim Raavare As String
Dim Descr As String
Dim Nummer As Integer
Dim NewPN As String

Nummer = MessageBox.Show("Vil du udtage et nummer til den åbne part i 80000 nr. listen?", "Skanroll Standard",MessageBoxButtons.YesNo)
If Nummer = 6 Then
    If iProperties.Value("Summary", "Title") = "" Then
    Title = InputBox("Indtast en titel", "Titel", "")
    iProperties.Value("Summary", "Title") = Title
    Else
    Title = InputBox("Er du tilfreds med denne titel, ellers ret den", "Titel", iProperties.Value("Summary", "Title"))
    iProperties.Value("Summary", "Title") = Title
    End If
    If iProperties.Value("Custom", "Raavare") = "" Then
    Raavare = InputBox("Indtast en Raavare" & vbCr & " Raavaren er den primære beskrivelse af komponenten", "Raavare", "")
    iProperties.Value("Custom", "Raavare") = Raavare
    Else
    Raavare = InputBox("Er du tilfreds med denne tekst, ellers ret den", "Raavare", iProperties.Value("Custom", "Raavare"))
    iProperties.Value("Custom", "Raavare") = Raavare
    End If
    If iProperties.Value("Project", "Description") = "" Then
    Descr = InputBox("Indtast en beskrivelse" & vbCr & " Beskrivelsen er den sekundære beskrivelse af komponenten", "Beskrivelse", "")
    iProperties.Value("Project", "Description") = Descr
    Else
    Descr = InputBox("Er du tilfreds med denne Tekst, ellers ret den", "Titel", iProperties.Value("Project", "Description"))
    iProperties.Value("Project", "Description") = Descr
    End If

    
    
    Navn = iProperties.Value("Summary", "Title")& "" & iProperties.Value("Custom", "Raavare")& "" & iProperties.Value("Project", "Description")
    GoExcel.Open("I:\TEGNINGSNUMRE SKEMAER\Standard nummer udtagning.xlsx", "80000")
    
    NewPN = GoExcel.CellValue("L1")
    
    RowN = 2
    
    Do
    RowN = RowN + 1
    Tomcelle = GoExcel.CellValue("C" & RowN)
    Loop Until Tomcelle = ""
    
    GoExcel.CellValue("C" & RowN) = Navn
    GoExcel.CellValue("D" & RowN) = ""
    GoExcel.CellValue("E" & RowN) = ""
    Pris = InputBox("Indtast Pris", "Pris", "100")
    GoExcel.CellValue("F" & RowN) = Pris
    GoExcel.CellValue("G" & RowN) = "0"
    GoExcel.CellValue("H" & RowN) = "1"
    GoExcel.CellValue("I" & RowN) = iProperties.Value("Summary", "Author")
    GoExcel.Save()
    
    MessageBox.Show("Din Part bliver nu gemt som " & NewPN, "Dit nr.")
    
    ThisDoc.Document.SaveAs("M:\tegn\Standard bibliotek\80000 Skanroll standard\" & NewPN & ".ipt" , False)

End If
If Nummer = 7 Then
GoExcel.Open("I:\TEGNINGSNUMRE SKEMAER\Standard nummer udtagning.xlsx", "80000")
NewPN = GoExcel.CellValue("L1")
MessageBox.Show("Så er der jo ingen grund til at trykke på knappen, vel..?!" & vbCr & "Du kunne ellers have fået nr.: " & NewPN, "Tumpe")
End If
0 Likes
Message 22 of 25

binuvarkey
Advocate
Advocate

To speed up vba loading, "enable load VBA on stratup" in Application Options -> General

VBA LOAD.jpg

 

HTH

0 Likes
Message 23 of 25

LSA-skan
Advocate
Advocate

thanks alot ! That was just what i was looking for.. 😄

 

/LSA

0 Likes
Message 24 of 25

Anonymous
Not applicable
Hate to comment on a solution and this may be that I don't know the language it is written in but I can not get this ilogic to work? Is there something that I am missing? I can get the ilogic to activate but somewhere around the "Raavare" area I am either not translating correctly, or something I can't figure out. So far for the translation on this I have attempted Material, and PropertyName. Neither seem to work, I have also gone back and put in all of the native code but it will not work at this point. Thanks,
0 Likes
Message 25 of 25

binuvarkey
Advocate
Advocate

"Raavare" is a custom iProperty. Add this to your custom iProperties or remove that section from your code.

HTH

0 Likes