yucad3d

Event Callbacks

yucad notifies the host by calling __stdcall function pointers the host registers — never the reverse.

Registering

Each event type has a CadOnEvent* registrar taking one function pointer. Registering again replaces the previous callback; passing null clears it. There is one callback slot per event type per process, matching Vecad.

void __stdcall onMove(YuHandle hDwg, double x, double y){ /* world coords */ }
CadOnEventMouseMove(onMove);

void __stdcall onCmdFinish(YuHandle hDwg, int cmdId){ /* command completed */ }
CadOnEventCmdFinish(onCmdFinish);

Callback contract

Event categories

CategoryExamplesFires when
PointerMouseMove, MouseDown, MouseUp the user moves/clicks in the viewport (world coordinates supplied).
SelectionEntSelect, selection-changed an entity is picked or the selection set changes.
CommandCmdStart, CmdFinish, CmdCancel an interactive command begins, commits or aborts.
Documententity added / changed / erased, modified flag, load & savethe model changes or files are read/written.
Viewzoom / pan changedthe viewport transform updates.
Custom entitiesthe CEnt* callbacks a host-defined entity needs to draw, hit-test, report properties, or be transformed (see below).

Custom entities & commands

A host can define its own entity types and commands: yucad calls back for display, grip points, hit-testing, transforms and a name/property list, and drives the whole lifecycle through the custom-entity (CEnt*) callback family and the custom-command family. This lets a host render and edit domain objects the core engine has no built-in knowledge of, while still participating in selection, undo and DXF round-tripping.

Callback signatures must match the ABI exactly — the wrong prototype corrupts the stack under __stdcall. Consult the Function Reference entry for each registrar before defining its handler.