Skip to main content
7-Bedrock
October 31, 2012
Question

CAD Data Loaders Customization

  • October 31, 2012
  • 2 replies
  • 1722 views

Hello All,

I have Bulk CAD Data to Load in to Windchill.

OOTB there is no Loader to load Bulk CAD data.

for this how to create customized Loaders to load Bulk Cad data.

I hope this stuff is allready done by many of you.

Any Help,Material / Procedure will be grate.

Kindly Help us.

Thanks & Regards,

Vivek

2 replies

1-Visitor
August 18, 2014

Hi,

I believe the best way to do this is to write your own handler for creating EPMDocuments and use it in the NMLoader framework. One should be able to find all the necessary information in the dataLoad guide. Besides taking a look at the OOTB handler for WTParts viz- LadPart.java could help too.

For content loading, you can use the exisitng handlers and tags. These are generally used to load content in case of primary and secondary attachments for WTDocuments.

-Malavika

1-Visitor
February 25, 2016

Hi try this it will load your CAD data in Windchill

public static EPMDocument createEPMDocument( String Name, String docFile, EPMDocumentType epmDocumentType, String epmDocFileName,

  WTContainerRef epmContainerReference, Folder epmFolder, String type, String primary )

  {

  LOGGER.info("%%%%% Start Creating the EPMDocument %%%%%  ");

  try {

  EPMAuthoringAppType authoringApplication = EPMAuthoringAppType.toEPMAuthoringAppType(type);

  EPMContextHelper.setApplication(wt.epm.EPMApplicationType.toEPMApplicationType("EPM"));

  EPMDocument EPMDoc = EPMDocument.newEPMDocument(Name, docFile, authoringApplication,

  EPMDocumentType.getEPMDocumentTypeDefault(), epmDocFileName);

  EPMDoc.setContainerReference(epmContainerReference);

  FolderHelper.assignLocation((wt.folder.FolderEntry) EPMDoc, epmFolder);

  PersistenceHelper.manager.save(EPMDoc);

  uploadPrimary(EPMDoc,primary, docFile );

  return EPMDoc;

  } catch (WTException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  } catch (WTInvalidParameterException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  } catch (WTPropertyVetoException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  } catch (Exception e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  }

  return null;

  }

  static public void uploadPrimary( EPMDocument docCOUT, String path, String filename ) throws Exception

  {

    //String path = "C:\\Pad_Test.CATPart";

    File filePrimary = new File(path);

     ContentHolder content_holder = (ContentHolder) docCOUT;

     ApplicationData appData = ApplicationData.newApplicationData( content_holder );

     appData.setFileName( filename );//appData.setFileName(filePrimary.getName());

     //  debug(view,"appData.setFileName di "+filePrimary.getName());

     appData.setUploadedFromPath( filePrimary.getParent() );

     //   debug(view,"appData.setUploadedFromPath di "+filePrimary.getParent());

     InputStream is = new FileInputStream( filePrimary );

     // Start transaction

     Transaction trx = new Transaction();

     trx.start();

     // upload stream to database

     appData = ContentServerHelper.service.updatePrimary( (FormatContentHolder) content_holder, appData, is );

     //    debug(view,"appData: "+appData);

     trx.commit();

  

}