Cancel State Change via API

Is there a way to cancel a user initiated state change via the Enterprise PDM API?  I am performing some work in response to the EdmCmdType.EdmCmd_PreState event, and I would like to cancel the state change in certain circumstances.  Throwing a COMException from my C# code works, but seems like a kludge.

Jim S.

SolidworksApi macros
Answers 1
JS
JS 2011-04-12 Best Answer

I found the answer here:

Solution Id:       S-034039

Product:       SolidWorks Enterprise PDM 2009 CAD Editor

Updated:       5/18/2009 02:24:16 PM

Area:       PDMWorks Enterprise

Sub-Area:       API

Question:       How is the Enterprise PDM operation cancelled/stopped via an API add-in if a EdmCmd_prexxx OnCmd hook is being used (for example EdmCmd_PreState, EdmCmd_PreAdd,EdmCmd_PreCopy) ?

Answer:       To stop an EdmCmd_prexxx hook, use poCmd.mbCancel = True.

Jim S.