MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / insert

Method insert

src/Mod/Import/Gui/AppImportGuiPy.cpp:184–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 }
183
184 Py::Object insert(const Py::Tuple& args, const Py::Dict& kwds)
185 {
186 char* Name;
187 char* DocName = nullptr;
188 PyObject* pyoptions = nullptr;
189 PyObject* importHidden = Py_None;
190 PyObject* merge = Py_None;
191 PyObject* useLinkGroup = Py_None;
192 int mode = -1;
193 static const std::array<const char*, 8> kwd_list {
194 "name",
195 "docName",
196 "options",
197 "importHidden",
198 "merge",
199 "useLinkGroup",
200 "mode",
201 nullptr
202 };
203 if (!Base::Wrapped_ParseTupleAndKeywords(
204 args.ptr(),
205 kwds.ptr(),
206 "et|sO!O!O!O!i",
207 kwd_list,
208 "utf-8",
209 &Name,
210 &DocName,
211 &PyDict_Type,
212 &pyoptions,
213 &PyBool_Type,
214 &importHidden,
215 &PyBool_Type,
216 &merge,
217 &PyBool_Type,
218 &useLinkGroup,
219 &mode
220 )) {
221 throw Py::Exception();
222 }
223
224 std::string Utf8Name = std::string(Name);
225 PyMem_Free(Name);
226
227 try {
228 Base::FileInfo file(Utf8Name.c_str());
229
230 App::Document* pcDoc = nullptr;
231 if (DocName) {
232 pcDoc = App::GetApplication().getDocument(DocName);
233 }
234 if (!pcDoc) {
235 pcDoc = App::GetApplication().newDocument();
236 }
237
238 Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication();
239 Handle(TDocStd_Document) hDoc;
240 hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
241 ImportOCAFGui ocaf(hDoc, pcDoc, file.fileNamePure());

Callers 12

AddFacetMethod · 0.45
getDistanceMethod · 0.45
executeMethod · 0.45
testSaveLoadStepFileMethod · 0.45
saveShapeMethod · 0.45
reallocateFreeShapeMethod · 0.45
loadShapesMethod · 0.45
loadShapesMethod · 0.45
ComposeFlattenedBlockMethod · 0.45
AddInsertMethod · 0.45

Calls 15

asBooleanFunction · 0.85
fileNamePureMethod · 0.80
setImportOptionsMethod · 0.80
setShowProgressMethod · 0.80
setMergeMethod · 0.80
setImportHiddenObjectMethod · 0.80
setReduceObjectsMethod · 0.80
setExpandCompoundMethod · 0.80
checkpointMethod · 0.80
runCommandByNameMethod · 0.80
ExceptionClass · 0.50

Tested by 4

AddFacetMethod · 0.36
getDistanceMethod · 0.36
executeMethod · 0.36
testSaveLoadStepFileMethod · 0.36