Compare commits
241 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 68e337670e | |||
| 3158be46ad | |||
| 02b66ca461 | |||
| 74c2ad4bf0 | |||
| 522c91ce79 | |||
| e8d65c22d6 | |||
| 166eee5eed | |||
| 3af54a7dda | |||
| 7fa294fd7a | |||
| 7400b11870 | |||
| 915371aa70 | |||
| 7b225789da | |||
| c0cccf7f7e | |||
| 5219718eb0 | |||
| 4b1004b33a | |||
| 9aa14b36a3 | |||
| 876ef07480 | |||
| 9e68e5f290 | |||
| 27a36156f6 | |||
| 09f1b14cc9 | |||
| e0487b62a6 | |||
| 741fdc53c7 | |||
| 832f181ec0 | |||
| 2a8f85d95c | |||
| 227e568b4f | |||
| f0e735ed33 | |||
| ebd1afc5d9 | |||
| 9065058265 | |||
| 0a79760745 | |||
| ac3390de12 | |||
| c2cfccf268 | |||
| 505de3215b | |||
| 4f91499ada | |||
| 4813e30703 | |||
| 8bbf9b8347 | |||
| 3528c626e7 | |||
| a06cc956c5 | |||
| e2856395a3 | |||
| a3a97d7b5e | |||
| 0c43dab796 | |||
| 298fb8983d | |||
| 75546946db | |||
| 4d19e611f8 | |||
| 47a5a6302e | |||
| 7b0b83a2e4 | |||
| d81b016b2a | |||
| 5a432fe9ac | |||
| e6a6d838a6 | |||
| f3a8edcb5e | |||
| baa1105a53 | |||
| 6c1c63cffe | |||
| 9ef72fcd06 | |||
| 7521cfc7a0 | |||
| 6d23205704 | |||
| 30706f4d0f | |||
| 6a877f7e29 | |||
| 007a5b351a | |||
| 9010b88b22 | |||
| a106f55ebe | |||
| b8434f2ddc | |||
| 6e587d130d | |||
| 38ec63cba1 | |||
| fbb5555f27 | |||
| 9b5aabe458 | |||
| 9dc93b8f99 | |||
| c8337118ba | |||
| d13ecc1efa | |||
| 1b65b3f600 | |||
| f89f032231 | |||
| 083a27dc68 | |||
| d4c180e953 | |||
| fdaca02994 | |||
| 4c3c23776d | |||
| 19ffd1ca94 | |||
| fa9c78611e | |||
| 825d95314e | |||
| 10c6d6eabf | |||
| b54b3e6e32 | |||
| 6bb6bb4d24 | |||
| 8fb5ce3c43 | |||
| 43a14ab4df | |||
| dd00c46a8c | |||
| 10edc03ec1 | |||
| 53e02bc851 | |||
| d17954276c | |||
| c4fec57368 | |||
| d8bf4dfeb9 | |||
| 7225e5f0ba | |||
| 68e8c19aaf | |||
| 8d5a957eb0 | |||
| e5fb5a6f27 | |||
| ecb1b3c3cc | |||
| 9a4ab21f2b | |||
| 9d7b7af48c | |||
| 28c269cc5f | |||
| 0f9ea612b6 | |||
| 4148a33d15 | |||
| d7d22b1e7e | |||
| 5864e17d9d | |||
| 920e8e0469 | |||
| c9cffae11d | |||
| c143d91978 | |||
| f401cbe832 | |||
| 2e4dcfc22a | |||
| b06f247f9f | |||
| e05e9a7247 | |||
| 5792c502bf | |||
| ef1a835f4f | |||
| 18eb44d120 | |||
| d0323e13c1 | |||
| f31544dca8 | |||
| f256e3caf4 | |||
| 0c6c3e5211 | |||
| 9570d88a39 | |||
| 6449e1bcf7 | |||
| 47bb1408da | |||
| 77627bbc23 | |||
| b9b21ddac5 | |||
| 242083bbf7 | |||
| eff8ecaafc | |||
| 80bdc3f960 | |||
| b4489422a5 | |||
| 8349a78dde | |||
| fd47f2253a | |||
| 3cccd4d69e | |||
| 721f253c59 | |||
| 29cc754cfd | |||
| af811b34b3 | |||
| 07422d2abe | |||
| 6462cdf231 | |||
| 9156d591c9 | |||
| 4223e5d84d | |||
| 7955c0dfac | |||
| 681d961254 | |||
| 332cb9ec2f | |||
| 34300c600f | |||
| f7c64c7322 | |||
| 7e638a624e | |||
| b5b5375fe4 | |||
| 23d65cc9f2 | |||
| 75a8998432 | |||
| 6e97e9570c | |||
| 27e3f3c153 | |||
| a42e1b0223 | |||
| 176cf0d144 | |||
| 4d7e550d97 | |||
| 3fe354718c | |||
| 8567ef1849 | |||
| 67c506d39e | |||
| 9c8b21f5f4 | |||
| f37574e809 | |||
| 0d6b5b7f30 | |||
| f7f85464a3 | |||
| 31047be9fb | |||
| ca9355b5cb | |||
| fc7f3f4e3d | |||
| 704feadc7c | |||
| e41879c6ea | |||
| 2b0dd54fe7 | |||
| d73f9e3762 | |||
| 134fa8b7ea | |||
| e8f1bde367 | |||
| 2d32de3cd2 | |||
| 56d289997c | |||
| 4dab407fbe | |||
| 34502193a2 | |||
| d540de8bee | |||
| acfbc72f50 | |||
| 3c1e446c2f | |||
| 2d5400f923 | |||
| be16e1f52b | |||
| be8a4037db | |||
| 977127012e | |||
| 89432a969d | |||
| 7b204c01db | |||
| ee4f4e8cb7 | |||
| 297e3520ec | |||
| 8891394d5a | |||
| d223d4362c | |||
| 213bf1ec61 | |||
| d860c4bb2d | |||
| a0c0b2616c | |||
| 07e38636b9 | |||
| a4b2bf584d | |||
| 477eed10a4 | |||
| 9946a3916e | |||
| a67701b85b | |||
| 2de25dd04e | |||
| 3f04bf7b4d | |||
| 8c123bad50 | |||
| eda43a2ef9 | |||
| 81d6401455 | |||
| 5542bc9970 | |||
| 3dfb51d3ee | |||
| 79a5cde3b5 | |||
| 33556d8a56 | |||
| b8952aaeb8 | |||
| 819cfd7a11 | |||
| d447d75882 | |||
| d920a5bf4d | |||
| 35c872d4f2 | |||
| 98cb5d50af | |||
| 62f65e12e2 | |||
| f7b9a70ee5 | |||
| 03f3852617 | |||
| 537acfdddd | |||
| 307cb3cda8 | |||
| 0b574523e9 | |||
| 8edb3e64cc | |||
| e13e3bcea3 | |||
| c2e34be393 | |||
| c5296fbb92 | |||
| 1723196166 | |||
| 37d2492719 | |||
| 47125d8fda | |||
| d3d96816ce | |||
| 7907b0f8b3 | |||
| c4cd127499 | |||
| 919271ed5e | |||
| 79c218ad9a | |||
| 7b79c9697c | |||
| 30f8015e71 | |||
| f94ab3ec84 | |||
| b47f8d2605 | |||
| 8e1a23eadf | |||
| 391c9a6bbf | |||
| bf6dbd4606 | |||
| 8676d67a87 | |||
| a80d9e5ef8 | |||
| b07be87677 | |||
| bd853e5ef2 | |||
| 4c2972cb23 | |||
| 975b8eac52 | |||
| 836c6b889a | |||
| 4474db7f50 | |||
| ccdbf99341 | |||
| 18120f8bcd | |||
| a21a5a2032 | |||
| 5ae3a0866e | |||
| 07d7ced8ec | |||
| 7630ee024b |
@@ -43,3 +43,4 @@ tags
|
||||
src/Tools/freecad.zip
|
||||
tsupdate_stderr.log
|
||||
tsupdate_stdout.log
|
||||
files_to_translate.txt
|
||||
|
||||
+10
-4
@@ -1127,7 +1127,8 @@ std::string Application::getUserMacroDir()
|
||||
std::string Application::getResourceDir()
|
||||
{
|
||||
#ifdef RESOURCEDIR
|
||||
std::string path(RESOURCEDIR);
|
||||
// #6892: Conda may inject null characters => remove them
|
||||
std::string path = std::string(RESOURCEDIR).c_str();
|
||||
path.append("/");
|
||||
QDir dir(QString::fromStdString(path));
|
||||
if (dir.isAbsolute())
|
||||
@@ -1141,7 +1142,8 @@ std::string Application::getResourceDir()
|
||||
std::string Application::getLibraryDir()
|
||||
{
|
||||
#ifdef LIBRARYDIR
|
||||
std::string path(LIBRARYDIR);
|
||||
// #6892: Conda may inject null characters => remove them
|
||||
std::string path = std::string(LIBRARYDIR).c_str();
|
||||
QDir dir(QString::fromStdString(path));
|
||||
if (dir.isAbsolute())
|
||||
return path;
|
||||
@@ -1154,7 +1156,8 @@ std::string Application::getLibraryDir()
|
||||
std::string Application::getHelpDir()
|
||||
{
|
||||
#ifdef DOCDIR
|
||||
std::string path(DOCDIR);
|
||||
// #6892: Conda may inject null characters => remove them
|
||||
std::string path = std::string(DOCDIR).c_str();
|
||||
path.append("/");
|
||||
QDir dir(QString::fromStdString(path));
|
||||
if (dir.isAbsolute())
|
||||
@@ -2160,7 +2163,7 @@ void parseProgramOptions(int ac, char ** av, const string& exe, variables_map& v
|
||||
("log-file", value<string>(), "Unlike --write-log this allows logging to an arbitrary file")
|
||||
("user-cfg,u", value<string>(),"User config file to load/save user settings")
|
||||
("system-cfg,s", value<string>(),"System config file to load/save system settings")
|
||||
("run-test,t", value<string>() ,"Test case - or 0 for all")
|
||||
("run-test,t", value<string>()->implicit_value(""),"Run a given test case (use 0 (zero) to run all tests). If no argument is provided then return list of all available tests.")
|
||||
("module-path,M", value< vector<string> >()->composing(),"Additional module paths")
|
||||
("python-path,P", value< vector<string> >()->composing(),"Additional python paths")
|
||||
("single-instance", "Allow to run a single instance of the application")
|
||||
@@ -2394,6 +2397,9 @@ void processProgramOptions(const variables_map& vm, std::map<std::string,std::st
|
||||
if ( "0" == testCase) {
|
||||
testCase = "TestApp.All";
|
||||
}
|
||||
else if (testCase.empty()) {
|
||||
testCase = "TestApp.PrintAll";
|
||||
}
|
||||
mConfig["TestCase"] = testCase;
|
||||
mConfig["RunMode"] = "Internal";
|
||||
mConfig["ScriptFileName"] = "FreeCADTest";
|
||||
|
||||
@@ -593,7 +593,12 @@ bool DocumentWeakPtrT::expired() const noexcept
|
||||
return (d->_document == nullptr);
|
||||
}
|
||||
|
||||
App::Document* DocumentWeakPtrT::operator->() noexcept
|
||||
App::Document* DocumentWeakPtrT::operator*() const noexcept
|
||||
{
|
||||
return d->_document;
|
||||
}
|
||||
|
||||
App::Document* DocumentWeakPtrT::operator->() const noexcept
|
||||
{
|
||||
return d->_document;
|
||||
}
|
||||
@@ -686,7 +691,12 @@ DocumentObjectWeakPtrT& DocumentObjectWeakPtrT::operator= (App::DocumentObject*
|
||||
return *this;
|
||||
}
|
||||
|
||||
App::DocumentObject* DocumentObjectWeakPtrT::operator->() noexcept
|
||||
App::DocumentObject* DocumentObjectWeakPtrT::operator*() const noexcept
|
||||
{
|
||||
return d->get();
|
||||
}
|
||||
|
||||
App::DocumentObject* DocumentObjectWeakPtrT::operator->() const noexcept
|
||||
{
|
||||
return d->get();
|
||||
}
|
||||
|
||||
@@ -294,11 +294,16 @@ public:
|
||||
* \return true if the managed object has already been deleted, false otherwise.
|
||||
*/
|
||||
bool expired() const noexcept;
|
||||
/*!
|
||||
* \brief operator *
|
||||
* \return pointer to the document
|
||||
*/
|
||||
App::Document* operator*() const noexcept;
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document
|
||||
*/
|
||||
App::Document* operator->() noexcept;
|
||||
App::Document* operator->() const noexcept;
|
||||
|
||||
private:
|
||||
// disable
|
||||
@@ -334,10 +339,15 @@ public:
|
||||
*/
|
||||
DocumentObjectWeakPtrT& operator= (App::DocumentObject* p);
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document
|
||||
* \brief operator *
|
||||
* \return pointer to the document object
|
||||
*/
|
||||
App::DocumentObject* operator->() noexcept;
|
||||
App::DocumentObject* operator*() const noexcept;
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document object
|
||||
*/
|
||||
App::DocumentObject* operator->() const noexcept;
|
||||
/*!
|
||||
* \brief operator ==
|
||||
* \return true if both objects are equal, false otherwise
|
||||
@@ -400,6 +410,13 @@ public:
|
||||
ptr = p;
|
||||
return *this;
|
||||
}
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document object
|
||||
*/
|
||||
T* operator*() const {
|
||||
return ptr.get<T>();
|
||||
}
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document object
|
||||
|
||||
@@ -1517,7 +1517,7 @@ void OperatorExpression::_toString(std::ostream &s, bool persistent,int) const
|
||||
leftOperator = static_cast<OperatorExpression*>(left)->op;
|
||||
if (left->priority() < priority()) // Check on operator priority first
|
||||
needsParens = true;
|
||||
else if (leftOperator == op) { // Equal priority?
|
||||
else if (leftOperator == op) { // Same operator ?
|
||||
if (!isLeftAssociative())
|
||||
needsParens = true;
|
||||
//else if (!isCommutative())
|
||||
@@ -1588,14 +1588,14 @@ void OperatorExpression::_toString(std::ostream &s, bool persistent,int) const
|
||||
rightOperator = static_cast<OperatorExpression*>(right)->op;
|
||||
if (right->priority() < priority()) // Check on operator priority first
|
||||
needsParens = true;
|
||||
else if (rightOperator == op) { // Equal priority?
|
||||
else if (rightOperator == op) { // Same operator ?
|
||||
if (!isRightAssociative())
|
||||
needsParens = true;
|
||||
else if (!isCommutative())
|
||||
needsParens = true;
|
||||
}
|
||||
else if (right->priority() == priority()) {
|
||||
if (!isRightAssociative())
|
||||
else if (right->priority() == priority()) { // Same priority ?
|
||||
if (!isRightAssociative() || rightOperator == MOD)
|
||||
needsParens = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,8 @@ def InitApplications():
|
||||
AddPath = FreeCAD.ConfigGet("AdditionalModulePaths").split(";")
|
||||
HomeMod = FreeCAD.getUserAppDataDir()+"Mod"
|
||||
HomeMod = os.path.realpath(HomeMod)
|
||||
MacroDir = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro").GetString("MacroPath")
|
||||
MacroStd = App.getUserMacroDir(False)
|
||||
MacroDir = App.getUserMacroDir(True)
|
||||
MacroMod = os.path.realpath(MacroDir+"/Mod")
|
||||
SystemWideMacroDir = FreeCAD.getHomePath()+'Macro'
|
||||
SystemWideMacroDir = os.path.realpath(SystemWideMacroDir)
|
||||
@@ -278,6 +279,7 @@ def InitApplications():
|
||||
for i in path:
|
||||
Log(" " + i + "\n")
|
||||
# add MacroDir to path (RFE #0000504)
|
||||
sys.path.append(MacroStd)
|
||||
sys.path.append(MacroDir)
|
||||
# add SystemWideMacroDir to path
|
||||
sys.path.append(SystemWideMacroDir)
|
||||
|
||||
+23
-14
@@ -11,37 +11,46 @@
|
||||
FatherNamespace="App">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Jürgen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<UserDocu>This class does the whole placement and position handling</UserDocu>
|
||||
<UserDocu>App.GeoFeature class.\n
|
||||
Base class of all geometric document objects.
|
||||
This class does the whole placement and position handling.
|
||||
With the method `getPropertyOfGeometry` is possible to obtain
|
||||
the main geometric property in general form, without reference
|
||||
to any particular property name.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="getPaths">
|
||||
<Documentation>
|
||||
<UserDocu>returns all possible paths to the root of the document</UserDocu>
|
||||
<UserDocu>getPaths()\n
|
||||
Returns all possible paths to the root of the document.
|
||||
Note: Not implemented.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getGlobalPlacement">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the placement of the object in the global coordinate space, respecting all stacked relationships.
|
||||
Note: This function is not available during recompute, as there the placements of parents can change
|
||||
after the execution of this object, rendering the result wrong.</UserDocu>
|
||||
<UserDocu>getGlobalPlacement() -> Base.Placement\n
|
||||
Returns the placement of the object in the global coordinate space, respecting all stacked
|
||||
relationships.
|
||||
Note: This function is not available during recompute, as there the placements of parents
|
||||
can change after the execution of this object, rendering the result wrong.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPropertyNameOfGeometry">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the property name of the actual geometry or None.
|
||||
For example for a part object it returns the value Shape,
|
||||
for a mesh the value Mesh and so on.
|
||||
<UserDocu>getPropertyNameOfGeometry() -> str or None\n
|
||||
Returns the property name of the actual geometry.
|
||||
For example for a Part feature it returns the value 'Shape', for a mesh feature the value
|
||||
'Mesh' and so on.
|
||||
If an object has no such property then None is returned.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPropertyOfGeometry">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the property of the actual geometry or None.
|
||||
For example for a part object it returns its Shape property,
|
||||
for a mesh its Mesh property and so on.
|
||||
<UserDocu>getPropertyOfGeometry() -> object or None\n
|
||||
Returns the property of the actual geometry.
|
||||
For example for a Part feature it returns its Shape property, for a Mesh feature its
|
||||
Mesh property and so on.
|
||||
If an object has no such property then None is returned.
|
||||
Unlike to getPropertyNameOfGeometry this function returns the geometry,
|
||||
not its name.
|
||||
</UserDocu>
|
||||
Unlike to getPropertyNameOfGeometry this function returns the geometry, not its name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<CustomAttributes />
|
||||
|
||||
+1
-1
@@ -554,7 +554,7 @@ void LinkBaseExtension::syncCopyOnChange()
|
||||
// so the last object will be the copy of the original linked object
|
||||
auto newLinked = copiedObjs.back();
|
||||
|
||||
// We are coping from the original linked object and we've already mutated
|
||||
// We are copying from the original linked object and we've already mutated
|
||||
// it, so we need to copy all CopyOnChange properties from the mutated
|
||||
// object to the new copy.
|
||||
std::vector<App::Property*> propList;
|
||||
|
||||
+88
-62
@@ -16,181 +16,207 @@
|
||||
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Chris Hennes" EMail="chennes@pioneerlibrarysystem.org" />
|
||||
<UserDocu>
|
||||
Metadata
|
||||
A Metadata object reads an XML-formatted package metadata file and provides read-only access to its contents.
|
||||
|
||||
A single constructor is supported:
|
||||
Metadata(file) -- Reads the XML file and provides access to the metadata it specifies.
|
||||
</UserDocu>
|
||||
<UserDocu>App.Metadata class.\n
|
||||
A Metadata object reads an XML-formatted package metadata file and provides
|
||||
read-only access to its contents.\n
|
||||
The following constructors are supported:\n
|
||||
Metadata()
|
||||
Empty constructor.\n
|
||||
Metadata(metadata)
|
||||
Copy constructor.
|
||||
metadata : App.Metadata\n
|
||||
Metadata(file)
|
||||
Reads the XML file and provides access to the metadata it specifies.
|
||||
file : str\n XML file name.</UserDocu>
|
||||
<DeveloperDocu>Metadata</DeveloperDocu>
|
||||
</Documentation>
|
||||
|
||||
<Attribute Name="Name" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>String: the name of this item</UserDocu>
|
||||
<UserDocu>String representing the name of this item.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Name" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Version" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>String: the version of this item in semantic triplet format</UserDocu>
|
||||
<UserDocu>String representing the version of this item in semantic triplet format.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Version" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Description" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>String: the description of this item (text only, no markup allowed)</UserDocu>
|
||||
<UserDocu>String representing the description of this item (text only, no markup allowed).</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Description" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Maintainer" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of maintainer objects with 'name' and 'email' string attributes</UserDocu>
|
||||
<UserDocu>List of maintainer objects with 'name' and 'email' string attributes.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Maintainer" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="License" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of applicable licenses as objects with 'name' and 'file' string attributes</UserDocu>
|
||||
<UserDocu>List of applicable licenses as objects with 'name' and 'file' string attributes.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="License" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Urls" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
List of URLs as objects with 'location' and 'type' string attributes, where type is one of:
|
||||
* website
|
||||
* repository
|
||||
* bugtracker
|
||||
* readme
|
||||
* documentation
|
||||
</UserDocu>
|
||||
<UserDocu>List of URLs as objects with 'location' and 'type' string attributes, where type
|
||||
is one of:
|
||||
* website
|
||||
* repository
|
||||
* bugtracker
|
||||
* readme
|
||||
* documentation</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Urls" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Author" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of author objects, each with a 'name' and a (potentially empty) 'email' string attribute</UserDocu>
|
||||
<UserDocu>List of author objects, each with a 'name' and a (potentially empty) 'email'
|
||||
string attribute.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Author" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Depend" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
List of dependencies, as objects with the following attributes:
|
||||
* package -- Required: must exactly match the contents of the 'name' element in the referenced package's package.xml file
|
||||
* version_lt -- Optional: The dependency to the package is restricted to versions less than the stated version number
|
||||
* version_lte -- Optional: The dependency to the package is restricted to versions less or equal than the stated version number
|
||||
* version_eq -- Optional: The dependency to the package is restricted to a version equal than the stated version number
|
||||
* version_gte -- Optional: The dependency to the package is restricted to versions greater or equal than the stated version number
|
||||
* version_gt -- Optional: The dependency to the package is restricted to versions greater than the stated version number
|
||||
* condition -- Optional: Conditional expression as documented in REP149
|
||||
</UserDocu>
|
||||
<UserDocu>List of dependencies, as objects with the following attributes:
|
||||
* package
|
||||
Required. Must exactly match the contents of the 'name' element in the
|
||||
referenced package's package.xml file.
|
||||
* version_lt
|
||||
Optional. The dependency to the package is restricted to versions less than
|
||||
the stated version number.
|
||||
* version_lte
|
||||
Optional. The dependency to the package is restricted to versions less or
|
||||
equal than the stated version number.
|
||||
* version_eq
|
||||
Optional. The dependency to the package is restricted to a version equal
|
||||
than the stated version number.
|
||||
* version_gte
|
||||
Optional. The dependency to the package is restricted to versions greater
|
||||
or equal than the stated version number.
|
||||
* version_gt
|
||||
Optional. The dependency to the package is restricted to versions greater
|
||||
than the stated version number.
|
||||
* condition
|
||||
Optional. Conditional expression as documented in REP149.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Depend" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Conflict" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of conflicts, format identical to dependencies</UserDocu>
|
||||
<UserDocu>List of conflicts, format identical to dependencies.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Conflict" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Replace" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of things this item is considered by its author to replace: format identical to dependencies</UserDocu>
|
||||
<UserDocu>List of things this item is considered by its author to replace. The format is
|
||||
identical to dependencies.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Replace" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Tag" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>List of strings</UserDocu>
|
||||
<UserDocu>List of strings.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Tag" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Icon" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Relative path to an icon file</UserDocu>
|
||||
<UserDocu>Relative path to an icon file.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Icon" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Classname" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>String: the name of the main Python class this item creates/represents</UserDocu>
|
||||
<UserDocu>String representing the name of the main Python class this item
|
||||
creates/represents.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Classname" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Subdirectory" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>String: the name of the subdirectory this content item is located in. If empty, the item is in a directory named the same as the content item.</UserDocu>
|
||||
<UserDocu>String representing the name of the subdirectory this content item is located in.
|
||||
If empty, the item is in a directory named the same as the content item.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Subdirectory" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="File" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>A list of files associated with this item -- the meaning of each file is implementation-defined</UserDocu>
|
||||
<UserDocu>List of files associated with this item.
|
||||
The meaning of each file is implementation-defined.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="File" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Content" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>A dictionary of lists of content items: defined recursively, each item is itself a Metadata object -- see package.xml file format documentation for details</UserDocu>
|
||||
<UserDocu>Dictionary of lists of content items: defined recursively, each item is itself
|
||||
a Metadata object.
|
||||
See package.xml file format documentation for details.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Content" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
<Attribute Name="FreeCADMin">
|
||||
<Documentation>
|
||||
<UserDocu>A string representing the minimum version of FreeCAD needed for this item. If unset it will be 0.0.0.</UserDocu>
|
||||
<UserDocu>String representing the minimum version of FreeCAD needed for this item.
|
||||
If unset it will be 0.0.0.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="FreeCADMin" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
<Attribute Name="FreeCADMax">
|
||||
<Documentation>
|
||||
<UserDocu>A string representing the maximum version of FreeCAD needed for this item. If unset it will be 0.0.0.</UserDocu>
|
||||
<UserDocu>String representing the maximum version of FreeCAD needed for this item.
|
||||
If unset it will be 0.0.0.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="FreeCADMax" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
<Methode Name="getLastSupportedFreeCADVersion">
|
||||
<Documentation>
|
||||
<UserDocu>getLastSupportedFreeCADVersion()
|
||||
Search through all content package items, and determine if a maximum supported version of FreeCAD
|
||||
is set. Returns None if no maximum version is set, or if *any* content item fails to provide a
|
||||
maximum version (implying that that content item will work with all known versions).
|
||||
</UserDocu>
|
||||
<UserDocu>getLastSupportedFreeCADVersion() -> str or None\n
|
||||
Search through all content package items, and determine if a maximum supported
|
||||
version of FreeCAD is set.
|
||||
Returns None if no maximum version is set, or if *any* content item fails to
|
||||
provide a maximum version (implying that that content item will work with all
|
||||
known versions).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<Methode Name="getFirstSupportedFreeCADVersion">
|
||||
<Documentation>
|
||||
<UserDocu>getFirstSupportedFreeCADVersion()
|
||||
Search through all content package items, and determine if a minimum supported version of FreeCAD
|
||||
is set. Returns 0.0 if no minimum version is set, or if *any* content item fails to provide a
|
||||
minimum version (implying that that content item will work with all known versions -- technically
|
||||
limited to 0.20 as the lowest known version since the metadata standard was added then).
|
||||
</UserDocu>
|
||||
<UserDocu>getFirstSupportedFreeCADVersion() -> str or None\n
|
||||
Search through all content package items, and determine if a minimum supported
|
||||
version of FreeCAD is set.
|
||||
Returns 0.0 if no minimum version is set, or if *any* content item fails to
|
||||
provide a minimum version (implying that that content item will work with all
|
||||
known versions. Technically limited to 0.20 as the lowest known version since
|
||||
the metadata standard was added then).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<Methode Name="supportsCurrentFreeCAD">
|
||||
<Documentation>
|
||||
<UserDocu>supportsCurrentFreeCAD()
|
||||
Returns false if this metadata object directly indicates that it does not support the current
|
||||
version of FreeCAD, or true if it makes no indication, or specifically indicates that it does
|
||||
support the current version. Does not recurse into Content items.
|
||||
</UserDocu>
|
||||
<UserDocu>supportsCurrentFreeCAD() -> bool\n
|
||||
Returns False if this metadata object directly indicates that it does not
|
||||
support the current version of FreeCAD, or True if it makes no indication, or
|
||||
specifically indicates that it does support the current version. Does not
|
||||
recurse into Content items.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<Methode Name="getGenericMetadata">
|
||||
<Documentation>
|
||||
<UserDocu>getGenericMetadata(name)
|
||||
Get the list of GenericMetadata objects with key 'name'. Generic metadata objects are Python objects with
|
||||
a string 'contents' and a dictionary of strings, 'attributes'. They represent unrecognized simple XML tags
|
||||
in the metadata file.
|
||||
</UserDocu>
|
||||
<UserDocu>getGenericMetadata(name) -> list\n
|
||||
Get the list of GenericMetadata objects with key 'name'.
|
||||
Generic metadata objects are Python objects with a string 'contents' and a
|
||||
dictionary of strings, 'attributes'. They represent unrecognized simple XML tags
|
||||
in the metadata file.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ XERCES_CPP_NAMESPACE_USE
|
||||
// Returns a string which represents the object e.g. when printed in Python
|
||||
std::string MetadataPy::representation(void) const
|
||||
{
|
||||
MetadataPy::PointerType ptr = reinterpret_cast<MetadataPy::PointerType>(_pcTwinPointer);
|
||||
MetadataPy::PointerType ptr = getMetadataPtr();
|
||||
std::stringstream str;
|
||||
str << "Metadata [Name=(";
|
||||
str << ptr->name();
|
||||
@@ -288,10 +288,11 @@ Py::Object MetadataPy::getContent(void) const
|
||||
PyObject* MetadataPy::getGenericMetadata(PyObject* args)
|
||||
{
|
||||
const char* name;
|
||||
if (!PyArg_ParseTuple(args, "s!", &name))
|
||||
if (!PyArg_ParseTuple(args, "s", &name))
|
||||
return nullptr;
|
||||
|
||||
auto gm = (*getMetadataPtr())[name];
|
||||
auto pyGenericMetadata = new Py::List;
|
||||
Py::List pyGenericMetadata;
|
||||
for (const auto& item : gm) {
|
||||
Py::Dict pyItem;
|
||||
pyItem["contents"] = Py::String(item.contents);
|
||||
@@ -300,12 +301,12 @@ PyObject* MetadataPy::getGenericMetadata(PyObject* args)
|
||||
pyAttributes[attribute.first] = Py::String(attribute.second);
|
||||
}
|
||||
pyItem["attributes"] = pyAttributes;
|
||||
pyGenericMetadata->append(pyItem);
|
||||
pyGenericMetadata.append(pyItem);
|
||||
}
|
||||
return pyGenericMetadata->ptr();
|
||||
return Py::new_reference_to(pyGenericMetadata);
|
||||
}
|
||||
|
||||
Py::Object MetadataPy::getFreeCADMin() const
|
||||
Py::Object MetadataPy::getFreeCADMin() const
|
||||
{
|
||||
return Py::String(getMetadataPtr()->freecadmin().str());
|
||||
}
|
||||
@@ -316,10 +317,11 @@ void MetadataPy::setFreeCADMin(Py::Object args)
|
||||
PyObject* p = args.ptr();
|
||||
if (!PyArg_ParseTuple(p, "s", &version))
|
||||
return;
|
||||
|
||||
getMetadataPtr()->setFreeCADMin(App::Meta::Version(version));
|
||||
}
|
||||
|
||||
Py::Object MetadataPy::getFreeCADMax() const
|
||||
Py::Object MetadataPy::getFreeCADMax() const
|
||||
{
|
||||
return Py::String(getMetadataPtr()->freecadmax().str());
|
||||
}
|
||||
@@ -330,6 +332,7 @@ void MetadataPy::setFreeCADMax(Py::Object args)
|
||||
PyObject* p = args.ptr();
|
||||
if (!PyArg_ParseTuple(p, "s", &version))
|
||||
return;
|
||||
|
||||
getMetadataPtr()->setFreeCADMax(App::Meta::Version(version));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,126 +12,139 @@
|
||||
DisableNotify="true">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<UserDocu>This is a Persistence class</UserDocu>
|
||||
<UserDocu>App.PropertyContainer class.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="getPropertyByName">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
getPropertyByName(name,checkOwner=0)
|
||||
|
||||
Return the value of a named property. Note that the returned property may not
|
||||
always belong to this container (e.g. from a linked object).
|
||||
|
||||
* name: name of the property
|
||||
* checkOwner: 0: just return the property
|
||||
1: raise exception if not found or the property
|
||||
does not belong to this container
|
||||
2: return a tuple(owner,property_value)
|
||||
</UserDocu>
|
||||
<UserDocu>getPropertyByName(name, checkOwner=0) -> object or Tuple\n
|
||||
Returns the value of a named property. Note that the returned property may not
|
||||
always belong to this container (e.g. from a linked object).\n
|
||||
name : str\n Name of the property.
|
||||
checkOwner : int\n 0: just return the property.
|
||||
1: raise exception if not found or the property does not belong to this container.
|
||||
2: return a tuple (owner, propertyValue).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPropertyTouchList">
|
||||
<Documentation>
|
||||
<UserDocu>Return a list of index of touched values for list type properties.</UserDocu>
|
||||
<UserDocu>getPropertyTouchList(name) -> tuple\n
|
||||
Returns a list of index of touched values for list type properties.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getTypeOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination. </UserDocu>
|
||||
<UserDocu>getTypeOfProperty(name) -> list\n
|
||||
Returns the type of a named property. This can be a list conformed by elements in
|
||||
(Hidden, NoRecompute, NoPersist, Output, ReadOnly, Transient).\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getTypeIdOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the C++ class name of a named property.</UserDocu>
|
||||
<UserDocu>getTypeIdOfProperty(name) -> str\n
|
||||
Returns the C++ class name of a named property.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setEditorMode">
|
||||
<Documentation>
|
||||
<UserDocu>Set the behaviour of the property in the property editor.
|
||||
0 - default behaviour
|
||||
1 - item is ready-only
|
||||
2 - item is hidden
|
||||
</UserDocu>
|
||||
<UserDocu>setEditorMode(name, type) -> None\n
|
||||
Set the behaviour of the property in the property editor.\n
|
||||
name : str\n Property name.
|
||||
type : int, sequence of str\n Property type.
|
||||
0: default behaviour. 1: item is ready-only. 2: item is hidden. 3: item is hidden and read-only.
|
||||
If sequence, the available items are 'ReadOnly' and 'Hidden'.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getEditorMode">
|
||||
<Documentation>
|
||||
<UserDocu>Get the behaviour of the property in the property editor.
|
||||
It returns a list of strings with the current mode. If the list is empty there are no special restrictions.
|
||||
If the list contains 'ReadOnly' then the item appears in the property editor but is disabled.
|
||||
If the list contains 'Hidden' then the item even doesn't appear in the property editor.
|
||||
</UserDocu>
|
||||
<UserDocu>getEditorMode(name) -> list\n
|
||||
Get the behaviour of the property in the property editor.
|
||||
It returns a list of strings with the current mode. If the list is empty there are no
|
||||
special restrictions.
|
||||
If the list contains 'ReadOnly' then the item appears in the property editor but is
|
||||
disabled.
|
||||
If the list contains 'Hidden' then the item even doesn't appear in the property editor.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getGroupOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Return the name of the group which the property belongs to in this class. The properties sorted in different named groups for convenience.</UserDocu>
|
||||
<UserDocu>getGroupOfProperty(name) -> str\n
|
||||
Returns the name of the group which the property belongs to in this class.
|
||||
The properties are sorted in different named groups for convenience.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setGroupOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Set the name of the group of a dynamic property.</UserDocu>
|
||||
<UserDocu>setGroupOfProperty(name, group) -> None\n
|
||||
Set the name of the group of a dynamic property.\n
|
||||
name : str\n Property name.
|
||||
group : str\n Group name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setPropertyStatus">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setPropertyStatus(name,val): Set property status
|
||||
|
||||
name(String): property name
|
||||
|
||||
val(String|Int|[String|Int...]): text or integer value, or list/tuple of
|
||||
values. Call getPropertyStatus() to get a list of supported text value.
|
||||
If the text start with '-' or the integer value is negative, then the
|
||||
status is cleared.
|
||||
</UserDocu>
|
||||
<UserDocu>setPropertyStatus(name, val) -> None\n
|
||||
Set property status.\n
|
||||
name : str\n Property name.
|
||||
val : int, str, sequence of str or int\n Call getPropertyStatus() to get a list of supported text value.
|
||||
If the text start with '-' or the integer value is negative, then the status is cleared.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPropertyStatus">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
getPropertyStatus(name=''): Get property status.
|
||||
|
||||
name(String): property name. If name is empty, return a list of supported
|
||||
text names of the status.
|
||||
</UserDocu>
|
||||
<UserDocu>getPropertyStatus(name='') -> list\n
|
||||
Get property status.\n
|
||||
name : str\n Property name. If empty, returns a list of supported text names of the status.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getDocumentationOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Return the documentation string of the property of this class.</UserDocu>
|
||||
<UserDocu>getDocumentationOfProperty(name) -> str\n
|
||||
Returns the documentation string of the property of this class.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setDocumentationOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Set the documentation string of a dynamic property of this class.</UserDocu>
|
||||
<UserDocu>setDocumentationOfProperty(name, docstring) -> None\n
|
||||
Set the documentation string of a dynamic property of this class.\n
|
||||
name : str\n Property name.
|
||||
docstring : str\n Documentation string.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getEnumerationsOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Return all enumeration strings of the property of this class or None if not a PropertyEnumeration.</UserDocu>
|
||||
<UserDocu>getEnumerationsOfProperty(name) -> list or None\n
|
||||
Return all enumeration strings of the property of this class or None if not a
|
||||
PropertyEnumeration.\n
|
||||
name : str\n Property name.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dumpPropertyContent" Keyword="true" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Dumps the content of the property, both the XML representation as well as the additional datafiles
|
||||
required, into a byte representation. It will be returned as byte array.
|
||||
dumpPropertyContent(propertyname) -- returns a byte array with full content
|
||||
dumpPropertyContent(propertyname, [Compression=1-9]) -- Sets the data compression from 0 (no) to 9 (max)
|
||||
</UserDocu>
|
||||
<UserDocu>dumpPropertyContent(Property, Compression=3) -> bytearray\n
|
||||
Dumps the content of the property, both the XML representation and the additional
|
||||
data files required, into a byte representation.\n
|
||||
Property : str\n Property Name.
|
||||
Compression : int\n Set the data compression level in the range [0, 9]. Set to 0 for no compression.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="restorePropertyContent">
|
||||
<Documentation>
|
||||
<UserDocu>Restore the content of given property from a byte representation as stored by \"dumpContent\".
|
||||
It could be restored from any python object implementing the buffer protocol.
|
||||
restorePropertyContent(propertyname, buffer) -- restores from the given byte array
|
||||
</UserDocu>
|
||||
<UserDocu>restorePropertyContent(name, obj) -> None\n
|
||||
Restore the content of the object from a byte representation as stored by `dumpPropertyContent`.
|
||||
It could be restored from any Python object implementing the buffer protocol.\n
|
||||
name : str\n Property name.
|
||||
obj : buffer\n Object with buffer protocol support.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="PropertiesList" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>A list of all property names</UserDocu>
|
||||
<UserDocu>A list of all property names.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="PropertiesList" Type="List"/>
|
||||
</Attribute>
|
||||
|
||||
@@ -54,16 +54,24 @@ PyObject* PropertyContainerPy::getPropertyByName(PyObject *args)
|
||||
int checkOwner=0;
|
||||
if (!PyArg_ParseTuple(args, "s|i", &pstr, &checkOwner))
|
||||
return nullptr;
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
|
||||
if (prop) {
|
||||
if(!checkOwner || (checkOwner==1 && prop->getContainer()==getPropertyContainerPtr()))
|
||||
return prop->getPyObject();
|
||||
Py::TupleN res(Py::asObject(prop->getContainer()->getPyObject()),
|
||||
Py::asObject(prop->getPyObject()));
|
||||
return Py::new_reference_to(res);
|
||||
|
||||
if (checkOwner < 0 || checkOwner > 2) {
|
||||
PyErr_SetString(PyExc_ValueError, "'checkOwner' expected in the range [0, 2]");
|
||||
return nullptr;
|
||||
}
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
|
||||
return nullptr;
|
||||
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!checkOwner || (checkOwner==1 && prop->getContainer()==getPropertyContainerPtr()))
|
||||
return prop->getPyObject();
|
||||
|
||||
Py::TupleN res(Py::asObject(prop->getContainer()->getPyObject()), Py::asObject(prop->getPyObject()));
|
||||
|
||||
return Py::new_reference_to(res);
|
||||
}
|
||||
|
||||
PyObject* PropertyContainerPy::getPropertyTouchList(PyObject *args)
|
||||
@@ -71,6 +79,7 @@ PyObject* PropertyContainerPy::getPropertyTouchList(PyObject *args)
|
||||
char *pstr;
|
||||
if (!PyArg_ParseTuple(args, "s", &pstr))
|
||||
return nullptr;
|
||||
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
|
||||
if (prop && prop->isDerivedFrom(PropertyLists::getClassTypeId())) {
|
||||
const auto &touched = static_cast<PropertyLists*>(prop)->getTouchList();
|
||||
@@ -80,11 +89,14 @@ PyObject* PropertyContainerPy::getPropertyTouchList(PyObject *args)
|
||||
ret.setItem(i++,Py::Long(idx));
|
||||
return Py::new_reference_to(ret);
|
||||
}
|
||||
else if(!prop)
|
||||
else if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_AttributeError, "Property '%s' is not of list type", pstr);
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args)
|
||||
@@ -168,7 +180,7 @@ PyObject* PropertyContainerPy::setEditorMode(PyObject *args)
|
||||
status.reset(Property::ReadOnly);
|
||||
status.reset(Property::Hidden);
|
||||
for (Py::Sequence::iterator it = seq.begin();it!=seq.end();++it) {
|
||||
std::string str = (std::string)Py::String(*it);
|
||||
std::string str = static_cast<std::string>(Py::String(*it));
|
||||
if (str == "ReadOnly")
|
||||
status.set(Property::ReadOnly);
|
||||
else if (str == "Hidden")
|
||||
@@ -210,28 +222,30 @@ PyObject* PropertyContainerPy::setPropertyStatus(PyObject *args)
|
||||
PyObject *pyValue;
|
||||
if (!PyArg_ParseTuple(args, "sO", &name, &pyValue))
|
||||
return nullptr;
|
||||
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name);
|
||||
return nullptr;
|
||||
}
|
||||
auto linkProp = Base::freecad_dynamic_cast<App::PropertyLinkBase>(prop);
|
||||
|
||||
auto linkProp = Base::freecad_dynamic_cast<App::PropertyLinkBase>(prop);
|
||||
std::bitset<32> status(prop->getStatus());
|
||||
size_t count = 1;
|
||||
bool isSeq = false;
|
||||
if(PyList_Check(pyValue) || PyTuple_Check(pyValue)) {
|
||||
if (PyList_Check(pyValue) || PyTuple_Check(pyValue)) {
|
||||
isSeq = true;
|
||||
count = PySequence_Size(pyValue);
|
||||
}
|
||||
for(size_t i=0;i<count;++i) {
|
||||
|
||||
for(size_t i=0; i<count; ++i) {
|
||||
Py::Object item;
|
||||
if(isSeq)
|
||||
if (isSeq)
|
||||
item = Py::Object(PySequence_GetItem(pyValue,i));
|
||||
else
|
||||
item = Py::Object(pyValue);
|
||||
bool value = true;
|
||||
if(item.isString()) {
|
||||
if (item.isString()) {
|
||||
const auto &statusMap = getStatusMap();
|
||||
auto v = (std::string)Py::String(item);
|
||||
if(v.size()>1 && v[0] == '-') {
|
||||
@@ -248,7 +262,8 @@ PyObject* PropertyContainerPy::setPropertyStatus(PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
status.set(it->second,value);
|
||||
}else if(item.isNumeric()) {
|
||||
}
|
||||
else if (item.isNumeric()) {
|
||||
int v = Py::Int(item);
|
||||
if(v<0) {
|
||||
value = false;
|
||||
@@ -257,7 +272,8 @@ PyObject* PropertyContainerPy::setPropertyStatus(PyObject *args)
|
||||
if(v==0 || v>31)
|
||||
PyErr_Format(PyExc_ValueError, "Status value out of range '%d'", v);
|
||||
status.set(v,value);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "Expects status type to be Int or String");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -275,31 +291,34 @@ PyObject* PropertyContainerPy::getPropertyStatus(PyObject *args)
|
||||
|
||||
Py::List ret;
|
||||
const auto &statusMap = getStatusMap();
|
||||
if(!name[0]) {
|
||||
if (!name[0]) {
|
||||
for(auto &v : statusMap)
|
||||
ret.append(Py::String(v.first.c_str()));
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
|
||||
if (prop) {
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto linkProp = Base::freecad_dynamic_cast<App::PropertyLinkBase>(prop);
|
||||
if(linkProp && linkProp->testFlag(App::PropertyLinkBase::LinkAllowPartial))
|
||||
ret.append(Py::String("AllowPartial"));
|
||||
auto linkProp = Base::freecad_dynamic_cast<App::PropertyLinkBase>(prop);
|
||||
if (linkProp && linkProp->testFlag(App::PropertyLinkBase::LinkAllowPartial))
|
||||
ret.append(Py::String("AllowPartial"));
|
||||
|
||||
std::bitset<32> bits(prop->getStatus());
|
||||
for(size_t i=1;i<bits.size();++i) {
|
||||
if(!bits[i]) continue;
|
||||
bool found = false;
|
||||
for(auto &v : statusMap) {
|
||||
if(v.second == (int)i) {
|
||||
ret.append(Py::String(v.first.c_str()));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
std::bitset<32> bits(prop->getStatus());
|
||||
for(size_t i=1; i<bits.size(); ++i) {
|
||||
if(!bits[i]) continue;
|
||||
bool found = false;
|
||||
for(auto &v : statusMap) {
|
||||
if(v.second == static_cast<int>(i)) {
|
||||
ret.append(Py::String(v.first.c_str()));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if(!found)
|
||||
ret.append(Py::Int((long)i));
|
||||
}
|
||||
if (!found)
|
||||
ret.append(Py::Int(static_cast<long>(i)));
|
||||
}
|
||||
}
|
||||
return Py::new_reference_to(ret);
|
||||
@@ -312,6 +331,11 @@ PyObject* PropertyContainerPy::getEditorMode(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
App::Property* prop = getPropertyContainerPtr()->getPropertyByName(name);
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py::List ret;
|
||||
if (prop) {
|
||||
short Type = prop->getType();
|
||||
@@ -357,7 +381,8 @@ PyObject* PropertyContainerPy::setGroupOfProperty(PyObject *args)
|
||||
}
|
||||
prop->getContainer()->changeDynamicProperty(prop,group,nullptr);
|
||||
Py_Return;
|
||||
} PY_CATCH
|
||||
}
|
||||
PY_CATCH
|
||||
}
|
||||
|
||||
|
||||
@@ -373,9 +398,9 @@ PyObject* PropertyContainerPy::getDocumentationOfProperty(PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char* Group = getPropertyContainerPtr()->getPropertyDocumentation(prop);
|
||||
if (Group)
|
||||
return Py::new_reference_to(Py::String(Group));
|
||||
const char* docstr = getPropertyContainerPtr()->getPropertyDocumentation(prop);
|
||||
if (docstr)
|
||||
return Py::new_reference_to(Py::String(docstr));
|
||||
else
|
||||
return Py::new_reference_to(Py::String(""));
|
||||
}
|
||||
@@ -395,7 +420,8 @@ PyObject* PropertyContainerPy::setDocumentationOfProperty(PyObject *args)
|
||||
}
|
||||
prop->getContainer()->changeDynamicProperty(prop,nullptr,doc);
|
||||
Py_Return;
|
||||
} PY_CATCH
|
||||
}
|
||||
PY_CATCH
|
||||
}
|
||||
|
||||
PyObject* PropertyContainerPy::getEnumerationsOfProperty(PyObject *args)
|
||||
@@ -411,13 +437,10 @@ PyObject* PropertyContainerPy::getEnumerationsOfProperty(PyObject *args)
|
||||
}
|
||||
|
||||
PropertyEnumeration *enumProp = dynamic_cast<PropertyEnumeration*>(prop);
|
||||
if (!enumProp) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
if (!enumProp)
|
||||
Py_Return;
|
||||
|
||||
std::vector<std::string> enumerations = enumProp->getEnumVector();
|
||||
|
||||
Py::List ret;
|
||||
for (std::vector<std::string>::const_iterator it = enumerations.begin(); it != enumerations.end(); ++it) {
|
||||
ret.append(Py::String(*it));
|
||||
@@ -432,7 +455,7 @@ Py::List PropertyContainerPy::getPropertiesList(void) const
|
||||
|
||||
getPropertyContainerPtr()->getPropertyMap(Map);
|
||||
|
||||
for (std::map<std::string,Property*>::const_iterator It=Map.begin();It!=Map.end();++It)
|
||||
for (std::map<std::string,Property*>::const_iterator It=Map.begin(); It!=Map.end(); ++It)
|
||||
ret.append(Py::String(It->first));
|
||||
|
||||
return ret;
|
||||
@@ -442,12 +465,11 @@ Py::List PropertyContainerPy::getPropertiesList(void) const
|
||||
PyObject* PropertyContainerPy::dumpPropertyContent(PyObject *args, PyObject *kwds)
|
||||
{
|
||||
int compression = 3;
|
||||
char* property;
|
||||
static char* kwds_def[] = {"Property", "Compression",nullptr};
|
||||
const char* property;
|
||||
static char* kwds_def[] = {"Property", "Compression", nullptr};
|
||||
PyErr_Clear();
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|i", kwds_def, &property, &compression)) {
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|i", kwds_def, &property, &compression))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Property* prop = getPropertyContainerPtr()->getPropertyByName(property);
|
||||
if (!prop) {
|
||||
|
||||
+23
-9
@@ -37,7 +37,7 @@ using namespace App;
|
||||
const int App::CellAddress::MAX_ROWS = 16384;
|
||||
const int App::CellAddress::MAX_COLUMNS = 26 * 26 + 26;
|
||||
|
||||
Range::Range(const char * range)
|
||||
Range::Range(const char * range, bool normalize)
|
||||
{
|
||||
std::string from;
|
||||
std::string to;
|
||||
@@ -62,28 +62,42 @@ Range::Range(const char * range)
|
||||
row_end = end.row();
|
||||
col_end = end.col();
|
||||
|
||||
if (normalize)
|
||||
this->normalize();
|
||||
row_curr = row_begin;
|
||||
col_curr = col_begin;
|
||||
}
|
||||
|
||||
Range::Range(int _row_begin, int _col_begin, int _row_end, int _col_end)
|
||||
: row_curr(_row_begin)
|
||||
, col_curr(_col_begin)
|
||||
, row_begin(_row_begin)
|
||||
Range::Range(int _row_begin, int _col_begin, int _row_end, int _col_end, bool normalize)
|
||||
: row_begin(_row_begin)
|
||||
, col_begin(_col_begin)
|
||||
, row_end(_row_end)
|
||||
, col_end(_col_end)
|
||||
{
|
||||
if (normalize)
|
||||
this->normalize();
|
||||
row_curr = row_begin;
|
||||
col_curr = col_begin;
|
||||
}
|
||||
|
||||
Range::Range(const CellAddress &from, const CellAddress &to)
|
||||
: row_curr(from.row())
|
||||
, col_curr(from.col())
|
||||
, row_begin(from.row())
|
||||
Range::Range(const CellAddress &from, const CellAddress &to, bool normalize)
|
||||
: row_begin(from.row())
|
||||
, col_begin(from.col())
|
||||
, row_end(to.row())
|
||||
, col_end(to.col())
|
||||
{
|
||||
if (normalize)
|
||||
this->normalize();
|
||||
row_curr = row_begin;
|
||||
col_curr = col_begin;
|
||||
}
|
||||
|
||||
void Range::normalize()
|
||||
{
|
||||
if (row_begin > row_end)
|
||||
std::swap(row_begin, row_end);
|
||||
if (col_begin > col_end)
|
||||
std::swap(col_begin, col_end);
|
||||
}
|
||||
|
||||
bool Range::next()
|
||||
|
||||
+6
-3
@@ -117,14 +117,17 @@ protected:
|
||||
|
||||
class AppExport Range {
|
||||
public:
|
||||
Range(const char *range);
|
||||
Range(const char *range, bool normalize=false);
|
||||
|
||||
Range(int _row_begin, int _col_begin, int _row_end, int _col_end);
|
||||
Range(int _row_begin, int _col_begin, int _row_end, int _col_end, bool normalize=false);
|
||||
|
||||
Range(const CellAddress & from, const CellAddress & to);
|
||||
Range(const CellAddress & from, const CellAddress & to, bool normalize=false);
|
||||
|
||||
bool next();
|
||||
|
||||
/** Make sure the range starts from top left and ends with bottom right corner **/
|
||||
void normalize();
|
||||
|
||||
/** Current row */
|
||||
inline int row() const { return row_curr; }
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ int AxisPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject* d;
|
||||
if (PyArg_ParseTuple(args, "O!O", &(Base::VectorPy::Type), &o,
|
||||
if (PyArg_ParseTuple(args, "O!O!", &(Base::VectorPy::Type), &o,
|
||||
&(Base::VectorPy::Type), &d)) {
|
||||
// NOTE: The first parameter defines the base (origin) and the second the direction.
|
||||
*getAxisPtr() = Base::Axis(static_cast<Base::VectorPy*>(o)->value(),
|
||||
|
||||
+120
-72
@@ -14,196 +14,244 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the BoundBox export class</DeveloperDocu>
|
||||
<UserDocu>Bound box class
|
||||
A bounding box is an orthographic cube which is a way to describe outer boundaries.
|
||||
You get a bounding box from a lot of 3D types. It is often used to check if a 3D
|
||||
entity lies in the range of another object. Checking for bounding interference first
|
||||
can save a lot of computing time!
|
||||
|
||||
Constructor:
|
||||
App.BoundBox([Xmin,Ymin,Zmin,Xmax,Ymax,Zmax])
|
||||
App.BoundBox(Tuple, Tuple)
|
||||
App.BoundBox(Vector, Vector)
|
||||
App.BoundBox(BoundBox)
|
||||
</UserDocu>
|
||||
<UserDocu>Base.BoundBox class.\n
|
||||
This class represents a bounding box.
|
||||
A bounding box is a rectangular cuboid which is a way to describe outer
|
||||
boundaries and is obtained from a lot of 3D types.
|
||||
It is often used to check if a 3D entity lies in the range of another object.
|
||||
Checking for bounding interference first can save a lot of computing time!
|
||||
An invalid BoundBox is represented by inconsistent values at each direction:
|
||||
The maximum float value of the system at the minimum coordinates, and the
|
||||
opposite value at the maximum coordinates.\n
|
||||
The following constructors are supported:\n
|
||||
BoundBox()
|
||||
Empty constructor. Returns an invalid BoundBox.\n
|
||||
BoundBox(boundBox)
|
||||
Copy constructor.
|
||||
boundBox : Base.BoundBox\n
|
||||
BoundBox(xMin, yMin=0, zMin=0, xMax=0, yMax=0, zMax=0)
|
||||
Define from the minimum and maximum values at each direction.
|
||||
xMin : float\n Minimum value at x-coordinate.
|
||||
yMin : float\n Minimum value at y-coordinate.
|
||||
zMin : float\n Minimum value at z-coordinate.
|
||||
xMax : float\n Maximum value at x-coordinate.
|
||||
yMax : float\n Maximum value at y-coordinate.
|
||||
zMax : float\n Maximum value at z-coordinate.\n
|
||||
App.BoundBox(min, max)
|
||||
Define from two containers representing the minimum and maximum values of the
|
||||
coordinates in each direction.
|
||||
min : Base.Vector, tuple\n Minimum values of the coordinates.
|
||||
max : Base.Vector, tuple\n Maximum values of the coordinates.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="setVoid">
|
||||
<Documentation>
|
||||
<UserDocu>method setVoid()
|
||||
Invalidate the bounding box</UserDocu>
|
||||
<UserDocu>setVoid() -> None\n
|
||||
Invalidate the bounding box.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isValid">
|
||||
<Documentation>
|
||||
<UserDocu>method isValid()
|
||||
Checks if the bounding box is valid</UserDocu>
|
||||
<UserDocu>isValid() -> bool\n
|
||||
Checks if the bounding box is valid.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="add">
|
||||
<Documentation>
|
||||
<UserDocu>method add(BoundBox)
|
||||
Add (enlarge) the given BoundBox</UserDocu>
|
||||
<UserDocu>add(minMax) -> None
|
||||
add(x, y, z) -> None\n
|
||||
Increase the maximum values or decrease the minimum values of this BoundBox by
|
||||
replacing the current values with the given values, so the bounding box can grow
|
||||
but not shrink.\n
|
||||
minMax : Base.Vector, tuple\n Values to enlarge at each direction.
|
||||
x : float\n Value to enlarge at x-direction.
|
||||
y : float\n Value to enlarge at y-direction.
|
||||
z : float\n Value to enlarge at z-direction.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getPoint">
|
||||
<Documentation>
|
||||
<UserDocu>method getPoint(Int)
|
||||
Get the point of the given index. The index must be in the range of [0,7]
|
||||
</UserDocu>
|
||||
<UserDocu>getPoint(index) ->Base.Vector\n
|
||||
Get the point of the given index.
|
||||
The index must be in the range of [0, 7].\n
|
||||
index : int</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getEdge">
|
||||
<Documentation>
|
||||
<UserDocu>method getEdge(Int)
|
||||
Get the edge points of the given index. The index must be in the range of [0,11]
|
||||
</UserDocu>
|
||||
<UserDocu>getEdge(index) -> tuple of Base.Vector\n
|
||||
Get the edge points of the given index.
|
||||
The index must be in the range of [0, 11].\n
|
||||
index : int</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="closestPoint">
|
||||
<Documentation>
|
||||
<UserDocu>method closestPoint(Vector)
|
||||
Get the closest point of the bounding box to the given point
|
||||
</UserDocu>
|
||||
<UserDocu>closestPoint(point) -> Base.Vector
|
||||
closestPoint(x, y, z) -> Base.Vector\n
|
||||
Get the closest point of the bounding box to the given point.\n
|
||||
point : Base.Vector, tuple\n Coordinates of the given point.
|
||||
x : float\n X-coordinate of the given point.
|
||||
y : float\n Y-coordinate of the given point.
|
||||
z : float\n Z-coordinate of the given point.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="intersect">
|
||||
<Documentation>
|
||||
<UserDocu>method intersect(BoundBox|Vector Base, Vector Dir)
|
||||
Checks if the given object intersects with the BoundBox. That can be:
|
||||
- Another BoundBox
|
||||
- A line, specified by Base and Dir
|
||||
</UserDocu>
|
||||
<UserDocu>intersect(boundBox2) -> bool
|
||||
intersect(base, dir) -> bool\n
|
||||
Checks if the given object intersects with this bounding box. That can be
|
||||
another bounding box or a line specified by base and direction.\n
|
||||
boundBox2 : Base.BoundBox
|
||||
base : Base.Vector, tuple
|
||||
dir : Base.Vector, tuple</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="intersected">
|
||||
<Documentation>
|
||||
<UserDocu>method intersected(BoundBox)
|
||||
Returns the intersection of this and the given bounding box.
|
||||
</UserDocu>
|
||||
<UserDocu>intersected(boundBox2) -> Base.BoundBox\n
|
||||
Returns the intersection of this and the given bounding box.\n
|
||||
boundBox2 : Base.BoundBox</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="united">
|
||||
<Documentation>
|
||||
<UserDocu>method united(BoundBox)
|
||||
Returns the union of this and the given bounding box.
|
||||
</UserDocu>
|
||||
<UserDocu>united(boundBox2) -> Base.BoundBox\n
|
||||
Returns the union of this and the given bounding box.\n
|
||||
boundBox2 : Base.BoundBox</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="enlarge">
|
||||
<Documentation>
|
||||
<UserDocu>method enlarge(Float)
|
||||
Enlarge the BoundBox by the given value in each direction.
|
||||
A negative value shrinks the box.</UserDocu>
|
||||
<UserDocu>enlarge(variation) -> None\n
|
||||
Decrease the minimum values and increase the maximum values by the given value.
|
||||
A negative value shrinks the bounding box.\n
|
||||
variation : float</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
|
||||
<Methode Name="getIntersectionPoint">
|
||||
<Documentation>
|
||||
<UserDocu>method Vector getIntersectionPoint(Vector Base, Vector Dir, [float epsilon=0.0001])
|
||||
Calculate the intersection point of a line with the BoundBox
|
||||
The Base point must lie inside the bounding box, if not an
|
||||
exception is thrown.
|
||||
</UserDocu>
|
||||
<UserDocu>getIntersectionPoint(base, dir, epsilon=0.0001) -> Base.Vector\n
|
||||
Calculate the intersection point of a line with the bounding box.
|
||||
The base point must lie inside the bounding box, if not an exception is thrown.\n
|
||||
base : Base.Vector\n Base point of the line.
|
||||
dir : Base.Vector\n Direction of the line.
|
||||
epsilon : float\n Bounding box size tolerance.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="move">
|
||||
<Documentation>
|
||||
<UserDocu> method move(Vector)
|
||||
Move the BoundBox by the given vector
|
||||
</UserDocu>
|
||||
<UserDocu>move(displacement) -> None
|
||||
move(x, y, z) -> None\n
|
||||
Move the bounding box by the given values.\n
|
||||
displacement : Base.Vector, tuple\n Displacement at each direction.
|
||||
x : float\n Displacement at x-direction.
|
||||
y : float\n Displacement at y-direction.
|
||||
z : float\n Displacement at z-direction.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="scale">
|
||||
<Documentation>
|
||||
<UserDocu> method scale(x,y,z)
|
||||
Scale the BoundBox by the given values in x, y and z
|
||||
</UserDocu>
|
||||
<UserDocu>scale(factor) -> None
|
||||
scale(x, y, z) -> None\n
|
||||
Scale the bounding box by the given values.\n
|
||||
factor : Base.Vector, tuple\n Factor scale at each direction.
|
||||
x : float\n Scale at x-direction.
|
||||
y : float\n Scale at y-direction.
|
||||
z : float\n Scale at z-direction.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transformed">
|
||||
<Documentation>
|
||||
<UserDocu> method transformed(Matrix)
|
||||
Return a new bounding box with the transformed corner of this bounding box
|
||||
</UserDocu>
|
||||
<UserDocu>transformed(matrix) -> Base.BoundBox\n
|
||||
Returns a new BoundBox containing the transformed rectangular cuboid
|
||||
represented by this BoundBox.\n
|
||||
matrix : Base.Matrix\n Transformation matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isCutPlane">
|
||||
<Documentation>
|
||||
<UserDocu>method bool isCutPlane(Vector Base, Vector Normal)
|
||||
Check if the plane specified by Base and Normal intersects (cuts) the BoundBox</UserDocu>
|
||||
<UserDocu>isCutPlane(base, normal) -> bool\n
|
||||
Check if the plane specified by base and normal intersects (cuts) this bounding
|
||||
box.\n
|
||||
base : Base.Vector
|
||||
normal : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isInside">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
method bool isInside(Vector Base|BoundBox box)
|
||||
Check if the point or bounding box is inside this bounding box
|
||||
</UserDocu>
|
||||
<UserDocu>isInside(object) -> bool
|
||||
isInside(x, y, z) -> bool\n
|
||||
Check if a point or a bounding box is inside this bounding box.\n
|
||||
object : Base.Vector, Base.BoundBox\n Object to check if it is inside this bounding box.
|
||||
x : float\n X-coordinate of the point to check.
|
||||
y : float\n Y-coordinate of the point to check.
|
||||
z : float\n Z-coordinate of the point to check.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Center" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Center point of the bounding box</UserDocu>
|
||||
<UserDocu>Center point of the bounding box.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Center" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="XMax" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The maximum x boundary position</UserDocu>
|
||||
<UserDocu>The maximum x boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="XMax" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="YMax" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The maximum y boundary position</UserDocu>
|
||||
<UserDocu>The maximum y boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="YMax" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="ZMax" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The maximum z boundary position</UserDocu>
|
||||
<UserDocu>The maximum z boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ZMax" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="XMin" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The minimum x boundary position</UserDocu>
|
||||
<UserDocu>The minimum x boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="XMin" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="YMin" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The minimum y boundary position</UserDocu>
|
||||
<UserDocu>The minimum y boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="YMin" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="ZMin" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The minimum z boundary position</UserDocu>
|
||||
<UserDocu>The minimum z boundary position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ZMin" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="XLength" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Length of the BoundBox in x direction</UserDocu>
|
||||
<UserDocu>Length of the bounding box in x direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="XLength" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="YLength" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Length of the BoundBox in y direction</UserDocu>
|
||||
<UserDocu>Length of the bounding box in y direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="YLength" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="ZLength" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Length of the BoundBox in z direction</UserDocu>
|
||||
<UserDocu>Length of the bounding box in z direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ZLength" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="DiagonalLength" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Diagonal length of the BoundBox</UserDocu>
|
||||
<UserDocu>Diagonal length of the bounding box.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="DiagonalLength" Type="Float" />
|
||||
</Attribute>
|
||||
|
||||
+24
-25
@@ -311,23 +311,22 @@ PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args)
|
||||
{
|
||||
PyObject *object,*object2;
|
||||
double epsilon=0.0001;
|
||||
if (PyArg_ParseTuple(args,"O!O!|d:Need base and direction vector",
|
||||
&(Base::VectorPy::Type), &object,&(Base::VectorPy::Type), &object2, &epsilon)) {
|
||||
Base::Vector3d point;
|
||||
bool ok = getBoundBoxPtr()->IntersectionPoint(
|
||||
*(static_cast<Base::VectorPy*>(object)->getVectorPtr()),
|
||||
*(static_cast<Base::VectorPy*>(object2)->getVectorPtr()),
|
||||
point, epsilon);
|
||||
if (ok) {
|
||||
return new VectorPy(point);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(Base::PyExc_FC_GeneralError, "No intersection");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!PyArg_ParseTuple(args,"O!O!|d;Need base and direction vector",
|
||||
&(Base::VectorPy::Type), &object,&(Base::VectorPy::Type), &object2, &epsilon))
|
||||
return nullptr;
|
||||
|
||||
Base::Vector3d point;
|
||||
bool ok = getBoundBoxPtr()->IntersectionPoint(
|
||||
*(static_cast<Base::VectorPy*>(object)->getVectorPtr()),
|
||||
*(static_cast<Base::VectorPy*>(object2)->getVectorPtr()),
|
||||
point, epsilon);
|
||||
if (ok) {
|
||||
return new VectorPy(point);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(Base::PyExc_FC_GeneralError, "No intersection");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* BoundBoxPy::move(PyObject *args)
|
||||
@@ -344,13 +343,13 @@ PyObject* BoundBoxPy::move(PyObject *args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args,"O!:Need vector to move",&PyTuple_Type, &object)) {
|
||||
if (PyArg_ParseTuple(args,"O!",&PyTuple_Type, &object)) {
|
||||
vec = getVectorFromTuple<double>(object);
|
||||
break;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args,"O!:Need vector to move",&(Base::VectorPy::Type), &object)) {
|
||||
if (PyArg_ParseTuple(args,"O!",&(Base::VectorPy::Type), &object)) {
|
||||
vec = *(static_cast<Base::VectorPy*>(object)->getVectorPtr());
|
||||
break;
|
||||
}
|
||||
@@ -382,13 +381,13 @@ PyObject* BoundBoxPy::scale(PyObject *args)
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args,"O!:Need vector to scale",&PyTuple_Type, &object)) {
|
||||
if (PyArg_ParseTuple(args,"O!",&PyTuple_Type, &object)) {
|
||||
vec = getVectorFromTuple<double>(object);
|
||||
break;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args,"O!:Need vector to scale",&(Base::VectorPy::Type), &object)) {
|
||||
if (PyArg_ParseTuple(args,"O!",&(Base::VectorPy::Type), &object)) {
|
||||
vec = *(static_cast<Base::VectorPy*>(object)->getVectorPtr());
|
||||
break;
|
||||
}
|
||||
@@ -429,14 +428,14 @@ PyObject* BoundBoxPy::isCutPlane(PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (PyArg_ParseTuple(args,"O!O!:Need base and normal vector of a plane",
|
||||
if (!PyArg_ParseTuple(args,"O!O!;Need base and normal vector of a plane",
|
||||
&(Base::VectorPy::Type), &object,&(Base::VectorPy::Type), &object2))
|
||||
retVal = getBoundBoxPtr()->IsCutPlane(
|
||||
*(static_cast<Base::VectorPy*>(object)->getVectorPtr()),
|
||||
*(static_cast<Base::VectorPy*>(object2)->getVectorPtr()));
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
retVal = getBoundBoxPtr()->IsCutPlane(
|
||||
*(static_cast<Base::VectorPy*>(object)->getVectorPtr()),
|
||||
*(static_cast<Base::VectorPy*>(object2)->getVectorPtr()));
|
||||
|
||||
return Py::new_reference_to(retVal);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,68 +14,76 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the CoordinateSystem export class</DeveloperDocu>
|
||||
<UserDocu></UserDocu>
|
||||
<UserDocu>Base.CoordinateSystem class.\n
|
||||
An orthonormal right-handed coordinate system in 3D space.\n
|
||||
CoordinateSystem()
|
||||
Empty constructor.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="setAxes">
|
||||
<Documentation>
|
||||
<UserDocu>setAxes(Axis or Vector z, Vector x)
|
||||
Set axis or z direction and x direction</UserDocu>
|
||||
<UserDocu>setAxes(axis, xDir) -> None\n
|
||||
Set axis or Z-direction, and X-direction.
|
||||
The X-direction is determined from the orthonormal compononent of `xDir`
|
||||
with respect to `axis` direction.\n
|
||||
axis : Base.Axis, Base.Vector
|
||||
xDir : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="displacement" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>displacement(CoordinateSystem)
|
||||
Computes the placement from this to the passed coordinate system</UserDocu>
|
||||
<UserDocu>displacement(coordSystem2) -> Base.Placement\n
|
||||
Computes the placement from this to the passed coordinate system `coordSystem2`.\n
|
||||
coordSystem2 : Base.CoordinateSystem</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transformTo">
|
||||
<Documentation>
|
||||
<UserDocu>transformTo(Vector)
|
||||
Computes the coordinates of the point in coordinates of this system
|
||||
</UserDocu>
|
||||
<UserDocu>transformTo(vector) -> Base.Vector\n
|
||||
Computes the coordinates of the point in coordinates of this coordinate system.\n
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transform">
|
||||
<Documentation>
|
||||
<UserDocu>transform(Rotation or Placement)
|
||||
Applies the rotation or placement on this coordinate system
|
||||
</UserDocu>
|
||||
<UserDocu>transform(trans) -> None\n
|
||||
Applies a transformation on this coordinate system.\n
|
||||
trans : Base.Rotation, Base.Placement</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setPlacement">
|
||||
<Documentation>
|
||||
<UserDocu>setPlacment(Placement)
|
||||
Set placement to the coordinate system.
|
||||
</UserDocu>
|
||||
<UserDocu>setPlacment(placement) -> None\n
|
||||
Set placement to the coordinate system.\n
|
||||
placement : Base.Placement</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Axis" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Set or get axis</UserDocu>
|
||||
<UserDocu>Set or get axis.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Axis" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="XDirection" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Set or get x direction</UserDocu>
|
||||
<UserDocu>Set or get X-direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="XDirection" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="YDirection" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Set or get y direction</UserDocu>
|
||||
<UserDocu>Set or get Y-direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="YDirection" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="ZDirection" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Set or get z direction</UserDocu>
|
||||
<UserDocu>Set or get Z-direction.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="ZDirection" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Position" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Set or get position</UserDocu>
|
||||
<UserDocu>Set or get position.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Position" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
@@ -181,11 +181,18 @@ std::string FileInfo::getTempFileName(const char* FileName, const char* Path)
|
||||
buf += "/fileXXXXXX";
|
||||
}
|
||||
|
||||
std::vector<char> vec;
|
||||
std::copy(buf.begin(), buf.end(), std::back_inserter(vec));
|
||||
vec.push_back('\0');
|
||||
|
||||
/* coverity[secure_temp] mkstemp uses 0600 as the mode and is safe */
|
||||
int id = mkstemp(const_cast<char*>(buf.c_str()));
|
||||
int id = mkstemp(vec.data());
|
||||
if (id > -1) {
|
||||
FILE* file = fdopen(id, "w");
|
||||
fclose(file);
|
||||
vec.pop_back(); // remove '\0'
|
||||
std::string str(vec.begin(), vec.end());
|
||||
buf.swap(str);
|
||||
unlink(buf.c_str());
|
||||
}
|
||||
return buf;
|
||||
@@ -512,6 +519,7 @@ bool FileInfo::copyTo(const char* NewName) const
|
||||
FileInfo fi1(FileName);
|
||||
FileInfo fi2(NewName);
|
||||
Base::ifstream file(fi1, std::ios::in | std::ios::binary);
|
||||
file.unsetf(std::ios_base::skipws);
|
||||
Base::ofstream copy(fi2, std::ios::out | std::ios::binary);
|
||||
file >> copy.rdbuf();
|
||||
return file.is_open() && copy.is_open();
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
Vector2dPy(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds);
|
||||
virtual ~Vector2dPy();
|
||||
|
||||
static void init_type(void);
|
||||
static void init_type();
|
||||
Py::Object getattro(const Py::String &name_);
|
||||
int setattro(const Py::String &name_, const Py::Object &value);
|
||||
virtual Py::Object repr();
|
||||
|
||||
+16
-26
@@ -34,59 +34,49 @@
|
||||
using namespace Base;
|
||||
|
||||
Matrix4D::Matrix4D ()
|
||||
: dMtrx4D{{1.,0.,0.,0.},
|
||||
{0.,1.,0.,0.},
|
||||
{0.,0.,1.,0.},
|
||||
{0.,0.,0.,1.}}
|
||||
{
|
||||
setToUnity();
|
||||
}
|
||||
|
||||
Matrix4D::Matrix4D (float a11, float a12, float a13, float a14,
|
||||
float a21, float a22, float a23, float a24,
|
||||
float a31, float a32, float a33, float a34,
|
||||
float a41, float a42, float a43, float a44 )
|
||||
float a41, float a42, float a43, float a44)
|
||||
: dMtrx4D{{a11,a12,a13,a14},
|
||||
{a21,a22,a23,a24},
|
||||
{a31,a32,a33,a34},
|
||||
{a41,a42,a43,a44}}
|
||||
{
|
||||
dMtrx4D[0][0] = static_cast<double>(a11);
|
||||
dMtrx4D[0][1] = static_cast<double>(a12);
|
||||
dMtrx4D[0][2] = static_cast<double>(a13);
|
||||
dMtrx4D[0][3] = static_cast<double>(a14);
|
||||
dMtrx4D[1][0] = static_cast<double>(a21);
|
||||
dMtrx4D[1][1] = static_cast<double>(a22);
|
||||
dMtrx4D[1][2] = static_cast<double>(a23);
|
||||
dMtrx4D[1][3] = static_cast<double>(a24);
|
||||
dMtrx4D[2][0] = static_cast<double>(a31);
|
||||
dMtrx4D[2][1] = static_cast<double>(a32);
|
||||
dMtrx4D[2][2] = static_cast<double>(a33);
|
||||
dMtrx4D[2][3] = static_cast<double>(a34);
|
||||
dMtrx4D[3][0] = static_cast<double>(a41);
|
||||
dMtrx4D[3][1] = static_cast<double>(a42);
|
||||
dMtrx4D[3][2] = static_cast<double>(a43);
|
||||
dMtrx4D[3][3] = static_cast<double>(a44);
|
||||
}
|
||||
|
||||
Matrix4D::Matrix4D (double a11, double a12, double a13, double a14,
|
||||
double a21, double a22, double a23, double a24,
|
||||
double a31, double a32, double a33, double a34,
|
||||
double a41, double a42, double a43, double a44 )
|
||||
: dMtrx4D{{a11,a12,a13,a14},
|
||||
{a21,a22,a23,a24},
|
||||
{a31,a32,a33,a34},
|
||||
{a41,a42,a43,a44}}
|
||||
{
|
||||
dMtrx4D[0][0] = a11; dMtrx4D[0][1] = a12; dMtrx4D[0][2] = a13; dMtrx4D[0][3] = a14;
|
||||
dMtrx4D[1][0] = a21; dMtrx4D[1][1] = a22; dMtrx4D[1][2] = a23; dMtrx4D[1][3] = a24;
|
||||
dMtrx4D[2][0] = a31; dMtrx4D[2][1] = a32; dMtrx4D[2][2] = a33; dMtrx4D[2][3] = a34;
|
||||
dMtrx4D[3][0] = a41; dMtrx4D[3][1] = a42; dMtrx4D[3][2] = a43; dMtrx4D[3][3] = a44;
|
||||
}
|
||||
|
||||
|
||||
Matrix4D::Matrix4D (const Matrix4D& rclMtrx)
|
||||
Matrix4D::Matrix4D (const Matrix4D& rclMtrx) : Matrix4D()
|
||||
{
|
||||
(*this) = rclMtrx;
|
||||
}
|
||||
|
||||
Matrix4D::Matrix4D (const Vector3f& rclBase, const Vector3f& rclDir, float fAngle)
|
||||
: Matrix4D()
|
||||
{
|
||||
setToUnity();
|
||||
this->rotLine(rclBase,rclDir,fAngle);
|
||||
}
|
||||
|
||||
Matrix4D::Matrix4D (const Vector3d& rclBase, const Vector3d& rclDir, double fAngle)
|
||||
: Matrix4D()
|
||||
{
|
||||
setToUnity();
|
||||
this->rotLine(rclBase,rclDir,fAngle);
|
||||
}
|
||||
|
||||
|
||||
+138
-104
@@ -16,303 +16,337 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the Matrix export class</DeveloperDocu>
|
||||
<UserDocu>A 4x4 Matrix</UserDocu>
|
||||
<UserDocu>Base.Matrix class.\n
|
||||
A 4x4 Matrix.
|
||||
In particular, this matrix can represent an affine transformation, that is, given a
|
||||
3D vector `x`, apply the transformation y = M*x + b, where the matrix `M` is a linear
|
||||
map and the vector `b` is a translation.
|
||||
`y` can be obtained using a linear transformation represented by the 4x4 matrix `A`
|
||||
conformed by the augmented 3x4 matrix (M|b), augmented by row with (0,0,0,1), therefore:
|
||||
(y, 1) = A*(x, 1).\n
|
||||
The following constructors are supported:\n
|
||||
Matrix()
|
||||
Empty constructor.\n
|
||||
Matrix(matrix)
|
||||
Copy constructor.
|
||||
matrix : Base.Matrix.\n
|
||||
Matrix(*coef)
|
||||
Define from 16 coefficients of the 4x4 matrix.
|
||||
coef : sequence of float\n The sequence can have up to 16 elements which complete the matrix by rows.\n
|
||||
Matrix(vector1, vector2, vector3, vector4)
|
||||
Define from four 3D vectors which represent the columns of the 3x4 submatrix, useful
|
||||
to represent an affine transformation. The fourth row is made up by (0,0,0,1).
|
||||
vector1 : Base.Vector
|
||||
vector2 : Base.Vector
|
||||
vector3 : Base.Vector
|
||||
vector4 : Base.Vector\n Default to (0,0,0). Optional.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="move">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
move(Vector)
|
||||
Move the matrix along the vector
|
||||
</UserDocu>
|
||||
<UserDocu>move(vector) -> None
|
||||
move(x, y, z) -> None\n
|
||||
Move the matrix along a vector, equivalent to left multiply the matrix
|
||||
by a pure translation transformation.\n
|
||||
vector : Base.Vector, tuple
|
||||
x : float\n `x` translation.
|
||||
y : float\n `y` translation.
|
||||
z : float\n `z` translation.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="scale">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
scale(Vector)
|
||||
Scale the matrix with the vector
|
||||
</UserDocu>
|
||||
<UserDocu>scale(vector) -> None
|
||||
scale(x, y, z) -> None
|
||||
scale(factor) -> None\n
|
||||
Scale the first three rows of the matrix.\n
|
||||
vector : Base.Vector
|
||||
x : float\n First row factor scale.
|
||||
y : float\n Second row factor scale.
|
||||
z : float\n Third row factor scale.
|
||||
factor : float\n global factor scale.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="hasScale" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
hasScale(tol=0.0)
|
||||
<UserDocu>hasScale(tol=0) -> ScaleType\n
|
||||
Return an enum value of ScaleType. Possible values are:
|
||||
Uniform, NonUniformLeft, NonUniformRight, NoScaling or Other
|
||||
if it's not a scale matrix
|
||||
</UserDocu>
|
||||
if it's not a scale matrix.\n
|
||||
tol : float</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="nullify">
|
||||
<Documentation>
|
||||
<UserDocu>nullify() - make this the null matrix</UserDocu>
|
||||
<UserDocu>nullify() -> None\n
|
||||
Make this the null matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isNull" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>isNull() - check if this is the null matrix</UserDocu>
|
||||
<UserDocu>isNull() -> bool\n
|
||||
Check if this is the null matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="unity">
|
||||
<Documentation>
|
||||
<UserDocu>unity() - make this matrix to unity</UserDocu>
|
||||
<UserDocu>unity() -> None\n
|
||||
Make this matrix to unity (4D identity matrix).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isUnity" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>isUnity() - check if this is the unit matrix</UserDocu>
|
||||
<UserDocu>isUnity() -> bool\n
|
||||
Check if this is the unit matrix (4D identity matrix).</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transform">
|
||||
<Documentation>
|
||||
<UserDocu>transform(Vector,Matrix) - return the dot product of the two vectors</UserDocu>
|
||||
<UserDocu>transform(vector, matrix2) -> None\n
|
||||
Transform the matrix around a given point.
|
||||
Equivalent to left multiply the matrix by T*M*T_inv, where M is `matrix2`, T the
|
||||
translation generated by `vector` and T_inv the inverse translation.
|
||||
For example, if `matrix2` is a rotation, the result is the transformation generated
|
||||
by the current matrix followed by a rotation around the point represented by `vector`.\n
|
||||
vector : Base.Vector
|
||||
matrix2 : Base.Matrix</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="col" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
col(index)
|
||||
Return the vector of a column
|
||||
</UserDocu>
|
||||
<UserDocu>col(index) -> Base.Vector\n
|
||||
Return the vector of a column, that is, the vector generated by the three
|
||||
first elements of the specified column.
|
||||
index : int\n Required column index.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setCol">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setCol(index, Vector)
|
||||
Set the vector of a column
|
||||
</UserDocu>
|
||||
<UserDocu>setCol(index, vector) -> None\n
|
||||
Set the vector of a column, that is, the three first elements of the specified
|
||||
column by index.\n
|
||||
index : int\n Required column index.
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="row" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
row(index)
|
||||
Return the vector of a row
|
||||
</UserDocu>
|
||||
<UserDocu>row(index) -> Base.Vector\n
|
||||
Return the vector of a row, that is, the vector generated by the three
|
||||
first elements of the specified row.\n
|
||||
index : int\n Required row index.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setRow">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setRow(index, Vector)
|
||||
Set the vector of a row
|
||||
</UserDocu>
|
||||
<UserDocu>setRow(index, vector) -> None\n
|
||||
Set the vector of a row, that is, the three first elements of the specified
|
||||
row by index.\n
|
||||
index : int\n Required row index.
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="trace" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
trace()
|
||||
Return the trace of the 3x3 sub-matrix as vector
|
||||
</UserDocu>
|
||||
<UserDocu>trace() -> Base.Vector\n
|
||||
Return the diagonal of the 3x3 leading principal submatrix as vector.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setTrace">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setTrace(Vector)
|
||||
Set the trace of the 3x3 sub-matrix
|
||||
</UserDocu>
|
||||
<UserDocu>setTrace(vector) -> None\n
|
||||
Set the diagonal of the 3x3 leading principal submatrix.\n
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="rotateX">
|
||||
<Documentation>
|
||||
<UserDocu>rotateX(float) - rotate around X</UserDocu>
|
||||
<UserDocu>rotateX(angle) -> None\n
|
||||
Rotate around X axis.
|
||||
angle : float\n Angle in radians.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="rotateY">
|
||||
<Documentation>
|
||||
<UserDocu>rotateY(float) - rotate around Y</UserDocu>
|
||||
<UserDocu>rotateY(angle) -> None\n
|
||||
Rotate around Y axis.
|
||||
angle : float\n Angle in radians.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="rotateZ">
|
||||
<Documentation>
|
||||
<UserDocu>rotateZ(float) - rotate around Z</UserDocu>
|
||||
<UserDocu>rotateZ(angle) -> None\n
|
||||
Rotate around Z axis.
|
||||
angle : float\n Angle in radians.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="multiply">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
multiply(Matrix|Vector)
|
||||
Multiply a matrix or vector with this matrix
|
||||
</UserDocu>
|
||||
<UserDocu>multiply(matrix) -> Base.Matrix
|
||||
multiply(vector) -> Base.Vector\n
|
||||
Right multiply the matrix by the given object.
|
||||
If the argument is a vector, this is augmented to the 4D vector (`vector`, 1).\n
|
||||
matrix : Base.Matrix
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="multVec" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
multVec(Vector) -> Vector
|
||||
Compute the transformed vector using the matrix
|
||||
</UserDocu>
|
||||
<UserDocu>multVec(vector) -> Base.Vector\n
|
||||
Compute the transformed vector using the matrix.
|
||||
vector : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="invert">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
invert() -> None
|
||||
Compute the inverse matrix, if possible
|
||||
</UserDocu>
|
||||
<UserDocu>invert() -> None\n
|
||||
Compute the inverse matrix in-place, if possible.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="inverse">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
inverse() -> Matrix
|
||||
Compute the inverse matrix, if possible
|
||||
</UserDocu>
|
||||
<Documentation><UserDocu>inverse() -> Base.Matrix\n
|
||||
Compute the inverse matrix, if possible.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transpose">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
transpose() -> None
|
||||
Transpose the matrix.
|
||||
</UserDocu>
|
||||
<UserDocu>transpose() -> None\n
|
||||
Transpose the matrix in-place.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="transposed" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
transposed() -> Matrix
|
||||
Returns a transposed copy of this matrix.
|
||||
</UserDocu>
|
||||
<UserDocu>transposed() -> Base.Matrix\n
|
||||
Returns a transposed copy of this matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="determinant">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
determinant() -> Float
|
||||
Compute the determinant of the matrix
|
||||
</UserDocu>
|
||||
<UserDocu>determinant() -> float\n
|
||||
Compute the determinant of the matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isOrthogonal">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isOrthogonal([Float]) -> Float
|
||||
<UserDocu>isOrthogonal(tol=1e-6) -> float\n
|
||||
Checks if the matrix is orthogonal, i.e. M * M^T = k*I and returns
|
||||
the multiple of the identity matrix. If it's not orthogonal 0 is returned.
|
||||
As argument you can set a tolerance which by default is 1.0e-6.
|
||||
</UserDocu>
|
||||
the multiple of the identity matrix. If it's not orthogonal 0 is returned.\n
|
||||
tol : float\n Tolerance used to check orthogonality.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="submatrix">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
submatrix(int) -> Matrix
|
||||
Get the sub-matrix. The parameter must be in the range [1,4].
|
||||
</UserDocu>
|
||||
<UserDocu>submatrix(dim) -> Base.Matrix\n
|
||||
Get the leading principal submatrix of the given dimension.
|
||||
The (4 - `dim`) remaining dimensions are completed with the
|
||||
corresponding identity matrix.\n
|
||||
dim : int\n Dimension parameter must be in the range [1,4].</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="analyze">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
analyze() -> string
|
||||
Analyzes the type of transformation.
|
||||
</UserDocu>
|
||||
<UserDocu>analyze() -> str\n
|
||||
Analyzes the type of transformation.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="A11" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (1,1) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A11" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A12" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (1,2) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A12" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A13" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (1,3) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A13" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A14" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (1,4) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A14" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A21" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (2,1) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A21" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A22" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (2,2) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A22" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A23" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (2,3) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A23" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A24" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (2,4) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A24" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A31" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (3,1) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A31" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A32" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (3,2) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A32" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A33" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (3,3) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A33" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A34" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (3,4) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A34" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A41" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (4,1) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A41" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A42" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (4,2) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A42" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A43" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (4,3) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A43" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A44" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The (4,4) matrix element.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A44" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="A" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The matrix elements</UserDocu>
|
||||
<UserDocu>The matrix elements.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="A" Type="Sequence" />
|
||||
</Attribute>
|
||||
|
||||
+67
-64
@@ -120,7 +120,7 @@ int MatrixPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "matrix or up to 16 floats expected");
|
||||
PyErr_SetString(PyExc_TypeError, "Base.Matrix, four Base.Vector or up to 16 floats expected");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -291,10 +291,9 @@ PyObject* MatrixPy::move(PyObject * args)
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->move(vec);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::scale(PyObject * args)
|
||||
@@ -337,10 +336,9 @@ PyObject* MatrixPy::scale(PyObject * args)
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->scale(vec);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::hasScale(PyObject * args)
|
||||
@@ -358,6 +356,7 @@ PyObject* MatrixPy::nullify(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->nullify();
|
||||
Py_Return;
|
||||
@@ -369,6 +368,7 @@ PyObject* MatrixPy::isNull(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ok = getMatrixPtr()->isNull();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
@@ -380,18 +380,19 @@ PyObject* MatrixPy::unity(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->setToUnity();
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::isUnity(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ok = getMatrixPtr()->isUnity();
|
||||
return Py::new_reference_to(Py::Boolean(ok));
|
||||
@@ -421,86 +422,91 @@ PyObject* MatrixPy::transform(PyObject * args)
|
||||
PyObject* MatrixPy::col(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (PyArg_ParseTuple(args, "i", &index)) {
|
||||
index = index % 4;
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->getCol(index);
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return nullptr;
|
||||
|
||||
if (index < 0 || index > 3) {
|
||||
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "int expected");
|
||||
return nullptr;
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->getCol(index);
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::setCol(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
PyObject* o;
|
||||
if (PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o)) {
|
||||
index = index % 4;
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setCol(index, v);
|
||||
Py_Return;
|
||||
if (!PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o))
|
||||
return nullptr;
|
||||
|
||||
if (index < 0 || index > 3) {
|
||||
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "int and Vector expected");
|
||||
return nullptr;
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setCol(index, v);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::row(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
if (PyArg_ParseTuple(args, "i", &index)) {
|
||||
index = index % 4;
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->getRow(index);
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
if (!PyArg_ParseTuple(args, "i", &index))
|
||||
return nullptr;
|
||||
|
||||
if (index < 0 || index > 3) {
|
||||
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "int expected");
|
||||
return nullptr;
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->getRow(index);
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::setRow(PyObject * args)
|
||||
{
|
||||
int index;
|
||||
PyObject* o;
|
||||
if (PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o)) {
|
||||
index = index % 4;
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setRow(index, v);
|
||||
Py_Return;
|
||||
if (!PyArg_ParseTuple(args, "iO!", &index, &(VectorPy::Type), &o))
|
||||
return nullptr;
|
||||
|
||||
if (index < 0 || index > 3) {
|
||||
PyErr_SetString(PyExc_ValueError, "Index expected in the range [0, 3]");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "int and Vector expected");
|
||||
return nullptr;
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setRow(index, v);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::trace(PyObject * args)
|
||||
{
|
||||
if (PyArg_ParseTuple(args, "")) {
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->trace();
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
}
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
return nullptr;
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
Base::Vector3d v = mat->trace();
|
||||
return Py::new_reference_to(Py::Vector(v));
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::setTrace(PyObject * args)
|
||||
{
|
||||
PyObject* o;
|
||||
if (PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &o)) {
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setTrace(v);
|
||||
Py_Return;
|
||||
}
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &o))
|
||||
return nullptr;
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Vector expected");
|
||||
return nullptr;
|
||||
Base::Vector3d v = Py::Vector(o, false).toVector();
|
||||
Matrix4D* mat = getMatrixPtr();
|
||||
mat->setTrace(v);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::rotateX(PyObject * args)
|
||||
@@ -528,10 +534,9 @@ PyObject* MatrixPy::rotateX(PyObject * args)
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->rotX(angle);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::rotateY(PyObject * args)
|
||||
@@ -559,10 +564,9 @@ PyObject* MatrixPy::rotateY(PyObject * args)
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->rotY(angle);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::rotateZ(PyObject * args)
|
||||
@@ -590,10 +594,9 @@ PyObject* MatrixPy::rotateZ(PyObject * args)
|
||||
|
||||
PY_TRY {
|
||||
getMatrixPtr()->rotZ(angle);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::multiply(PyObject * args)
|
||||
@@ -619,6 +622,7 @@ PyObject* MatrixPy::multVec(PyObject * args)
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &obj))
|
||||
return nullptr;
|
||||
|
||||
Base::Vector3d vec(static_cast<VectorPy*>(obj)->value());
|
||||
getMatrixPtr()->multVec(vec, vec);
|
||||
return new VectorPy(new Vector3d(vec));
|
||||
@@ -630,16 +634,16 @@ PyObject* MatrixPy::invert(PyObject * args)
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON)
|
||||
if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON) {
|
||||
getMatrixPtr()->inverseGauss();
|
||||
Py_Return;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot invert singular matrix");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::inverse(PyObject * args)
|
||||
@@ -659,14 +663,13 @@ PyObject* MatrixPy::inverse(PyObject * args)
|
||||
}
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::determinant(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return nullptr;
|
||||
|
||||
return PyFloat_FromDouble(getMatrixPtr()->determinant());
|
||||
}
|
||||
|
||||
@@ -675,6 +678,7 @@ PyObject* MatrixPy::submatrix(PyObject * args)
|
||||
int dim;
|
||||
if (!PyArg_ParseTuple(args, "i", &dim))
|
||||
return nullptr;
|
||||
|
||||
if (dim < 1 || dim > 4) {
|
||||
PyErr_SetString(PyExc_IndexError, "Dimension out of range");
|
||||
return nullptr;
|
||||
@@ -709,6 +713,7 @@ PyObject* MatrixPy::isOrthogonal(PyObject * args)
|
||||
double eps=1.0e-06;
|
||||
if (!PyArg_ParseTuple(args, "|d",&eps))
|
||||
return nullptr;
|
||||
|
||||
const Base::Matrix4D& mat = *getMatrixPtr();
|
||||
Base::Matrix4D trp = mat;
|
||||
trp.transpose();
|
||||
@@ -747,8 +752,6 @@ PyObject* MatrixPy::transposed(PyObject * args)
|
||||
return new MatrixPy(m);
|
||||
}
|
||||
PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject* MatrixPy::transpose(PyObject * args)
|
||||
|
||||
@@ -174,7 +174,7 @@ MemDebug::~MemDebug()
|
||||
*/
|
||||
int MemDebug::sReportHook(int nRptType,char *szMsg,int *retVal)
|
||||
{
|
||||
char *RptTypes[] = { "Warning", "Error", "Assert" };
|
||||
const char *RptTypes[] = { "Warning", "Error", "Assert" };
|
||||
|
||||
if ( ( nRptType > 0 ) || ( strstr( szMsg, "HEAP CORRUPTION DETECTED" ) ) )
|
||||
fprintf( logFile, "%s: %s", RptTypes[nRptType], szMsg );
|
||||
@@ -199,8 +199,8 @@ int __cdecl MemDebug::sAllocHook(
|
||||
int nLine
|
||||
)
|
||||
{
|
||||
char *operation[] = { " :", "Alloc :", "Realloc:", "Free :" };
|
||||
char *blockType[] = { "Free", "Normal", "CRT", "Ignore", "Client" };
|
||||
const char *operation[] = { " :", "Alloc :", "Realloc:", "Free :" };
|
||||
const char *blockType[] = { "Free", "Normal", "CRT", "Ignore", "Client" };
|
||||
|
||||
if ( nBlockUse == _CRT_BLOCK ) // Ignore internal C runtime library allocations
|
||||
return( 7 ); // (True = 7, False = 0)
|
||||
|
||||
@@ -85,7 +85,7 @@ class ParameterManager;
|
||||
* and exporting groups of parameters and enables streaming
|
||||
* to a persistent medium via XML.
|
||||
* \par
|
||||
* Its main task is making user parameter persitent, saving
|
||||
* Its main task is making user parameter persistent, saving
|
||||
* last used values in dialog boxes, setting and retrieving all
|
||||
* kind of preferences and so on.
|
||||
* @see ParameterManager
|
||||
|
||||
+12
-12
@@ -12,35 +12,35 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the Persistence class</DeveloperDocu>
|
||||
<UserDocu>This is a persistence class</UserDocu>
|
||||
<UserDocu>Base.Persistence class.\n
|
||||
Class to dump and restore the content of an object.</UserDocu>
|
||||
</Documentation>
|
||||
<Attribute Name="Content" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Content of the object in XML representation</UserDocu>
|
||||
<UserDocu>Content of the object in XML representation.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Content" Type="String" />
|
||||
</Attribute>
|
||||
<Attribute Name="MemSize" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Memory size of the object in byte</UserDocu>
|
||||
<UserDocu>Memory size of the object in bytes.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MemSize" Type="Int"/>
|
||||
</Attribute>
|
||||
<Methode Name="dumpContent" Keyword="true" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Dumps the content of the object, both the XML representation as well as the additional datafiles
|
||||
required, into a byte representation. It will be returned as byte array.
|
||||
dumpContent() -- returns a byte array with full content
|
||||
dumpContent(Compression=1-9) -- Sets the data compression from 0 (no) to 9 (max)
|
||||
</UserDocu>
|
||||
<UserDocu>dumpContent(Compression=3) -> bytearray\n
|
||||
Dumps the content of the object, both the XML representation and the additional
|
||||
data files required, into a byte representation.\n
|
||||
Compression : int\n Set the data compression level in the range [0,9]. Set to 0 for no compression.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="restoreContent">
|
||||
<Documentation>
|
||||
<UserDocu>Restore the content of the object from a byte representation as stored by \"dumpContent\".
|
||||
It could be restored from any python object implementing the buffer protocol.
|
||||
restoreContent(buffer) -- restores from the given byte array
|
||||
</UserDocu>
|
||||
<UserDocu>restoreContent(obj) -> None\n
|
||||
Restore the content of the object from a byte representation as stored by `dumpContent`.
|
||||
It could be restored from any Python object implementing the buffer protocol.\n
|
||||
obj : buffer\n Object with buffer protocol support.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
</PythonExport>
|
||||
|
||||
@@ -66,7 +66,7 @@ Placement Placement::fromDualQuaternion(DualQuat qq)
|
||||
return Placement(Vector3d(mvq.x.re,mvq.y.re, mvq.z.re), rot);
|
||||
}
|
||||
|
||||
Base::Matrix4D Placement::toMatrix(void) const
|
||||
Base::Matrix4D Placement::toMatrix() const
|
||||
{
|
||||
Base::Matrix4D matrix;
|
||||
_rot.getValue(matrix);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
FatherNamespace="Base">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<UserDocu>Base.Placement class\n
|
||||
<UserDocu>Base.Placement class.\n
|
||||
A Placement defines an orientation (rotation) and a position (base) in 3D space.
|
||||
It is used when no scaling or other distortion is needed.\n
|
||||
The following constructors are supported:\n
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <stack>
|
||||
|
||||
+99
-81
@@ -16,157 +16,175 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the Rotation export class</DeveloperDocu>
|
||||
<UserDocu>
|
||||
A Rotation using a quaternion.
|
||||
The Rotation object can be created by:
|
||||
-- an empty parameter list
|
||||
-- a Rotation object
|
||||
-- a Vector (axis) and a float (angle)
|
||||
-- two Vectors (rotation from/to vector)
|
||||
-- three floats (Euler angles) as yaw-pitch-roll in XY'Z'' convention
|
||||
-- one string and three floats (Euler angles) as euler rotation
|
||||
of a given type. Call toEulerSequence() for supported sequence types.
|
||||
-- four floats (Quaternion) where the quaternion is specified as:
|
||||
q=xi+yj+zk+w, i.e. the last parameter is the real part
|
||||
-- three vectors that define rotated axes directions + an optional
|
||||
3-characher string of capital letters 'X', 'Y', 'Z' that sets the
|
||||
order of importance of the axes (e.g., 'ZXY' means z direction is
|
||||
followed strictly, x is used but corrected if necessary, y is ignored).
|
||||
</UserDocu>
|
||||
<UserDocu>Base.Rotation class.\n
|
||||
A Rotation using a quaternion.\n
|
||||
The following constructors are supported:\n
|
||||
Rotation()
|
||||
Empty constructor.\n
|
||||
Rotation(rotation)
|
||||
Copy constructor.\n
|
||||
Rotation(Axis, Radian)
|
||||
Rotation(Axis, Degree)
|
||||
Define from an axis and an angle (in radians or degrees according to the keyword).
|
||||
Axis : Base.Vector
|
||||
Radian : float
|
||||
Degree : float\n
|
||||
Rotation(vector_start, vector_end)
|
||||
Define from two vectors (rotation from/to vector).
|
||||
vector_start : Base.Vector
|
||||
vector_end : Base.Vector\n
|
||||
Rotation(angle1, angle2, angle3)
|
||||
Define from three floats (Euler angles) as yaw-pitch-roll in XY'Z'' convention.
|
||||
angle1 : float
|
||||
angle2 : float
|
||||
angle3 : float\n
|
||||
Rotation(seq, angle1, angle2, angle3)
|
||||
Define from one string and three floats (Euler angles) as Euler rotation
|
||||
of a given type. Call toEulerSequence() for supported sequence types.
|
||||
seq : str
|
||||
angle1 : float
|
||||
angle2 : float
|
||||
angle3 : float\n
|
||||
Rotation(x, y, z, w)
|
||||
Define from four floats (quaternion) where the quaternion is specified as:
|
||||
q = xi+yj+zk+w, i.e. the last parameter is the real part.
|
||||
x : float
|
||||
y : float
|
||||
z : float
|
||||
w : float\n
|
||||
Rotation(dir1, dir2, dir3, seq)
|
||||
Define from three vectors that define rotated axes directions plus an optional
|
||||
3-characher string of capital letters 'X', 'Y', 'Z' that sets the order of
|
||||
importance of the axes (e.g., 'ZXY' means z direction is followed strictly,
|
||||
x is used but corrected if necessary, y is ignored).
|
||||
dir1 : Base.Vector
|
||||
dir2 : Base.Vector
|
||||
dir3 : Base.Vector
|
||||
seq : str\n
|
||||
Rotation(matrix)
|
||||
Define from a matrix rotation in the 4D representation.
|
||||
matrix : Base.Matrix\n
|
||||
Rotation(*coef)
|
||||
Define from 16 or 9 elements which represent the rotation in the 4D matrix
|
||||
representation or in the 3D matrix representation, respectively.
|
||||
coef : sequence of float</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="invert">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
invert() -> None
|
||||
Sets the rotation to its inverse
|
||||
</UserDocu>
|
||||
<UserDocu>invert() -> None\n
|
||||
Sets the rotation to its inverse.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="inverted">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
inverted() -> Rotation
|
||||
Returns the inverse of the rotation
|
||||
</UserDocu>
|
||||
<UserDocu>inverted() -> Base.Rotation\n
|
||||
Returns the inverse of the rotation.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isSame">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isSame(Rotation, [tolerance=0])
|
||||
Checks if the two quaternions perform the same rotation.
|
||||
Optionally, a tolerance value greater than zero can be passed.
|
||||
</UserDocu>
|
||||
<UserDocu>isSame(rotation, tol=0) -> bool\n
|
||||
Checks if `rotation` perform the same transformation as this rotation.\n
|
||||
rotation : Base.Rotation
|
||||
tol : float\n Tolerance used to compare both rotations.
|
||||
If tol is negative or zero, no tolerance is used.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="multiply" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
multiply(Rotation)
|
||||
Multiply this quaternion with another quaternion
|
||||
</UserDocu>
|
||||
<UserDocu>multiply(rotation) -> Base.Rotation\n
|
||||
Right multiply this rotation with another rotation.\n
|
||||
rotation : Base.Rotation\n Rotation by which to multiply this rotation.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="multVec" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
multVec(Vector) -> Vector
|
||||
Compute the transformed vector using the rotation
|
||||
</UserDocu>
|
||||
<UserDocu>multVec(vector) -> Base.Vector\n
|
||||
Compute the transformed vector using the rotation.\n
|
||||
vector : Base.Vector\n Vector to be transformed.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="slerp" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
slerp(Rotation, Float) -> Rotation
|
||||
Spherical linear interpolation of this and a given rotation. The float must be in the range of 0 and 1
|
||||
</UserDocu>
|
||||
<UserDocu>slerp(rotation2, t) -> Base.Rotation\n
|
||||
Spherical Linear Interpolation (SLERP) of this rotation and `rotation2`.\n
|
||||
t : float\n Parameter of the path. t=0 returns this rotation, t=1 returns `rotation2`.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setYawPitchRoll">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setYawPitchRoll(angle1, angle2, angle3)
|
||||
Set the Euler angles of this rotation
|
||||
as yaw-pitch-roll in XY'Z'' convention.
|
||||
|
||||
NOTE: The angles are in degree
|
||||
</UserDocu>
|
||||
<UserDocu>setYawPitchRoll(angle1, angle2, angle3) -> None\n
|
||||
Set the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.\n
|
||||
angle1 : float\n Angle around yaw axis in degrees.
|
||||
angle2 : float\n Angle around pitch axis in degrees.
|
||||
angle3 : float\n Angle around roll axis in degrees.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getYawPitchRoll" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
getYawPitchRoll() -> list
|
||||
Get the Euler angles of this rotation
|
||||
as yaw-pitch-roll in XY'Z'' convention
|
||||
NOTE: The angles are in degree
|
||||
</UserDocu>
|
||||
<UserDocu>getYawPitchRoll() -> tuple\n
|
||||
Get the Euler angles of this rotation as yaw-pitch-roll in XY'Z'' convention.
|
||||
The angles are given in degrees.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setEulerAngles">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
setEulerAngles(seq, angle1, angle2, angle3)
|
||||
Set the Euler angles in a given sequence for this rotation.
|
||||
'seq' is the Euler sequence name. You get all possible values with toEulerAngles()
|
||||
</UserDocu>
|
||||
<UserDocu>setEulerAngles(seq, angle1, angle2, angle3) -> None\n
|
||||
Set the Euler angles in a given sequence for this rotation.
|
||||
The angles must be given in degrees.\n
|
||||
seq : str\n Euler sequence name. All possible values given by toEulerAngles().
|
||||
angle1 : float
|
||||
angle2 : float
|
||||
angle3 : float </UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toEulerAngles" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
toEulerAngles(seq='') -> list
|
||||
Get the Euler angles in a given sequence for this rotation.
|
||||
Call this function without arguments to output all possible values of 'seq'.
|
||||
</UserDocu>
|
||||
<UserDocu>toEulerAngles(seq) -> list\n
|
||||
Get the Euler angles in a given sequence for this rotation.\n
|
||||
seq : str\n Euler sequence name. If not given, the function returns
|
||||
all possible values of `seq`. Optional.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toMatrix" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
toMatrix()
|
||||
convert the rotation to a matrix representation
|
||||
</UserDocu>
|
||||
<UserDocu>toMatrix() -> Base.Matrix\n
|
||||
Convert the rotation to a 4D matrix representation.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isNull" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isNull() -> Bool
|
||||
returns True if all Q values are zero
|
||||
</UserDocu>
|
||||
<UserDocu>isNull() -> bool\n
|
||||
Returns True if all values in the quaternion representation are zero.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isIdentity" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
isIdentity() -> Bool
|
||||
returns True if the rotation equals the unity matrix
|
||||
</UserDocu>
|
||||
<UserDocu>isIdentity() -> bool\n
|
||||
Returns True if the rotation equals the 4D identity matrix.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Q" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The rotation elements (as quaternion)</UserDocu>
|
||||
<UserDocu>The rotation elements (as quaternion).</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Q" Type="Tuple" />
|
||||
</Attribute>
|
||||
<Attribute Name="Axis" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The rotation axis of the quaternion</UserDocu>
|
||||
<UserDocu>The rotation axis of the quaternion.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Axis" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="RawAxis" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The rotation axis without normalization</UserDocu>
|
||||
<UserDocu>The rotation axis without normalization.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="RawAxis" Type="Object" />
|
||||
</Attribute>
|
||||
<Attribute Name="Angle" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>The rotation angle of the quaternion</UserDocu>
|
||||
<UserDocu>The rotation angle of the quaternion.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Angle" Type="Float" />
|
||||
</Attribute>
|
||||
|
||||
+1
-1
@@ -426,7 +426,7 @@ IODeviceOStreambuf::seekpos(std::streambuf::pos_type pos,
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
IODeviceIStreambuf::IODeviceIStreambuf(QIODevice* dev) : device(dev)
|
||||
IODeviceIStreambuf::IODeviceIStreambuf(QIODevice* dev) : device(dev), buffer{}
|
||||
{
|
||||
setg (buffer+pbSize, // beginning of putback area
|
||||
buffer+pbSize, // read position
|
||||
|
||||
+36
-15
@@ -17,78 +17,99 @@ namespace Base {
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the Type class</DeveloperDocu>
|
||||
<UserDocu>This is the Type class</UserDocu>
|
||||
<UserDocu>Base.BaseType class.\n
|
||||
This class is not intended to create instances of itself, but to get information
|
||||
from the different types and create instances of them.
|
||||
Regarding instantiation, this is possible in cases that inherit from the
|
||||
Base::BaseClass class and are not abstract classes.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="fromName" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns a type object by name</UserDocu>
|
||||
<UserDocu>fromName(name) -> Base.BaseType\n
|
||||
Returns a type object by name.\n
|
||||
name : str</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="fromKey" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns a type object by key</UserDocu>
|
||||
<UserDocu>fromKey(key) -> Base.BaseType\n
|
||||
Returns a type id object by key.\n
|
||||
key : int</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getNumTypes" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the number of type ids</UserDocu>
|
||||
<UserDocu>getNumTypes() -> int\n
|
||||
Returns the number of type ids created so far.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getBadType" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns an invalid type id</UserDocu>
|
||||
<UserDocu>getBadType() -> Base.BaseType\n
|
||||
Returns an invalid type id.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getAllDerivedFrom" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns all descendants</UserDocu>
|
||||
<UserDocu>getAllDerivedFrom(type) -> list\n
|
||||
Returns all descendants from the given type id.\n
|
||||
type : str, Base.BaseType</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getParent" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the parent type id</UserDocu>
|
||||
<UserDocu>getParent() -> Base.BaseType\n
|
||||
Returns the parent type id.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isBad" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Checks if the type id is invalid</UserDocu>
|
||||
<UserDocu>isBad() -> bool\n
|
||||
Checks if the type id is invalid.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isDerivedFrom" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns true if given type is a father</UserDocu>
|
||||
<UserDocu>isDerivedFrom(type) -> bool\n
|
||||
Returns true if given type id is a father of this type id.\n
|
||||
type : str, Base.BaseType</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getAllDerived" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns all descendants</UserDocu>
|
||||
<UserDocu>getAllDerived() -> list\n
|
||||
Returns all descendants from this type id.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="createInstance">
|
||||
<Documentation>
|
||||
<UserDocu>Creates an instance of this type</UserDocu>
|
||||
<UserDocu>createInstance() -> object\n
|
||||
Creates an instance of this type id.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="createInstanceByName" Static="true">
|
||||
<Documentation>
|
||||
<UserDocu>Creates an instance of the named type</UserDocu>
|
||||
<UserDocu>createInstanceByName(name, load=False) -> object\n
|
||||
Creates an instance of the named type id.\n
|
||||
name : str
|
||||
load : bool\n Load named type id module.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Name" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The name of the type id</UserDocu>
|
||||
<UserDocu>The name of the type id.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Name" Type="String" />
|
||||
</Attribute>
|
||||
<Attribute Name="Key" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>The key of the type id</UserDocu>
|
||||
<UserDocu>The key of the type id.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Key" Type="Long" />
|
||||
</Attribute>
|
||||
<Attribute Name="Module" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Module in which this class is defined</UserDocu>
|
||||
<UserDocu>Module in which this class is defined.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Module" Type="String"/>
|
||||
</Attribute>
|
||||
|
||||
@@ -39,14 +39,6 @@ Vector3<_Precision>::Vector3 (_Precision fx, _Precision fy, _Precision fz)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Vector3<_Precision>::Vector3 (const Vector3<_Precision>& rcVct)
|
||||
: x(rcVct.x),
|
||||
y(rcVct.y),
|
||||
z(rcVct.z)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
_Precision& Vector3<_Precision>::operator [] (unsigned short usIndex)
|
||||
{
|
||||
@@ -155,15 +147,6 @@ Vector3<_Precision> Vector3<_Precision>::operator / (_Precision fDiv) const
|
||||
return Vector3<_Precision>(this->x/fDiv,this->y/fDiv,this->z/fDiv);
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
Vector3<_Precision>& Vector3<_Precision>::operator = (const Vector3<_Precision>& rcVct)
|
||||
{
|
||||
x = rcVct.x;
|
||||
y = rcVct.y;
|
||||
z = rcVct.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
_Precision Vector3<_Precision>::operator * (const Vector3<_Precision>& rcVct) const
|
||||
{
|
||||
|
||||
+5
-3
@@ -91,8 +91,9 @@ public:
|
||||
|
||||
/// Construction
|
||||
explicit Vector3 (_Precision fx = 0.0, _Precision fy = 0.0, _Precision fz = 0.0);
|
||||
/// Construction
|
||||
Vector3 (const Vector3<_Precision>& rcVct);
|
||||
Vector3 (const Vector3<_Precision>& v) = default;
|
||||
Vector3 (Vector3<_Precision>&& v) = default;
|
||||
~Vector3 () = default;
|
||||
|
||||
/** @name Operator */
|
||||
//@{
|
||||
@@ -117,7 +118,8 @@ public:
|
||||
Vector3 & operator *= (_Precision fScale);
|
||||
Vector3 & operator /= (_Precision fDiv);
|
||||
/// Assignment
|
||||
Vector3 & operator = (const Vector3<_Precision>& rcVct);
|
||||
Vector3 & operator = (const Vector3<_Precision>& v) = default;
|
||||
Vector3 & operator = (Vector3<_Precision>&& v) = default;
|
||||
/// Scalar product
|
||||
_Precision operator * (const Vector3<_Precision>& rcVct) const;
|
||||
/// Scalar product
|
||||
|
||||
+91
-75
@@ -16,171 +16,187 @@
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Juergen Riegel" EMail="FreeCAD@juergen-riegel.net" />
|
||||
<DeveloperDocu>This is the Vector export class</DeveloperDocu>
|
||||
<UserDocu>This class represents a 3D float vector</UserDocu>
|
||||
<UserDocu>Base.Vector class.\n
|
||||
This class represents a 3D float vector.
|
||||
Useful to represent points in the 3D space.\n
|
||||
The following constructors are supported:\n
|
||||
Vector(x=0, y=0, z=0)
|
||||
x : float
|
||||
y : float
|
||||
z : float\n
|
||||
Vector(vector)
|
||||
Copy constructor.
|
||||
vector : Base.Vector\n
|
||||
Vector(seq)
|
||||
Define from a sequence of float.
|
||||
seq : sequence of float.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="__reduce__" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>__reduce__()
|
||||
Serialization of Vector objects
|
||||
</UserDocu>
|
||||
<UserDocu>__reduce__() -> tuple\n
|
||||
Serialization of Vector objects.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="add" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>add(Vector)
|
||||
returns the sum of this and another vector
|
||||
</UserDocu>
|
||||
<UserDocu>add(vector2) -> Base.Vector\n
|
||||
Returns the sum of this vector and `vector2`.\n
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="sub" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>sub(Vector)
|
||||
returns the difference of this and another vector
|
||||
</UserDocu>
|
||||
<UserDocu>sub(vector2) -> Base.Vector\n
|
||||
Returns the difference of this vector and `vector2`.\n
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="negative" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>negative()
|
||||
returns the negative (opposite) of this vector
|
||||
</UserDocu>
|
||||
<UserDocu>negative() -> Base.Vector\n
|
||||
Returns the negative (opposite) of this vector.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="scale">
|
||||
<Documentation>
|
||||
<UserDocu>scale(Float,Float,Float)
|
||||
scales (multiplies) this vector by a factor
|
||||
</UserDocu>
|
||||
<UserDocu>scale(x, y, z) -> Base.Vector\n
|
||||
Scales in-place this vector by the given factor in each component.\n
|
||||
x : float\n x-component factor scale.
|
||||
y : float\n y-component factor scale.
|
||||
z : float\n z-component factor scale.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="multiply">
|
||||
<Documentation>
|
||||
<UserDocu>multiply(Float)
|
||||
multiplies (scales) this vector by a single factor
|
||||
</UserDocu>
|
||||
<UserDocu>multiply(factor) -> Base.Vector\n
|
||||
Multiplies in-place each component of this vector by a single factor.
|
||||
Equivalent to scale(factor, factor, factor).\n
|
||||
factor : float</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="dot" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>dot(Vector)
|
||||
returns the dot product of the this vector with another one
|
||||
</UserDocu>
|
||||
<UserDocu>dot(vector2) -> float\n
|
||||
Returns the scalar product (dot product) between this vector and `vector2`.\n
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="cross" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>cross(Vector)
|
||||
returns the cross product between this and another vector
|
||||
</UserDocu>
|
||||
<UserDocu>cross(vector2) -> Base.Vector\n
|
||||
Returns the vector product (cross product) between this vector and `vector2`.\n
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isOnLineSegment" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>isOnLineSegment(Vector, Vector)
|
||||
checks if Vector is on a line segment
|
||||
</UserDocu>
|
||||
<UserDocu>isOnLineSegment(vector1, vector2) -> bool\n
|
||||
Checks if this vector is on the line segment generated by `vector1` and `vector2`.\n
|
||||
vector1 : Base.Vector
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getAngle" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getAngle(Vector)
|
||||
returns the angle in radians between this and another vector
|
||||
</UserDocu>
|
||||
<UserDocu>getAngle(vector2) -> float\n
|
||||
Returns the angle in radians between this vector and `vector2`.\n
|
||||
vector2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="normalize">
|
||||
<Documentation>
|
||||
<UserDocu>normalize()
|
||||
normalizes the vector to the length of 1.0
|
||||
</UserDocu>
|
||||
<UserDocu>normalize() -> Base.Vector\n
|
||||
Normalizes in-place this vector to the length of 1.0.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="isEqual">
|
||||
<Documentation>
|
||||
<UserDocu>isEqual(Vector, tolerance) -> Boolean
|
||||
If the distance to the given point is less or equal to the tolerance
|
||||
bith points are considered equal.
|
||||
</UserDocu>
|
||||
<UserDocu>isEqual(vector2, tol=0) -> bool\n
|
||||
Checks if the distance between the points represented by this vector
|
||||
and `vector2` is less or equal to the given tolerance.\n
|
||||
vector2 : Base.Vector
|
||||
tol : float</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="projectToLine">
|
||||
<Documentation>
|
||||
<UserDocu>projectToLine(Vector pnt,Vector vec)
|
||||
Projects the point 'pnt' on a line that goes through the origin with the direction vector 'vec'.
|
||||
The result is the vector from point 'pnt' to the projected point.
|
||||
NOTE: The result does not depend on the vector instance 'self'.
|
||||
NOTE: This method modifies the vector instance 'self'.
|
||||
</UserDocu>
|
||||
<UserDocu>projectToLine(point, dir) -> Base.Vector\n
|
||||
Projects `point` on a line that goes through the origin with the direction `dir`.
|
||||
The result is the vector from `point` to the projected point.
|
||||
The operation is equivalent to dir_n.cross(dir_n.cross(point)), where `dir_n` is
|
||||
the vector `dir` normalized.
|
||||
The method modifies this vector instance according to result and does not
|
||||
depend on the vector itself.\n
|
||||
point : Base.Vector
|
||||
dir : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="projectToPlane">
|
||||
<Documentation>
|
||||
<UserDocu>projectToPlane(Vector,Vector)
|
||||
projects the vector on a plane defined by a base point and a normal
|
||||
</UserDocu>
|
||||
<UserDocu>projectToPlane(base, normal) -> Base.Vector\n
|
||||
Projects in-place this vector on a plane defined by a base point
|
||||
represented by `base` and a normal defined by `normal`.\n
|
||||
base : Base.Vector
|
||||
normal : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="distanceToPoint" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
distanceToPoint(Vector)
|
||||
returns the distance to another point
|
||||
</UserDocu>
|
||||
<UserDocu>distanceToPoint(point2) -> float\n
|
||||
Returns the distance to another point represented by `point2`.\n.
|
||||
point : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="distanceToLine" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>distanceToLine(Vector,Vector)
|
||||
returns the distance between this vector and a line defined by
|
||||
a base point and a direction
|
||||
</UserDocu>
|
||||
<UserDocu>distanceToLine(base, dir) -> float\n
|
||||
Returns the distance between the point represented by this vector
|
||||
and a line defined by a base point represented by `base` and a
|
||||
direction `dir`.\n
|
||||
base : Base.Vector
|
||||
dir : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="distanceToLineSegment" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>distanceToLineSegment(Vector,Vector)
|
||||
returns the distance between this vector and a line segment defined by
|
||||
a base point and a direction
|
||||
</UserDocu>
|
||||
<UserDocu>distanceToLineSegment(point1, point2) -> Base.Vector\n
|
||||
Returns the vector between the point represented by this vector and the point
|
||||
on the line segment with the shortest distance. The line segment is defined by
|
||||
`point1` and `point2`.\n
|
||||
point1 : Base.Vector
|
||||
point2 : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="distanceToPlane" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>distanceToPlane(Vector,Vector)
|
||||
returns the distance between this vector and a plane defined by
|
||||
a base point and a normal
|
||||
</UserDocu>
|
||||
<UserDocu>distanceToPlane(base, normal) -> float\n
|
||||
Returns the distance between this vector and a plane defined by a
|
||||
base point represented by `base` and a normal defined by `normal`.\n
|
||||
base : Base.Vector
|
||||
normal : Base.Vector</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="Length" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>Length([Float]) -> Float
|
||||
gets or sets the length of this vector
|
||||
</UserDocu>
|
||||
<UserDocu>Gets or sets the length of this vector.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Type" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="x" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>x([Float]) -> Float
|
||||
gets or sets the X component of this vector
|
||||
</UserDocu>
|
||||
<UserDocu>Gets or sets the X component of this vector.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="x" Type="Float"/>
|
||||
</Attribute>
|
||||
<Attribute Name="y" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>y([Float]) -> Float
|
||||
gets or sets the Y component of this vector
|
||||
</UserDocu>
|
||||
<UserDocu>Gets or sets the Y component of this vector.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="y" Type="Float"/>
|
||||
</Attribute>
|
||||
<Attribute Name="z" ReadOnly="false">
|
||||
<Documentation>
|
||||
<UserDocu>z([Float]) -> Float
|
||||
gets or sets the Z component of this vector
|
||||
</UserDocu>
|
||||
<UserDocu>Gets or sets the Z component of this vector.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="z" Type="Float"/>
|
||||
</Attribute>
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
// inclusion of the generated files (generated out of VectorPy.xml)
|
||||
#include "GeometryPyCXX.h"
|
||||
#include "VectorPy.h"
|
||||
#include "MatrixPy.h"
|
||||
#include "RotationPy.h"
|
||||
#include "VectorPy.cpp"
|
||||
|
||||
using namespace Base;
|
||||
@@ -156,7 +154,7 @@ PyObject* VectorPy::number_multiply_handler(PyObject *self, PyObject *other)
|
||||
return new VectorPy(a * b);
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_NotImplementedError, "Not implemented");
|
||||
PyErr_SetString(PyExc_TypeError, "A Vector can only be multiplied by Vector or number");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -927,7 +927,7 @@ void RecentMacrosAction::setFiles(const QStringList& files)
|
||||
auto check = Application::Instance->commandManager().checkAcceleratorForConflicts(qPrintable(accel_tmp));
|
||||
if (check) {
|
||||
recentFiles[index]->setShortcut(QKeySequence());
|
||||
auto msg = QStringLiteral("Recent macros : shortcut %1 disabled because conflicting with %2")
|
||||
auto msg = QStringLiteral("Recent macros : keyboard shortcut %1 disabled because conflicting with %2")
|
||||
.arg(accel_tmp).arg(QLatin1String(check->getName()));
|
||||
Base::Console().Warning("%s\n", qPrintable(msg));
|
||||
}
|
||||
@@ -936,7 +936,7 @@ void RecentMacrosAction::setFiles(const QStringList& files)
|
||||
recentFiles[index]->setShortcut(accel);
|
||||
}
|
||||
}
|
||||
recentFiles[index]->setStatusTip(tr("Run macro %1 (Shift+click to edit) shortcut: %2").arg(files[index]).arg(accel));
|
||||
recentFiles[index]->setStatusTip(tr("Run macro %1 (Shift+click to edit) keyboard shortcut: %2").arg(files[index]).arg(accel));
|
||||
recentFiles[index]->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
+19
-18
@@ -13,71 +13,72 @@
|
||||
Delete="true">
|
||||
<Documentation>
|
||||
<Author Licence="LGPL" Name="Zheng, Lei" EMail="realthunder.dev@gmail.com" />
|
||||
<UserDocu>Class for creating a Coin3D representation of a coordinate system</UserDocu>
|
||||
<UserDocu>Gui.AxisOrigin class.\n
|
||||
Class for creating a Coin3D representation of a coordinate system.</UserDocu>
|
||||
</Documentation>
|
||||
<Methode Name="getElementPicked" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>getElementPicked(pickPoint): return the picked subelement</UserDocu>
|
||||
<UserDocu>getElementPicked(pickedPoint) -> str\n
|
||||
Returns the picked element name.\n
|
||||
pickedPoint : coin.SoPickedPoint</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getDetailPath" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
getDetailPath(subname,path): return Coin detail and path of an subelement
|
||||
|
||||
subelement: dot separated string reference to the sub element
|
||||
pPath: output coin path leading to the returned element detail
|
||||
</UserDocu>
|
||||
<UserDocu>getDetailPath(subname, path) -> coin.SoDetail or None\n
|
||||
Returns Coin detail of a subelement.
|
||||
Note: Not fully implemented. Currently only returns None.\n
|
||||
subname : str\n String reference to the subelement.
|
||||
path: coin.SoPath\n Output Coin path leading to the returned element detail.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Attribute Name="AxisLength">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set the axis length</UserDocu>
|
||||
<UserDocu>Get/set the axis length.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="AxisLength" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="LineWidth">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set the axis line width for rendering</UserDocu>
|
||||
<UserDocu>Get/set the axis line width for rendering.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="LineWidth" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="PointSize">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set the origin point size for rendering</UserDocu>
|
||||
<UserDocu>Get/set the origin point size for rendering.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="PointSize" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="Scale">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set auto scaling factor, 0 to disable</UserDocu>
|
||||
<UserDocu>Get/set auto scaling factor, 0 to disable.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Scale" Type="Float" />
|
||||
</Attribute>
|
||||
<Attribute Name="Plane">
|
||||
<Documentation>
|
||||
<UserDocu>Get/set axis plane size and distance to axis line</UserDocu>
|
||||
<UserDocu>Get/set axis plane size and distance to axis line.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Plane" Type="Tuple" />
|
||||
</Attribute>
|
||||
<Attribute Name="Labels">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
Get/set axis component names as a dictionary. Available keys are,
|
||||
<UserDocu>Get/set axis component names as a dictionary.
|
||||
Available keys are:
|
||||
'O': origin
|
||||
'X': x axis
|
||||
'Y': y axis
|
||||
'Z': z axis
|
||||
'XY': xy plane
|
||||
'XZ': xz plane
|
||||
'YZ': yz plane
|
||||
</UserDocu>
|
||||
'YZ': yz plane</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Labels" Type="Dict" />
|
||||
</Attribute>
|
||||
<Attribute Name="Node" ReadOnly='true'>
|
||||
<Documentation>
|
||||
<UserDocu>Get the Coin3D node</UserDocu>
|
||||
<UserDocu>Get the Coin3D node.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Node" Type="Object" />
|
||||
</Attribute>
|
||||
|
||||
+54
-31
@@ -53,16 +53,21 @@ std::string AxisOriginPy::representation(void) const
|
||||
PyObject* AxisOriginPy::getElementPicked(PyObject* args)
|
||||
{
|
||||
PyObject *obj;
|
||||
if (!PyArg_ParseTuple(args, "O",&obj))
|
||||
if (!PyArg_ParseTuple(args, "O", &obj))
|
||||
return nullptr;
|
||||
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPickedPoint", obj, &ptr, 0);
|
||||
SoPickedPoint *pp = reinterpret_cast<SoPickedPoint*>(ptr);
|
||||
if(!pp)
|
||||
throw Base::TypeError("type must be of coin.SoPickedPoint");
|
||||
if (!ptr) {
|
||||
PyErr_SetString(PyExc_TypeError, "'pickedPoint' must be a coin.SoPickedPoint");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SoPickedPoint *pp = static_cast<SoPickedPoint*>(ptr);
|
||||
std::string name;
|
||||
if(!getAxisOriginPtr()->getElementPicked(pp,name))
|
||||
if (!getAxisOriginPtr()->getElementPicked(pp,name))
|
||||
Py_Return;
|
||||
|
||||
return Py::new_reference_to(Py::String(name));
|
||||
}
|
||||
|
||||
@@ -70,82 +75,100 @@ PyObject* AxisOriginPy::getDetailPath(PyObject* args)
|
||||
{
|
||||
const char *sub;
|
||||
PyObject *path;
|
||||
if (!PyArg_ParseTuple(args, "sO",&sub,&path))
|
||||
if (!PyArg_ParseTuple(args, "sO", &sub,&path))
|
||||
return nullptr;
|
||||
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "_p_SoPath", path, &ptr, 0);
|
||||
SoPath *pPath = reinterpret_cast<SoPath*>(ptr);
|
||||
if(!pPath)
|
||||
throw Base::TypeError("type must be of coin.SoPath");
|
||||
if (!ptr) {
|
||||
PyErr_SetString(PyExc_TypeError, "'path' must be a coin.SoPath");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SoPath *pPath = static_cast<SoPath*>(ptr);
|
||||
SoDetail *det = nullptr;
|
||||
if(!getAxisOriginPtr()->getDetailPath(
|
||||
sub,static_cast<SoFullPath*>(pPath),det))
|
||||
{
|
||||
if(det) delete det;
|
||||
if (!getAxisOriginPtr()->getDetailPath(sub, static_cast<SoFullPath*>(pPath), det)) {
|
||||
delete det;
|
||||
Py_Return;
|
||||
}
|
||||
if(!det)
|
||||
return Py::new_reference_to(Py::True());
|
||||
return Base::Interpreter().createSWIGPointerObj("pivy.coin", "_p_SoDetail", (void*)det, 0);
|
||||
if (!det)
|
||||
Py_Return;
|
||||
|
||||
return Base::Interpreter().createSWIGPointerObj("pivy.coin", "_p_SoDetail", static_cast<void*>(det), 0);
|
||||
}
|
||||
|
||||
Py::Float AxisOriginPy::getAxisLength() const {
|
||||
Py::Float AxisOriginPy::getAxisLength() const
|
||||
{
|
||||
return Py::Float(getAxisOriginPtr()->getAxisLength());
|
||||
}
|
||||
|
||||
void AxisOriginPy::setAxisLength(Py::Float size) {
|
||||
void AxisOriginPy::setAxisLength(Py::Float size)
|
||||
{
|
||||
getAxisOriginPtr()->setAxisLength(size);
|
||||
}
|
||||
|
||||
Py::Float AxisOriginPy::getLineWidth() const {
|
||||
Py::Float AxisOriginPy::getLineWidth() const
|
||||
{
|
||||
return Py::Float(getAxisOriginPtr()->getLineWidth());
|
||||
}
|
||||
|
||||
void AxisOriginPy::setLineWidth(Py::Float size) {
|
||||
void AxisOriginPy::setLineWidth(Py::Float size)
|
||||
{
|
||||
getAxisOriginPtr()->setLineWidth(size);
|
||||
}
|
||||
|
||||
Py::Float AxisOriginPy::getPointSize() const {
|
||||
Py::Float AxisOriginPy::getPointSize() const
|
||||
{
|
||||
return Py::Float(getAxisOriginPtr()->getPointSize());
|
||||
}
|
||||
|
||||
void AxisOriginPy::setPointSize(Py::Float size) {
|
||||
void AxisOriginPy::setPointSize(Py::Float size)
|
||||
{
|
||||
getAxisOriginPtr()->setPointSize(size);
|
||||
}
|
||||
|
||||
Py::Float AxisOriginPy::getScale() const {
|
||||
Py::Float AxisOriginPy::getScale() const
|
||||
{
|
||||
return Py::Float(getAxisOriginPtr()->getScale());
|
||||
}
|
||||
|
||||
void AxisOriginPy::setScale(Py::Float size) {
|
||||
void AxisOriginPy::setScale(Py::Float size)
|
||||
{
|
||||
getAxisOriginPtr()->setScale(size);
|
||||
}
|
||||
|
||||
Py::Tuple AxisOriginPy::getPlane() const {
|
||||
Py::Tuple AxisOriginPy::getPlane() const
|
||||
{
|
||||
auto info = getAxisOriginPtr()->getPlane();
|
||||
Py::Tuple ret(2);
|
||||
ret.setItem(0,Py::Float(info.first));
|
||||
ret.setItem(1,Py::Float(info.second));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AxisOriginPy::setPlane(Py::Tuple tuple) {
|
||||
void AxisOriginPy::setPlane(Py::Tuple tuple)
|
||||
{
|
||||
float s,d;
|
||||
if (!PyArg_ParseTuple(*tuple, "dd",&s,&d))
|
||||
if (!PyArg_ParseTuple(*tuple, "ff",&s,&d))
|
||||
throw Py::Exception();
|
||||
|
||||
getAxisOriginPtr()->setPlane(s,d);
|
||||
}
|
||||
|
||||
Py::Dict AxisOriginPy::getLabels() const {
|
||||
Py::Dict AxisOriginPy::getLabels() const
|
||||
{
|
||||
Py::Dict dict;
|
||||
for(auto &v : getAxisOriginPtr()->getLabels())
|
||||
for (auto &v : getAxisOriginPtr()->getLabels())
|
||||
dict.setItem(Py::String(v.first),Py::String(v.second));
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
void AxisOriginPy::setLabels(Py::Dict dict) {
|
||||
void AxisOriginPy::setLabels(Py::Dict dict)
|
||||
{
|
||||
std::map<std::string,std::string> labels;
|
||||
for(auto it=dict.begin();it!=dict.end();++it) {
|
||||
for (auto it=dict.begin(); it!=dict.end(); ++it) {
|
||||
const auto &value = *it;
|
||||
labels[value.first.as_string()] = Py::Object(value.second).as_string();
|
||||
}
|
||||
|
||||
+6
-6
@@ -1061,6 +1061,7 @@ void GroupCommand::activated(int iMsg)
|
||||
}
|
||||
|
||||
void GroupCommand::languageChange() {
|
||||
Command::languageChange();
|
||||
if (_pcAction)
|
||||
setup(_pcAction);
|
||||
}
|
||||
@@ -1069,18 +1070,17 @@ void GroupCommand::setup(Action *pcAction) {
|
||||
|
||||
pcAction->setText(QCoreApplication::translate(className(), getMenuText()));
|
||||
|
||||
// The tooltip for the group is the tooltip of the active tool (that is, the tool that will
|
||||
// be activated when the main portion of the button is clicked).
|
||||
int idx = pcAction->property("defaultAction").toInt();
|
||||
if(idx>=0 && idx<(int)cmds.size() && cmds[idx].first) {
|
||||
auto cmd = cmds[idx].first;
|
||||
pcAction->setIcon(BitmapFactory().iconFromTheme(cmd->getPixmap()));
|
||||
pcAction->setChecked(cmd->getAction()->isChecked(),true);
|
||||
const char *context = dynamic_cast<PythonCommand*>(cmd) ? cmd->getName() : cmd->className();
|
||||
const char *tooltip = cmd->getToolTipText();
|
||||
const char *statustip = cmd->getStatusTip();
|
||||
if (!statustip || '\0' == *statustip)
|
||||
statustip = tooltip;
|
||||
recreateTooltip(context, pcAction);
|
||||
pcAction->setStatusTip(QCoreApplication::translate(context,statustip));
|
||||
cmd->recreateTooltip(context, cmd->getAction());
|
||||
pcAction->setToolTip(cmd->getAction()->toolTip());
|
||||
pcAction->setStatusTip(cmd->getAction()->statusTip());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -870,7 +870,7 @@ public:
|
||||
sGroup = "View";
|
||||
sMenuText = QT_TR_NOOP("Link actions");
|
||||
sToolTipText = QT_TR_NOOP("Link actions");
|
||||
sWhatsThis = "Std_LinkActions";
|
||||
sWhatsThis = "Std_LinkMakeRelative";
|
||||
sStatusTip = QT_TR_NOOP("Link actions");
|
||||
eType = AlterDoc;
|
||||
bCanLog = false;
|
||||
|
||||
@@ -100,6 +100,33 @@ void _cmdDocument(Gui::Command::DoCmd_Type cmdType, const App::Document* doc, co
|
||||
}
|
||||
}
|
||||
|
||||
/** Runs a command for accessing document attribute or method
|
||||
* This function is an alternative to _FCMD_DOC_CMD
|
||||
* @param doc: document name
|
||||
* @param mod: module name, "Gui" or "App"
|
||||
* @param cmd: command string, streamable
|
||||
*
|
||||
* Example:
|
||||
* @code{.cpp}
|
||||
* _cmdDocument(Gui::Command::Gui, doc, "Gui", std::stringstream() << "getObject('" << objName << "')");
|
||||
* @endcode
|
||||
*
|
||||
* Translates to command (assuming doc's name is 'DocName', and
|
||||
* and objName contains value 'ObjName'):
|
||||
* @code{.py}
|
||||
* Gui.getDocument('DocName').getObject('ObjName')
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
void _cmdDocument(Gui::Command::DoCmd_Type cmdType, const std::string& doc, const std::string& mod, T&& cmd) {
|
||||
if (!doc.empty()) {
|
||||
std::stringstream str;
|
||||
str << mod << ".getDocument('" << doc << "')."
|
||||
<< FormatString::str(cmd);
|
||||
Gui::Command::runCommand(cmdType, str.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
/** Runs a command for accessing App.Document attribute or method
|
||||
* This function is an alternative to FCMD_DOC_CMD
|
||||
*
|
||||
@@ -123,6 +150,29 @@ inline void cmdAppDocument(const App::Document* doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Doc, doc, "App", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
/** Runs a command for accessing App.Document attribute or method
|
||||
* This function is an alternative to FCMD_DOC_CMD
|
||||
*
|
||||
* @param doc: document name
|
||||
* @param cmd: command string, streamable
|
||||
* @sa _cmdDocument()
|
||||
*
|
||||
* Example:
|
||||
* @code{.cpp}
|
||||
* cmdAppDocument(doc, std::stringstream() << "getObject('" << objName << "')");
|
||||
* @endcode
|
||||
*
|
||||
* Translates to command (assuming doc's name is 'DocName', and
|
||||
* and objName contains value 'ObjName'):
|
||||
* @code{.py}
|
||||
* App.getDocument('DocName').getObject('ObjName')
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdAppDocument(const std::string& doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Doc, doc, "App", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
/** Runs a command for accessing App.Document attribute or method
|
||||
*
|
||||
* @param doc: pointer to a document
|
||||
@@ -145,6 +195,28 @@ inline void cmdGuiDocument(const App::Document* doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Gui, doc, "Gui", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
/** Runs a command for accessing App.Document attribute or method
|
||||
*
|
||||
* @param doc: document name
|
||||
* @param cmd: command string, streamable
|
||||
* @sa _cmdDocument()
|
||||
*
|
||||
* Example:
|
||||
* @code{.cpp}
|
||||
* cmdGuiDocument(doc, std::stringstream() << "getObject('" << objName << "')");
|
||||
* @endcode
|
||||
*
|
||||
* Translates to command (assuming doc's name is 'DocName', and
|
||||
* and objName contains value 'ObjName'):
|
||||
* @code{.py}
|
||||
* Gui.getDocument('DocName').getObject('ObjName')
|
||||
* @endcode
|
||||
*/
|
||||
template<typename T>
|
||||
inline void cmdGuiDocument(const std::string& doc, T&& cmd) {
|
||||
_cmdDocument(Gui::Command::Gui, doc, "Gui", std::forward<T>(cmd));
|
||||
}
|
||||
|
||||
/** Runs a command for accessing an object's document attribute or method
|
||||
* This function is an alternative to _FCMD_OBJ_DOC_CMD
|
||||
* @param obj: pointer to a DocumentObject
|
||||
|
||||
+20
-19
@@ -1824,7 +1824,7 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
Base::Reference<ParameterGrp> hExt = App::GetApplication().GetUserParameter().GetGroup("BaseApp")
|
||||
->GetGroup("Preferences")->GetGroup("General");
|
||||
QString ext = QString::fromLatin1(hExt->GetASCII("OffscreenImageFormat").c_str());
|
||||
int backtype = hExt->GetInt("OffscreenImageBackground",0);
|
||||
int backtype = hExt->GetInt("OffscreenImageBackground", 0);
|
||||
|
||||
Base::Reference<ParameterGrp> methodGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View");
|
||||
@@ -1889,14 +1889,14 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
|
||||
// which background chosen
|
||||
const char* background;
|
||||
switch(opt->backgroundType()){
|
||||
case 0: background="Current"; break;
|
||||
case 1: background="White"; break;
|
||||
case 2: background="Black"; break;
|
||||
case 3: background="Transparent"; break;
|
||||
default: background="Current"; break;
|
||||
switch (opt->backgroundType()) {
|
||||
case 0: background = "Current"; break;
|
||||
case 1: background = "White"; break;
|
||||
case 2: background = "Black"; break;
|
||||
case 3: background = "Transparent"; break;
|
||||
default: background = "Current"; break;
|
||||
}
|
||||
hExt->SetInt("OffscreenImageBackground",opt->backgroundType());
|
||||
hExt->SetInt("OffscreenImageBackground", opt->backgroundType());
|
||||
|
||||
QString comment = opt->comment();
|
||||
if (!comment.isEmpty()) {
|
||||
@@ -1904,17 +1904,17 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
// otherwise Python would interpret it as an invalid command.
|
||||
// Python does the decoding for us.
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
QStringList lines = comment.split(QLatin1String("\n"), Qt::KeepEmptyParts );
|
||||
QStringList lines = comment.split(QLatin1String("\n"), Qt::KeepEmptyParts);
|
||||
#else
|
||||
QStringList lines = comment.split(QLatin1String("\n"), QString::KeepEmptyParts );
|
||||
QStringList lines = comment.split(QLatin1String("\n"), QString::KeepEmptyParts);
|
||||
#endif
|
||||
comment = lines.join(QLatin1String("\\n"));
|
||||
doCommand(Gui,"Gui.activeDocument().activeView().saveImage('%s',%d,%d,'%s','%s')",
|
||||
fn.toUtf8().constData(),w,h,background,comment.toUtf8().constData());
|
||||
doCommand(Gui, "Gui.activeDocument().activeView().saveImage('%s',%d,%d,'%s','%s')",
|
||||
fn.toUtf8().constData(), w, h, background, comment.toUtf8().constData());
|
||||
}
|
||||
else {
|
||||
doCommand(Gui,"Gui.activeDocument().activeView().saveImage('%s',%d,%d,'%s')",
|
||||
fn.toUtf8().constData(),w,h,background);
|
||||
doCommand(Gui, "Gui.activeDocument().activeView().saveImage('%s',%d,%d,'%s')",
|
||||
fn.toUtf8().constData(), w, h, background);
|
||||
}
|
||||
|
||||
// When adding a watermark check if the image could be created
|
||||
@@ -1924,7 +1924,7 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
if (fi.exists() && pixmap.load(fn)) {
|
||||
QString name = qApp->applicationName();
|
||||
std::map<std::string, std::string>& config = App::Application::Config();
|
||||
QString url = QString::fromLatin1(config["MaintainerUrl"].c_str());
|
||||
QString url = QString::fromLatin1(config["MaintainerUrl"].c_str());
|
||||
url = QUrl(url).host();
|
||||
|
||||
QPixmap appicon = Gui::BitmapFactory().pixmap(config["AppIcon"].c_str());
|
||||
@@ -1932,7 +1932,7 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
QPainter painter;
|
||||
painter.begin(&pixmap);
|
||||
|
||||
painter.drawPixmap(8, h-15-appicon.height(), appicon);
|
||||
painter.drawPixmap(8, h - 15 - appicon.height(), appicon);
|
||||
|
||||
QFont font = painter.font();
|
||||
font.setPointSize(20);
|
||||
@@ -1942,12 +1942,13 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
int h = pixmap.height();
|
||||
|
||||
painter.setFont(font);
|
||||
painter.drawText(8+appicon.width(), h-24, name);
|
||||
painter.drawText(8 + appicon.width(), h - 24, name);
|
||||
|
||||
font.setPointSize(12);
|
||||
int u = QtTools::horizontalAdvance(fm, url);
|
||||
QFontMetrics fm2(font);
|
||||
int u = QtTools::horizontalAdvance(fm2, url);
|
||||
painter.setFont(font);
|
||||
painter.drawText(8+appicon.width()+n-u, h-9, url);
|
||||
painter.drawText(8 + appicon.width() + n - u, h - 6, url);
|
||||
|
||||
painter.end();
|
||||
pixmap.save(fn);
|
||||
|
||||
@@ -370,16 +370,16 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
ui->assignedTreeWidget->resizeColumnToContents(0);
|
||||
|
||||
if (countAmbiguous > 1) {
|
||||
QMessageBox::warning(this, tr("Multiple defined shortcut"),
|
||||
tr("The shortcut '%1' is defined more than once. This could result in unexpected behaviour.").arg(sc) );
|
||||
QMessageBox::warning(this, tr("Multiple defined keyboard shortcut"),
|
||||
tr("The keyboard shortcut '%1' is defined more than once. This could result in unexpected behaviour.").arg(sc) );
|
||||
ui->editShortcut->setFocus();
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
}
|
||||
else if (countAmbiguous == 1 && ambiguousCommand != QLatin1String(name)) {
|
||||
QMessageBox box(this);
|
||||
box.setIcon(QMessageBox::Warning);
|
||||
box.setWindowTitle(tr("Already defined shortcut"));
|
||||
box.setText(tr("The shortcut '%1' is already assigned to '%2'.").arg(sc, ambiguousMenu));
|
||||
box.setWindowTitle(tr("Already defined keyboard shortcut"));
|
||||
box.setText(tr("The keyboard shortcut '%1' is already assigned to '%2'.").arg(sc, ambiguousMenu));
|
||||
box.setInformativeText(tr("Do you want to override it?"));
|
||||
box.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
box.setDefaultButton(QMessageBox::No);
|
||||
|
||||
@@ -88,9 +88,13 @@ void DlgSettingsColorGradientImp::setupConnections()
|
||||
group->setExclusive(true);
|
||||
group->addButton(ui->radioButtonFlow);
|
||||
group->addButton(ui->radioButtonZero);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
connect(group, &QButtonGroup::idClicked,
|
||||
this, &DlgSettingsColorGradientImp::colorModelChanged);
|
||||
#else
|
||||
connect(group, qOverload<int>(&QButtonGroup::buttonClicked),
|
||||
this, &DlgSettingsColorGradientImp::colorModelChanged);
|
||||
|
||||
#endif
|
||||
connect(ui->comboBoxModel, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
this, &DlgSettingsColorGradientImp::colorModelChanged);
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="recentMacroListShortcutCountLabel">
|
||||
<property name="text">
|
||||
<string>Shortcut count</string>
|
||||
<string>Keyboard shortcut count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -2413,6 +2413,8 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
if (viewProvider && viewProvider->getChildRoot()) {
|
||||
std::vector<App::DocumentObject*> children = viewProvider->claimChildren3D();
|
||||
SoGroup* childGroup = viewProvider->getChildRoot();
|
||||
SoGroup* frontGroup = viewProvider->getFrontRoot();
|
||||
SoGroup* backGroup = viewProvider->getFrontRoot();
|
||||
|
||||
// size not the same -> build up the list new
|
||||
if (deleting || childGroup->getNumChildren() != static_cast<int>(children.size())) {
|
||||
@@ -2425,6 +2427,8 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
}
|
||||
|
||||
Gui::coinRemoveAllChildren(childGroup);
|
||||
Gui::coinRemoveAllChildren(frontGroup);
|
||||
Gui::coinRemoveAllChildren(backGroup);
|
||||
|
||||
if(!deleting) {
|
||||
for (std::vector<App::DocumentObject*>::iterator it=children.begin();it!=children.end();++it) {
|
||||
@@ -2436,6 +2440,14 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
SoSeparator* childRootNode = ChildViewProvider->getRoot();
|
||||
childGroup->addChild(childRootNode);
|
||||
|
||||
SoSeparator* childFrontNode = ChildViewProvider->getFrontRoot();
|
||||
if (frontGroup && childFrontNode)
|
||||
frontGroup->addChild(childFrontNode);
|
||||
|
||||
SoSeparator* childBackNode = ChildViewProvider->getBackRoot();
|
||||
if (backGroup && childBackNode)
|
||||
backGroup->addChild(childBackNode);
|
||||
|
||||
// cycling to all views of the document to remove the viewprovider from the viewer itself
|
||||
for (std::list<Gui::BaseView*>::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
|
||||
@@ -278,7 +278,12 @@ bool DocumentWeakPtrT::expired() const noexcept
|
||||
return (d->_document == nullptr);
|
||||
}
|
||||
|
||||
Gui::Document* DocumentWeakPtrT::operator->() noexcept
|
||||
Gui::Document* DocumentWeakPtrT::operator*() const noexcept
|
||||
{
|
||||
return d->_document;
|
||||
}
|
||||
|
||||
Gui::Document* DocumentWeakPtrT::operator->() const noexcept
|
||||
{
|
||||
return d->_document;
|
||||
}
|
||||
@@ -378,7 +383,12 @@ ViewProviderWeakPtrT& ViewProviderWeakPtrT::operator= (ViewProviderDocumentObjec
|
||||
return *this;
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject* ViewProviderWeakPtrT::operator->() noexcept
|
||||
ViewProviderDocumentObject* ViewProviderWeakPtrT::operator*() const noexcept
|
||||
{
|
||||
return d->get();
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject* ViewProviderWeakPtrT::operator->() const noexcept
|
||||
{
|
||||
return d->get();
|
||||
}
|
||||
|
||||
@@ -147,11 +147,16 @@ public:
|
||||
* \return true if the managed object has already been deleted, false otherwise.
|
||||
*/
|
||||
bool expired() const noexcept;
|
||||
/*!
|
||||
* \brief operator *
|
||||
* \return pointer to the document
|
||||
*/
|
||||
Gui::Document* operator*() const noexcept;
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document
|
||||
*/
|
||||
Gui::Document* operator->() noexcept;
|
||||
Gui::Document* operator->() const noexcept;
|
||||
|
||||
private:
|
||||
// disable
|
||||
@@ -186,11 +191,16 @@ public:
|
||||
* Assignment operator
|
||||
*/
|
||||
ViewProviderWeakPtrT& operator= (ViewProviderDocumentObject* p);
|
||||
/*!
|
||||
* \brief operator *
|
||||
* \return pointer to the document
|
||||
*/
|
||||
ViewProviderDocumentObject* operator*() const noexcept;
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the document
|
||||
*/
|
||||
ViewProviderDocumentObject* operator->() noexcept;
|
||||
ViewProviderDocumentObject* operator->() const noexcept;
|
||||
/*!
|
||||
* \brief operator ==
|
||||
* \return true if both objects are equal, false otherwise
|
||||
@@ -253,6 +263,13 @@ public:
|
||||
ptr = p;
|
||||
return *this;
|
||||
}
|
||||
/*!
|
||||
* \brief operator *
|
||||
* \return pointer to the view provider
|
||||
*/
|
||||
T* operator*() const {
|
||||
return ptr.get<T>();
|
||||
}
|
||||
/*!
|
||||
* \brief operator ->
|
||||
* \return pointer to the view provider
|
||||
|
||||
@@ -553,7 +553,7 @@ void DocumentRecovery::on_buttonCleanup_clicked()
|
||||
|
||||
DocumentRecoveryHandler handler;
|
||||
handler.checkForPreviousCrashes(std::bind(&DocumentRecovery::cleanup, this, sp::_1, sp::_2, sp::_3));
|
||||
DlgCheckableMessageBox::showMessage(tr("Transient deleted"), tr("Transient directories deleted."));
|
||||
DlgCheckableMessageBox::showMessage(tr("Delete"), tr("Transient directories deleted."));
|
||||
reject();
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 281 KiB |
@@ -1,6 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>freecadsplash.png</file>
|
||||
<file>freecadsplash2x.png</file>
|
||||
<file>freecadabout.png</file>
|
||||
<file>background.png</file>
|
||||
<file>mouse_pointer.svg</file>
|
||||
|
||||
+2502
-11
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2517
-26
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2656
-164
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2590
-102
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2507
-16
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2507
-16
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2518
-28
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2510
-19
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-22
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2510
-19
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2612
-121
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2508
-17
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2560
-72
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2521
-30
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2571
-80
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+2509
-18
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user