![]() |
How to get name of face?
Date Opened : 9/7/2006 05:46:53 AM
Summary : How to get name of face ? [SR-1-349760789] Description : How to get name of face? my code is as follows. code: // get the active model doc LPDISPATCH dModelDoc = SLDWORKS->GetActiveDoc(); // A PartDoc is derived from a ModelDoc IPARTDOC swPartDoc(dModelDoc); // …… // LPDISPATCH dBody // get a body // ....... LPDISPATCH dFace; IBODY swBody(dBody); dFace = swBody.GetFirstFace(); CString name = swPartDoc.GetEntityName (dFace); Question: When the above code is compiled, name is NULL, in other words, I can't get the NAME of FACE and complie process is very slow. Yanhua |
回复: How to get name of face?
Dear Yanhua,
You are using the correct methods to retrieve the name. Can you send me a drawing so I can verify the problem? I don't know why its compiling slow. Regards, Robin |
回复: How to get name of face?
Dear Yanhua,
Thank you for your patience so far. I have attached a simple drawing in which all the faces have names (listed below). Try running your program on this drawing. If the face names are returned then you'll know your program is working correctly. If it still returns NULL, send me the complete code of that function. So far, on the drawing you sent me none of the faces have names. I'll continue to process the drawing and let you know what I find. Entity Name = FaceName Entity Name = FaceName0.533424 Entity Name = FaceName0.5795186 Entity Name = FaceName0.2895625 Entity Name = FaceName0.301948 Entity Name = FaceName0.7747401 Regards, Robin Richter |
回复: How to get name of face?
Dear Yanhua,
I checked all the faces of the part you sent me. None of them have names. That may explain why your program isn't working. Let me know if the drawing I sent earlier works with your program. Regards, Robin Richter |
回复: How to get name of face?
Dear Yanhua,
The only way I can find to check all the names is to iterate thru the faces and check for NULL values or empty strings. Is it possible to use the face IDs in your application? I pasted in some information about the IDs below. SolidWorks uses the face ID to track the specific faces of imported bodies (for example, IGES imports). The face ID is a persistent ID that is not saved with the document. Any third party application can change the face ID. The intent is that you will assign an ID value to a particular face so that you can refer to that face within your application. Each ID value must be unique, so it is best to let SolidWorks assign ID value for you when an imported body or surface is created. Use the Attribute object to store data with a face. Regards, Robin Richter |
回复: How to get name of face?
Dear Yanhua,
I tried to email two examples from our website (http://www.solidworks.com/pages/services/APISupport.html). But the email was rejected. You can go the website and download the examples. Unfortunately, all the Attributes examples are in VB. However, they should give you an idea of how to use Attributes. There are also two VB examples in our documentation. Regards, Robin Richter |
所有的时间均为北京时间。 现在的时间是 07:42 PM. |