Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Refreshing a changed BRep Entity

pludikar
Collaborator

Refreshing a changed BRep Entity

pludikar
Collaborator
Collaborator

Hi,

 

I'm trying to use HoleFeatures in an add-in to put several scallops on an edge of a body face (hole center just a radius distance outside a face).  In doing so, the face loop changes and causes the BRepFace to become inValid.  I can then no longer work use the face to get, for example -.- face Normal. In particular, the face.evaluator property fails.

 

Is there any way to refresh the BRepFace, or any other BRep Entity for that matter, to make it valid again?    

 

Regards

Peter

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
0 Likes
Reply
251 Views
1 Reply
Reply (1)

pludikar
Collaborator
Collaborator

For anyone interested -

 

The solution I've come up with involves the use of attributes.  I found that a face that has changed will have a corresponding "new" face in the face's parent body and it will retain the original attributes.  It's now a question of setting the attribute, then finding it and re-referencing the face.  You need to ensure that you start off with a known state of attribute - I created a routine to clear everything.

 

I then set the attribute for the face I'm interested in, then the refresh routine finds that face and returns it.  The principle would probably work for other entities, although I suspect the face to be the area where it's most likely to be needed. 

 

It does seem to work effectively - however, if anyone has a better idea, I would love to hear for them

 

#design = app.activeProduct
def clearFaceAttribs(design): attribs = design.findAttributes("FaceFind","selected") if not attribs: return for attrib in attribs: attrib.deleteMe() def setFaceAttrib(face): face.attributes.add("FaceFind", "selected","1") def refreshFace(design): attribs = design.findAttributes("FaceFind","selected") if len(attribs) !=1: return False return attribs[0].parent

 

 

 

Regards

Peter

 

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
0 Likes