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.

Adding file to representation for ECAD publishing

avillanueva
22-Sapphire I

Adding file to representation for ECAD publishing

I've been reading up on Afterhooks and post publishing so I think I am in the right area but looking for guidance as to possibility or different approaches. I have a need to combine a user generate PDF with an ECAD published representation. For quality reasons, at this time I do not think its possible to publish a good PDF off an .eda file (WYSISYG) and I have an archive of existing PDFs in representations to merge in. This is using WTDocs were the PDF might be loaded as secondary content.

I've done this manually were I created a .pvz by downloading a published ECAD representation, adding a file and reuploading as a new representation. Works as I expected in that the .eda file and the PDF are visible when you open the representation giving users a choice. The PDF is also available for download from the Representations table. Check.

I suspect that just adding a file to the Representation in code will make the PDF available for download from the Representations table but would not be visible inside of Creo View when I open the representation. I believe that the .pvs file would need to be modified to include the reference to this added file, something Creo View does when I manually added it.  Process would be that the user would add a PDF as secondary content to a WTDoc with the ECAD (OrCAD Capture or Allegro) file being primary content.  The publisher would trigger publishing to an .eda and create a thumbnail. So, is there a way I can get my cake and eat it too?

1 ACCEPTED SOLUTION

Accepted Solutions

SOLVED! I am so excited I can hardly contain myself.  avillanueva_0-1646664365843.jpeg

avillanueva_1-1646664448855.png

My AfterECRloader hook now adds the PDF to Creo View PVS structure and is accessible when you click on default representation. Process involved reading the PVS and PVM (map) files. PVS is a Structure2 file and has methods to add viewables like this:

CViewable viewable=Structure2.addViewableByViewerName(root, "document", content.getFileName(), null, 0);

You then need to update the map and write our the files.

sed2.addFileMapEntry(content.getFileName(), PublishUtils.getRefFromObject(content).substring(3),PublishUtils.getRefFromObject(rep).substring(3));

avillanueva_2-1646664837183.jpeg

Crossing fingers that this works in WC 12.

 

View solution in original post

3 REPLIES 3

Well, this turned out as expected. Afterhook code is here (https://www.ptc.com/en/support/article/CS348518)

but I had to modify to copy file from attachments into secondary content of the representation as shown below. This matches manner in which my CAD drawings have secondary PDF files created from the default HGPL. Check. I have not yet solved auto-publishing PDFs from OrCAD and to keep same consistent quality, it will be a manual task for now. 

avillanueva_0-1646142776774.png

I would note that on the same page where you see this representation, above it is the secondary attachments showing the same PDF file. A bit of redundancy, I get it. As I expected, the PDF does not appear in Creo View when you open the ECAD representation. Why? The PDF file was not added to the .pvs file. I have yet to solve that part. Next step is this:

https://www.ptc.com/en/support/article/cs252900?language=en&posno=3&q=add%20file%20to%20.pvs&source=search

SOLVED! I am so excited I can hardly contain myself.  avillanueva_0-1646664365843.jpeg

avillanueva_1-1646664448855.png

My AfterECRloader hook now adds the PDF to Creo View PVS structure and is accessible when you click on default representation. Process involved reading the PVS and PVM (map) files. PVS is a Structure2 file and has methods to add viewables like this:

CViewable viewable=Structure2.addViewableByViewerName(root, "document", content.getFileName(), null, 0);

You then need to update the map and write our the files.

sed2.addFileMapEntry(content.getFileName(), PublishUtils.getRefFromObject(content).substring(3),PublishUtils.getRefFromObject(rep).substring(3));

avillanueva_2-1646664837183.jpeg

Crossing fingers that this works in WC 12.

 

Hi @avillanueva 

good Job.

PetrH

Top Tags