- UID
- 786079
- 积分
- 17
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2019-4-11
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
为啥我的程序里,如下所贴,只要加上“AcGeMatrix3d Pixel2Model_3D”这一句,运行就会报错呢
- void Test()
- {
- Acad::ErrorStatus es;
- struct resbuf *Rb1 = new resbuf;
- Rb1->restype = 0;
- Rb1->resval.rstring = L"TEXT";
- Rb1->rbnext = NULL;
- acutPrintf(L"选择需要添加遮罩的文本:");
- ads_name Ss;
- if (ads_ssget(NULL, NULL, NULL, Rb1, Ss) != RTNORM)
- {
- return;
- }
- int32_t *n;//选择集总个数
- ads_sslength(Ss, n);
- ads_name Ent0;//当前实体名
- for (int i = 0; i < *n; i++)
- {
- ads_ssname(Ss, i, Ent0);
- CDcText Txt0;
- AcDbObjectId txtID;
- Txt0.getID(Ent0);
- Txt0.getPt(Txt0.Entity_ID);
- Txt0.getRotation(Txt0.Entity_ID);
- Txt0.getWH(Txt0.Entity_ID, 1.05);
- //遮罩点集合
- AcGePoint2dArray wipPts;
- //wipPts.append(Txt0.pt_leftlower);
- //wipPts.append(Txt0.pt_rightlower);
- //wipPts.append(Txt0.pt_rightupper);
- //wipPts.append(Txt0.pt_leftupper);
- //wipPts.append(Txt0.pt_leftlower);
- wipPts.append(AcGePoint2d(0, 0));
- wipPts.append(AcGePoint2d(10, 0));
- wipPts.append(AcGePoint2d(10, 10));
- wipPts.append(AcGePoint2d(0, 10));
- wipPts.append(AcGePoint2d(0, 0));
- AcDbWipeout::createImageDefinition();//初始化遮罩
- AcDbWipeout *pWipeout = new AcDbWipeout;
- pWipeout->createImageDefinition();
- pWipeout->setDatabaseDefaults();
- AcGePoint3d originPnt(0, 0, 0);
- AcGeVector3d Udirection(1, 0, 0);
- AcGeVector3d Vdirection(0, -1, 0);
- AcGeVector3d Zdirection(0, 0, 1);
- pWipeout->setOrientation(originPnt, Udirection, Vdirection);
- pWipeout->setDisplayOpt(AcDbRasterImage::kTransparent, Adesk::kTrue);
- pWipeout->setDisplayOpt(AcDbRasterImage::kShowUnAligned, Adesk::kTrue);
- pWipeout->setClipBoundaryToWholeImage();
- [color=Red]AcGeMatrix3d Pixel2Model_3D[/color];//创建像素到模型空间的转换
- pWipeout->getPixelToModelTransform(Pixel2Model_3D);
- Pixel2Model_3D.invert();
- AcGeMatrix2d Pixel2Model_2D;//创建像素到模型空间的转换
- double pixel2model_z = 0;
- Pixel2Model_2D = Pixel2Model_3D.convertToLocal(Zdirection , pixel2model_z);
- for ( i = 0; i < wipPts.length(); i++)
- {
- wipPts.at(i).transformBy(Pixel2Model_2D);
- }
- pWipeout->setClipBoundary(AcDbRasterImage::kPoly, wipPts);
- Post2Model(pWipeout);
- pWipeout->close();
- acutPrintf(L"x=%f\ty=%f\n", Txt0.Position.x, Txt0.Position.y);
- acutPrintf(L"W=%f\tH=%f\n", Txt0.txtW, Txt0.txtH);
- acutPrintf(L"Rotation=%f\n", Txt0.Rotation);
- acutPrintf(L"%f,%f\t%f,%f\n", Txt0.pt_leftlower.x, Txt0.pt_leftlower.y, Txt0.pt_rightupper.x, Txt0.pt_rightupper.y);
- }
- delete Rb1;
- }
复制代码 |
|