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

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   SolidWorks二次开发 (http://www.dimcax.com/hust/forumdisplay.php?f=111)
-   -   Earl,how to resolve the error as "Unable to read write-only property"? (http://www.dimcax.com/hust/showthread.php?t=734)

yogy 2007-05-20 09:47 AM

Earl,how to resolve the error as "Unable to read write-only property"?
 
Q:
Subject: Earl,how to resolve the error as "Unable to read write-only property"? SR:1-407938223

Dear,

Thanks.

But, I get an error as “Unable to read write-only property” when add a call to body.EnumFaces. How to resolve the error?

My code as fllows:

LPUNKNOWN pFaces = NULL;
pFaces = swBody.EnumFaces();
LPDISPATCH *dFaces = NULL;
pFaces->QueryInterface(IID_IDispatch, (LPVOID*)&dFaces);

Sence:

SW API OLE & VC++

Yogy

yogy 2007-05-20 09:48 AM

回复: Earl,how to resolve the error as "Unable to read write-only property"?
 
R:
Hello,

Ah. It looks like you are using the older swdisp.h and swdisp.cpp interfaces for SW. In that case, you might look at using:



#import “sldworks.tlb” raw_interfaces_only



LPDISPATCH pDisp = swBody;

SldWorks::IBody2 *comBody;

pDisp->QueryInterface(__uuidof(SldWorks::IBody2), (LPVOID*)&comBody);



SldWorks::IEnumFaces2 *comEnumFaces;

comBody->get_IEnumFaces(&comEnumFaces);

// … do your work…



This will allow you to get to the COM version of the object and work with it directly. Be sure to call the object’s Release() method when done with each object.





Regards,

-Earl


所有的时间均为北京时间。 现在的时间是 11:51 PM.