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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How do you add baseline to package

mpoorman
1-Visitor

How do you add baseline to package

I am trying to add a baseline that I have created to a package. While in folder that the baseline exists, I have the baseline checked, go up to the actions drop down, select add to package only to get the error show in picture. For those that cannot open picture, it is a window that in window heading reads " Message from webpage" in message area, there is a yellow triangle with exclamation mark and reads " One or more objects cannot be added to the set of initially selected objects because it is not a valid object type" Not sure why I am getting this.

Any help would be appreciated.

Thanks

Mark

4 REPLIES 4
LoriSood
22-Sapphire III
(To:mpoorman)

What kind of objects are in the baseline you are adding?

What version of Windchill are you running?

I was able to successfully add a managed baseline to a package  that contained a WTPart and a CAD Document in Windchill PDMLink 10.2 M030.

Lori, thanks for the interest.

I am running Windchill PDMLink 10.0 M030. And the baseline is made up of .prt, .asm, and .drw files.  I am simply trying to add the baseline to a package via the drop down menu, but keep getting the error. I do have call in to PTC, but having to send them method logs and such, still waiting for results from them. Any input would be appreciated.

Mark, Did you tried to add it from within the package? Add to Package from package context, and pick the baseline.

Hello Mark,

If your open to customization, you can try below code snippet.

Feel free to reply if you have any questions on below code,

Thanks,

Shirish

/**

*  This class will add Managed Collection to Work Package

*/

package ext;

import wt.facade.persistedcollection.PersistedCollectionHelper;

import wt.facade.persistedcollection.PersistedCollectionRecipe;

import wt.fc.ObjectIdentifier;

import wt.fc.PersistenceHelper;

import wt.fc.QueryResult;

import wt.pds.StatementSpec;

import wt.query.QuerySpec;

import wt.query.SearchCondition;

import wt.util.WTException;

import com.ptc.core.managedcollection.ManagedCollectionImpl;

import com.ptc.windchill.wp.WorkPackage;

/**

* @author smorkhade

*

*/

public class addMCtoWKPCKG {

    /**

     * @param args

     * @throws WTException

     */

    public static void main(String[] args) throws WTException {

       

        QuerySpec qs = new QuerySpec(ManagedCollectionImpl.class);

        SearchCondition sc = new SearchCondition (ManagedCollectionImpl.class ,ManagedCollectionImpl.NAME, "LIKE", "%Newellco%");

        qs.appendWhere(sc, new int[]{0});

        QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);

        System.out.println("Total Number of Objects retrieved -> "+ qr.size());

        ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("com.ptc.windchill.wp.WorkPackage:187336");

        WorkPackage wpkg = (WorkPackage)PersistenceHelper.manager.refresh(oid);

           

        while (qr.hasMoreElements()){

           

            ManagedCollectionImpl mc = (ManagedCollectionImpl)qr.nextElement();

           

            PersistedCollectionHelper.service.checkout(wpkg);

            PersistedCollectionHelper.service.addSeed(wpkg, mc);

           

            PersistedCollectionRecipe recipe = PersistedCollectionHelper.service.getRecipe(wpkg);

            if (recipe == null)

            {

                recipe = PersistedCollectionRecipe.newPersistedCollectionRecipe();

                PersistedCollectionHelper.service.setRecipe(wpkg, recipe);

            }

            wpkg = (WorkPackage)PersistedCollectionHelper.service.refreshMembers(wpkg, "AddToManagedCollection");

           

            PersistedCollectionHelper.service.checkin(wpkg);

        }

        // PersistenceHelper.manager.modify(wpkg);

        System.out.println(qr.size()+" Managed Collections are added succesfully to Work Package");

    }

}

Announcements


Top Tags