yucad3d

3D Face

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

// 3DFACE: a quad with one invisible edge.
static void feat_face() {
    samp_clear();
    int f = CadAddFace(g_hDwg);
    if (!f) { set_status(L"CadAddFace failed"); return; }
    CadFacePutVer(f, 0, 0, 0, 0);  CadFacePutVer(f, 1, 50, 0, 0);
    CadFacePutVer(f, 2, 62, 38, 0); CadFacePutVer(f, 3, 8, 42, 0);
    CadFacePutEdge(f, 1, 0);                             // hide edge 1->2
    CadUpdate(g_hDwg); samp_zoom_ext();
    wchar_t s[160]; swprintf(s, 160,
        L"CadAddFace: 4-corner 3DFACE, edge 1 hidden (verts=%d, edge1=%d)",
        CadFaceGetNumVers(f), CadFaceGetEdge(f, 1));
    set_status(s);
}
    7:                                            // 3DFACE
      begin
        CadPurge(FhDwg, CAD_CLEAR_ENTITIES);
        f := CadAddFace(FhDwg);
        if f = 0 then begin StatusBar.SimpleText := 'CadAddFace failed'; Exit; end;
        CadFacePutVer(f, 0, 0, 0, 0);   CadFacePutVer(f, 1, 50, 0, 0);
        CadFacePutVer(f, 2, 62, 38, 0); CadFacePutVer(f, 3, 8, 42, 0);
        CadFacePutEdge(f, 1, 0);
        CadUpdate(FhDwg); CadExecute(FhDwg, FCadHwnd, CAD_CMD_ZOOM_EXT);
        StatusBar.SimpleText := Format('CadAddFace: 4-corner 3DFACE, edge 1 hidden (verts=%d, edge1=%d)',
                                       [CadFaceGetNumVers(f), CadFaceGetEdge(f, 1)]);
      end;
    private void FeatFace()
    {
        SampleClear();
        var f = YuCadApi.CadAddFace(_hDwg);
        if (f == 0) { SetStatus("CadAddFace failed"); return; }
        YuCadApi.CadFacePutVer(f, 0, 0, 0, 0);   YuCadApi.CadFacePutVer(f, 1, 50, 0, 0);
        YuCadApi.CadFacePutVer(f, 2, 62, 38, 0); YuCadApi.CadFacePutVer(f, 3, 8, 42, 0);
        YuCadApi.CadFacePutEdge(f, 1, 0);
        YuCadApi.CadUpdate(_hDwg); SampleZoomExt();
        SetStatus($"CadAddFace: 4-corner 3DFACE, edge 1 hidden (verts={YuCadApi.CadFaceGetNumVers(f)}, edge1={YuCadApi.CadFaceGetEdge(f, 1)})");
    }
This code is extracted verbatim from the shipped demo hosts (examples/cpp, examples/delphi, examples/csharp) — run the matching menu item there to see it live.