cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

We are happy to announce the new Windchill Customization board! Learn more.

Export all CAD from Windchill database

MattPat
12-Amethyst

Export all CAD from Windchill database

Hi,

One of my clients wants to shut down the old Windchill server. They probably won't use old files from the server but they want to export them and maybe use some of them in the future. 

Is it possible to export all data from Oracle Database using for example data pump and extract it? it will be possible then to open these exported files in Creo? 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
d_graham
17-Peridot
(To:MattPat)

I saw your second post regarding this.  I still think if you are simply downloading/copying the content to a folder where you can zip it a java script to do this is the way to go.

The script could add the content directly to a zip file but I'm thinking it might be good to see the files in a folder before compressing it.

 

That said, I wrote script to do it and it works fine.  I did run it on a test system with a limited amount of data and for testing I limited it to all CAD Assemblies and CAD Components (Drawings, Formats and whatever can easily be added) but even so I used a direct dB sql select statement so that the script would have no limit on the number of objects it finds.

Before

d_graham_0-1637021523942.png

 

Run script in Windchill shell.

Note the path to the file in the vault.

d_graham_1-1637021668687.png

After

d_graham_2-1637021692050.png

 

Easy way to get CAD files out of Windchill.

I can also include a log of everything that was copied including and metadata associated with each object.

I think that might be helpful too.

 

David

View solution in original post

25 REPLIES 25
BenLoosli
23-Emerald II
(To:MattPat)

The CAD data is not in Oracle, only the metadata which contains the pointer from the actual file name to the sequential numbered files in the Vault. You can open the files from the vault and the file name is in the header information.

To maintain file structures and linkages, your best method is to open each drawing in Creo and do a backup to a single folder or a folder for each drawing. This will insure that you capture all related file to the drawing. It is time consuming as I had to do this for 35 drawings that a customer wanted from us. 

Ajit_Kulkarni
14-Alexandrite
(To:MattPat)

Hello,

 

This is typical use case. If the properites wt.fv.forceContentToVault in wt.properties is set to true , all content will go to vault. Otherwise content will go to database.

 

You have below options available 

1. Take a snapshot of the system . e.g. amazon aws snapshot , vmware snapshot  along with db snapshot and then shutdown the system.

2. Export data manually in Creo

3. For larger number , you can use script like JLink script to download the files on the disk. 

 

Let me know if you need any further details.

 

Thanks and Regards

Ajit

Hi, 

thank you for your response.

Can you tell me more about JLink? I have thousands of files to download to the disk. I want only the last iteration and version of asm and prt files. 

Hello,

there is one more option that I used. From the database you can find relation between CAD Name nad file name in the Vault. So you

can write simple bat procedure do rename Vault files. Then files can be directly opened in the Creo.

 

Best regards

Hello,

In this case there is one risk. Rename in the Windchill. (change filename)

It he CAD file is renamed in the Windchill and is not opened in Creo and checkedin again, then a old file name is pointed from ASM

This cases a regeneration conflict with missing models.

 

I wanted just point to mention this issue.

 

Best Regards

 

PetrH

@HelesicPetr good point.  As such I've include in the download tool utility I wrote a log of all cadname changes in chronological order.

This will allow anyone to find the correct filename if what you described happens.

 

The log output from test system looks like this (one line per CADDocument master).

Seems to work.

 

CADName Change History for the entire database
Code author: David Graham, email: <intentionally left blank> 
Date: 2021-12-14 10:57:32.239
The first CADName on each line is the original CADName.
The last CADName on each line is the current CADName at the time of download.


dummy_part_1.prt > dummy_part_.prt > dummy_part_1_xxx.prt > dummy_part_1.prt

dummy_part_1_.prt > dummy_part.prt

123456789.prt > 23456789.prt

23456789.prt > 123456789.prt

123456789.prt > 56789.prt

dummy_part_2_.prt > dummy_part_2_123.prt

dummy_part_2_123.prt > 123456890.prt

123456890.prt > 12345.prt

12345.prt > 12345555.prt

12345555.prt > 1234.prt

mhofert
4-Participant
(To:d_graham)

How do you create the log file?

Which download tool you are talking about?

I am faced with an export, and I am very interest what you have mentioned.

You could create a Windchill Package of the data which would give you a ZIP of all the requested files.

https://www.ptc.com/en/support/article/CS22813

Hi, 

thank you for your answer. I read more about Creo Packages but where I should run the export command? Windchill Shell doesn't recognize WPCExport command. 

Thanks in advance

There is no WC shell commands for Packages. Everything is defined in the application UI.

  • Create a new package
  • Add the desired items using Collector to gather all dependencies
  • Lock the package
  • Create a delivery
  • ZIP the delivery
  • Download the ZIP

Hi Scott,

I think the package is the way I will choose. 

Is there any option to select all files from context/folder to export? In package creation, I have to choose files manually one by one, what if we have thousands of them?

Is there any automatic way? I want to export only part/assembly in the latest iteration.

The best way will be to write some customization for automatically creating a package from the product folder/context and then manually delivering a zip. 

Thanks in advance 🙂 

Scott already responded, but packages is the way I would go as well.

 

Mike C.

 

I think package is the way I will choose. I made some tests and I have another question. 

Is there any option to select all files from context/folder to export? In package creation, I have to choose files manually one by one, what if we have thousands of them? Is there any automatic way? I want to export only part/assembly in the latest iteration.

If creating a really big package, you'll want to make sure you choose an appropriate size to split up the ZIP file. If its more than a GB, the java process creating the ZIP could definitely be problematic if not assigned to its own background method server which is sized appropriately.

d_graham
17-Peridot
(To:MattPat)

Matt,

 

Is the content stored in file vaults or in BLOBs in the dB? Could be one or the other or a mixture of the two. Anything is possible.

As always, it’s a good to know the ground rules before doing anything.

 

Are you looking to get all iterations of every number?

Just the latest iteration of each revision of every number?

Just the latest iteration of every number?

 

If just latest it would be easy to write code that downloads the CAD files (with the correct filename) to a folder on a server.


If you need more that just the latest iteration I suggest appending a “.#” to the filename. For example, let’s say you have ten iterations of the same number. Save the latest widget.prt.10, the next latest as widget.prt.9, etc.

 

This can easily be automated by writing code to do the entire dB. Just write a query to get all EPMDoc masters. For each master query all iterations (or all versions whatever you need). Get the size of the query (this would be used as the number you append to the filename subtracting 1 for each iteration).

Loop thru the iteration query streaming the content to your folder with the appropriate filename.

If ten iteration the query size is 10 so the first iteration streamed is <filename>.10, the second is <filename>.9, etc.

 

I would also suggest having the code write a log that records the filename version.iteration (and any other metadata you’d be interested in).

 

Thats how I’d do it. Wouldn’t take much to write it either. Run it from a Windchill shell and your done 👍


Hope this is helpful.

If you decide to go this route and need help with the code let me know.

 

David

dnordin
15-Moonstone
(To:MattPat)

Since you are just looking to export the latest of the .asm and .prt files, I'd suggest the following as an alternative method to packages or custom programming. Also, I believe that packages have a limit to the number of items that can be included in the package, but that would need to be verified.

 

1. Modify the limit on the number of resulting items in a search and table display. This will allow you to search for all .asm and .prt files and get the results in a single search results table.
2. In a Creo Parametric session, search for all objects of type CAD Document. Since you've specified searching for just CAD Documents, you can set the criteria to "Filename=*.asm" or "Filename=*.prt". [If you want the drawings, skip the criteria settings and just use a keyword of *]. You can save the search if you plan on running this multiple times [for testing, etc.].
3. Change the search results table display to include the location [full context folder path] of the objects, and the filename [not the name or number, but the real Creo Parametric filename]. You should also include any other columns that are of interest; name, number, description, version, last modified, etc.
4. Export the search results table to a .csv file. This file can be used as a record of what was in the database that includes some of the database metadata (the columns you added to the search table results).
5. Add everything in the search results table to a new workspace (WS). No dependents (because you searched for everything), no drawings, no family table, no generics (if you have nested family tables), and latest iteration. If your family tables are clean, there should be no conflicts/errors.
6. You should now have every .asm and .prt file in a WS. Modify the WS table display to only show CAD Documents and filter out family table instances [Instance NE Yes] because family table instances don't have a real file to export. Include the filename and location again.
7. Save the table display to a .csv file. This will serve as a record of what was actually exported. It can also be used later to build a folder structure identical to the Windchill folder structure.
8. Export everything from your WS. No dependents, no drawings, no secondary content, etc.
9. You now have every .asm and .prt file in a single directory on your hard drive. Compare the directory listing against the WS .csv file to validate that everything was successfully exported.
10. Optionally, you can create a small script to recreate the folder structure from Windchill on disk and move the exported files into the appropriate folders. The WS .csv file contains the "location" information from Windchill along with the filename.

 

Regards,

 

Dan N.

d_graham
17-Peridot
(To:MattPat)

I saw your second post regarding this.  I still think if you are simply downloading/copying the content to a folder where you can zip it a java script to do this is the way to go.

The script could add the content directly to a zip file but I'm thinking it might be good to see the files in a folder before compressing it.

 

That said, I wrote script to do it and it works fine.  I did run it on a test system with a limited amount of data and for testing I limited it to all CAD Assemblies and CAD Components (Drawings, Formats and whatever can easily be added) but even so I used a direct dB sql select statement so that the script would have no limit on the number of objects it finds.

Before

d_graham_0-1637021523942.png

 

Run script in Windchill shell.

Note the path to the file in the vault.

d_graham_1-1637021668687.png

After

d_graham_2-1637021692050.png

 

Easy way to get CAD files out of Windchill.

I can also include a log of everything that was copied including and metadata associated with each object.

I think that might be helpful too.

 

David

HJ1
15-Moonstone
15-Moonstone
(To:d_graham)

Hi!

A bit off topic, but related to extracting data...

We're possibly coming up with a requirement to extract pdf-files from Attachments of EPMDoc drawings and the same for wtDocuments linked to a wtPart structure. Extract would be 'triggered' from a subassembly or the top wtPart. Drawings are with Calculated association to wtPart and wtDocs with Referenced by links. Also, we're using baselines to capture the BOM and the above mentioned content versions which should be considered.

 

Based on your experiences to extract files do you see the above doable?

 

d_graham
17-Peridot
(To:HJ1)

@HJ1 , the answer to your question is yes.

All of what you describe is very doable. As long as there is sound logic provided (which you have 👍) code can be written to get the attachments you described.

 

How do you intend to trigger the ‘extraction’ of the attachments? Admin runs code in Windchill shell? User runs code from the part’s page?

 

If you need help with this let me know.

 

David

 

PS

Interesting that you mention how you’re capturing the BOM. I just wrote a utility to display a “released” part structure where the parts’ lifecycles each include multiple states that are considered “released” states.

 

 

BTW, for those of you following this post. The original poster has subsequently told me that the data he needs to get out of the database is in fact stored in BLOBs in the dB not in file vaults. Therefore I adjusted my code to work regardless of where the data is stored. Could be in BLOBs, file vaults or a combination of the two. Now it’s bombproof 😀

HJ1
15-Moonstone
15-Moonstone
(To:d_graham)

Hi,

ok, easy if you know your stuff..    😎

I'm not exactly sure yet where and who would trigger the extraction... but let's say ideally it's the user, either

- user triggers from the part's page or

- user triggers from intranet page in SharePoint...

somehow I think the realistic alternative is that admin runs the code and delivers the data to a location users can access...

 

If I need help with this, well, yes, nobody in the company knows coding well enough, but there's a lot of opinions how data should be collected from Windchill and all of them require something else than OOTB or Navigate.

 

P.S.

"Interesting that you mention how you’re capturing the BOM. I just wrote a utility to display a “released” part structure where the parts’ lifecycles each include multiple states that are considered “released” states."

 

I didn't quite understand this, but managing the evolving BOM with baselines is somewhat uncomfortable given Windchill's default behaviour to display the latest if you don't use the proper filter. Sometimes makes me wonder if that's the right approach at all.

 

 

 
Hi, I would be really interested in the script for copying the cad documents contained in Windchill to disk, I was wondering if you are available to share it, thanks. Alternatively how to contact you privately. Greetings

Hi @NinoDiPietranto 

Here is an Afteloader class that can save an additional files to a disk.

If you want you can rewrite the code to save a Primary file instead of the additional files.

https://www.ptc.com/en/support/article/CS348848

PetrH

@NinoDiPietranto , hi

 

I can be reached via email at windchill.developer@yahoo.com 

 

I’ve a lot of code I’ve written over the years and I continue to write more as the need arises.

 

David

avillanueva
22-Sapphire I
(To:MattPat)

Just out of curiosity, how many CAD objects are there in the server?  That could guide your decision. What CAD type?

Hi, document of approximately 260,000 each
Top Tags