Hi DanPaul,
Small Problem with the code provided by you.
mdlMeshDscr_fromElmdscr(&MeshElmDscr,gMSElmDescr,MASTERFILE,0,0,0,3,FALSE);
Private int mdlMeshDscr_fromElmdscr
(
MSElementDescr **ppResultDescr, // result mesh
MSElementDescr *pSourceDescr, // input element
DgnModelRefP modelRef, // destination model
double chordTol, // tolerance in master units
double angleTol, // tolerance in radians
double maxEdgeLen, // max edge in master units
int maxPerFace, // max num of edges per face
BoolInt preserveVisibility // pass FALSE for polygons
)
{
boolean status;
Transform *pTran = NULL;
KIENTITY *pBody = NULL;
MSElementDescr *remainingEdPP = NULL;
KIENTITY_LIST *bodyListPP = NULL;
KIENTITY_LIST *transformListPP = NULL;
double kernelChordTol;
double kernelMaxEdgeLen;
int i,j;
if (ppResultDescr == NULL || pSourceDescr == NULL)
return ERROR;
if (modelRef == NULL)
modelRef = MASTERFILE;
status = ERROR;
mdlKISolid_beginCurrTrans(modelRef);
mdlCnv_UORToMaster(&kernelChordTol, chordTol, modelRef);
mdlCurrTrans_invScaleDoubleArray (&kernelChordTol, &kernelChordTol, 1);
mdlCnv_UORToMaster(&kernelChordTol, maxEdgeLen, modelRef);
mdlCurrTrans_invScaleDoubleArray (&kernelMaxEdgeLen, &kernelChordTol, 1);
status = mdlKISolid_elementToBodyList(&bodyListPP, NULL, &transformListPP, &remainingEdPP, pSourceDescr,modelRef, mdlElmdscr_getFilePos(pSourceDescr), KISOLID_CACHE_NOCOPY, TRUE, TRUE );
mdlKISolid_endCurrTrans();
if (status == SUCCESS)
{
EmbeddedDPoint3dArray * pts = jmdlEmbeddedDPoint3dArray_new();
EmbeddedIntArray * ids = jmdlEmbeddedIntArray_new();
for(i = 0;SUCCESS == mdlKISolid_listNthEl ((void**)&pBody, bodyListPP, i) && SUCCESS == mdlKISolid_listNthEl ((void**)&pTran, transformListPP, i);i++)
{
DPoint3d *vertices = NULL;
long *facets = NULL;
long numFacets = 0;
long numVertices = 0;
if (SUCCESS == (status = mdlKISolid_facetBody(&vertices, &numVertices, &facets, &numFacets,pBody, pTran, maxPerFace, kernelChordTol, angleTol, kernelMaxEdgeLen)))
{
int id_add = jmdlEmbeddedDPoint3dArray_getCount(pts);
jmdlEmbeddedDPoint3dArray_insertDPoint3dArray(pts, vertices, 0, numVertices);
for (j = 0; numFacets > 0; j++)
{
if (facets[j] == 0)
{
jmdlEmbeddedIntArray_addInt(ids, 0);
numFacets--;
}
else
{
if (preserveVisibility)
{
if (facets[j] > 0)
{
jmdlEmbeddedIntArray_addInt(ids, facets[j] + id_add);
}
else if (facets[j] < 0)
{
jmdlEmbeddedIntArray_addInt(ids, facets[j] - id_add);
}
}
else
{
jmdlEmbeddedIntArray_addInt(ids, abs(facets[j]) + id_add);
}
if (((j + 1) % maxPerFace) == 0)
{
jmdlEmbeddedIntArray_addInt(ids, 0);
numFacets--;
}
}
}
mdlKISolid_freeFacetArray(facets);
mdlKISolid_freeFacetArray(vertices);
}
}
status = mdlMesh_newPolyfaceFromEmbeddedArrays(ppResultDescr, &pSourceDescr->el, ids, 0, pts);
pts = jmdlEmbeddedDPoint3dArray_free(pts);
ids = jmdlEmbeddedIntArray_free(ids);
}
if (bodyListPP) mdlKISolid_listDelete(&bodyListPP);
if (transformListPP) mdlKISolid_listDelete(&transformListPP);
return status;
}
1) 386425.9091, 5996533.7462, 2208.1903 Polygon Start Point Coordinates.
2) -410.0282, -267.9764, 0.5141 Mesh Start Point Coordinates