void QCSXCAD::ExportGeometry(QString dirname, int type) { if (dirname.isEmpty()) dirname = QFileDialog::getExistingDirectory(this, tr("Choose directory to save data")); if (dirname.isEmpty()) return; int QtyProp = GetQtyProperties(); for (int i=0;i<QtyProp;++i) { CSProperties* prop = GetProperty(i); if (prop==NULL) continue; unsigned int uID = prop->GetUniqueID(); if (prop->GetVisibility()==true) { QString filename(dirname); filename.append("/"); filename.append(QString::fromUtf8(prop->GetName().c_str())); switch (type) { case 0: StructureVTK->ExportProperty2PolyDataVTK(uID,filename,clGrid.GetDeltaUnit()); break; case 1: StructureVTK->ExportProperty2STL(uID,filename,clGrid.GetDeltaUnit()); break; case 2: StructureVTK->ExportProperty2PLY(uID,filename,clGrid.GetDeltaUnit()); break; default: QMessageBox::warning(this, "Export Dialog","Unkown export type, skipping..."); return; break; } } } }
void QCSXCAD::Delete() { CSPrimitives* prim = CSTree->GetCurrentPrimitive(); if (prim!=NULL) { if (QMessageBox::question(this,tr("Delete Primitive"),tr("Delete current Primitive (ID: %1)?").arg(prim->GetID()),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { CSTree->DeletePrimItem(prim); DeletePrimitive(prim); setModified(); } return; } CSProperties* prop = CSTree->GetCurrentProperty(); if (prop!=NULL) { size_t qtyPrim=prop->GetQtyPrimitives(); if (qtyPrim>0) { if (QMessageBox::question(this,tr("Delete Property"),tr("\"%1\" contains Primitive(s)!!\n Delete anyway?").arg(prop->GetName().c_str()),QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) return; } else if (QMessageBox::question(this,tr("Delete Property"),tr("Delete current Property?"),QMessageBox::Yes,QMessageBox::No)!=QMessageBox::Yes) return; CSTree->DeletePropItem(prop); DeleteProperty(prop); setModified(); } }