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: 

Renaming Selected Components

10 REPLIES 10
Reply
Message 1 of 11
sanders720
333 Views, 10 Replies

Renaming Selected Components

I have some VBA code that I would like to use to rename the component name
based on selected components in my assembly. In the code below, only the
fist item is renamed, afterwhich I get a runtime error 5 - Invalid Procedure
Call or Argument. This happens when C=2 on the MsgBox line. Thus, my logic
is working great, but the program is having trouble renaming the property
for the 2nd plus item. Whaat else do I need to address here?

For C = 1 To oDoc.SelectSet.Count
Debug.Print C
MsgBox oDoc.SelectSet.Item(C).Name
oDoc.SelectSet.Item(C).Name = oDoc.SelectSet.Item(C).Name & "XXX"
Next C

Thanks in advance for any help that you can provide.
10 REPLIES 10
Message 2 of 11
avbuiten
in reply to: sanders720

Sanders, See ICF for an explanation of the problem, how to overcome this problem.

KENT, the example shows you how to avoid using the Application as an PUBLIC variable (Answer to you’re question of a few days ago)

Anton
Message 3 of 11
sanders720
in reply to: sanders720

Is there a link to the ICF, or how else might I understand where to go?

Thanks for your reply.
Message 4 of 11
avbuiten
in reply to: sanders720

Sorry Sanders, ICF is short for Inventor Customer Files, the "other" discussion group for Inventor.

Anton
Message 5 of 11
Anonymous
in reply to: sanders720

ICF is where all attachments are placed. It appears you are coming through the web side
so you could find it at the main Inventor NG page
http://discussion.autodesk.com/WebX?14@58.09OiaFgtoLg.0@.ee93814

Or for the direct links
Web
http://discussion.autodesk.com/WebX?14@186.Fx3taaT3ofu.79@.f15ad3a
Newsreader
news://discussion.autodesk.com/autodesk.inventor.customer-files



--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"sanders720" wrote in message news:f1a20f5.2@WebX.maYIadrTaRb...
> Is there a link to the ICF, or how else might I understand where to go?
> Thanks for your reply.
>
Message 6 of 11
sanders720
in reply to: sanders720

Sorry for my ignorance, but I must really be missing something here. My PC is setup to go through Outlook Express, or the Web.

But, I have no idea where to look for the answer to my question on the web. The link works great, and brings me here. Where do I go from here? In the future, is this something I should know, or do I need a link supplied to get there?

Thanks again.
Message 7 of 11
avbuiten
in reply to: sanders720

Try this:
1. Start Internet Explorer
2. copy this into the Address field(one line): http://discussion.autodesk.com/WebX?14@@.f15ad3a
3. read the post "Dec/02/03 Renaming Selected Components"

How did you came to this group?
Message 8 of 11
Anonymous
in reply to: sanders720

Your link worked great.  My
question is, how would I have found it without the link being attached in your
initial response?

 

I've been a member for a few months,
give or take.  I have been customizing our Inventor 6/7 to interface parts
with Access while simultaneously updating the properties, and create a BOM off
of the assembly drawings.  I have been in Engineering and using Autodesk
products since 1985 and customizing since 1988.  I am more fluent with
VBA for Access than VBA for Inventor. 

 


 

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Try
this:
1. Start Internet Explorer
2. copy this into the Address
field(one line):
href="http://discussion.autodesk.com/WebX?14@@.f15ad3a">http://discussion.autodesk.com/WebX?14@@....


3. read the post "Dec/02/03 Renaming Selected Components"

How did you came to this group?

Message 9 of 11
avbuiten
in reply to: sanders720

Hi Stephen,
You might be quite valuable because of you’re Access knowledge, so Welcome.

To help find you're way around in these discussion groups,
Do this:
1. Start: Internet Explorer
2. goto: http://discussion.autodesk.com/
3. select group: Autodesk Inventor
4a. select this group: Web Brouwser->Autodesk Inventor Customization
4b. select ICF group: Web Brouwser->Inventor Customer Files

Hope this helps
Anton
Message 10 of 11
Anonymous
in reply to: sanders720

Access questions, ask
away!

 

Anyhow, I would like to take my last
question one step further.  Your code for renaming occurrences worked
flawlessly!  Now, I would like to include duplicate components in the
renaming.  Inj other words, if there are three parts, say Part1:1, Part1:2,
and Part1:3 for the occurrence names, I would like to concatenate the name for
all the parts upon selecting one of them.  Perhaps there is a way to
truncate the :1, :2 and :3 and access the parts by name within the same loop to
perform this function, or another way?

 

Thanks for your responses thus
far!


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi
Stephen,
You might be quite valuable because of you’re Access knowledge,
so Welcome.

To help find you're way around in these discussion groups,
Do this:

1. Start: Internet Explorer
2. goto:
href="http://discussion.autodesk.com/">http://discussion.autodesk.com/


3. select group: Autodesk Inventor
4a. select this group: Web
Brouwser->Autodesk Inventor Customization
4b. select ICF group: Web
Brouwser->Inventor Customer Files

Hope this helps
Anton

Message 11 of 11
Anonymous
in reply to: sanders720

I did something simalar.  Creating an array
that went through and counted the names.  Then I go through again renaming
and incrementing from 1 to whatever was in the array.

 

Kathy Johnson

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

Post to forums  

Autodesk Design & Make Report