Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iParts - Did you know?

13 REPLIES 13
Reply
Message 1 of 14
Anonymous
607 Views, 13 Replies

iParts - Did you know?

If you edit your iPart tables with Excel, you can use standard Excel
functions and user-defined VBA functions to calculate required fields?

 

Take a bolt for example.  Say column A contains the nominal size,
column B contains the length, and column C contains the filename.  Let's
say cell A2 holds '0.25-20 UNC' and cell B2 holds '2.5', and we want the
filename to read '0.25-20 UNC - 2.5 LONG'.  Instead of cutting and pasting,
you can put a formula into cell C2 that reads '=concatenate(A2, " - ", B2, "
LONG")'.  Furthermore, since it's a function, if you change the length in
B2, for example, the filename (C2) will update without having to fix it
accordingly.

 

You will have to change the cell format first in order to input a
function.  Inventor creates the cells as text, so you'll have to change the
format to something else (like "General") for Excel to interpret the
function.

 

This is just a very simple example and can be extended to a myriad of
different applications.

 

A warning comes with this tip, though - if you use Excel functions to
define a cell, you cannot edit that cell with the built-in iPart table
editor.  The cells are red and can only be modified in Excel.

 

Maybe this helps someone out there.  My apologies if this is already
common knowledge, 'cause I just figured this out on my own, and it's coming in
VERY handy.




Brian R.
Iwaskewycz

Senior Mechanical Engineer
PA Transformer
Technology, Inc.
13 REPLIES 13
Message 2 of 14
Anonymous
in reply to: Anonymous

One word of warning. I had used some VBA in a few iPart tables a couple of releases back
and it ended up causing corruption problems. The issue may be fixed now, but I haven't
checked to see 8^) If you use vba macros in Excel I would suggest making sure to delete
them once you are done.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Brian R. Iwaskewycz" wrote in message
news:F7B3CB8D2A85C37452B4B6C450D51166@in.WebX.maYIadrTaRb...
> If you edit your iPart tables with Excel, you can use standard Excel functions and
user-defined VBA functions to calculate required fields?
Message 3 of 14
Anonymous
in reply to: Anonymous

Macros (which I assume to be subs) or functions? Or doesn't it matter?

"Kent Keller" wrote in message
news:D5EB04382A6AA5D324F325A094455C1A@in.WebX.maYIadrTaRb...
> One word of warning. I had used some VBA in a few iPart tables a couple
of releases back
> and it ended up causing corruption problems. The issue may be fixed now,
but I haven't
> checked to see 8^) If you use vba macros in Excel I would suggest making
sure to delete
> them once you are done.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
Message 4 of 14
Anonymous
in reply to: Anonymous

I am pretty sure I had only used subs, but I wouldn't risk leaving any code in the iPart
Parent table. As I said, for all I know the issue could be fixed, but probably not worth
the risk.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Brian R. Iwaskewycz" wrote in message
news:45248A7D291C94358AA562E65FCD23D1@in.WebX.maYIadrTaRb...
> Macros (which I assume to be subs) or functions? Or doesn't it matter?
Message 5 of 14
Anonymous
in reply to: Anonymous

I guess I'll be the guinea pig here then. Seems to be working ok for now,
but we'll see. Thanks for the warning.

"Kent Keller" wrote in message
news:1DCE0CAC836BF464E7DEDF875B672F4C@in.WebX.maYIadrTaRb...
> I am pretty sure I had only used subs, but I wouldn't risk leaving any
code in the iPart
> Parent table. As I said, for all I know the issue could be fixed, but
probably not worth
> the risk.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
Message 6 of 14
Anonymous
in reply to: Anonymous

I wouldn't if I was you. Here is from a old post of mine, might want to keep it handy.
8^) Since they felt the issue was a OLE one I doubt it has been fixed. And trust me
fixing a bunch of library iParts is no treat.


iPart Network connection may have been lost

Tom McNeil at Autodesk has informed me of a issue that shows up on some of the iParts off
my Web site. I have not had a chance to check them all, but there are a few that have a
VBA macro in the iPart Excel table. The Macros were simple little snips of code that I
used when building the table. They should have had no affect on the part, but it appears
there is some sort of problem (if I understand correctly the problem is with OLE more-so
than anything with Inventor)

At this point I have only had time to go through a few of the parts on my site to check
them out. Consequently I have removed the iPart page until I can make sure all will be
OK.

As I understand it if you had downloaded one of the iParts with VBA in the Excel file and
been using it you would have seen the problem. It would be something along the lines of a
error message saying "Network connection may have been lost". "Not enough storage is
available to complete this operation. OK."

If you are getting any errors like that when placing iParts you can take these steps to
clean the file.

1. Open the file in question.

2. Select the iPart table, right mouse menu, select "Delete"

You will be prompted to verify that you want the iPart turned into a normal part, select
'yes'

The previously hidden embedded file is now visible under the 3rdParty folder.

By turning this table into a normal 3rdParty item, you will bypass table code that is used
to determine if the table is clean, healthy, and well structured.

This is extra layer of code was preventing us from editing Excel, since it would open and
then close Excel.

3. Select this new embedded item, right mouse menu, select 'Edit'

Excel should start and be visible in it's own window.

4. Scroll down to the bottom of the iPart table.

5. Several rows *AFTER* the last iPart row, add a value into an empty cell.

It is necessary for Excel to really think it is dirty and needs to save, and this simple
edit should accomplish that.

I am going to add to Toms notes to Press Alt F11 and double click on each of the Sheets
and "ThisWorkbook" in the Project browser window and if you see any text in any of the
pages then delete it. Close the window, and follow the rest of the steps.

6. Save and close Excel.

When Excel saves, it "migrates" it's data.

7. Back in Inventor, undo back over the Table 'Delete' so that the table reappears

Edits directly to the excel data as not part of Inventor's transacted data, so the edits
will not get undo

8. (optional) You can now removed the "bogus" cell data that was added in step #4 using
"Edit via Spreadsheet" on the iPart Table.

I will be fixing the parts from the site as time permits. I plan on also doing a little
bit of cleanup work on the tables so it may take some time. When I put them back up I will
post a list of the ones I found to have VBA in the Excel table so you won't have to
download any that didn't have problems.


I sincerely apologize for the inconvenience.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program
Message 7 of 14
Anonymous
in reply to: Anonymous

I know the error you speak of Kent but in Brian's example he's not using
VBA. He's just using the built in Excel function which we have been using
since they introduced iParts (R3/4?) so there should be no problem.

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Kent Keller" wrote in message
news:D5EB04382A6AA5D324F325A094455C1A@in.WebX.maYIadrTaRb...
> One word of warning. I had used some VBA in a few iPart tables a couple
of releases back
> and it ended up causing corruption problems. The issue may be fixed now,
but I haven't
> checked to see 8^) If you use vba macros in Excel I would suggest making
sure to delete
> them once you are done.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Brian R. Iwaskewycz" wrote in message
> news:F7B3CB8D2A85C37452B4B6C450D51166@in.WebX.maYIadrTaRb...
> > If you edit your iPart tables with Excel, you can use standard Excel
functions and
> user-defined VBA functions to calculate required fields?
>
>
Message 8 of 14
Anonymous
in reply to: Anonymous

True his examples are just Excel functions but his very first statement was
[Quote] If you edit your iPart tables with Excel, you can use standard Excel functions and
user-defined VBA functions to calculate required fields? [/Quote]

and there was talks of subs vs functions.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Sean Dotson" wrote in message
news:40C79D64603C0A04B12A4A38DFBC326E@in.WebX.maYIadrTaRb...
> I know the error you speak of Kent but in Brian's example he's not using
> VBA. He's just using the built in Excel function which we have been using
> since they introduced iParts (R3/4?) so there should be no problem.
>
> --
> Sean Dotson, PE
> http://www.sdotson.com
> Check the Inventor FAQ for most common questions
> www.sdotson.com/faq.html
Message 9 of 14
Anonymous
in reply to: Anonymous

Ah, I just skipped to the juicy part. Didn't see his mention of VBA. But
again for the record for everyone else, what he's doing is not VBA related.

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
----------------------------------------------------------------------------
------
"Kent Keller" wrote in message
news:161893CAE26758FE5C41F4DF0FBFF458@in.WebX.maYIadrTaRb...
> True his examples are just Excel functions but his very first statement
was
> [Quote] If you edit your iPart tables with Excel, you can use standard
Excel functions and
> user-defined VBA functions to calculate required fields? [/Quote]
>
> and there was talks of subs vs functions.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Sean Dotson" wrote in message
> news:40C79D64603C0A04B12A4A38DFBC326E@in.WebX.maYIadrTaRb...
> > I know the error you speak of Kent but in Brian's example he's not using
> > VBA. He's just using the built in Excel function which we have been
using
> > since they introduced iParts (R3/4?) so there should be no problem.
> >
> > --
> > Sean Dotson, PE
> > http://www.sdotson.com
> > Check the Inventor FAQ for most common questions
> > www.sdotson.com/faq.html
>
>
Message 10 of 14
Anonymous
in reply to: Anonymous

Correct, Kent. One of the functions I'm using is a user-defined VBA
function.

I wrote a simple function to make fractions in Excel appear better. In
Excel, set the cell format to Fraction, Up to 2 digits. Now type 1.5 in the
cell. It appears as "1 1/2" (note the two spaces between the 1 and the
1/2). This was enough (doesn't take much) to drive me crazy and write my
own routine that displays it without the space. The good news is that if I
do have problems with the iPart because of the VBA function, I can remove it
without having any serious negative effect on the functionality of the
iPart - just the Description field and the filename have those annoying
extra spaces in them.

"Kent Keller" wrote in message
news:161893CAE26758FE5C41F4DF0FBFF458@in.WebX.maYIadrTaRb...
> True his examples are just Excel functions but his very first statement
was
> [Quote] If you edit your iPart tables with Excel, you can use standard
Excel functions and
> user-defined VBA functions to calculate required fields? [/Quote]
>
> and there was talks of subs vs functions.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
Message 11 of 14
Anonymous
in reply to: Anonymous

How do you get the spreadsheet function to update when inserting a custom
iPart?

By way of explanation, I use custom iParts for standard materials such as
strut channel and 2X2 steel tube where you enter the length when you insert
the iPart. I then edit the part numbers for these parts to include the
length using iProperties. Since I would like to avoid having to edit the
part number each time I create a new part, spreadsheet functions seemed to
be an ideal solution.

So I set up a table for an iPart factory using Excel's text functions
(concatenate and some others) to create the correct part number, but when I
insert a custom iPart with this factory they always have the length as 36 in
the part number (36 is the default length of the iPart factory) rather than
the actual length of the custom iPart. And if I change the length, the part
number does not update. Either the function is not running when the custom
iPart is created or the part number function is not referencing the custom
length.

Any suggestions on how I can get this to work?

Sincerely,

Michael
Message 12 of 14
Anonymous
in reply to: Anonymous

Hello,
There are two places you can store VBA routines in Excel aren't there, one
being the workbook and the other being your personal.xls workbook... correct
me if I'm wrong. In the situation where VBA routines were corrupting the
IPart sheet, was the VBA routine stored in the workbook or the personal
workbook?

Just curious

Scott
Message 13 of 14
Anonymous
in reply to: Anonymous

Hi Scott

It has been a while, but as I remember it was in the "ThisWorkbook" that I placed the
code.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Scott Stubbington" wrote in message

In the situation where VBA routines were corrupting the
> IPart sheet, was the VBA routine stored in the workbook or the personal
> workbook?
>
> Just curious
>
> Scott
>
>
Message 14 of 14
Anonymous
in reply to: Anonymous

You could create any sort of function you want to generate the filename, but
it's not going to work with a custom iPart. As soon as you define a column
as a custom column (or a single cell as someone (Sean?) found), Inventor
ignores whatever is in the Filename column, and the user must manually
specify the filename and path.

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

Post to forums  

Autodesk Design & Make Report