Cancel
Showing results for 
Search instead for 
Did you mean: 

All _Planningpart

Pioneer
Pioneer

Hello, 

i have tried this way to get all planning parts, but i could nt get it. Can somebody help me?

 

 

private TxObjectList GetListOfParts()
{
TxObjectList parts = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxComponent)));
TxObjectList pla = parts.PlanningRepresentations;
TxTypeFilter partsFilter = new TxTypeFilter(typeof(TxPlanningPart));
TxObjectList plan = partsFilter.Filter(pla);
TxObjectList pParts = plan.EngineeringRepresentations;
return pParts;
}

private void button2_Click(object sender, EventArgs e)
{
GetListOfParts();
}

2 REPLIES

Re: All _Planningpart

Legend
Legend

Hello @ChristyBell

 

Have you tried to return the object list in your button click event and check if the objects are inside of it?

 

private void button2_Click(object sender, EventArgs e)
{
TxObjectList list = GetListOfParts();
}

Regards!

Re: All _Planningpart

Pioneer
Pioneer

Hi @FredCastro,

sorry Fred, I thought ,your given command will work. But it did not worked. In Forum i found that method is right. So what should be the problem in my study, that i donot get list of any objects of particular type. Can you give some ideas to solve it? 

TxObjectList robot = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxPlanningPart)));
private TxObjectList GetListOfParts()
        {
            TxObjectList parts = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(TxComponent)));
            TxObjectList pla = parts.PlanningRepresentations;
            TxTypeFilter partsFilter = new TxTypeFilter(typeof(TxPlanningPart));
            TxObjectList plan = partsFilter.Filter(pla);
            TxObjectList pParts = plan.EngineeringRepresentations;
            return pParts      ;   
        }
private void button2_Click(object sender, EventArgs e)
        {
            TxObjectList list = GetListOfParts();
        }

 

Can you also suggest whatare differance between above two code interms of output?