yucad3d

Code Samples

Complete, runnable samples in C++, Delphi and C# — the same task in all three languages, extracted verbatim from the demo hosts shipped in examples/. Pick your language with the tabs; the choice sticks.

Create a drawing & embed the CAD window

The canonical start of every host: create the drawing, embed yucad's child window, add an entity, repaint — and destroy on shutdown. (hc_Code_CreateDrw in the VeCAD help.)

Enumerate all entities

Walk every layer and every entity, reading per-entity data (here: counting entities whose UserData equals 7).

Create a Hatch

Build a boundary from entities (arc, lines, circles, a polyline) with CadAddHatchPath, then fill it with an ANSI31 pattern.

Create Dimensions

Horizontal, vertical, aligned and 3-point angular dimensions over a polyline, using the CadAddDimPoint + CadAddDim flow.

Complex linetypes

Custom dash patterns with embedded text and Unicode glyphs (CadAddLinetype with a Vecad-style pattern string).

Block + inserts

Define a block from entities, then place single and rectangular-array references (CadAddInsBlock / CadAddInsBlockM).

Boundary trace (seed point)

Click-a-point boundary detection: two overlapping rectangles are split at their crossings and CadAddBoundary / CadAddBoundPolygon returns the minimal region enclosing the seed.

Block clip (XCLIP)

Insert a block clipped to a rectangle — only the content inside draws, and the clip round-trips to AutoCAD as a SPATIAL_FILTER.

Pline marks (GIS highlights)

Transient coloured runs and point marks along an entity's contour (CadSetPlineMark); marks are overlay chrome, never saved.

Road alignment (clothoid)

A horizontal alignment with true clothoid spiral-arc-spiral curves; query any chainage with CadRPlanGetPoint. (hc_Code_RPlan in the VeCAD help.)

Road profile (vertical curves)

PVIs joined by grades with symmetric parabolic curves; CadRProfGetY returns tangent vs curve elevations.

3D Face

A four-corner 3DFACE with one invisible edge (CadFacePutVer / CadFacePutEdge).

Park data round-trip

Attach application strings to an entity and read them back (CadEntityPutParkData / CadEntityGetParkData).

Entity intersections

All intersection points of two entities into caller arrays (CadGetInterPoints).

Extract a preview bitmap

Save the drawing, then extract a 246×190 Windows-BMP thumbnail into a caller buffer (CadExtractImage, 250 000-byte contract).

CadWin host-owned-window mode

The second integration mode: the HOST owns the window and message loop, forwards each message to CadWin*, and yucad renders offscreen OpenGL into the window's DC. Drag pans, the wheel zooms — on the same document as the main window.