Somehow I dont manage to select imported 3d data and assign a specific color to it:
workPart = theSession.Parts.Work allbreps =  for feat in workPart.Features: if feat.FeatureType == "BREP": allbreps.append(feat) else: continue displayModification1 = theSession.DisplayManager.NewDisplayModification() displayModification1.ApplyToAllFaces = True displayModification1.ApplyToOwningParts = False displayModification1.NewColor = 186 displayModification1.Apply(allbreps)
The code gives me the following error message: TypeError. Expeting List of NXOpen.DisplayableObject type, found NXOpen.Features.Brep
Can someone point me in the right direction what to do?
Thanks in advance.
Solved! Go to Solution.
That error message is telling you that you need to get the underlying geometry, and set the color on the geometry object, rather than trying to set it on the feature.
Your feat variable is a reference to a feature object; try using feat.GetEntities to get the geometry that the feature created. This should get you a reference to the underlying geometry as @SteveLabout suggested.
as in :
for feat in workPart.Features: if feat.FeatureType == "BREP": allbreps.append(feat.GetEntities()) else: continue
but that gets me emty lists in "allbreps" and it isn't working either. Or do you mean something else?
I guess, I still dont get it...
In the "Getting Started with SNAP" guide, there is a section in chapter 10 entitled "Feature Display Properties'. The way these properties work in SNAP is a little different from in NX/Open, but there are many similarities, too, so the material might be useful.