几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】undo objects in the api (http://www.dimcax.com/hust/showthread.php?t=4955)

yang686526 2009-04-12 10:43 PM

【转帖】undo objects in the api
 
"undo objects" in the api
has anyone developed an addin which creates something new in the sw part and adds it to the undo queue so that it's undo-able by the user?
there's some documentation about undo objects, but i'm not quite sure i understand how it works.
i'm using sw2009 and my addin is developed in c++, but any examples in that language would be best, but i won't be choosy.
pete rimkus
cnc software, inc.
(pete.rimkus@mastercam.com)
hi,
swmodeldocext.startrecordingundoobject
'do the task
swmodeldocext.finishrecordingundoobject ("api undo")
scott,
thanks, but isn't there more than that? i've put that code around some simple isketchmanager::createline() calls and undo is not available afterwards.
the connection between these 2 functions and imodeldocextension::setapiundoobject() is not clear to me...the "startrecording" and "endrecording" functions dont explicitly require that the undoobject or it's handler be defined, but since i have not done that, maybe that's why undo isn't available to me. when i debug finishrecordingundoobject() returns a result of s_false.
if this is the case, exactly what should my handler look like?
if this is not the case, what else might i be doing wrong?
---edited----
more to the point, what would a c++ handler look like?
pete rimkus
cnc software, inc.
(pete.rimkus@mastercam.com)
edited: 11/24/2008 at 02:40 pm by pete rimkus
quick


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