Changing the name of an ipt

Changing the name of an ipt

Anonymous
Not applicable
650 Views
4 Replies
Message 1 of 5

Changing the name of an ipt

Anonymous
Not applicable
Hi everyone! I was wondering if anyone can help me out. I have a part named
Part1.ipt, Part1.idw has views created from Part1.ipt. What I would like to
do using Visual Basic is rename Part1.ipt to Part1_RevA.ipt (Done), and then
I would like to change Part1.idw so it references Part1_RevA.ipt instead of
Part1.ipt. I'm trying to do this all through the Aprentice. Is this even
possible? Thank you for your help.

-Chuck Elliott
-Technical Consultant / VB Programmer
-MGB Systems, Inc.
0 Likes
651 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Yes it is possible, and rather simple.

You have to use the PutLogicalFileNameUsingFull method.

Here is an example (oDoc is your idw):

Dim oRefFileDescs As InventorApprentice.ReferencedFileDescriptors
Dim oRefFileDesc As InventorApprentice.ReferencedFileDescriptor
Set oRefFileDescs = oDoc.ReferencedFileDescriptors

'Check there's something
If Not oRefFileDescs Is Nothing Then
If oRefFileDescs.Count > 0 Then
' Iterate through the references looking for a
' reference to a specific file.
For Each oRefFileDesc In oRefFileDescs
If LCase(oRefFileDesc.FullFileName) =
LCase(sOldIptFullFileName) Then
' Replace the reference.
Call
oRefFileDesc.PutLogicalFileNameUsingFull(sNewIptFullFileName)
Exit For
End If
Next
End If
End If

If you know that you have only one referenced file (your Ipt), you could
probably avoid steping through all the ReferencedFileDescriptors, just set
oRefFileDesc = oDoc.ReferencedFileDescriptors(1)

Enjoy!

M (from M & X)

"Chuck Elliott" a écrit dans le message news:
EAD094579E521DBEC3F430EAF36566C8@in.WebX.maYIadrTaRb...
> Hi everyone! I was wondering if anyone can help me out. I have a part
named
> Part1.ipt, Part1.idw has views created from Part1.ipt. What I would like
to
> do using Visual Basic is rename Part1.ipt to Part1_RevA.ipt (Done), and
then
> I would like to change Part1.idw so it references Part1_RevA.ipt instead
of
> Part1.ipt. I'm trying to do this all through the Aprentice. Is this even
> possible? Thank you for your help.
>
> -Chuck Elliott
> -Technical Consultant / VB Programmer
> -MGB Systems, Inc.
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Hi All.

Changing file names from Apprentice is pretty cool, but is the same function available from within Inventor, from an assembly file say. PutLogicalFilename...seems to be avalable from Apprentice only. If renaming an '.ipt' file from within an assembly can be done, would someone have a piece of sample code, similar to the Apprentice version posted by M&X?

Thanks
Rwollen
0 Likes
Message 4 of 5

Anonymous
Not applicable
No it is not available in the Inventor
Object.

 

If you look at the Inventor Programming Help, in
Apprentice Server, you will find the following stated:

 

There are a few things that can only be done using Apprentice. These are
all things that cause problems when the file is open in Inventor but can be
easily accomplished when accessed through Apprentice. One of the most important
of these is the ability to change file references. This is a critical part of
Apprentice that Design Assistant uses. For example, let's say you have an
assembly that contains Part1 and Part2. Part1 needs to be revised so you make a
copy of the file, give it a new name, make the changes to the part, and save it.
When you open the assembly it's still referencing the old file. The file
reference portion of the API allows you to change the reference within the
assembly so that it's pointing to the file that represents the revised version
of Part1.

 

That's all I can tell you, but I hope this answers
your question.

 

M from M&X

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi
All.

Changing file names from Apprentice is pretty cool, but is the same
function available from within Inventor, from an assembly file say.
PutLogicalFilename...seems to be avalable from Apprentice only. If renaming an
'.ipt' file from within an assembly can be done, would someone have a piece of
sample code, similar to the Apprentice version posted by M&X?

Thanks
Rwollen

0 Likes
Message 5 of 5

Anonymous
Not applicable
You could use the replace method - but you'll lose
any adaptivity in the part - also, if you do decide to use the apprentice server
- be careful with derived parts - it doesn;t appear you can change the reference
of the base part within the derived part...


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi
All.

Changing file names from Apprentice is pretty cool, but is the same
function available from within Inventor, from an assembly file say.
PutLogicalFilename...seems to be avalable from Apprentice only. If renaming an
'.ipt' file from within an assembly can be done, would someone have a piece of
sample code, similar to the Apprentice version posted by M&X?

Thanks
Rwollen

0 Likes