怎么获取BLOCK UI “指定CSYS”
怎么样获取这个block ui呢,不知道是什么类型的你要获取什么,这个结果 都是通过 GetTaggedObjectVector("SelectedObjects")得到的。
自己转换下,如果要创建的话,还需要特征创建Features::DatumCsysBuilder *datumCsysBuilder ;
NXOpen::ListingWindow*lw = theSession->ListingWindow();
stringstream ss;
NXOpen::NXObject *createdcsys;
NXOpen::Vector3d xdir,ydir;
NXOpen::Point3d originPoint;
lw->Open();
ss << ("创建的坐标系统信息如下:\n");
std::vector<NXOpen::TaggedObject *> coordObjects = this->coord_system0->GetProperties()->GetTaggedObjectVector("SelectedObjects");
NXOpen::CartesianCoordinateSystem *coord = dynamic_cast<NXOpen::CartesianCoordinateSystem *>(coordObjects);
coord->GetDirections(&xdir,&ydir);
ss<<"返回的坐标系X方向矢量是:"<<xdir.X<<"\t"<<xdir.Y<<"\t"<<xdir.Z<<endl;
ss<<"返回的坐标系Y方向矢量是:"<<ydir.X<<"\t"<<ydir.Y<<"\t"<<ydir.Z<<endl;
originPoint = coord->Origin();
ss<<"返回的坐标系中心是:"<<originPoint.X<<"\t"<<originPoint.Y<<"\t"<<originPoint.Z<<endl;
lw->WriteLine(ss.str());
// create the csys
Part *workpart(theSession->Parts()->Work());
Features::Feature *null_feature(NULL);
Features::DatumCsysBuilder *datumCsysBuilder ;
datumCsysBuilder = workpart->Features()->CreateDatumCsysBuilder(null_feature);
datumCsysBuilder->SetCsys(coord);
datumCsysBuilder->SetDisplayScaleFactor(0.5);
createdcsys = datumCsysBuilder->Commit();
datumCsysBuilder->Destroy();
嗯,谢谢啦,要的就是这种效果
页:
[1]