Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 1677

Re: Change Elements Elevation with in the drawn polygon and break lines (Microstation V8i Using MDL Language or C#.Net)

$
0
0
This is not tested code, but should give you idea of using functions.
 
MSElementDescrP ELEMENT = elementToMove();
DPoint3d plan_origin;  // polygon's center
DVec3d plane_normal;   // polygon's plane

mdlMeasure_polygonProperties(
  NULL,NULL,(DPoint3d*)&plane_normal,&plane_origin,
  NULL,NULL,NULL,NULL,PolyElmVer,PolyElmNoVer);

DPoint3d line_point;   // ELEMENT's pivot
DVec3d line_vector;    // {0, 0, 1} vector
line_point = < ELEMENT'S PIVOT POINT >;
line_vector.x = line_vector.y = 0.0;
line_vector.z = 1.0;

// vectors should not be perpendicular to get intersection
if (FALSE == mdlVec_arePerpendicularTight(&plane_normal, &line_vector))
{
  DPoint3d new_pivot;  // new ELEMENT's pivot

  // compute intersection
  mdlVec_linePlaneIntersect(
    &new_pivot, 
    &line_point, &line_vector, 
    &plan_origin, &plane_normal,
    FALSE); 

  // compute ELEMENT's translation
  DVec3d elm_offset;
  mdlVec_subtractDPoint3dDPoint3d(&elm_offset, new_pivot, line_point);

  // init transform
  Transform trnsf;
  mdlTMatrix_getIdentity(&trnsf);
  mdlTMatrix_setTranslation(&trnsf, (DPoint3d*)&elm_offset);

  // move ELEMENT to ne position
  mdlElmdscr_transform(ELEMENT, &trnsf);
  mdlElmdscr_rewrite(ELEMENT, NULL, mdlElmdscr_getFilePos(ELEMENT));    
}

Viewing all articles
Browse latest Browse all 1677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>