Creating Geometry PRC Entities

The Exchange API Reference describes the PRC entities that specify geometry in the Geometry module. This module contains these submodules:

  • Surfaces: Entities that represent different kinds of surfaces, such as NURBS, spherical, and toric.

  • Curves: Entities that represent different kinds of curves, such as NURBS, elliptic, and helical.

This section describes the creation of a cylinder surface on which a circular co-edge is UV-mapped.

A circular curve includes a coordinate system and parameterization settings. By default, the reference domain is [0, 2PI]. A circular curve uses an A3IntervalData entity as the linear domain and an A3DMiscCartesianTransformationData structure as the coordinate system. New parameterization is computed from two coefficients applied to the reference parameterization [0, 2PI].

Create a Surface Cylinder Entity

  • Declare a null pointer to an A3DSurfCylinder entity.

    A3DSurfCylinder* pSurfCylinder = NULL;
    
  • Declare and initialize a surface cylinder data structure, and initialize the structures it contains.

    A3DSurfCylinderData sData;
    A3D_INITIALIZE_DATA(sData);
    A3D_INITIALIZE_DATA(sData.m_sParam);
    A3D_INITIALIZE_DATA(sData.m_sTrsf);
    
  • Set the UV-parameterization data of the surface cylinder data structure, which specifies how the circular curve is mapped to the cylinder. The following example specifies the trimming and orientation of the mapping:

    • Minimum and maximum extents in the UV domain (sData.m_sParam.m_sUVDomain) establish the trimming contour in the final parameterization space. Each extent is a 2D vector. The following example clips the texture represented by the co-edge to the area described by [0.0, 0.0] and [360.0 40.0].

    • Coefficients establish parameterization along the U and V axes. In this example, U values are expressed as inverted degrees (1.0/degrees). V values are expressed as inverted lengths (1.0/length).

    sData.m_sParam.m_sUVDomain.m_sMin.m_dX = 0.0;
    sData.m_sParam.m_sUVDomain.m_sMin.m_dY = 0.0;
    sData.m_sParam.m_sUVDomain.m_sMax.m_dX = 360.0;
    sData.m_sParam.m_sUVDomain.m_sMax.m_dY = 40.0;
    //   Parameters go from -1 to +1 in both directions
    sData.m_sParam.m_dUCoeffA =
    1.0 / (sData.m_sParam.m_sUVDomain.m_sMax.m_dX / 2);
    sData.m_sParam.m_dUCoeffB = -1.0;
    sData.m_sParam.m_dVCoeffA =
    1.0 / (sData.m_sParam.m_sUVDomain.m_sMax.m_dY / 2);
    sData.m_sParam.m_dVCoeffB = -1.0;
    sData.m_sParam.m_bSwapUV = FALSE;
    sData.m_sTrsf.m_ucBehaviour = kA3DTransformationIdentity;
    
  • Set other member values of the surface cylinder data structure. In the following example, the radius of the cylinder is set to 10.0. The unit of measure (as multiples of millimeters) was previously set for the model file entity. (See Creating PRC Entities.)

    sData.m_dRadius = 10.0;
    
  • Package the cylinder data as a PRC entity by invoking the A3DSurfCylinderCreate function. The first argument is a pointer to the surface cylinder data, and the second is the pointer to the surface cylinder entity created in Step 1.

    A3DInt32 iRet = A3DSurfCylinderCreate(&sData, &pSurfCylinder);
    
  • Declare a null pointer to a circular curve entity.

    A3DCrvCircle* pCrvCircle = NULL;
    
  • Declare and initialize a circular curve data structure, and initialize the structures it contains.

    A3DCrvCircleData sData;
    A3D_INITIALIZE_DATA(sData);
    A3D_INITIALIZE_DATA(sData.m_sParam);
    A3D_INITIALIZE_DATA(sData.m_sTrsf);
    
  • Set the values of the circular curve data structure. The following example sets the radius of the circle to a value originally specified during loop creation. (See Creating Topology PRC Entities.)

    sData.m_dRadius = radius;
    
  • Set the values of the parameterization structure within the circular curve data structure. In this example, the interval defines the circular arc as the entire circle and the co-efficients set the parameterization across the entire length of the circular arc.

    sData.m_sParam.m_dCoeffA = 1.0;
    sData.m_sParam.m_dCoeffB = 0.0;
    sData.m_sParam.m_sInterval.m_dMin = 0.0;
    sData.m_sParam.m_sInterval.m_dMax = 360;
    
  • Set the values of the Cartesian transformation structure within the circular curve data structure. The following example sets the behavior of the Cartesian transformation data to the identity transformation.

    sData.m_sTrsf.m_ucBehaviour = kA3DTransformationIdentity;
    
  • Package the curve data as a PRC entity by invoking the A3DCrvCircleCreate function. The first argument is a pointer to the curve circle data, and the second is the pointer to the circular curve entity created in Step 1.

    A3DInt32 iRet = A3DCrvCircleCreate(&sData, &pCrvCircle);