I' m wanna to Draw a line,there have a opened AccuSnap when I open the Draw Line Tool,so that can I catch a point as a start point of a line.
Now I want to set a operation take effect,when the mouse moved to a grasped point,I need to extract this line and set the AccuDraw direction be paralleled with the line of the normol direction. The following are some codes and a picture, but the codes do not in the way I want to work!!
mdlAccuSnap_enableSnap(true); //_OnPostInstall event
mdlAccuDraw_setEnabledState(true); //open AccuDraw
//get Z
DPoint3d minPt, maxPt;
mdlSystem_computeDesignRange(&minPt, &maxPt, NULL, -1, NULL, NULL);
//mouse move
DPoint3d pt
pt.x = ev.GetPoint()->x;
pt.y = ev.GetPoint()->y;
pt.z = minPt.Z;
//extract the line,but I do not know How to give the third parameter
DSegment3d segment;
mdlLinear_getClosestSegment(&segment, &pt, &linearElm);
//get the line's normal
EditElementHandle eehline;
LineHandler::CreateLineElement(eehline, NULL, segment, true, *MASTERFILE);
mdlElmdscr_extractNormal(&vNormal, &pos, eehline.GetElementDescrP(), NULL);
//lock axis
Dpoint3d xAxisVec,pt1,pt2;
tmpPts.GetEndPoint(pt1);
tmpPts.GetEndPoint(pt2);
double length = mdlVec_computeNormal(&xAxisVec, &pt2, &pt1);
mdlState_setAccudrawContext(DgnPlatform::ACCUDRAW_SetNormal | ACCUDRAW_SetXAxis, &pt1, NULL, NULL, NULL, &xAxisVec);
![]()