AnsweredAssumed Answered

Emulate drag component with mouse

Question asked by Gabriele Sorrento on Jan 30, 2018
Latest reply on Jan 31, 2018 by Artem Taturevych

Hi everybody,

I am trying to emulate the component dragging in an assembly with the mouse. I will try to be more clear. Given two 3D points (start point and end point), I want to move a selected component, according to the constraints. Imagine to have a propeller, I want to set a translation from a point to another and have the rotation on its axis (I attached a picture).

Now, I found this example 2012 SOLIDWORKS API Help - Rotate Assembly Component on Axis Using IDragOperator::Drag Example (VBA) , which works fine, but has some problems in my case.

- if I set the translation as transform, the component SOMETIMES detaches from the assembly.

- Still I have not clear the difference between Drag - DragAsUi and what DynamicClearanceEnabled and DragMode really do.

- CollisionDetectionEnabled=true seems to reduce a lot the performances

- the transform matrix is a generic translation. I need to know which are the allowed movements of a point of a component.

Also, I am thinking to tackle the problem in an alternative way. I guess if it is possible to emulate the mouse drag using the mouse events (click on a 3D point and drag). Do you think it is feasible?

I would be grateful to have opinions/advices/examples from you!!