Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

problem in getting csys of assembly component

Valued Contributor
Valued Contributor

I have assembly in the following order:

I have added Components from  workPart.ComponentAssembly.AddComponent() 

 

1. Component1                           ---> Root component

      a. Component2                     ---> Sub assembly i.e child of Component1

           i. Component3                 ---> child of Component2

           ii.Component4

 

when i try to get DatumCsys which is a Feature of component3 , it says zero features found.

How do i get DatumCsys.?

I am using following code for that:

foreach (Component component in Component2.GetChildren())
{
    foreach (Feature feature in (Part)component.Prototype).Features.GetFeatures())                                                                   
     {
          datumlist.Add(feature);
     }
}

 

4 REPLIES 4

Re: problem in getting csys of assembly component

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

The component part file needs to be fully loaded before you can access the feature data. If you are using partial loading (or the component failed to load for any reason), the feature data won't be available to you.

Re: problem in getting csys of assembly component

Valued Contributor
Valued Contributor

i have also checked the load status for sub-assembly and individual comoponents.

result is always true;

bool owningPartIsFullyLoaded = Component2.OwningPart.IsFullyLoaded;   // result is always true

foreach (Component component in Component2.GetChildren()) {
bool partIsFullyLoaded = component.OwningPart.IsFullyLoaded; // result is always true foreach (Feature feature in ((Part)component.Prototype).Features.GetFeatures()) { datumlist.Add(feature); } }

Re: problem in getting csys of assembly component

Valued Contributor
Valued Contributor
Solved...!!!
I used

theSession.Parts.EnsurePartsLoadedFully(partstoLoad, true);

Re: problem in getting csys of assembly component

Valued Contributor
Valued Contributor
Thanks.