几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » SolidWorks二次开发
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2007-09-04, 12:08 AM   #1
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
旧 2007-09-04, 12:10 AM   #2
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 回复: 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
旧 2007-09-04, 12:11 AM   #3
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 回复: 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
旧 2007-09-04, 12:13 AM   #4
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 回复: 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
旧 2007-09-04, 12:15 AM   #5
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 回复: 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
旧 2007-09-04, 12:17 AM   #6
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 回复: 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
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
How to get the boundary of any face rapidly? yogy SolidWorks二次开发 3 2007-05-20 01:36 PM
How to set tessellation quality for a face? yogy SolidWorks二次开发 1 2007-05-20 09:54 AM
How to set the tolerance parameters of Tessellate face? yogy SolidWorks二次开发 5 2007-05-20 09:10 AM
How to set the parameters of Tessellate face? huangyhg SolidWorks二次开发 0 2006-12-07 04:14 PM


所有的时间均为北京时间。 现在的时间是 04:36 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多