- 积分
- 4340
- 明经币
- 个
- 注册时间
- 2010-10-23
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
- Adesk::Boolean lxdxh::worldDraw (AcGiWorldDraw *mode) {
- assertReadEnabled () ;
-
- // 声明下一个输入点.
- double changdu = sqrt((m_PtB.x - m_PtA.x)*(m_PtB.x - m_PtA.x)+(m_PtB.y - m_PtA.y)*(m_PtB.y - m_PtA.y));//A点到B点的距离
- //得到距离B点(圆的中心)为2.5的ptNext点
- AcGePoint3d ptNext(m_PtB.x - m_bl*5 * (m_PtB.x - m_PtA.x)/changdu, m_PtB.y - m_bl*5 * (m_PtB.y - m_PtA.y)/changdu, 0);
- // 添加指引线
- AcGePoint3d pts[2];
- pts[0] = m_PtA;
- pts[1] = ptNext;
- mode->geometry().worldLine(pts);
- // 添加序号球
- mode->subEntityTraits().setSelectionMarker(1); // Mark 1
- mode->subEntityTraits().setColor(1); // Red
- mode->geometry().circle(m_PtB, m_bl*5, AcGeVector3d::kZAxis);
- // 设置Text
- mode->subEntityTraits().setSelectionMarker(2); // Mark 2
- mode->subEntityTraits().setColor(256); // ByLayer
- AcGiTextStyle style;
- style.setFileName(_T("txt.shx"));
- style.setBigFontFileName(_T(""));
- style.setTextSize(m_bl*3.5);
- style.loadStyleRec();
- TCHAR buffer [20] ;
- _stprintf (buffer, _T("%d"), m_ID) ;
- size_t max=wcsnlen(buffer, 20);
-
- // 文本插入点
- AcGePoint3d ptText(m_PtB.x-m_bl*1.5, m_PtB.y-m_bl*1.5, 0);
- if (max==1)
- {
- AcGePoint3d ptText1(m_PtB.x-m_bl*1.5, m_PtB.y-m_bl*1.5, 0);
- ptText=ptText1;
- }
- if (max==2)
- {
- AcGePoint3d ptText1(m_PtB.x-m_bl*3, m_PtB.y-m_bl*1.5, 0);
- ptText=ptText1;
- }
- if (max==3)
- {
- AcGePoint3d ptText1(m_PtB.x-m_bl*4.5, m_PtB.y-m_bl*1.5, 0);
- ptText=ptText1;
- }
- // 添加Text
- mode->geometry().text(ptText, AcGeVector3d::kZAxis, AcGeVector3d::kXAxis, buffer, max, Adesk::kFalse, style);
- return Adesk::kTrue;
- }
复制代码 我做了一个序号的自定义实体,在做比例时,不能缩放。我加了一个参数,做为缩放比例,但加了以后,在夹点移动时,圆和字就不随着鼠标移动了,当夹点移动结束后,才移动到当前位置,请问:这个应该怎么做? |
|