Set Filename = PartNumber(RevisionNumber)

Set Filename = PartNumber(RevisionNumber)

xavi.saus
Contributor Contributor
260 Views
1 Reply
Message 1 of 2

Set Filename = PartNumber(RevisionNumber)

xavi.saus
Contributor
Contributor

Hello all

 

I am fighting to implement a way where I am able to save a part / asm with a filename that is always depending on the partnumber + the revision number. This should work an first save and with every revision.

 

The idea is show a form before first save, where I can introduce the information, something like this, where Part Numer is a read only field, where should appear P/N(revision number):

xavisaus_0-1637586406197.png

In this case, I am using a custom iproperty called P/N to define the "raw" part number, without revisions. I do this since I want the part number to have the revision included on it, so I can keep track of everything.

 

The ideal Filename=PartNumber should be something like:

M000000(0)

where:

M000000 is the "raw" part number

(0) is the current revision

 

During first save, I need to be able to define the folder where I want to save the part.

 

By now, I am not able to define the name of the first saved part, sinde Snippet FileName is read only.

 

When I create a revision, I will use the snippet "File SaveAs" with the new revision, that I will compare first with the current one.

 

Thanks

 

 

 

0 Likes
261 Views
1 Reply
Reply (1)
Message 2 of 2

SometimesInventorMakesMeAngry
Advocate
Advocate

To get folder:

 

Dim folder as FolderBrowserDialog = New FolderBrowserDialog()
folder = ShowDialog()

 

To get iProperty:

 

Dim PN as string = iProperties.Value("Custom", "P/N")

 

Save file:

 

ThisDoc.Document.SaveAs(folder.SelectedPath + "\(" + PN + ").ipt", True)

 

0 Likes