SmApiGeneral.h#

Fully qualified name: SM_API/inc/SmApiGeneral.h

File members: SM_API/inc/SmApiGeneral.h

// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

/**********************************************************************
FILE NAME: SmApiGeneral.h

PURPOSE:
    Contains popular high level "C" type functions of general use.

GENERAL NOTES:
    High level functions may assume some input parameters
    for ease of use. For maximum flexibility, related functions
    can be found in SMLib, etc
**********************************************************************/

#ifndef __SmApiGeneral_H__
#define __SmApiGeneral_H__

#ifndef __SmApiTypes_H__
#include <SmApiTypes.h>
#endif

#include <SmCoreTypes.h>

class SmBrep;
class SmFace;
class SmContext;
class SmObject;
class SmPolyBrep;
class SmSurface;
class SmBSplineCurve;
class SmCurve;
class SmAxis2Placement;
class SmVector3d;

// Context and concurrency: many SM_API operations use the process-global default
// SmContext (SmApiGetOrCreateContext()), whose traversal mark counters are unlocked.
// Some operations use other contexts; this does not make arbitrary SmApi* calls
// safe to run concurrently in one process. Use one worker process per concurrent
// job, with a long-lived default context. In the shipped build, caches belong to
// objects, so context lifetime alone does not preserve them across object
// replacement. Context-owned SmGlobalCache queues require SM_USE_GLOBAL_CACHE,
// which is disabled by default. Operations run single-threaded in the shipped
// build. Lazy initialization is not synchronized: call SmApiCreateContext() once
// at startup before spawning threads. See .agents/operations/concurrency.md.
SMAPI_EXPORT void SmApiCreateContext();
SMAPI_EXPORT SmContext* SmApiGetOrCreateContext();

SMAPI_EXPORT SmApiStatus SmApiDraw(
    SmBrep* pBrep,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    SmFace* pFace,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    SmCurve* pCurve,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    SmSurface* pSurface,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    const SmTArray<SmCurve*>& pArray,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    const SmTArray<SmPoint3d>& pArray,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    const SmPoint3d& rBasePt,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false );

SMAPI_EXPORT SmApiStatus SmApiDraw(
    const SmPoint3d& rBasePt,
    const SmVector3d& rDirection,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiDraw(
    SmPolyBrep* pPolyBrep,
    const SmVector3d* pColor = NULL,
    SmBoolean bClearFirst = false,
    SmBoolean bCenter = false
);

SMAPI_EXPORT SmApiStatus SmApiTransform(
    SmObject* pObj,
    const SmAxis2Placement & rRotateMove
);

SMAPI_EXPORT SmApiStatus SmApiScale(
    SmObject* pObj,
    const SmVector3d& rScale
);

SMAPI_EXPORT SmApiStatus SmApiScaleByPt(
    SmObject* pObj,
    const SmVector3d& rRefPt,
    const SmVector3d& rScale
);

SMAPI_EXPORT SmApiStatus SmApiTranslate(
    SmObject* pObj,
    const SmVector3d& crTranslate
);

SMAPI_EXPORT SmApiStatus SmApiRotate(
    SmObject* pObj,
    const SmVector3d& rRefPt,
    const SmVector3d& rAxis,
    double dAngleDeg
);

#endif