几何尺寸与公差论坛

 找回密码
 注册
查看: 2610|回复: 5

How to get name of face?

[复制链接]
发表于 2007-9-4 00:08:32 | 显示全部楼层 |阅读模式
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
 楼主| 发表于 2007-9-4 00:10:36 | 显示全部楼层

回复: 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
 楼主| 发表于 2007-9-4 00:11:54 | 显示全部楼层

回复: 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
 楼主| 发表于 2007-9-4 00:13:02 | 显示全部楼层

回复: 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
 楼主| 发表于 2007-9-4 00:15:00 | 显示全部楼层

回复: 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
 楼主| 发表于 2007-9-4 00:17:21 | 显示全部楼层

回复: 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-22 19:10 , Processed in 0.038632 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表