Merge pull request #19479 from tritao/base-cleanup-xml-generation
Base: Minor cleanups to base XML bindings generation
This commit is contained in:
@@ -126,7 +126,7 @@ ENDMACRO(fc_target_copy_resource_flat)
|
||||
# It would be a bit cleaner to generate these files in ${CMAKE_CURRENT_BINARY_DIR}
|
||||
|
||||
macro(generate_from_xml BASE_NAME)
|
||||
set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/generate.py")
|
||||
set(TOOL_PATH "${CMAKE_SOURCE_DIR}/src/Tools/bindings/generate.py")
|
||||
file(TO_NATIVE_PATH "${TOOL_PATH}" TOOL_NATIVE_PATH)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${BASE_NAME}.xml" SOURCE_NATIVE_PATH)
|
||||
|
||||
@@ -147,7 +147,7 @@ macro(generate_from_xml BASE_NAME)
|
||||
COMMAND ${PYTHON_EXECUTABLE} "${TOOL_NATIVE_PATH}" --outputPath "${OUTPUT_NATIVE_PATH}" ${BASE_NAME}.xml
|
||||
MAIN_DEPENDENCY "${BASE_NAME}.xml"
|
||||
DEPENDS
|
||||
"${CMAKE_SOURCE_DIR}/src/Tools/generateTemplates/templateClassPyExport.py"
|
||||
"${CMAKE_SOURCE_DIR}/src/Tools/bindings/templates/templateClassPyExport.py"
|
||||
"${TOOL_PATH}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMMENT "Building ${BASE_NAME}.h/.cpp out of ${BASE_NAME}.xml"
|
||||
|
||||
@@ -1042,7 +1042,7 @@ PyObject* Application::sCheckLinkDepth(PyObject* /*self*/, PyObject* args)
|
||||
PY_TRY
|
||||
{
|
||||
return Py::new_reference_to(
|
||||
Py::Int(GetApplication().checkLinkDepth(depth, MessageOption::Throw)));
|
||||
Py::Long(GetApplication().checkLinkDepth(depth, MessageOption::Throw)));
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ PyObject* Application::sSetActiveTransaction(PyObject* /*self*/, PyObject* args)
|
||||
|
||||
PY_TRY
|
||||
{
|
||||
Py::Int ret(GetApplication().setActiveTransaction(name, Base::asBoolean(persist)));
|
||||
Py::Long ret(GetApplication().setActiveTransaction(name, Base::asBoolean(persist)));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
PY_CATCH;
|
||||
@@ -1153,7 +1153,7 @@ PyObject* Application::sGetActiveTransaction(PyObject* /*self*/, PyObject* args)
|
||||
}
|
||||
Py::Tuple ret(2);
|
||||
ret.setItem(0, Py::String(name));
|
||||
ret.setItem(1, Py::Int(id));
|
||||
ret.setItem(1, Py::Long(id));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
<Documentation>
|
||||
<UserDocu>Geometry Tag</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Tag" Type="Int"/>
|
||||
<Parameter Name="Tag" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Hasher">
|
||||
<Documentation>
|
||||
@@ -129,7 +129,7 @@
|
||||
<Documentation>
|
||||
<UserDocu>Get the current element map size</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ElementMapSize" Type="Int" />
|
||||
<Parameter Name="ElementMapSize" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="ElementMap">
|
||||
<Documentation>
|
||||
|
||||
@@ -110,9 +110,9 @@ PyObject* ComplexGeoDataPy::getFacesFromSubElement(PyObject* args)
|
||||
Py::List facet;
|
||||
for (const auto& it : facets) {
|
||||
Py::Tuple f(3);
|
||||
f.setItem(0, Py::Int(int(it.I1)));
|
||||
f.setItem(1, Py::Int(int(it.I2)));
|
||||
f.setItem(2, Py::Int(int(it.I3)));
|
||||
f.setItem(0, Py::Long(int(it.I1)));
|
||||
f.setItem(1, Py::Long(int(it.I2)));
|
||||
f.setItem(2, Py::Long(int(it.I3)));
|
||||
facet.append(f);
|
||||
}
|
||||
tuple.setItem(1, facet);
|
||||
@@ -147,8 +147,8 @@ PyObject* ComplexGeoDataPy::getLinesFromSubElement(PyObject* args)
|
||||
Py::List line;
|
||||
for (const auto& it : lines) {
|
||||
Py::Tuple l(2);
|
||||
l.setItem(0, Py::Int((int)it.I1));
|
||||
l.setItem(1, Py::Int((int)it.I2));
|
||||
l.setItem(0, Py::Long((int)it.I1));
|
||||
l.setItem(1, Py::Long((int)it.I2));
|
||||
line.append(l);
|
||||
}
|
||||
tuple.setItem(1, line);
|
||||
@@ -213,8 +213,8 @@ PyObject* ComplexGeoDataPy::getLines(PyObject* args)
|
||||
Py::List line;
|
||||
for (const auto& it : lines) {
|
||||
Py::Tuple l(2);
|
||||
l.setItem(0, Py::Int((int)it.I1));
|
||||
l.setItem(1, Py::Int((int)it.I2));
|
||||
l.setItem(0, Py::Long((int)it.I1));
|
||||
l.setItem(1, Py::Long((int)it.I2));
|
||||
line.append(l);
|
||||
}
|
||||
tuple.setItem(1, line);
|
||||
@@ -247,9 +247,9 @@ PyObject* ComplexGeoDataPy::getFaces(PyObject* args)
|
||||
Py::List facet;
|
||||
for (const auto& it : facets) {
|
||||
Py::Tuple f(3);
|
||||
f.setItem(0, Py::Int((int)it.I1));
|
||||
f.setItem(1, Py::Int((int)it.I2));
|
||||
f.setItem(2, Py::Int((int)it.I3));
|
||||
f.setItem(0, Py::Long((int)it.I1));
|
||||
f.setItem(1, Py::Long((int)it.I2));
|
||||
f.setItem(2, Py::Long((int)it.I3));
|
||||
facet.append(f);
|
||||
}
|
||||
tuple.setItem(1, facet);
|
||||
@@ -509,9 +509,9 @@ Py::Dict ComplexGeoDataPy::getElementReverseMap() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
Py::Int ComplexGeoDataPy::getElementMapSize() const
|
||||
Py::Long ComplexGeoDataPy::getElementMapSize() const
|
||||
{
|
||||
return Py::Int((long)getComplexGeoDataPtr()->getElementMapSize());
|
||||
return Py::Long((long)getComplexGeoDataPtr()->getElementMapSize());
|
||||
}
|
||||
|
||||
void ComplexGeoDataPy::setHasher(Py::Object obj)
|
||||
@@ -575,12 +575,12 @@ Py::String ComplexGeoDataPy::getElementMapVersion() const
|
||||
}
|
||||
|
||||
|
||||
Py::Int ComplexGeoDataPy::getTag() const
|
||||
Py::Long ComplexGeoDataPy::getTag() const
|
||||
{
|
||||
return Py::Int(getComplexGeoDataPtr()->Tag);
|
||||
return Py::Long(getComplexGeoDataPtr()->Tag);
|
||||
}
|
||||
|
||||
void ComplexGeoDataPy::setTag(Py::Int tag)
|
||||
void ComplexGeoDataPy::setTag(Py::Long tag)
|
||||
{
|
||||
getComplexGeoDataPtr()->Tag = tag;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ or None if the GUI is not up</UserDocu>
|
||||
<Documentation>
|
||||
<UserDocu>The unique identifier (among its document) of this object</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ID" Type="Int"/>
|
||||
<Parameter Name="ID" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Removing" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -898,9 +898,9 @@ int DocumentObjectPy::setCustomAttributes(const char*, PyObject*)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py::Int DocumentObjectPy::getID() const
|
||||
Py::Long DocumentObjectPy::getID() const
|
||||
{
|
||||
return Py::Int(getDocumentObjectPtr()->getID());
|
||||
return Py::Long(getDocumentObjectPtr()->getID());
|
||||
}
|
||||
|
||||
Py::Boolean DocumentObjectPy::getRemoving() const
|
||||
|
||||
@@ -313,25 +313,25 @@ sort: whether to topologically sort the return list
|
||||
<Documentation>
|
||||
<UserDocu>The Undo mode of the Document (0 = no Undo, 1 = Undo/Redo)</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="UndoMode" Type="Int" />
|
||||
<Parameter Name="UndoMode" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="UndoRedoMemSize" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The size of the Undo stack in byte</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="UndoRedoMemSize" Type="Int" />
|
||||
<Parameter Name="UndoRedoMemSize" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="UndoCount" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Number of possible Undos</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="UndoCount" Type="Int" />
|
||||
<Parameter Name="UndoCount" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="RedoCount" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Number of possible Redos</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="RedoCount" Type="Int"/>
|
||||
<Parameter Name="RedoCount" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="UndoNames" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -388,7 +388,7 @@ PyObject* DocumentPy::addObject(PyObject* args, PyObject* kwd)
|
||||
pyvp = Py::Object(view);
|
||||
}
|
||||
if (pyvp.isNone()) {
|
||||
pyvp = Py::Int(1);
|
||||
pyvp = Py::Long(1);
|
||||
}
|
||||
// 'pyvp' is the python class with the implementation for ViewProvider
|
||||
if (pyvp.hasAttr("__vobject__")) {
|
||||
@@ -695,7 +695,7 @@ PyObject* DocumentPy::recompute(PyObject* args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Py::new_reference_to(Py::Int(objectCount));
|
||||
return Py::new_reference_to(Py::Long(objectCount));
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
@@ -890,30 +890,30 @@ Py::List DocumentPy::getRootObjectsIgnoreLinks() const
|
||||
return res;
|
||||
}
|
||||
|
||||
Py::Int DocumentPy::getUndoMode() const
|
||||
Py::Long DocumentPy::getUndoMode() const
|
||||
{
|
||||
return Py::Int(getDocumentPtr()->getUndoMode());
|
||||
return Py::Long(getDocumentPtr()->getUndoMode());
|
||||
}
|
||||
|
||||
void DocumentPy::setUndoMode(Py::Int arg)
|
||||
void DocumentPy::setUndoMode(Py::Long arg)
|
||||
{
|
||||
getDocumentPtr()->setUndoMode(arg);
|
||||
}
|
||||
|
||||
|
||||
Py::Int DocumentPy::getUndoRedoMemSize() const
|
||||
Py::Long DocumentPy::getUndoRedoMemSize() const
|
||||
{
|
||||
return Py::Int((long)getDocumentPtr()->getUndoMemSize());
|
||||
return Py::Long((long)getDocumentPtr()->getUndoMemSize());
|
||||
}
|
||||
|
||||
Py::Int DocumentPy::getUndoCount() const
|
||||
Py::Long DocumentPy::getUndoCount() const
|
||||
{
|
||||
return Py::Int((long)getDocumentPtr()->getAvailableUndos());
|
||||
return Py::Long((long)getDocumentPtr()->getAvailableUndos());
|
||||
}
|
||||
|
||||
Py::Int DocumentPy::getRedoCount() const
|
||||
Py::Long DocumentPy::getRedoCount() const
|
||||
{
|
||||
return Py::Int((long)getDocumentPtr()->getAvailableRedos());
|
||||
return Py::Long((long)getDocumentPtr()->getAvailableRedos());
|
||||
}
|
||||
|
||||
Py::List DocumentPy::getUndoNames() const
|
||||
|
||||
@@ -278,14 +278,14 @@ bool FeaturePythonImp::getSubObject(DocumentObject*& ret,
|
||||
subname = "";
|
||||
}
|
||||
args.setItem(1, Py::String(subname));
|
||||
args.setItem(2, Py::Int(pyObj ? 2 : 1));
|
||||
args.setItem(2, Py::Long(pyObj ? 2 : 1));
|
||||
Base::MatrixPy* pyMat = new Base::MatrixPy(new Base::Matrix4D);
|
||||
if (_mat) {
|
||||
*pyMat->getMatrixPtr() = *_mat;
|
||||
}
|
||||
args.setItem(3, Py::asObject(pyMat));
|
||||
args.setItem(4, Py::Boolean(transform));
|
||||
args.setItem(5, Py::Int(depth));
|
||||
args.setItem(5, Py::Long(depth));
|
||||
|
||||
Py::Object res(Base::pyCall(py_getSubObject.ptr(), args.ptr()));
|
||||
if (res.isNone()) {
|
||||
@@ -343,7 +343,7 @@ bool FeaturePythonImp::getSubObjects(std::vector<std::string>& ret, int reason)
|
||||
try {
|
||||
Py::Tuple args(2);
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
args.setItem(1, Py::Int(reason));
|
||||
args.setItem(1, Py::Long(reason));
|
||||
Py::Object res(Base::pyCall(py_getSubObjects.ptr(), args.ptr()));
|
||||
if (!res.isTrue()) {
|
||||
return true;
|
||||
@@ -390,7 +390,7 @@ bool FeaturePythonImp::getLinkedObject(DocumentObject*& ret,
|
||||
}
|
||||
args.setItem(2, Py::asObject(pyMat));
|
||||
args.setItem(3, Py::Boolean(transform));
|
||||
args.setItem(4, Py::Int(depth));
|
||||
args.setItem(4, Py::Long(depth));
|
||||
|
||||
Py::Object res(Base::pyCall(py_getLinkedObject.ptr(), args.ptr()));
|
||||
if (!res.isTrue()) {
|
||||
@@ -466,7 +466,7 @@ int FeaturePythonImp::isElementVisible(const char* element) const
|
||||
Py::Tuple args(2);
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
args.setItem(1, Py::String(element ? element : ""));
|
||||
return Py::Int(Base::pyCall(py_isElementVisible.ptr(), args.ptr()));
|
||||
return Py::Long(Base::pyCall(py_isElementVisible.ptr(), args.ptr()));
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
|
||||
@@ -488,7 +488,7 @@ int FeaturePythonImp::setElementVisible(const char* element, bool visible)
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
args.setItem(1, Py::String(element ? element : ""));
|
||||
args.setItem(2, Py::Boolean(visible));
|
||||
return Py::Int(Base::pyCall(py_setElementVisible.ptr(), args.ptr()));
|
||||
return Py::Long(Base::pyCall(py_setElementVisible.ptr(), args.ptr()));
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
|
||||
@@ -568,7 +568,7 @@ int FeaturePythonImp::canLoadPartial() const
|
||||
try {
|
||||
Py::Tuple args(1);
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
Py::Int ret(Base::pyCall(py_canLoadPartial.ptr(), args.ptr()));
|
||||
Py::Long ret(Base::pyCall(py_canLoadPartial.ptr(), args.ptr()));
|
||||
return ret;
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
|
||||
@@ -409,7 +409,7 @@ App::DocumentObjectExecReturn* LinkBaseExtension::extensionExecute()
|
||||
else {
|
||||
const auto& elements = _getElementListValue();
|
||||
for (int i = 0; i < _getElementCountValue(); ++i) {
|
||||
args.setItem(2, Py::Int(i));
|
||||
args.setItem(2, Py::Long(i));
|
||||
if (i < (int)elements.size()) {
|
||||
args.setItem(3, Py::asObject(elements[i]->getPyObject()));
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ PyObject* LinkBaseExtensionPy::setLink(PyObject* _args)
|
||||
PyObject *key, *value;
|
||||
Py_ssize_t pos = 0;
|
||||
while (PyDict_Next(pcObj, &pos, &key, &value)) {
|
||||
parseLink(ext, Py::Int(key), value);
|
||||
parseLink(ext, Py::Long(key), value);
|
||||
}
|
||||
}
|
||||
else if (PySequence_Check(pcObj)) {
|
||||
|
||||
@@ -692,7 +692,7 @@ Py::Object ObjectIdentifier::Component::get(const Py::Object& pyobj) const
|
||||
}
|
||||
else if (isArray()) {
|
||||
if (pyobj.isMapping()) {
|
||||
res = Py::Mapping(pyobj).getItem(Py::Int(begin));
|
||||
res = Py::Mapping(pyobj).getItem(Py::Long(begin));
|
||||
}
|
||||
else {
|
||||
res = Py::Sequence(pyobj).getItem(begin);
|
||||
@@ -703,9 +703,9 @@ Py::Object ObjectIdentifier::Component::get(const Py::Object& pyobj) const
|
||||
}
|
||||
else {
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end != INT_MAX ? Py::Int(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Int(step).ptr() : nullptr),
|
||||
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
|
||||
end != INT_MAX ? Py::Long(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Long(step).ptr() : nullptr),
|
||||
true);
|
||||
PyObject* r = PyObject_GetItem(pyobj.ptr(), slice.ptr());
|
||||
if (!r) {
|
||||
@@ -731,7 +731,7 @@ void ObjectIdentifier::Component::set(Py::Object& pyobj, const Py::Object& value
|
||||
}
|
||||
else if (isArray()) {
|
||||
if (pyobj.isMapping()) {
|
||||
Py::Mapping(pyobj).setItem(Py::Int(begin), value);
|
||||
Py::Mapping(pyobj).setItem(Py::Long(begin), value);
|
||||
}
|
||||
else {
|
||||
Py::Sequence(pyobj).setItem(begin, value);
|
||||
@@ -742,9 +742,9 @@ void ObjectIdentifier::Component::set(Py::Object& pyobj, const Py::Object& value
|
||||
}
|
||||
else {
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end != INT_MAX ? Py::Int(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Int(step).ptr() : nullptr),
|
||||
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
|
||||
end != INT_MAX ? Py::Long(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Long(step).ptr() : nullptr),
|
||||
true);
|
||||
if (PyObject_SetItem(pyobj.ptr(), slice.ptr(), value.ptr()) < 0) {
|
||||
Base::PyException::ThrowException();
|
||||
@@ -759,7 +759,7 @@ void ObjectIdentifier::Component::del(Py::Object& pyobj) const
|
||||
}
|
||||
else if (isArray()) {
|
||||
if (pyobj.isMapping()) {
|
||||
Py::Mapping(pyobj).delItem(Py::Int(begin));
|
||||
Py::Mapping(pyobj).delItem(Py::Long(begin));
|
||||
}
|
||||
else {
|
||||
PySequence_DelItem(pyobj.ptr(), begin);
|
||||
@@ -770,9 +770,9 @@ void ObjectIdentifier::Component::del(Py::Object& pyobj) const
|
||||
}
|
||||
else {
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end != INT_MAX ? Py::Int(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Int(step).ptr() : nullptr),
|
||||
Py::Object slice(PySlice_New(Py::Long(begin).ptr(),
|
||||
end != INT_MAX ? Py::Long(end).ptr() : nullptr,
|
||||
step != 1 ? Py::Long(step).ptr() : nullptr),
|
||||
true);
|
||||
if (PyObject_DelItem(pyobj.ptr(), slice.ptr()) < 0) {
|
||||
Base::PyException::ThrowException();
|
||||
|
||||
@@ -284,7 +284,7 @@ PyObject* PropertyContainerPy::setPropertyStatus(PyObject* args)
|
||||
status.set(it->second, value);
|
||||
}
|
||||
else if (item.isNumeric()) {
|
||||
int v = Py::Int(item);
|
||||
int v = Py::Long(item);
|
||||
if (v < 0) {
|
||||
value = false;
|
||||
v = -v;
|
||||
@@ -345,7 +345,7 @@ PyObject* PropertyContainerPy::getPropertyStatus(PyObject* args)
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
ret.append(Py::Int(static_cast<long>(i)));
|
||||
ret.append(Py::Long(static_cast<long>(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ void PropertyEnumeration::setPyObject(PyObject* value)
|
||||
if (seq.size() == 2) {
|
||||
Py::Object v(seq[0].ptr());
|
||||
if (!v.isString() && v.isSequence()) {
|
||||
idx = Py::Int(seq[1].ptr());
|
||||
idx = Py::Long(seq[1].ptr());
|
||||
seq = v;
|
||||
}
|
||||
}
|
||||
@@ -608,7 +608,7 @@ bool PropertyEnumeration::getPyPathValue(const ObjectIdentifier& path, Py::Objec
|
||||
else {
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, res);
|
||||
tuple.setItem(1, Py::Int(getValue()));
|
||||
tuple.setItem(1, Py::Long(getValue()));
|
||||
r = tuple;
|
||||
}
|
||||
}
|
||||
@@ -617,7 +617,7 @@ bool PropertyEnumeration::getPyPathValue(const ObjectIdentifier& path, Py::Objec
|
||||
r = Py::String(v ? v : "");
|
||||
}
|
||||
else {
|
||||
r = Py::Int(getValue());
|
||||
r = Py::Long(getValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ base64: indicate if the input 'txt' is base64 encoded binary data
|
||||
<Documentation>
|
||||
<UserDocu>Return count of used hashes</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Count" Type="Int" />
|
||||
<Parameter Name="Count" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="Size" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Return the size of the hashes</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Size" Type="Int"/>
|
||||
<Parameter Name="Size" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="SaveAll">
|
||||
<Documentation>
|
||||
@@ -58,7 +58,7 @@ base64: indicate if the input 'txt' is base64 encoded binary data
|
||||
<Documentation>
|
||||
<UserDocu>Data length exceed this threshold will be hashed before storing</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Threshold" Type="Int"/>
|
||||
<Parameter Name="Threshold" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Table" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<Documentation>
|
||||
<UserDocu>Return the integer value of this ID</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Value" Type="Int"/>
|
||||
<Parameter Name="Value" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Related" ReadOnly="true">
|
||||
<Documentation>
|
||||
@@ -54,7 +54,7 @@
|
||||
<Documentation>
|
||||
<UserDocu>Geometry index. Only meaningful for geometry element name</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Index" Type="Int"/>
|
||||
<Parameter Name="Index" Type="Long"/>
|
||||
</Attribute>
|
||||
<ClassDeclarations>private:
|
||||
friend class StringID;
|
||||
|
||||
@@ -64,7 +64,7 @@ max : Base.Vector, tuple
|
||||
Invalidate the bounding box.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isValid">
|
||||
<Methode Name="isValid" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>isValid() -> bool
|
||||
|
||||
@@ -90,9 +90,9 @@ z : float
|
||||
Value to enlarge at z-direction.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPoint">
|
||||
<Methode Name="getPoint" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getPoint(index) ->Base.Vector
|
||||
<UserDocu>getPoint(index) -> Base.Vector
|
||||
|
||||
Get the point of the given index.
|
||||
The index must be in the range of [0, 7].
|
||||
@@ -100,7 +100,7 @@ The index must be in the range of [0, 7].
|
||||
index : int</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getEdge">
|
||||
<Methode Name="getEdge" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getEdge(index) -> tuple of Base.Vector
|
||||
|
||||
@@ -110,7 +110,7 @@ The index must be in the range of [0, 11].
|
||||
index : int</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="closestPoint">
|
||||
<Methode Name="closestPoint" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>closestPoint(point) -> Base.Vector
|
||||
closestPoint(x, y, z) -> Base.Vector
|
||||
|
||||
@@ -99,7 +99,8 @@ tol : float</UserDocu>
|
||||
</Methode>
|
||||
<Methode Name="decompose" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>decompose() -> Base.Matrix, Base.Matrix, Base.Matrix, Base.Matrix\n
|
||||
<UserDocu>decompose() -> Base.Matrix, Base.Matrix, Base.Matrix, Base.Matrix
|
||||
|
||||
Return a tuple of matrices representing shear, scale, rotation and move.
|
||||
So that matrix = move * rotation * scale * shear.</UserDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -212,7 +212,7 @@ PyObject* MatrixPy::number_power_handler(PyObject* self, PyObject* other, PyObje
|
||||
|
||||
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
|
||||
|
||||
long b = Py::Int(other);
|
||||
long b = Py::Long(other);
|
||||
if (b == 0) {
|
||||
return new MatrixPy(Matrix4D());
|
||||
}
|
||||
@@ -363,7 +363,7 @@ PyObject* MatrixPy::hasScale(PyObject* args)
|
||||
ScaleType type = getMatrixPtr()->hasScale(tol);
|
||||
Py::Module mod("FreeCAD");
|
||||
return Py::new_reference_to(
|
||||
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Int(static_cast<int>(type)))));
|
||||
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Long(static_cast<int>(type)))));
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::decompose(PyObject* args)
|
||||
|
||||
@@ -26,7 +26,7 @@ Class to dump and restore the content of an object.</UserDocu>
|
||||
<Documentation>
|
||||
<UserDocu>Memory size of the object in bytes.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MemSize" Type="Int"/>
|
||||
<Parameter Name="MemSize" Type="Long"/>
|
||||
</Attribute>
|
||||
<Methode Name="dumpContent" Keyword="true" Const="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -52,9 +52,9 @@ Py::String PersistencePy::getContent() const
|
||||
return {writer.getString()};
|
||||
}
|
||||
|
||||
Py::Int PersistencePy::getMemSize() const
|
||||
Py::Long PersistencePy::getMemSize() const
|
||||
{
|
||||
return Py::Int((long)getPersistencePtr()->getMemSize());
|
||||
return Py::Long((long)getPersistencePtr()->getMemSize());
|
||||
}
|
||||
|
||||
PyObject* PersistencePy::dumpContent(PyObject* args, PyObject* kwds)
|
||||
|
||||
@@ -163,18 +163,18 @@ namespace Base
|
||||
{
|
||||
|
||||
|
||||
/** The PyObjectBase class, exports the class as a python type
|
||||
/** The PyObjectBase class, exports the class as a Python type
|
||||
* PyObjectBase is the base class for all C++ classes which
|
||||
* need to get exported into the python namespace. This class is
|
||||
* need to get exported into the Python namespace. This class is
|
||||
* very important because nearly all important classes in FreeCAD
|
||||
* are visible in python for macro recording and automation purpose.
|
||||
* The class App::Document is a good expample for an exported class.
|
||||
* are visible in Python for macro recording and automation purpose.
|
||||
* The class App::Document is a good example for an exported class.
|
||||
* There are some convenience macros to make it easier to inherit
|
||||
* from this class and defining new methods exported to python.
|
||||
* from this class and defining new methods exported to Python.
|
||||
* PYFUNCDEF_D defines a new exported method.
|
||||
* PYFUNCIMP_D defines the implementation of the new exported method.
|
||||
* In the implementation you can use Py_Return, Py_Error, Py_Try and Py_Assert.
|
||||
* PYMETHODEDEF makes the entry in the python method table.
|
||||
* PYMETHODEDEF makes the entry in the Python method table.
|
||||
* @see Document
|
||||
* @see PYFUNCDEF_D
|
||||
* @see PYFUNCIMP_D
|
||||
|
||||
@@ -29,38 +29,36 @@ Quantity(string) -- arbitrary mixture of numbers and chars defining a Quantity
|
||||
</Documentation>
|
||||
<Methode Name="toStr" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
toStr([decimals])
|
||||
returns a string representation rounded to number of decimals. If no decimals are specified then
|
||||
the internal precision is used
|
||||
<UserDocu>toStr([decimals])
|
||||
|
||||
Returns a string representation rounded to number of decimals. If no decimals are specified then
|
||||
the internal precision is used
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getUserPreferred" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
returns a quantity with the translation factor and a string with the prevered unit
|
||||
Returns a quantity with the translation factor and a string with the prevered unit
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getValueAs" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
returns a floating point value as the provided unit
|
||||
<UserDocu>Returns a floating point value as the provided unit
|
||||
|
||||
Following parameters are allowed:
|
||||
getValueAs('m/s') # unit string to parse
|
||||
getValueAs(2.45,1) # translation value and unit signature
|
||||
getValueAs(FreeCAD.Units.Pascal) # predefined standard units
|
||||
getValueAs(Qantity('N/m^2')) # a quantity
|
||||
getValueAs(Unit(0,1,0,0,0,0,0,0)) # a unit
|
||||
Following parameters are allowed:
|
||||
getValueAs('m/s') # unit string to parse
|
||||
getValueAs(2.45,1) # translation value and unit signature
|
||||
getValueAs(FreeCAD.Units.Pascal) # predefined standard units
|
||||
getValueAs(Qantity('N/m^2')) # a quantity
|
||||
getValueAs(Unit(0,1,0,0,0,0,0,0)) # a unit
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="__round__" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
Return the Integral closest to x, rounding half toward even.
|
||||
<UserDocu>Returns the Integral closest to x, rounding half toward even.
|
||||
When an argument is passed, work like built-in round(x, ndigits).
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -641,9 +641,9 @@ Py::Dict QuantityPy::getFormat() const
|
||||
QuantityFormat fmt = getQuantityPtr()->getFormat();
|
||||
|
||||
Py::Dict dict;
|
||||
dict.setItem("Precision", Py::Int(fmt.precision));
|
||||
dict.setItem("Precision", Py::Long(fmt.precision));
|
||||
dict.setItem("NumberFormat", Py::Char(fmt.toFormat()));
|
||||
dict.setItem("Denominator", Py::Int(fmt.denominator));
|
||||
dict.setItem("Denominator", Py::Long(fmt.denominator));
|
||||
return dict;
|
||||
}
|
||||
|
||||
@@ -652,14 +652,14 @@ void QuantityPy::setFormat(Py::Dict arg)
|
||||
QuantityFormat fmt = getQuantityPtr()->getFormat();
|
||||
|
||||
if (arg.hasKey("Precision")) {
|
||||
Py::Int prec(arg.getItem("Precision"));
|
||||
Py::Long prec(arg.getItem("Precision"));
|
||||
fmt.precision = static_cast<int>(prec);
|
||||
}
|
||||
|
||||
if (arg.hasKey("NumberFormat")) {
|
||||
Py::Object item = arg.getItem("NumberFormat");
|
||||
if (item.isNumeric()) {
|
||||
int format = static_cast<int>(Py::Int(item));
|
||||
int format = static_cast<int>(Py::Long(item));
|
||||
if (format < 0 || format > QuantityFormat::Scientific) {
|
||||
throw Py::ValueError("Invalid format value");
|
||||
}
|
||||
@@ -681,7 +681,7 @@ void QuantityPy::setFormat(Py::Dict arg)
|
||||
}
|
||||
|
||||
if (arg.hasKey("Denominator")) {
|
||||
Py::Int denom(arg.getItem("Denominator"));
|
||||
Py::Long denom(arg.getItem("Denominator"));
|
||||
int fracInch = static_cast<int>(denom);
|
||||
// check that the value is positive and a power of 2
|
||||
if (fracInch <= 0) {
|
||||
|
||||
@@ -88,7 +88,7 @@ coef : sequence of float</UserDocu>
|
||||
Sets the rotation to its inverse.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="inverted">
|
||||
<Methode Name="inverted" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>inverted() -> Base.Rotation
|
||||
|
||||
@@ -232,12 +232,11 @@ tol : float
|
||||
</Documentation>
|
||||
<Parameter Name="Angle" Type="Float" />
|
||||
</Attribute>
|
||||
<ClassDeclarations>
|
||||
public:
|
||||
RotationPy(const Rotation & mat, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Rotation(mat),T){}
|
||||
Rotation value() const
|
||||
{ return *(getRotationPtr()); }
|
||||
<ClassDeclarations>public:
|
||||
RotationPy(const Rotation & mat, PyTypeObject *T = &Type)
|
||||
:PyObjectBase(new Rotation(mat),T){}
|
||||
Rotation value() const
|
||||
{ return *(getRotationPtr()); }
|
||||
</ClassDeclarations>
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Base {
|
||||
<DeveloperDocu>This is the Type class</DeveloperDocu>
|
||||
<UserDocu>BaseTypePy class.
|
||||
|
||||
This class provides functionality related to type management in the Base module. It's not intended for direct instantiation but for accessing type information and creating instances of various types. Instantiation is possible for classes that inherit from the Base::BaseClass class and are not abstract.</UserDocu>
|
||||
This class provides functionality related to type management in the Base module. It's not intended for direct instantiation but for accessing type information and creating instances of various types. Instantiation is possible for classes that inherit from the Base::BaseClass class and are not abstract.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="fromName" Static="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -15,16 +15,15 @@
|
||||
FatherNamespace="Base">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<UserDocu>
|
||||
Unit
|
||||
defines a unit type, calculate and compare.
|
||||
<UserDocu>Unit
|
||||
defines a unit type, calculate and compare.
|
||||
|
||||
The following constructors are supported:
|
||||
Unit() -- empty constructor
|
||||
Unit(i1,i2,i3,i4,i5,i6,i7,i8) -- unit signature
|
||||
Unit(Quantity) -- copy unit from Quantity
|
||||
Unit(Unit) -- copy constructor
|
||||
Unit(string) -- parse the string for units
|
||||
The following constructors are supported:
|
||||
Unit() -- empty constructor
|
||||
Unit(i1,i2,i3,i4,i5,i6,i7,i8) -- unit signature
|
||||
Unit(Quantity) -- copy unit from Quantity
|
||||
Unit(Unit) -- copy constructor
|
||||
Unit(string) -- parse the string for units
|
||||
</UserDocu>
|
||||
<DeveloperDocu>Unit</DeveloperDocu>
|
||||
</Documentation>
|
||||
|
||||
@@ -1560,7 +1560,7 @@ void PythonGroupCommand::activated(int iMsg)
|
||||
if (cmd.hasAttr("Activated")) {
|
||||
Py::Callable call(cmd.getAttr("Activated"));
|
||||
Py::Tuple args(1);
|
||||
args.setItem(0, Py::Int(iMsg));
|
||||
args.setItem(0, Py::Long(iMsg));
|
||||
Py::Object ret = call.apply(args);
|
||||
}
|
||||
// If the command group doesn't implement the 'Activated' method then invoke the command directly
|
||||
@@ -1640,7 +1640,7 @@ Action * PythonGroupCommand::createAction()
|
||||
|
||||
if (cmd.hasAttr("GetDefaultCommand")) {
|
||||
Py::Callable call2(cmd.getAttr("GetDefaultCommand"));
|
||||
Py::Int def(call2.apply(args));
|
||||
Py::Long def(call2.apply(args));
|
||||
defaultId = static_cast<int>(def);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,106 +15,106 @@
|
||||
</Documentation>
|
||||
<Methode Name="show">
|
||||
<Documentation>
|
||||
<UserDocu>show(objName) -> None
|
||||
<UserDocu>show(objName) -> None
|
||||
|
||||
Show an object.
|
||||
Show an object.
|
||||
|
||||
objName : str
|
||||
objName : str
|
||||
Name of the `Gui.ViewProvider` to show.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="hide">
|
||||
<Documentation>
|
||||
<UserDocu>hide(objName) -> None
|
||||
<UserDocu>hide(objName) -> None
|
||||
|
||||
Hide an object.
|
||||
Hide an object.
|
||||
|
||||
objName : str
|
||||
objName : str
|
||||
Name of the `Gui.ViewProvider` to hide.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setPos">
|
||||
<Documentation>
|
||||
<UserDocu>setPos(objName, matrix) -> None
|
||||
<UserDocu>setPos(objName, matrix) -> None
|
||||
|
||||
Set the position of an object.
|
||||
Set the position of an object.
|
||||
|
||||
objName : str
|
||||
Name of the `Gui.ViewProvider`.
|
||||
objName : str
|
||||
Name of the `Gui.ViewProvider`.
|
||||
|
||||
matrix : Base.Matrix
|
||||
matrix : Base.Matrix
|
||||
Transformation to apply on the object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setEdit">
|
||||
<Documentation>
|
||||
<UserDocu>setEdit(obj, mod=0, subName) -> bool
|
||||
<UserDocu>setEdit(obj, mod=0, subName) -> bool
|
||||
|
||||
Set an object in edit mode.
|
||||
Set an object in edit mode.
|
||||
|
||||
obj : str, App.DocumentObject, Gui.ViewPrivider
|
||||
obj : str, App.DocumentObject, Gui.ViewPrivider
|
||||
Object to set in edit mode.
|
||||
mod : int
|
||||
mod : int
|
||||
Edit mode.
|
||||
subName : str
|
||||
subName : str
|
||||
Subelement name. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getInEdit">
|
||||
<Documentation>
|
||||
<UserDocu>getInEdit() -> Gui.ViewProviderDocumentObject or None
|
||||
<UserDocu>getInEdit() -> Gui.ViewProviderDocumentObject or None
|
||||
|
||||
Returns the current object in edit mode or None if there is no such object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="resetEdit">
|
||||
<Documentation>
|
||||
<UserDocu>resetEdit() -> None
|
||||
<UserDocu>resetEdit() -> None
|
||||
|
||||
End the current editing.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="addAnnotation">
|
||||
<Documentation>
|
||||
<UserDocu>addAnnotation(annoName, fileName, modName) -> None
|
||||
<UserDocu>addAnnotation(annoName, fileName, modName) -> None
|
||||
|
||||
Add an Inventor object from a file.
|
||||
Add an Inventor object from a file.
|
||||
|
||||
annoName : str
|
||||
annoName : str
|
||||
Annotation name.
|
||||
fileName : str
|
||||
fileName : str
|
||||
File name.
|
||||
modName : str
|
||||
modName : str
|
||||
Display mode name. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="update">
|
||||
<Documentation>
|
||||
<UserDocu>update() -> None
|
||||
<UserDocu>update() -> None
|
||||
|
||||
Update the view representations of all objects.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getObject">
|
||||
<Documentation>
|
||||
<UserDocu>getObject(objName) -> object or None
|
||||
<UserDocu>getObject(objName) -> object or None
|
||||
|
||||
Return the object with the given name. If no one exists, return None.
|
||||
Return the object with the given name. If no one exists, return None.
|
||||
|
||||
ObjName : str
|
||||
ObjName : str
|
||||
Object name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="activeObject">
|
||||
<Documentation>
|
||||
<UserDocu>activeObject() -> object or None
|
||||
<UserDocu>activeObject() -> object or None
|
||||
|
||||
The active object of the document. Deprecated, use ActiveObject.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="activeView">
|
||||
<Documentation>
|
||||
<UserDocu>activeView() -> object or None
|
||||
<UserDocu>activeView() -> object or None
|
||||
|
||||
The active view of the document. Deprecated, use ActiveView.</UserDocu>
|
||||
</Documentation>
|
||||
@@ -131,76 +131,76 @@ type : str
|
||||
</Methode>
|
||||
<Methode Name="mdiViewsOfType" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>mdiViewsOfType(type) -> list of MDIView
|
||||
<UserDocu>mdiViewsOfType(type) -> list of MDIView
|
||||
|
||||
Return a list of mdi views of a given type.
|
||||
Return a list of mdi views of a given type.
|
||||
|
||||
type : str
|
||||
type : str
|
||||
Type name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="save">
|
||||
<Documentation>
|
||||
<UserDocu>save() -> bool
|
||||
<UserDocu>save() -> bool
|
||||
|
||||
Attempts to save the document</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="saveAs">
|
||||
<Documentation>
|
||||
<UserDocu>saveAs() -> bool
|
||||
<UserDocu>saveAs() -> bool
|
||||
|
||||
Attempts to save the document under a new name</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="sendMsgToViews">
|
||||
<Documentation>
|
||||
<UserDocu>sendMsgToViews(msg) -> None
|
||||
<UserDocu>sendMsgToViews(msg) -> None
|
||||
|
||||
Send a message to all views of the document.
|
||||
Send a message to all views of the document.
|
||||
|
||||
msg : str</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="mergeProject">
|
||||
<Documentation>
|
||||
<UserDocu>mergeProject(fileName) -> None
|
||||
<UserDocu>mergeProject(fileName) -> None
|
||||
|
||||
Merges this document with another project file.
|
||||
Merges this document with another project file.
|
||||
|
||||
fileName : str
|
||||
fileName : str
|
||||
File name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toggleTreeItem">
|
||||
<Documentation>
|
||||
<UserDocu>toggleTreeItem(obj, mod=0, subName) -> None
|
||||
<UserDocu>toggleTreeItem(obj, mod=0, subName) -> None
|
||||
|
||||
Change TreeItem of a document object.
|
||||
Change TreeItem of a document object.
|
||||
|
||||
obj : App.DocumentObject
|
||||
mod : int
|
||||
mod : int
|
||||
Item mode.
|
||||
0: Toggle, 1: Collapse, 2: Expand, 3: Expand path.
|
||||
subName : str
|
||||
subName : str
|
||||
Subelement name. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="scrollToTreeItem">
|
||||
<Documentation>
|
||||
<UserDocu>scrollToTreeItem(obj) -> None
|
||||
<UserDocu>scrollToTreeItem(obj) -> None
|
||||
|
||||
Scroll the tree view to the item of a view object.
|
||||
Scroll the tree view to the item of a view object.
|
||||
|
||||
obj : Gui.ViewProviderDocumentObject</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toggleInSceneGraph">
|
||||
<Documentation>
|
||||
<UserDocu>toggleInSceneGraph(obj) -> None
|
||||
<UserDocu>toggleInSceneGraph(obj) -> None
|
||||
|
||||
Add or remove view object from scene graph of all views depending
|
||||
on its canAddToSceneGraph().
|
||||
Add or remove view object from scene graph of all views depending
|
||||
on its canAddToSceneGraph().
|
||||
|
||||
obj : Gui.ViewProvider</UserDocu>
|
||||
</Documentation>
|
||||
@@ -233,7 +233,7 @@ obj : Gui.ViewProvider</UserDocu>
|
||||
<Documentation>
|
||||
<UserDocu>Current edit mode. Only meaningful when there is a current object in edit.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="EditMode" Type="Int" />
|
||||
<Parameter Name="EditMode" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="Document" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -494,7 +494,7 @@ Py::Object DocumentPy::getInEditInfo() const {
|
||||
return Py::None();
|
||||
|
||||
return Py::TupleN(Py::Object(vp->getObject()->getPyObject(),true),
|
||||
Py::String(subname),Py::String(subelement),Py::Int(mode));
|
||||
Py::String(subname),Py::String(subelement),Py::Long(mode));
|
||||
}
|
||||
|
||||
void DocumentPy::setInEditInfo(Py::Object arg)
|
||||
@@ -509,12 +509,12 @@ void DocumentPy::setInEditInfo(Py::Object arg)
|
||||
pyobj)->getViewProviderDocumentObjectPtr(),subname);
|
||||
}
|
||||
|
||||
Py::Int DocumentPy::getEditMode() const
|
||||
Py::Long DocumentPy::getEditMode() const
|
||||
{
|
||||
int mode = -1;
|
||||
getDocumentPtr()->getInEdit(nullptr,nullptr,&mode);
|
||||
|
||||
return Py::Int(mode);
|
||||
return Py::Long(mode);
|
||||
}
|
||||
|
||||
Py::Boolean DocumentPy::getTransacting() const
|
||||
|
||||
@@ -154,7 +154,7 @@ Return a tuple(path,detail) for the coin3D SoPath and SoDetail of the element
|
||||
<Documentation>
|
||||
<UserDocu>Set the element size to create an array of linked object</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Count" Type="Int" />
|
||||
<Parameter Name="Count" Type="Long" />
|
||||
</Attribute>
|
||||
<Methode Name="getChildren" Const="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -83,7 +83,7 @@ PyObject* LinkViewPy::setMaterial(PyObject *args) {
|
||||
Py_ssize_t pos = 0;
|
||||
std::map<int,App::Material*> materials;
|
||||
while(PyDict_Next(pyObj, &pos, &key, &value)) {
|
||||
Py::Int idx(key);
|
||||
Py::Long idx(key);
|
||||
if(value == Py_None)
|
||||
materials[(int)idx] = nullptr;
|
||||
else if(!PyObject_TypeCheck(value,&App::MaterialPy::Type)) {
|
||||
@@ -135,7 +135,7 @@ PyObject* LinkViewPy::setTransform(PyObject *args) {
|
||||
Py_ssize_t pos = 0;
|
||||
std::map<int,Base::Matrix4D*> mat;
|
||||
while(PyDict_Next(pyObj, &pos, &key, &value)) {
|
||||
Py::Int idx(key);
|
||||
Py::Long idx(key);
|
||||
if(!PyObject_TypeCheck(value,&Base::MatrixPy::Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "exepcting a type of Matrix");
|
||||
return nullptr;
|
||||
@@ -384,11 +384,11 @@ PyObject* LinkViewPy::getChildren(PyObject *args) {
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
Py::Int LinkViewPy::getCount() const {
|
||||
return Py::Int(getLinkViewPtr()->getSize());
|
||||
Py::Long LinkViewPy::getCount() const {
|
||||
return Py::Long(getLinkViewPtr()->getSize());
|
||||
}
|
||||
|
||||
void LinkViewPy::setCount(Py::Int count) {
|
||||
void LinkViewPy::setCount(Py::Long count) {
|
||||
try {
|
||||
getLinkViewPtr()->setSize((int)count);
|
||||
} catch (const Base::Exception& e) {
|
||||
|
||||
@@ -50,7 +50,7 @@ Py::Object PythonStdout::getattr(const char *name)
|
||||
{
|
||||
if (strcmp(name, "softspace") == 0) {
|
||||
int i=0;
|
||||
return Py::Int(i);
|
||||
return Py::Long(i);
|
||||
}
|
||||
return getattr_methods(name);
|
||||
}
|
||||
@@ -114,7 +114,7 @@ Py::Object PythonStderr::getattr(const char *name)
|
||||
{
|
||||
if (strcmp(name, "softspace") == 0) {
|
||||
int i=0;
|
||||
return Py::Int(i);
|
||||
return Py::Long(i);
|
||||
}
|
||||
return getattr_methods(name);
|
||||
}
|
||||
@@ -175,7 +175,7 @@ Py::Object OutputStdout::getattr(const char *name)
|
||||
{
|
||||
if (strcmp(name, "softspace") == 0) {
|
||||
int i=0;
|
||||
return Py::Int(i);
|
||||
return Py::Long(i);
|
||||
}
|
||||
return getattr_methods(name);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ Py::Object OutputStderr::getattr(const char *name)
|
||||
{
|
||||
if (strcmp(name, "softspace") == 0) {
|
||||
int i=0;
|
||||
return Py::Int(i);
|
||||
return Py::Long(i);
|
||||
}
|
||||
return getattr_methods(name);
|
||||
}
|
||||
|
||||
@@ -1282,8 +1282,8 @@ Py::Object View3DInventorPy::getCursorPos()
|
||||
auto viewer = getView3DInventorPtr()->getViewer();
|
||||
SbVec2s vec = viewer->fromQPoint(pos);
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, Py::Int(vec[0]));
|
||||
tuple.setItem(1, Py::Int(vec[1]));
|
||||
tuple.setItem(0, Py::Long(vec[0]));
|
||||
tuple.setItem(1, Py::Long(vec[1]));
|
||||
return tuple;
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
@@ -1300,13 +1300,13 @@ Py::Object View3DInventorPy::getObjectInfo(const Py::Tuple& args)
|
||||
|
||||
try {
|
||||
//Note: For gcc (4.2) we need the 'const' keyword to avoid the compiler error:
|
||||
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Int' requested
|
||||
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Long' requested
|
||||
//We should report this problem to the PyCXX project as in the documentation an
|
||||
//example without the 'const' keyword is used.
|
||||
//Or we can also write Py::Int x(tuple[0]);
|
||||
//Or we can also write Py::Long x(tuple[0]);
|
||||
const Py::Tuple tuple(object);
|
||||
Py::Int x(tuple[0]);
|
||||
Py::Int y(tuple[1]);
|
||||
Py::Long x(tuple[0]);
|
||||
Py::Long y(tuple[1]);
|
||||
|
||||
// As this method could be called during a SoHandleEventAction scene
|
||||
// graph traversal we must not use a second SoHandleEventAction as
|
||||
@@ -1406,13 +1406,13 @@ Py::Object View3DInventorPy::getObjectsInfo(const Py::Tuple& args)
|
||||
|
||||
try {
|
||||
//Note: For gcc (4.2) we need the 'const' keyword to avoid the compiler error:
|
||||
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Int' requested
|
||||
//conversion from 'Py::seqref<Py::Object>' to non-scalar type 'Py::Long' requested
|
||||
//We should report this problem to the PyCXX project as in the documentation an
|
||||
//example without the 'const' keyword is used.
|
||||
//Or we can also write Py::Int x(tuple[0]);
|
||||
//Or we can also write Py::Long x(tuple[0]);
|
||||
const Py::Tuple tuple(object);
|
||||
Py::Int x(tuple[0]);
|
||||
Py::Int y(tuple[1]);
|
||||
Py::Long x(tuple[0]);
|
||||
Py::Long y(tuple[1]);
|
||||
|
||||
// As this method could be called during a SoHandleEventAction scene
|
||||
// graph traversal we must not use a second SoHandleEventAction as
|
||||
@@ -1562,8 +1562,8 @@ Py::Object View3DInventorPy::getSize()
|
||||
try {
|
||||
SbVec2s size = getView3DInventorPtr()->getViewer()->getSoRenderManager()->getSize();
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, Py::Int(size[0]));
|
||||
tuple.setItem(1, Py::Int(size[1]));
|
||||
tuple.setItem(0, Py::Long(size[0]));
|
||||
tuple.setItem(1, Py::Long(size[1]));
|
||||
return tuple;
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
@@ -1577,8 +1577,8 @@ Py::Object View3DInventorPy::getPointOnFocalPlane(const Py::Tuple& args)
|
||||
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
|
||||
PyErr_Clear();
|
||||
Py::Tuple t(args[0]);
|
||||
x = (int)Py::Int(t[0]);
|
||||
y = (int)Py::Int(t[1]);
|
||||
x = (int)Py::Long(t[0]);
|
||||
y = (int)Py::Long(t[1]);
|
||||
}
|
||||
try {
|
||||
SbVec3f pt = getView3DInventorPtr()->getViewer()->getPointOnFocalPlane(SbVec2s(x,y));
|
||||
@@ -1612,8 +1612,8 @@ Py::Object View3DInventorPy::getPointOnViewport(const Py::Tuple& args)
|
||||
try {
|
||||
SbVec2s pt = getView3DInventorPtr()->getViewer()->getPointOnViewport(SbVec3f(vx,vy,vz));
|
||||
Py::Tuple tuple(2);
|
||||
tuple.setItem(0, Py::Int(pt[0]));
|
||||
tuple.setItem(1, Py::Int(pt[1]));
|
||||
tuple.setItem(0, Py::Long(pt[0]));
|
||||
tuple.setItem(1, Py::Long(pt[1]));
|
||||
|
||||
return tuple;
|
||||
}
|
||||
@@ -1631,8 +1631,8 @@ Py::Object View3DInventorPy::projectPointToLine(const Py::Tuple& args)
|
||||
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
|
||||
PyErr_Clear();
|
||||
Py::Tuple t(args[0]);
|
||||
x = (int)Py::Int(t[0]);
|
||||
y = (int)Py::Int(t[1]);
|
||||
x = (int)Py::Long(t[0]);
|
||||
y = (int)Py::Long(t[1]);
|
||||
}
|
||||
try {
|
||||
SbVec3f pt1, pt2;
|
||||
@@ -1691,8 +1691,8 @@ void View3DInventorPy::eventCallback(void * ud, SoEventCallback * n)
|
||||
dict.setItem("Time", Py::String(std::string(e->getTime().formatDate("%Y-%m-%d %H:%M:%S").getString())));
|
||||
SbVec2s p = n->getEvent()->getPosition();
|
||||
Py::Tuple pos(2);
|
||||
pos.setItem(0, Py::Int(p[0]));
|
||||
pos.setItem(1, Py::Int(p[1]));
|
||||
pos.setItem(0, Py::Long(p[0]));
|
||||
pos.setItem(1, Py::Long(p[1]));
|
||||
// Position
|
||||
dict.setItem("Position", pos);
|
||||
// Shift, Ctrl, Alt down
|
||||
@@ -2565,7 +2565,7 @@ Py::Object View3DInventorPy::setCornerCrossSize(const Py::Tuple& args)
|
||||
Py::Object View3DInventorPy::getCornerCrossSize()
|
||||
{
|
||||
int size = getView3DInventorPtr()->getViewer()->getFeedbackSize();
|
||||
return Py::Int(size);
|
||||
return Py::Long(size);
|
||||
}
|
||||
|
||||
Py::Object View3DInventorPy::cast_to_base()
|
||||
|
||||
@@ -277,8 +277,8 @@ Py::Object View3DInventorViewerPy::seekToPoint(const Py::Tuple& args)
|
||||
_viewer->seekToPoint(hitpoint);
|
||||
}
|
||||
else {
|
||||
Py::Int x(tuple[0]);
|
||||
Py::Int y(tuple[1]);
|
||||
Py::Long x(tuple[0]);
|
||||
Py::Long y(tuple[1]);
|
||||
|
||||
SbVec2s hitpoint ((long)x,(long)y);
|
||||
_viewer->seekToPoint(hitpoint);
|
||||
@@ -344,8 +344,8 @@ Py::Object View3DInventorViewerPy::getPointOnFocalPlane(const Py::Tuple& args)
|
||||
if (!PyArg_ParseTuple(args.ptr(), "hh", &x, &y)) {
|
||||
PyErr_Clear();
|
||||
Py::Tuple t(args[0]);
|
||||
x = (int)Py::Int(t[0]);
|
||||
y = (int)Py::Int(t[1]);
|
||||
x = (int)Py::Long(t[0]);
|
||||
y = (int)Py::Long(t[1]);
|
||||
}
|
||||
try {
|
||||
SbVec3f pt = _viewer->getPointOnFocalPlane(SbVec2s(x,y));
|
||||
|
||||
@@ -356,7 +356,7 @@ ViewProviderFeaturePythonImp::setEdit(int ModNum)
|
||||
try {
|
||||
if (has__object__) {
|
||||
Py::Tuple args(1);
|
||||
args.setItem(0, Py::Int(ModNum));
|
||||
args.setItem(0, Py::Long(ModNum));
|
||||
Py::Object ret(Base::pyCall(py_setEdit.ptr(),args.ptr()));
|
||||
if (ret.isNone())
|
||||
return NotImplemented;
|
||||
@@ -367,7 +367,7 @@ ViewProviderFeaturePythonImp::setEdit(int ModNum)
|
||||
else {
|
||||
Py::Tuple args(2);
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
args.setItem(1, Py::Int(ModNum));
|
||||
args.setItem(1, Py::Long(ModNum));
|
||||
Py::Object ret(Base::pyCall(py_setEdit.ptr(),args.ptr()));
|
||||
if (ret.isNone())
|
||||
return NotImplemented;
|
||||
@@ -397,7 +397,7 @@ ViewProviderFeaturePythonImp::unsetEdit(int ModNum)
|
||||
try {
|
||||
if (has__object__) {
|
||||
Py::Tuple args(1);
|
||||
args.setItem(0, Py::Int(ModNum));
|
||||
args.setItem(0, Py::Long(ModNum));
|
||||
Py::Object ret(Base::pyCall(py_unsetEdit.ptr(),args.ptr()));
|
||||
if (ret.isNone())
|
||||
return NotImplemented;
|
||||
@@ -408,7 +408,7 @@ ViewProviderFeaturePythonImp::unsetEdit(int ModNum)
|
||||
else {
|
||||
Py::Tuple args(2);
|
||||
args.setItem(0, Py::Object(object->getPyObject(), true));
|
||||
args.setItem(1, Py::Int(ModNum));
|
||||
args.setItem(1, Py::Long(ModNum));
|
||||
Py::Object ret(Base::pyCall(py_unsetEdit.ptr(),args.ptr()));
|
||||
if (ret.isNone())
|
||||
return NotImplemented;
|
||||
@@ -439,7 +439,7 @@ ViewProviderFeaturePythonImp::setEditViewer(View3DInventorViewer *viewer, int Mo
|
||||
Py::Tuple args(3);
|
||||
args.setItem(0, Py::Object(object->getPyObject(),true));
|
||||
args.setItem(1, Py::Object(viewer->getPyObject(),true));
|
||||
args.setItem(2, Py::Int(ModNum));
|
||||
args.setItem(2, Py::Long(ModNum));
|
||||
Py::Object ret(Base::pyCall(py_setEditViewer.ptr(),args.ptr()));
|
||||
return ret.isTrue()?Accepted:Rejected;
|
||||
}
|
||||
@@ -681,7 +681,7 @@ void ViewProviderFeaturePythonImp::finishRestoring()
|
||||
Py::Object vp = Proxy.getValue();
|
||||
if (vp.isNone()) {
|
||||
object->show();
|
||||
Proxy.setValue(Py::Int(1));
|
||||
Proxy.setValue(Py::Long(1));
|
||||
} else {
|
||||
_FC_PY_CALL_CHECK(finishRestoring,return);
|
||||
Base::pyCall(py_finishRestoring.ptr());
|
||||
|
||||
@@ -15,274 +15,274 @@
|
||||
</Documentation>
|
||||
<Methode Name="addProperty">
|
||||
<Documentation>
|
||||
<UserDocu>addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider
|
||||
<UserDocu>addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider
|
||||
|
||||
Add a generic property.
|
||||
Add a generic property.
|
||||
|
||||
type : str
|
||||
type : str
|
||||
Property type.
|
||||
name : str
|
||||
name : str
|
||||
Property name. Optional.
|
||||
group : str
|
||||
group : str
|
||||
Property group. Optional.
|
||||
attr : int
|
||||
attr : int
|
||||
Property attributes.
|
||||
ro : bool
|
||||
ro : bool
|
||||
Read only property.
|
||||
hd : bool
|
||||
hd : bool
|
||||
Hidden property.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="removeProperty">
|
||||
<Documentation>
|
||||
<UserDocu>removeProperty(name) -> bool
|
||||
<UserDocu>removeProperty(name) -> bool
|
||||
|
||||
Remove a generic property.
|
||||
Only user-defined properties can be removed, not built-in ones.
|
||||
Only user-defined properties can be removed, not built-in ones.
|
||||
|
||||
name : str
|
||||
name : str
|
||||
Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="supportedProperties">
|
||||
<Documentation>
|
||||
<UserDocu>supportedProperties() -> list
|
||||
<UserDocu>supportedProperties() -> list
|
||||
|
||||
A list of supported property types.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="show">
|
||||
<Documentation>
|
||||
<UserDocu>show() -> None
|
||||
<UserDocu>show() -> None
|
||||
|
||||
Show the object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="hide">
|
||||
<Documentation>
|
||||
<UserDocu>show() -> None
|
||||
<UserDocu>show() -> None
|
||||
|
||||
Hide the object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isVisible">
|
||||
<Documentation>
|
||||
<UserDocu>isVisible() -> bool
|
||||
<UserDocu>isVisible() -> bool
|
||||
|
||||
Check if the object is visible.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDragObject">
|
||||
<Documentation>
|
||||
<UserDocu>canDragObject(obj=None) -> bool
|
||||
<UserDocu>canDragObject(obj=None) -> bool
|
||||
|
||||
Check whether the child object can be removed by dragging.
|
||||
If 'obj' is not given, check without filter by any particular object.
|
||||
If 'obj' is not given, check without filter by any particular object.
|
||||
|
||||
obj : App.DocumentObject
|
||||
obj : App.DocumentObject
|
||||
Object to be dragged.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dragObject">
|
||||
<Documentation>
|
||||
<UserDocu>dragObject(obj) -> None
|
||||
<UserDocu>dragObject(obj) -> None
|
||||
|
||||
Remove a child object by dropping.
|
||||
Remove a child object by dropping.
|
||||
|
||||
obj : App.DocumentObject
|
||||
obj : App.DocumentObject
|
||||
Object to be dragged.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDropObject" Keyword="true">
|
||||
<Documentation>
|
||||
<UserDocu>canDropObject(obj=None, owner=None, subname, elem=None) -> bool
|
||||
<UserDocu>canDropObject(obj=None, owner=None, subname, elem=None) -> bool
|
||||
|
||||
Check whether the child object can be added by dropping.
|
||||
If 'obj' is not given, check without filter by any particular object.
|
||||
If 'obj' is not given, check without filter by any particular object.
|
||||
|
||||
obj : App.DocumentObject
|
||||
obj : App.DocumentObject
|
||||
Object to be dropped.
|
||||
owner : App.DocumentObject
|
||||
owner : App.DocumentObject
|
||||
Parent object of the dropping object.
|
||||
subname : str
|
||||
subname : str
|
||||
Subname reference to the dropping object. Optional.
|
||||
elem : sequence of str
|
||||
elem : sequence of str
|
||||
Non-objects subelements selected when the object is
|
||||
being dropped.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dropObject" Keyword="true">
|
||||
<Documentation>
|
||||
<UserDocu>dropObject(obj, owner=None, subname, elem=None) -> str
|
||||
<UserDocu>dropObject(obj, owner=None, subname, elem=None) -> str
|
||||
|
||||
Add a child object by dropping.
|
||||
Add a child object by dropping.
|
||||
|
||||
obj : App.DocumentObject
|
||||
obj : App.DocumentObject
|
||||
Object to be dropped.
|
||||
owner : App.DocumentObject
|
||||
owner : App.DocumentObject
|
||||
Parent object of the dropping object.
|
||||
subname : str
|
||||
subname : str
|
||||
Subname reference to the dropping object. Optional.
|
||||
elem : sequence of str
|
||||
elem : sequence of str
|
||||
Non-objects subelements selected when the object is
|
||||
being dropped.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="canDragAndDropObject">
|
||||
<Documentation>
|
||||
<UserDocu>canDragAndDropObject(obj) -> bool
|
||||
<UserDocu>canDragAndDropObject(obj) -> bool
|
||||
|
||||
Check whether the child object can be removed from
|
||||
other parent and added here by drag and drop.
|
||||
other parent and added here by drag and drop.
|
||||
|
||||
obj : App.DocumentObject
|
||||
obj : App.DocumentObject
|
||||
Object to be dragged and dropped.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="replaceObject">
|
||||
<Documentation>
|
||||
<UserDocu>replaceObject(oldObj, newObj) -> int
|
||||
<UserDocu>replaceObject(oldObj, newObj) -> int
|
||||
|
||||
Replace a child object.
|
||||
Returns 1 if succeeded, 0 if not found, -1 if not supported.
|
||||
Returns 1 if succeeded, 0 if not found, -1 if not supported.
|
||||
|
||||
oldObj : App.DocumentObject
|
||||
oldObj : App.DocumentObject
|
||||
Old object.
|
||||
newObj : App.DocumentObject
|
||||
newObj : App.DocumentObject
|
||||
New object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="doubleClicked">
|
||||
<Documentation>
|
||||
<UserDocu>doubleClicked() -> bool
|
||||
<UserDocu>doubleClicked() -> bool
|
||||
|
||||
Trigger double clicking the corresponding tree item of this view object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="addDisplayMode">
|
||||
<Documentation>
|
||||
<UserDocu>addDisplayMode(obj, mode) -> None
|
||||
<UserDocu>addDisplayMode(obj, mode) -> None
|
||||
|
||||
Add a new display mode to the view provider.
|
||||
Add a new display mode to the view provider.
|
||||
|
||||
obj : coin.SoNode
|
||||
obj : coin.SoNode
|
||||
Display mode.
|
||||
mode : str
|
||||
mode : str
|
||||
Name of the display mode.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="listDisplayModes">
|
||||
<Documentation>
|
||||
<UserDocu>listDisplayModes() -> list
|
||||
<UserDocu>listDisplayModes() -> list
|
||||
|
||||
Show a list of all display modes.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toString">
|
||||
<Documentation>
|
||||
<UserDocu>toString() -> str
|
||||
<UserDocu>toString() -> str
|
||||
|
||||
Return a string representation of the Inventor node.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setTransformation">
|
||||
<Documentation>
|
||||
<UserDocu>setTransformation(trans) -> None
|
||||
<UserDocu>setTransformation(trans) -> None
|
||||
|
||||
Set a transformation on the Inventor node.
|
||||
Set a transformation on the Inventor node.
|
||||
|
||||
trans : Base.Placement, Base.Matrix</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="claimChildren" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>claimChildren() -> list
|
||||
<UserDocu>claimChildren() -> list
|
||||
|
||||
Returns list of objects that are to be grouped in tree under this object.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="claimChildrenRecursive" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>claimChildrenRecursive() -> list
|
||||
<UserDocu>claimChildrenRecursive() -> list
|
||||
|
||||
Returns list of objects that are to be grouped in tree under this object recursively.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="partialRender">
|
||||
<Documentation>
|
||||
<UserDocu>partialRender(sub=None, clear=False) -> int
|
||||
<UserDocu>partialRender(sub=None, clear=False) -> int
|
||||
|
||||
Render only part of the object.
|
||||
Render only part of the object.
|
||||
|
||||
sub: None, str, sequence of str
|
||||
sub: None, str, sequence of str
|
||||
Refer to the subelement. If it is None then reset the partial rendering.
|
||||
clear: bool
|
||||
clear: bool
|
||||
True to add, or False to remove the subelement(s) for rendering.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getElementColors">
|
||||
<Documentation>
|
||||
<UserDocu>getElementColors(elementName) -> dict
|
||||
<UserDocu>getElementColors(elementName) -> dict
|
||||
|
||||
Get a dictionary of the form {elementName : (r,g,b,a)}.
|
||||
If no element name is given a dictionary with all the elements is returned.
|
||||
If no element name is given a dictionary with all the elements is returned.
|
||||
|
||||
elementName : str
|
||||
elementName : str
|
||||
Name of the element. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setElementColors">
|
||||
<Documentation>
|
||||
<UserDocu>setElementColors(colors) -> None
|
||||
<UserDocu>setElementColors(colors) -> None
|
||||
|
||||
Set element colors.
|
||||
Set element colors.
|
||||
|
||||
colors: dict
|
||||
colors: dict
|
||||
Color dictionary of the form {elementName:(r,g,b,a)}.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getElementPicked" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getElementPicked(pickPoint) -> str
|
||||
<UserDocu>getElementPicked(pickPoint) -> str
|
||||
|
||||
Return the picked subelement.
|
||||
Return the picked subelement.
|
||||
|
||||
pickPoint : coin.SoPickedPoint</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getDetailPath" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getDetailPath(subelement, path, append=True) -> coin.SoDetail or None
|
||||
<UserDocu>getDetailPath(subelement, path, append=True) -> coin.SoDetail or None
|
||||
|
||||
Return Coin detail and path of an subelement.
|
||||
Return Coin detail and path of an subelement.
|
||||
|
||||
subname: str
|
||||
subname: str
|
||||
Dot separated string reference to the sub element.
|
||||
pPath: coin.SoPath
|
||||
pPath: coin.SoPath
|
||||
Output coin path leading to the returned element detail.
|
||||
append: bool
|
||||
append: bool
|
||||
If True, path will be first appended with the root node and the mode
|
||||
switch node of this view provider.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="signalChangeIcon" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>signalChangeIcon() -> None
|
||||
<UserDocu>signalChangeIcon() -> None
|
||||
|
||||
Trigger icon changed signal.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getBoundingBox">
|
||||
<Documentation>
|
||||
<UserDocu>getBoundingBox(subName, transform=True, view) -> Base.BoundBox
|
||||
<UserDocu>getBoundingBox(subName, transform=True, view) -> Base.BoundBox
|
||||
|
||||
Obtain the bounding box of this view object.
|
||||
Obtain the bounding box of this view object.
|
||||
|
||||
subName : str
|
||||
subName : str
|
||||
Name referring a sub-object. Optional.
|
||||
transform: bool
|
||||
transform: bool
|
||||
Whether to apply the transformation matrix of this view provider.
|
||||
view: View3DInventorPy
|
||||
view: View3DInventorPy
|
||||
Default to active view. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
@@ -314,7 +314,7 @@ view: View3DInventorPy
|
||||
<Documentation>
|
||||
<UserDocu>Get/Set the default display mode in turns of coin node index.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="DefaultNode" Type="Int" />
|
||||
<Parameter Name="DefaultNode" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="IV" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -304,7 +304,7 @@ PyObject* ViewProviderPy::replaceObject(PyObject *args)
|
||||
int ret = getViewProviderPtr()->replaceObject(
|
||||
static_cast<App::DocumentObjectPy*>(oldObj)->getDocumentObjectPtr(),
|
||||
static_cast<App::DocumentObjectPy*>(newObj)->getDocumentObjectPtr());
|
||||
return Py::new_reference_to(Py::Int(ret));
|
||||
return Py::new_reference_to(Py::Long(ret));
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
@@ -456,7 +456,7 @@ PyObject* ViewProviderPy::partialRender(PyObject* args)
|
||||
}
|
||||
}
|
||||
|
||||
Py::Int ret(getViewProviderPtr()->partialRender(values, Base::asBoolean(clear)));
|
||||
Py::Long ret(getViewProviderPtr()->partialRender(values, Base::asBoolean(clear)));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
@@ -677,12 +677,12 @@ Py::Object ViewProviderPy::getIcon() const
|
||||
return wrap.fromQIcon(new QIcon(icon));
|
||||
}
|
||||
|
||||
Py::Int ViewProviderPy::getDefaultMode() const
|
||||
Py::Long ViewProviderPy::getDefaultMode() const
|
||||
{
|
||||
return Py::Int((long)getViewProviderPtr()->getDefaultMode());
|
||||
return Py::Long((long)getViewProviderPtr()->getDefaultMode());
|
||||
}
|
||||
|
||||
void ViewProviderPy::setDefaultMode(Py::Int arg)
|
||||
void ViewProviderPy::setDefaultMode(Py::Long arg)
|
||||
{
|
||||
return getViewProviderPtr()->setDefaultMode(arg);
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ Py::Object PyResource::value(const Py::Tuple& args)
|
||||
item = Py::Long(static_cast<unsigned long>(v.toUInt()));
|
||||
break;
|
||||
case QMetaType::Int:
|
||||
item = Py::Int(v.toInt());
|
||||
item = Py::Long(v.toInt());
|
||||
break;
|
||||
default:
|
||||
item = Py::String("");
|
||||
|
||||
@@ -666,7 +666,7 @@ Py::List AreaPy::getShapes() const
|
||||
Area* area = getAreaPtr();
|
||||
const std::list<Area::Shape>& shapes = area->getChildren();
|
||||
for (auto& s : shapes) {
|
||||
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Int(s.op)));
|
||||
ret.append(Py::TupleN(Part::shape2pyshape(s.shape), Py::Long(s.op)));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<Documentation>
|
||||
<UserDocu>Returns the cell's category as an integer</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="SourceCategory" Type="Int"/>
|
||||
<Parameter Name="SourceCategory" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="SourceCategoryName" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -134,10 +134,10 @@ Py::Long VoronoiCellPy::getSourceIndex() const
|
||||
return Py::Long(index);
|
||||
}
|
||||
|
||||
Py::Int VoronoiCellPy::getSourceCategory() const
|
||||
Py::Long VoronoiCellPy::getSourceCategory() const
|
||||
{
|
||||
VoronoiCell* c = getVoronoiCellFromPy(this);
|
||||
return Py::Int(c->ptr->source_category());
|
||||
return Py::Long(c->ptr->source_category());
|
||||
}
|
||||
|
||||
Py::String VoronoiCellPy::getSourceCategoryName() const
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
<Documentation>
|
||||
<UserDocu>The number of rows in the array.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Rows" Type="Int"/>
|
||||
<Parameter Name="Rows" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Columns" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The number of columns in the array.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Columns" Type="Int"/>
|
||||
<Parameter Name="Columns" Type="Long"/>
|
||||
</Attribute>
|
||||
<Methode Name="getRow" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -81,14 +81,14 @@ Py::List Array2DPy::getArray() const
|
||||
return list;
|
||||
}
|
||||
|
||||
Py::Int Array2DPy::getRows() const
|
||||
Py::Long Array2DPy::getRows() const
|
||||
{
|
||||
return Py::Int(getMaterial2DArrayPtr()->rows());
|
||||
return Py::Long(getMaterial2DArrayPtr()->rows());
|
||||
}
|
||||
|
||||
Py::Int Array2DPy::getColumns() const
|
||||
Py::Long Array2DPy::getColumns() const
|
||||
{
|
||||
return Py::Int(getMaterial2DArrayPtr()->columns());
|
||||
return Py::Long(getMaterial2DArrayPtr()->columns());
|
||||
}
|
||||
|
||||
PyObject* Array2DPy::getRow(PyObject* args)
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
<Documentation>
|
||||
<UserDocu>The number of columns in the array.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Columns" Type="Int"/>
|
||||
<Parameter Name="Columns" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="Depth" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The depth of the array (3rd dimension).</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Columns" Type="Int"/>
|
||||
<Parameter Name="Columns" Type="Long"/>
|
||||
</Attribute>
|
||||
<Methode Name="getRows" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
||||
@@ -83,14 +83,14 @@ Py::List Array3DPy::getArray() const
|
||||
return list;
|
||||
}
|
||||
|
||||
Py::Int Array3DPy::getColumns() const
|
||||
Py::Long Array3DPy::getColumns() const
|
||||
{
|
||||
return Py::Int(getMaterial3DArrayPtr()->columns());
|
||||
return Py::Long(getMaterial3DArrayPtr()->columns());
|
||||
}
|
||||
|
||||
Py::Int Array3DPy::getDepth() const
|
||||
Py::Long Array3DPy::getDepth() const
|
||||
{
|
||||
return Py::Int(getMaterial3DArrayPtr()->depth());
|
||||
return Py::Long(getMaterial3DArrayPtr()->depth());
|
||||
}
|
||||
|
||||
PyObject* Array3DPy::getRows(PyObject* args)
|
||||
|
||||
@@ -1054,7 +1054,7 @@ private:
|
||||
if (!PyLong_Check(value)) {
|
||||
throw Py::ValueError(err);
|
||||
}
|
||||
int order = Py::Int(value);
|
||||
int order = Py::Long(value);
|
||||
params.orders[s] = static_cast<TopoShape::Continuity>(order);
|
||||
return;
|
||||
});
|
||||
@@ -1131,7 +1131,7 @@ private:
|
||||
if (!PyLong_Check(value)) {
|
||||
throw Py::ValueError(err);
|
||||
}
|
||||
int order = Py::Int(value);
|
||||
int order = Py::Long(value);
|
||||
params.orders[s] = static_cast<TopoShape::Continuity>(order);
|
||||
return;
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ PyObject *PartFeaturePy::getElementHistory(PyObject *args, PyObject *kwds) {
|
||||
} else
|
||||
ret.setItem(0, Py::Object(history.obj->getPyObject(), true));
|
||||
} else
|
||||
ret.setItem(0, Py::Int(history.tag));
|
||||
ret.setItem(0, Py::Long(history.tag));
|
||||
tmp.clear();
|
||||
ret.setItem(1, Py::String(history.element.appendToBuffer(tmp)));
|
||||
Py::List intermedates;
|
||||
|
||||
@@ -1889,7 +1889,7 @@ PyObject* TopoShapePy::countElement(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(Py::Int((long)getTopoShapePtr()->countSubShapes(input)));
|
||||
return Py::new_reference_to(Py::Long((long)getTopoShapePtr()->countSubShapes(input)));
|
||||
}
|
||||
PY_CATCH_OCC
|
||||
}
|
||||
@@ -2362,10 +2362,10 @@ PyObject* TopoShapePy::findSubShape(PyObject* args)
|
||||
for (auto& s : getPyShapes(pyobj)) {
|
||||
int index = getTopoShapePtr()->findShape(s.getShape());
|
||||
if (index > 0) {
|
||||
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Int(index)));
|
||||
res.append(Py::TupleN(Py::String(s.shapeName()), Py::Long(index)));
|
||||
}
|
||||
else {
|
||||
res.append(Py::TupleN(Py::Object(), Py::Int(0)));
|
||||
res.append(Py::TupleN(Py::Object(), Py::Long(0)));
|
||||
}
|
||||
}
|
||||
if (PySequence_Check(pyobj)) {
|
||||
@@ -2652,7 +2652,7 @@ PyObject* TopoShapePy::getElementHistory(PyObject* args)
|
||||
Py_Return;
|
||||
}
|
||||
Py::Tuple ret(3);
|
||||
ret.setItem(0, Py::Int(tag));
|
||||
ret.setItem(0, Py::Long(tag));
|
||||
std::string tmp;
|
||||
ret.setItem(1, Py::String(original.appendToBuffer(tmp)));
|
||||
Py::List pyHistory;
|
||||
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
args.setItem(3,vector.apply(xyz));
|
||||
|
||||
args.setItem(4,Py::Float(radius));
|
||||
args.setItem(5,Py::Int((int)0));
|
||||
args.setItem(5,Py::Long((int)0));
|
||||
Py::Tuple ret(method.apply(args));
|
||||
Py::Object S1(ret.getItem(0));
|
||||
Py::Object S2(ret.getItem(1));
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
args.setItem(2,Py::Vector(l2));
|
||||
args.setItem(3,Py::Vector(Base::Vector3d(0,0,1)));
|
||||
args.setItem(4,Py::Float(radius));
|
||||
//args.setItem(5,Py::Int((int)0));
|
||||
//args.setItem(5,Py::Long((int)0));
|
||||
args.setItem(5,Py::Long((long)1));
|
||||
Py::Tuple ret(method.apply(args));
|
||||
Py::Vector S1(ret.getItem(0));
|
||||
|
||||
@@ -2462,7 +2462,7 @@ Py::List SketchObjectPy::getConflictingConstraints() const
|
||||
Py::List conflicting;
|
||||
|
||||
for (auto cid : conflictinglist) {
|
||||
conflicting.append(Py::Int(cid));
|
||||
conflicting.append(Py::Long(cid));
|
||||
}
|
||||
|
||||
return conflicting;
|
||||
@@ -2475,7 +2475,7 @@ Py::List SketchObjectPy::getRedundantConstraints() const
|
||||
Py::List redundant;
|
||||
|
||||
for (auto cid : redundantlist) {
|
||||
redundant.append(Py::Int(cid));
|
||||
redundant.append(Py::Long(cid));
|
||||
}
|
||||
|
||||
return redundant;
|
||||
@@ -2488,7 +2488,7 @@ Py::List SketchObjectPy::getPartiallyRedundantConstraints() const
|
||||
Py::List redundant;
|
||||
|
||||
for (auto cid : redundantlist) {
|
||||
redundant.append(Py::Int(cid));
|
||||
redundant.append(Py::Long(cid));
|
||||
}
|
||||
|
||||
return redundant;
|
||||
@@ -2501,7 +2501,7 @@ Py::List SketchObjectPy::getMalformedConstraints() const
|
||||
Py::List malformed;
|
||||
|
||||
for (auto cid : malformedlist) {
|
||||
malformed.append(Py::Int(cid));
|
||||
malformed.append(Py::Long(cid));
|
||||
}
|
||||
|
||||
return malformed;
|
||||
|
||||
@@ -178,7 +178,7 @@ PyObject* SketchPy::moveGeometry(PyObject* args)
|
||||
|
||||
Py::Long SketchPy::getConstraint() const
|
||||
{
|
||||
// return Py::Int();
|
||||
// return Py::Long();
|
||||
throw Py::AttributeError("Not yet implemented");
|
||||
}
|
||||
|
||||
|
||||
2
src/Tools/.gitignore
vendored
2
src/Tools/.gitignore
vendored
@@ -1,4 +1,2 @@
|
||||
# ignore the pyc files created while compile
|
||||
*.pyc
|
||||
generateBase/*.pyc
|
||||
generateTemplates/*.pyc
|
||||
|
||||
3
src/Tools/bindings/.gitignore
vendored
Normal file
3
src/Tools/bindings/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# ignore the pyc files created while compile
|
||||
model/*.pyc
|
||||
templates/*.pyc
|
||||
@@ -3,9 +3,9 @@
|
||||
# (c) 2006 Jürgen Riegel GPL
|
||||
|
||||
import os, sys, getopt
|
||||
import generateBase.generateModel_Module
|
||||
import generateTemplates.templateModule
|
||||
import generateTemplates.templateClassPyExport
|
||||
import model.generateModel_Module
|
||||
import templates.templateModule
|
||||
import templates.templateClassPyExport
|
||||
|
||||
Usage = """generate - generates a FreeCAD Module out of an XML model
|
||||
|
||||
@@ -31,27 +31,28 @@ Version:
|
||||
# Globals
|
||||
|
||||
|
||||
def generate(filename, path):
|
||||
def generate(filename, outputPath):
|
||||
# load model
|
||||
GenerateModelInst = generateBase.generateModel_Module.parse(filename)
|
||||
GenerateModelInst = model.generateModel_Module.parse(filename)
|
||||
|
||||
if len(GenerateModelInst.Module) != 0:
|
||||
Module = generateTemplates.templateModule.TemplateModule()
|
||||
Module.path = path
|
||||
Module = templates.templateModule.TemplateModule()
|
||||
Module.outputDir = outputPath
|
||||
Module.module = GenerateModelInst.Module[0]
|
||||
Module.Generate()
|
||||
print("Done generating: " + GenerateModelInst.Module[0].Name)
|
||||
else:
|
||||
Export = generateTemplates.templateClassPyExport.TemplateClassPyExport()
|
||||
Export.path = path + "/"
|
||||
Export.dirname = os.path.dirname(filename) + "/"
|
||||
Export = templates.templateClassPyExport.TemplateClassPyExport()
|
||||
Export.outputDir = outputPath + "/"
|
||||
Export.inputDir = os.path.dirname(filename) + "/"
|
||||
Export.export = GenerateModelInst.PythonExport[0]
|
||||
Export.Generate()
|
||||
print("Done generating: " + GenerateModelInst.PythonExport[0].Name)
|
||||
|
||||
|
||||
def main():
|
||||
defaultPath = ""
|
||||
verbose = False
|
||||
outputPath = ""
|
||||
|
||||
class generateOutput:
|
||||
def write(self, data):
|
||||
@@ -60,10 +61,8 @@ def main():
|
||||
def flush(self): # mandatory for file-like objects
|
||||
pass
|
||||
|
||||
sys.stdout = generateOutput()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "ho:", ["help", "outputPath="])
|
||||
opts, args = getopt.getopt(sys.argv[1:], "hvo:", ["help", "verbose", "outputPath="])
|
||||
except getopt.GetoptError:
|
||||
# print help information and exit:
|
||||
sys.stderr.write(Usage)
|
||||
@@ -75,7 +74,12 @@ def main():
|
||||
sys.stderr.write(Usage)
|
||||
sys.exit()
|
||||
if o in ("-o", "--outputPath"):
|
||||
defaultPath = a
|
||||
outputPath = a
|
||||
if o in ("-v", "--verbose"):
|
||||
verbose = True
|
||||
|
||||
if not verbose:
|
||||
sys.stdout = generateOutput()
|
||||
|
||||
# running through the files
|
||||
if len(args) == 0:
|
||||
@@ -83,12 +87,11 @@ def main():
|
||||
else:
|
||||
for i in args:
|
||||
filename = os.path.abspath(i)
|
||||
if defaultPath == "":
|
||||
head, tail = os.path.split(filename)
|
||||
print(head, tail)
|
||||
if outputPath == "":
|
||||
head, _ = os.path.split(filename)
|
||||
generate(filename, head)
|
||||
else:
|
||||
generate(filename, defaultPath)
|
||||
generate(filename, outputPath)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@@ -3182,8 +3182,8 @@ def parse(inFileName):
|
||||
rootObj.build(rootNode)
|
||||
# Enable Python to collect the space used by the DOM.
|
||||
doc = None
|
||||
sys.stdout.write('<?xml version="1.0" ?>\n')
|
||||
rootObj.export(sys.stdout, 0, name_="GenerateModel")
|
||||
# sys.stdout.write('<?xml version="1.0" ?>\n')
|
||||
# rootObj.export(sys.stdout, 0, name_="GenerateModel")
|
||||
return rootObj
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
# (c) 2006 Juergen Riegel
|
||||
|
||||
import template
|
||||
import generateBase.generateModel_Module
|
||||
import generateBase.generateTools
|
||||
import model.generateModel_Module
|
||||
import model.generateTools
|
||||
|
||||
|
||||
class TemplateCPPFile(template.ModelTemplate):
|
||||
def Generate(self):
|
||||
generateBase.generateTools.ensureDir(self.path)
|
||||
model.generateTools.ensureDir(self.outputDir)
|
||||
print("Generate() App Dir")
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
from . import template
|
||||
import os, sys
|
||||
import generateBase.generateModel_Module
|
||||
import generateBase.generateTools
|
||||
import model.generateModel_Module
|
||||
import model.generateTools
|
||||
|
||||
|
||||
class TemplateClassPyExport(template.ModelTemplate):
|
||||
@@ -14,9 +14,9 @@ class TemplateClassPyExport(template.ModelTemplate):
|
||||
# self.ParentNamespace = "Base"
|
||||
# self.Namespace = "Base"
|
||||
encoding = sys.getfilesystemencoding()
|
||||
path = self.path
|
||||
exportName = self.export.Name
|
||||
dirname = self.dirname
|
||||
inputDir = self.inputDir
|
||||
outputDir = self.outputDir
|
||||
|
||||
def escapeString(s, indent=4):
|
||||
"""Escapes a string for use as literal in C++ code"""
|
||||
@@ -26,24 +26,32 @@ class TemplateClassPyExport(template.ModelTemplate):
|
||||
s = s.replace("\n", f'\\n"\n{" "*indent}"')
|
||||
return s
|
||||
|
||||
print("TemplateClassPyExport", path + exportName)
|
||||
print("TemplateClassPyExport", outputDir + exportName)
|
||||
|
||||
# Create the subdir it necessary
|
||||
subpath = os.path.dirname(path + exportName)
|
||||
subpath = os.path.dirname(outputDir + exportName)
|
||||
if not os.path.exists(subpath):
|
||||
os.makedirs(subpath)
|
||||
|
||||
# Imp.cpp must not exist, neither in path nor in dirname
|
||||
if not os.path.exists(path + exportName + "Imp.cpp"):
|
||||
if not os.path.exists(dirname + exportName + "Imp.cpp"):
|
||||
file = open(path + exportName + "Imp.cpp", "wb")
|
||||
generateBase.generateTools.replace(self.TemplateImplement, locals(), file)
|
||||
# Imp.cpp must not exist, neither in outputDir nor in inputDir
|
||||
outputImp = outputDir + exportName + "Imp.cpp"
|
||||
if not os.path.exists(outputImp):
|
||||
if not os.path.exists(inputDir + exportName + "Imp.cpp"):
|
||||
file = open(outputImp, "wb")
|
||||
print("TemplateClassPyExport", "TemplateImplement", file.name)
|
||||
model.generateTools.replace(self.TemplateImplement, locals(), file)
|
||||
file.close()
|
||||
with open(path + exportName + ".cpp", "wb") as file:
|
||||
generateBase.generateTools.replace(self.TemplateModule, locals(), file)
|
||||
with open(path + exportName + ".h", "wb") as file:
|
||||
generateBase.generateTools.replace(self.TemplateHeader, locals(), file)
|
||||
# file.write( generateBase.generateTools.replace(self.Template,locals()))
|
||||
|
||||
outputCpp = outputDir + exportName + ".cpp"
|
||||
with open(outputCpp, "wb") as file:
|
||||
print("TemplateClassPyExport", "TemplateModule", file.name)
|
||||
model.generateTools.replace(self.TemplateModule, locals(), file)
|
||||
|
||||
outputHeader = outputDir + exportName + ".h"
|
||||
with open(outputHeader, "wb") as file:
|
||||
print("TemplateClassPyExport", "TemplateHeader", file.name)
|
||||
model.generateTools.replace(self.TemplateHeader, locals(), file)
|
||||
# file.write( model.generateTools.replace(self.Template,locals()))
|
||||
|
||||
TemplateHeader = """
|
||||
// This file is generated by src/Tools/generateTemplates/templateClassPyExport.py out of the XML file
|
||||
@@ -7,8 +7,8 @@ from . import template, templateModuleApp
|
||||
|
||||
class TemplateModule(template.ModelTemplate):
|
||||
def Generate(self):
|
||||
print("generateBase.generateModel_Module.Generate()\n")
|
||||
print("model.generateModel_Module.Generate()\n")
|
||||
App = templateModuleApp.TemplateModuleApp()
|
||||
App.path = self.path
|
||||
App.outputDir = self.outputDir
|
||||
App.module = self.module
|
||||
App.Generate()
|
||||
@@ -3,26 +3,26 @@
|
||||
# (c) 2007 Juergen Riegel
|
||||
|
||||
from . import template, templateModuleAppMain, templateModuleAppFeature
|
||||
import generateBase.generateModel_Module
|
||||
import generateBase.generateTools
|
||||
import model.generateModel_Module
|
||||
import model.generateTools
|
||||
|
||||
|
||||
class TemplateModuleApp(template.ModelTemplate):
|
||||
def Generate(self):
|
||||
AppPath = self.path + "/App/"
|
||||
generateBase.generateTools.ensureDir(AppPath)
|
||||
AppPath = self.outputDir + "/App/"
|
||||
model.generateTools.ensureDir(AppPath)
|
||||
|
||||
# the main module files
|
||||
AppMain = templateModuleAppMain.TemplateModuleAppMain()
|
||||
AppMain.path = AppPath
|
||||
AppMain.outputDir = AppPath
|
||||
AppMain.module = self.module
|
||||
AppMain.Generate()
|
||||
|
||||
# Features
|
||||
generateBase.generateTools.ensureDir(AppPath + "Features/")
|
||||
model.generateTools.ensureDir(AppPath + "Features/")
|
||||
for i in self.module.Content.Feature:
|
||||
AppFeature = templateModuleAppFeature.TemplateFeature()
|
||||
AppFeature.path = AppPath + "Features/"
|
||||
AppFeature.outputDir = AppPath + "Features/"
|
||||
AppFeature.module = self.module
|
||||
AppFeature.feature = i
|
||||
AppFeature.Generate()
|
||||
@@ -3,19 +3,19 @@
|
||||
# (c) 2006 Juergen Riegel
|
||||
|
||||
from . import template
|
||||
import generateBase.generateModel_Module
|
||||
import generateBase.generateTools
|
||||
import model.generateModel_Module
|
||||
import model.generateTools
|
||||
|
||||
|
||||
class TemplateFeature(template.ModelTemplate):
|
||||
def Generate(self):
|
||||
file = open(self.path + self.feature.Name + "Imp.cpp", "w")
|
||||
generateBase.generateTools.replace(self.TemplateImplement, locals(), file)
|
||||
file = open(self.path + self.feature.Name + ".cpp", "w")
|
||||
generateBase.generateTools.replace(self.TemplateModule, locals(), file)
|
||||
file = open(self.path + self.feature.Name + ".h", "w")
|
||||
generateBase.generateTools.replace(self.TemplateHeader, locals(), file)
|
||||
# file.write( generateBase.generateTools.replace(self.Template,locals()))
|
||||
file = open(self.outputDir + self.feature.Name + "Imp.cpp", "w")
|
||||
model.generateTools.replace(self.TemplateImplement, locals(), file)
|
||||
file = open(self.outputDir + self.feature.Name + ".cpp", "w")
|
||||
model.generateTools.replace(self.TemplateModule, locals(), file)
|
||||
file = open(self.outputDir + self.feature.Name + ".h", "w")
|
||||
model.generateTools.replace(self.TemplateHeader, locals(), file)
|
||||
# file.write( model.generateTools.replace(self.Template,locals()))
|
||||
|
||||
TemplateHeader = """
|
||||
#ifndef @self.module.Name.upper()@_FEATURE_@self.feature.Name.upper()@_H
|
||||
@@ -3,15 +3,15 @@
|
||||
# (c) 2006 Juergen Riegel
|
||||
|
||||
from . import template
|
||||
import generateBase.generateModel_Module
|
||||
import generateBase.generateTools
|
||||
import model.generateModel_Module
|
||||
import model.generateTools
|
||||
|
||||
|
||||
class TemplateModuleAppMain(template.ModelTemplate):
|
||||
def Generate(self):
|
||||
file = open(self.path + "/App" + self.module.Name + ".cpp", "w")
|
||||
generateBase.generateTools.replace(self.Template, locals(), file)
|
||||
# file.write( generateBase.generateTools.replace(self.Template,locals()))
|
||||
file = open(self.outputDir + "/App" + self.module.Name + ".cpp", "w")
|
||||
model.generateTools.replace(self.Template, locals(), file)
|
||||
# file.write( model.generateTools.replace(self.Template,locals()))
|
||||
|
||||
Template = """
|
||||
/***************************************************************************
|
||||
Reference in New Issue
Block a user