Skip to main content
10-Marble
October 19, 2023
Solved

how to get creo view URL for a representation of CAD Document?

  • October 19, 2023
  • 1 reply
  • 2000 views

HI all,

 

Using below API  I am able to get representations for EPM document. Is there any API to get creo view URL of a representation? 

 

VisualizationHelper visualizationHelper = new VisualizationHelper();
QueryResult epmReps = visualizationHelper.getRepresentations(epm);

 

Best answer by HelesicPetr

Hi @gmydoor-2 

The result of getRepresentations should contain files for Creo view.

If you need to download them then use 

 

try
{
	Representation defaultRep = RepresentationHelper.service.getDefaultRepresentation(cadDoc);
	Vector<ApplicationData> vectorOfAppData = ContentHelper.getContentListAll(defaultRep);
	Iterator<ApplicationData> appIter = vectorOfAppData.iterator();
	while (appIter.hasNext())
	{
		ApplicationData syAppData = appIter.next();
		ContentHolder holder = ContentHelper.service.getContents(defaultRep);
		final URL viewContentURL = WVSContentHelper.getViewContentURL(syAppData, holder);
		final URL downloadURL = WVSContentHelper.getDownloadURL(syAppData, holder);
	}
} catch (WTException | PropertyVetoException e)
{
	e.printStackTrace();
}

 

PetrH

1 reply

HelesicPetr
22-Sapphire II
22-Sapphire II
October 19, 2023

Hi @gmydoor-2 

The result of getRepresentations should contain files for Creo view.

If you need to download them then use 

 

try
{
	Representation defaultRep = RepresentationHelper.service.getDefaultRepresentation(cadDoc);
	Vector<ApplicationData> vectorOfAppData = ContentHelper.getContentListAll(defaultRep);
	Iterator<ApplicationData> appIter = vectorOfAppData.iterator();
	while (appIter.hasNext())
	{
		ApplicationData syAppData = appIter.next();
		ContentHolder holder = ContentHelper.service.getContents(defaultRep);
		final URL viewContentURL = WVSContentHelper.getViewContentURL(syAppData, holder);
		final URL downloadURL = WVSContentHelper.getDownloadURL(syAppData, holder);
	}
} catch (WTException | PropertyVetoException e)
{
	e.printStackTrace();
}

 

PetrH

gmydoor-210-MarbleAuthor
10-Marble
October 27, 2023

Thanks for the response. @HelesicPetr