本文整理汇总了C++中app::DocumentObject::hasExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentObject::hasExtension方法的具体用法?C++ DocumentObject::hasExtension怎么用?C++ DocumentObject::hasExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::DocumentObject
的用法示例。
在下文中一共展示了DocumentObject::hasExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readParametersFromFeature
PyObject* AttachEnginePy::readParametersFromFeature(PyObject* args)
{
PyObject* obj;
if (!PyArg_ParseTuple(args, "O!",&(App::DocumentObjectPy::Type),&obj))
return NULL; // NULL triggers exception
try{
App::DocumentObjectPy* dobjpy = static_cast<App::DocumentObjectPy*>(obj);
App::DocumentObject* dobj = dobjpy->getDocumentObjectPtr();
if (! dobj->hasExtension(Part::AttachExtension::getExtensionClassTypeId())){
throw Py::TypeError("Supplied object has no Part::AttachExtension");
}
Part::AttachExtension* feat = dobj->getExtensionByType<Part::AttachExtension>();
AttachEngine &attacher = *(this->getAttachEnginePtr());
attacher.setUp(feat->Support,
eMapMode(feat->MapMode.getValue()),
feat->MapReversed.getValue(),
feat->MapPathParameter.getValue(),
0.0,0.0,
feat->AttachmentOffset.getValue());
return Py::new_reference_to(Py::None());
} ATTACHERPY_STDCATCH_METH;
}
示例2: writeParametersToFeature
PyObject* AttachEnginePy::writeParametersToFeature(PyObject* args)
{
PyObject* obj;
if (!PyArg_ParseTuple(args, "O!",&(App::DocumentObjectPy::Type),&obj))
return NULL; // NULL triggers exception
try{
App::DocumentObjectPy* dobjpy = static_cast<App::DocumentObjectPy*>(obj);
App::DocumentObject* dobj = dobjpy->getDocumentObjectPtr();
if (! dobj->hasExtension(Part::AttachExtension::getExtensionClassTypeId())){
throw Py::TypeError("Supplied object has no Part::AttachExtension");
}
Part::AttachExtension* feat = dobj->getExtensionByType<Part::AttachExtension>();
const AttachEngine &attacher = *(this->getAttachEnginePtr());
AttachEngine::verifyReferencesAreSafe(attacher.references);
feat->Support.Paste(attacher.references);
feat->MapMode.setValue(attacher.mapMode);
feat->MapReversed.setValue(attacher.mapReverse);
feat->MapPathParameter.setValue(attacher.attachParameter);
feat->AttachmentOffset.setValue(attacher.attachmentOffset);
return Py::new_reference_to(Py::None());
} ATTACHERPY_STDCATCH_METH;
}
示例3: slotChangedObject
void ShapeBinder::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop)
{
App::Document* doc = getDocument();
if (!doc || doc->testStatus(App::Document::Restoring))
return;
if (this == &Obj)
return;
if (!TraceSupport.getValue())
return;
if (!Prop.getTypeId().isDerivedFrom(App::PropertyPlacement::getClassTypeId()))
return;
Part::Feature* obj = nullptr;
std::vector<std::string> subs;
ShapeBinder::getFilteredReferences(&Support, obj, subs);
if (obj) {
if (obj == &Obj) {
// the directly referenced object has changed
enforceRecompute();
}
else if (Obj.hasExtension(App::GroupExtension::getExtensionClassTypeId())) {
// check if the changed property belongs to a group-like object
// like Body or Part
std::vector<App::DocumentObject*> chain;
std::vector<App::DocumentObject*> list = getInListRecursive();
chain.insert(chain.end(), list.begin(), list.end());
list = obj->getInListRecursive();
chain.insert(chain.end(), list.begin(), list.end());
auto it = std::find(chain.begin(), chain.end(), &Obj);
if (it != chain.end()) {
enforceRecompute();
}
}
}
}