Compare commits

...

241 Commits

Author SHA1 Message Date
wmayer 68e337670e Fem: remove string from translation 2022-06-14 01:43:45 +02:00
wmayer 3158be46ad Fem: added signals and slots to notify when first function is added 2022-06-14 01:38:55 +02:00
Uwe 02b66ca461 [Win installer] refine deletion script
- remove more unnecessary files for the installer
2022-06-14 01:22:20 +02:00
Uwe 74c2ad4bf0 [FEM] point filter: use a LineEdit to output value
- that one copy the result to the clipboard
- also fix a typo
2022-06-14 01:21:17 +02:00
Uwe 522c91ce79 [FEM] next try to proper revert 2022-06-14 00:58:08 +02:00
Uwe e8d65c22d6 Revert "Fixing principal stress plots part 2"
This reverts commit 166eee5eed.
2022-06-14 00:40:51 +02:00
FEA-eng 166eee5eed Fixing principal stress plots part 2
https://forum.freecadweb.org/viewtopic.php?f=18&t=69385
2022-06-13 19:52:16 +02:00
FEA-eng 3af54a7dda Fixing principal stress plots part 1
https://forum.freecadweb.org/viewtopic.php?f=18&t=69385
2022-06-13 19:51:53 +02:00
wmayer 7fa294fd7a Fem: for PointMarker and DataMarker use the internal name instead of label, in customEvent() do not expect a fix name 2022-06-13 17:37:26 +02:00
wmayer 7400b11870 Fem: in FEM_PostFilterLinearizedStresses command do not use a hard-coded object name but that of the selected FemPostDataAlongLineFilter 2022-06-13 17:08:58 +02:00
wmayer 915371aa70 Fem: do not use the Label property but the internal name to access an FEM post object via Python 2022-06-13 17:01:38 +02:00
wmayer 7b225789da Fem: do not access the active document but the document the FEM post object is part of 2022-06-13 16:46:15 +02:00
wmayer c0cccf7f7e Gui: add overloaded version of cmdAppDocument and cmdGuiDocument() that has a string as first parameter 2022-06-13 15:21:55 +02:00
Chris Hennes 5219718eb0 GUI: Preliminary support for HiDPI splashscreen 2022-06-13 15:19:40 +02:00
marioalexis 4b1004b33a Base: Improve docstrings in BoundBoxPy.xml 2022-06-13 08:42:40 -04:00
wmayer 9aa14b36a3 Fem: use WeakPtrT classes instead of raw pointers to avoid possible dangling pointers and to avoid undefined behaviour if a wrong static_cast is performed 2022-06-13 14:21:18 +02:00
wmayer 876ef07480 Gui: implement '*' operator for weak pointer classes 2022-06-13 13:52:34 +02:00
wmayer 9e68e5f290 App: implement '*' operator for weak pointer classes 2022-06-13 13:52:21 +02:00
wmayer 27a36156f6 Fem: improve TaskPostDataAtPoint:
* refactor TaskPostDataAtPoint::on_Field_activated()
* show results in a label instead of message box to reduce clicks
* in output window also print field and position as the pure values are useless
2022-06-13 12:31:37 +02:00
wmayer 09f1b14cc9 Fem: remove several superfluous casts 2022-06-13 11:14:29 +02:00
wmayer e0487b62a6 Gui: [skip ci] set Std_LinkMakeRelative as WhatsThis name 2022-06-13 11:01:36 +02:00
wmayer 741fdc53c7 Base: unset flag to skip leading whitespaces when copying a file 2022-06-13 08:43:58 +02:00
Uwe 832f181ec0 [Gui] make What's This? work for sublinks 2022-06-13 02:42:37 +02:00
Uwe 2a8f85d95c [FEM] make post filter Ui std::unique_ptr 2022-06-13 01:59:46 +02:00
Uwe 227e568b4f [FEM] cut and clip filter: handle new functions
- on adding a new function, it should be used
- there is still a bug, see the added FIXME
2022-06-13 01:42:58 +02:00
Uwe f0e735ed33 [FEM] line filter resolution fix
a resolution of zero is senseless, thus set minimum to 1
2022-06-12 23:09:33 +02:00
Uwe ebd1afc5d9 [FEM] fix 2 crashes with line and scalar filter
- same crash origin like the crash fixed earlier today: https://github.com/FreeCAD/FreeCAD/commit/7b0b83a2e4
2022-06-12 22:18:59 +02:00
wmayer 9065058265 plugin: [skip ci] copy sizeHint handling to QuantitySpinBox implementation in QtDesigner plugin 2022-06-12 21:56:08 +02:00
wmayer 0a79760745 Gui: set a minimum width for quantity spin boxes in FEM dialogs to ignore the results of (minimum)sizeHint() 2022-06-12 20:25:40 +02:00
wmayer ac3390de12 Gui: add function to determine size that a quantity spin box would need to display a certain text 2022-06-12 20:01:41 +02:00
Kuzemko Alexsandr c2cfccf268 Crowdin Add some menu text for translation. 2022-06-12 13:02:41 -04:00
Uwe 505de3215b [GUI] fix screenshot watermark
as reported here: https://forum.freecadweb.org/viewtopic.php?p=601651#p601651
2022-06-12 18:39:14 +02:00
Uwe 4f91499ada [FEM] line filter, resolution tweak
- disable keyboard tracking for the resolution
2022-06-12 18:22:24 +02:00
Uwe 4813e30703 [FEM] fix line filter resolution
- when the resolution changes, the data must be refreshed for visualization and the plot
2022-06-12 18:18:26 +02:00
Uwe 8bbf9b8347 [Main] change URL
as reported in the forum: https://forum.freecadweb.org/viewtopic.php?p=601657#p601657
we should use our new URL
2022-06-12 18:12:28 +02:00
Uwe 3528c626e7 [FEM] fix plots of line filter
- when the line geometry changed, the axis data must be refreshed to get correct plots
2022-06-12 17:24:41 +02:00
Uwe a06cc956c5 [FEM] function dialogs size fix
- as suggested in https://github.com/FreeCAD/FreeCAD/commit/d4c180e9538d570a05849b22d4acc8f8624d0878#r75908012
the labels should have maximum size policy
2022-06-12 16:52:41 +02:00
Uwe e2856395a3 [FEM] remove hardcoding of spinbox sizes 2022-06-12 16:40:41 +02:00
Uwe a3a97d7b5e [FEM] fixes for line filter
- on changing a point coordinate, either by clicking a point or by changing the spinbox in the dialog, the color bar must be refreshed and data must be evaluated for all fields along the new line
2022-06-12 16:35:08 +02:00
Uwe 0c43dab796 [FEM] function dialogs fix
- keyboard tracking must be turned off
2022-06-12 16:25:02 +02:00
Uwe 298fb8983d [FEM] fix along line dialog
- as suggested in https://github.com/FreeCAD/FreeCAD/commit/d4c180e9538d570a05849b22d4acc8f8624d0878#r75908012
- keyboard tracking must be turned off
2022-06-12 16:17:21 +02:00
Zheng, Lei 75546946db Spreadsheet: fix border rendering for merged cells 2022-06-12 16:11:59 +02:00
Zheng, Lei 4d19e611f8 Spreadsheet: fix binding of merged cells 2022-06-12 16:11:59 +02:00
Zheng, Lei 47a5a6302e Spreadsheet: replace obsolete href with hiddenref in binding 2022-06-12 16:11:59 +02:00
Uwe 7b0b83a2e4 [FEM] fix crash with data point filter
- when the filter is upon another filter that e.g. clipped all data, we cannot access data
2022-06-12 14:56:54 +02:00
wmayer d81b016b2a PD: several fixes of shape binder:
* add action to context-menu to remove an element
* use an exclusive button group to avoid to have several buttons pressed at the same time
* allow to completely clear the support
* when pressing OK/Cancel then operate on the document the shape binder is part of (which isn't necessarily the active document)
* remove obsolete parameter from ViewProviderShapeBinder::highlightReferences()
2022-06-12 14:03:42 +02:00
wmayer 5a432fe9ac PD: allow to clear the shape when nullifying the Support property 2022-06-12 14:01:19 +02:00
Zheng, Lei e6a6d838a6 Spreadsheet: fix range selection 2022-06-12 13:51:09 +02:00
Yorik van Havre f3a8edcb5e Merge pull request #7004 from Roy-043/Arch-ArchSectionPlane-always-showed-plan-symbols-of-windows
Arch: ArchSectionPlane always showed plan symbols of windows
2022-06-12 11:58:40 +02:00
Yorik van Havre baa1105a53 Merged crowdin translations 2022-06-12 11:56:37 +02:00
Uwe 6c1c63cffe [FEM] point filter: fix data display for coordinate change
- not only by clicking the data must be shown, also by changing a single coordinate value in the dialog.
2022-06-12 04:51:19 +02:00
Uwe 9ef72fcd06 [FEM] fix color bar handling of point filter
- recoloring the gradient bar for a single point is senseless. One therefore already got dozens of errors that max = min in the console. Therefore don't recolor for point filters
2022-06-12 04:02:11 +02:00
Uwe 7521cfc7a0 [FEM] fix point filter output
fixes #7008:

- the point data must be read also when the center changed
- when the dialog is called it has only the value for the current field, thus recompute the feature to fill all fields with data
- on clicking on a mesh point display the value at the clicked position
- due to the object's recomputation at the start, a complete recomputation (for the whole pipeline) is needed on closing the dialog
2022-06-12 03:34:02 +02:00
Uwe 6d23205704 [FEM] fix display of point filter
- results of 1e8 or 1e-7 in fixed notation are almost unreadable, therefore use scientific notation if necessary
2022-06-12 01:05:26 +02:00
wmayer 30706f4d0f PD: allow to set object in shape binder dialog by typing its name 2022-06-12 00:38:48 +02:00
Uwe 6a877f7e29 [FEM] point filter: fix initialization issue
- we cannot assume to have a geometry at position (0, 0, 1) this initialize at (0, 0, 0)
- also don't hardcode the unit in the UI file

- also fix wrong property description
- property "Radius" is not used in the code and it seems it is only there as copy paste bug once the point filter was implemented. However close to a release, keep the property and just mention it is unused.
2022-06-12 00:25:58 +02:00
wmayer 007a5b351a PD: use WeakPtr to avoid any possible dangling pointers 2022-06-11 23:37:33 +02:00
VM4Dim 9010b88b22 Fix for non-Latin Group name in Tree View 2022-06-11 15:24:25 -04:00
wmayer a106f55ebe PD: show object label instead of internal name in shape binder dialog 2022-06-11 21:00:15 +02:00
wmayer b8434f2ddc Test: [skip ci] extend test for issue #6949 2022-06-11 16:10:09 +02:00
0penBrain 6e587d130d Expression: add unit test for issue #6948 2022-06-11 15:59:06 +02:00
0penBrain 38ec63cba1 [Bugfix] Expression: fix precedence+associativity management in parenthesis removal
Fixes #6948
2022-06-11 15:59:06 +02:00
wmayer fbb5555f27 Part: do not expect a face to be infinite if meshing it has failed
See https://forum.freecadweb.org/viewtopic.php?p=601240#p601240
2022-06-11 13:01:15 +02:00
Uwe 9b5aabe458 [FEM] fix unit handling of filter functions
- the function properties use already units but the dialogs were unitless
2022-06-11 04:54:51 +02:00
Uwe 9dc93b8f99 [skip CI] [FEM] sort UI file
I forgot to use our UI sorter
2022-06-11 04:46:21 +02:00
Uwe c8337118ba [skip CI] [FEM] whitespace and comments to keep overview 2022-06-11 04:28:21 +02:00
Uwe d13ecc1efa [Path] fix compilation with precompiled headers
- also sort includes to keep overview
2022-06-11 00:56:00 +02:00
Wanderer Fan 1b65b3f600 [TD]fix icons for dark schemes 2022-06-10 17:49:43 -04:00
Roy-043 f89f032231 Arch: ArchSectionPlane always showed plan symbols of windows 2022-06-10 22:32:45 +02:00
sliptonic 083a27dc68 Merge pull request #6886 from younghang/master
Path: Fix PointProjectionFailed
2022-06-10 09:06:38 -05:00
Uwe d4c180e953 [FEM] fix unit handling of line filter
- in contrary to other filters the properties have no unit handling
(there are several bugs in line filter and to fix them, unit handling is necessary)
2022-06-10 14:17:42 +02:00
Uwe fdaca02994 [skip CI] [FEM] fix initialization mistake
- initial point should be (0, 0, 0)
  (mistake introduced by me today)
2022-06-10 14:11:42 +02:00
Uwe 4c3c23776d [FEM] fix illegal storage access in point filter
- occurred when changing Field to "None"

- also remove doubled and unused code and add a blank line to separate the different filters in the code better
2022-06-10 13:16:23 +02:00
Yorik van Havre 19ffd1ca94 Merged crowdin translations 2022-06-10 11:03:57 +02:00
Yorik van Havre fa9c78611e Updated ts files 2022-06-10 10:29:18 +02:00
Uwe 825d95314e [FEM] fix unit handling of point result filter
- the App part used already units but the dialog worked unitless. This is error-prone and confusing. Therefore use unit widgets in the dialog.
- also fix issue that unit was not reset (after e.g. a temperature maybe a unitless strain should be shown)
2022-06-10 04:20:25 +02:00
Uwe 10c6d6eabf [skip CI] [PD] fix typo 2022-06-10 03:39:04 +02:00
Chris Hennes b54b3e6e32 Addon Manager: Fix bug in macro git repo 2022-06-09 19:50:05 -05:00
Uwe 6bb6bb4d24 [FEM] fix unit settings of data point filter 2022-06-10 02:42:17 +02:00
Uwe 8fb5ce3c43 [FEM] allow to copy and edit result data
- at the moment you cannot get the result data, for example to make your own plot. Also for the line you might want to have unequal x-steps etc. Especially for the data point filter not getting the data actually makes the tool quite useless.
- therefore set the properties to output
2022-06-10 02:41:08 +02:00
Uwe 43a14ab4df [FEM] fix result point filter upon line filter
having a point filter on a line filter is valid and useful, was maybe just forgotten once the line filter was added
2022-06-10 01:43:22 +02:00
Uwe dd00c46a8c [FEM] fix issue that all plot windows had the same name
- they all had the name "figure 1"
- thus make the name unique and this way also enable to have several plots open displaying different result types (for the line filter)
2022-06-10 00:55:02 +02:00
marioalexis 10edc03ec1 App: Clean up code in PropertyContainerPyImp.cpp 2022-06-09 18:46:41 -04:00
marioalexis 53e02bc851 App: Improve docstrings in PropertyContainerPy.xml 2022-06-09 18:46:41 -04:00
Uwe d17954276c [FEM] fix detached plot (#6998)
* [FEM] fix detached plot

the stress linearization plot is at the moment detached from FreeCAD's main window.
This PR fixes it the same way as in https://github.com/FreeCAD/FreeCAD/commit/920e8e046
2022-06-10 00:34:05 +02:00
Uwe c4fec57368 [FEM] fix linear filter plot (#6999)
* [FEM] fix linear filter plot

the plot one can create from within the linear filter is at the moment detached from FreeCAD's main window.
This PR fixes it the same way as in https://github.com/FreeCAD/FreeCAD/commit/920e8e046
2022-06-10 00:33:27 +02:00
marioalexis d8bf4dfeb9 App: Improve docstrings in MetadataPy.xml and fix memory leak 2022-06-09 17:48:45 -04:00
wmayer 7225e5f0ba App: issue #6892: FreeCAD fails to start 2022-06-09 15:40:37 +02:00
Yorik van Havre 68e8c19aaf Merged crowdin translations 2022-06-09 13:40:35 +02:00
wmayer 8d5a957eb0 Gui: use expresion 'keyboard shortcut' to avoid incorrect translation 2022-06-09 13:15:41 +02:00
wmayer e5fb5a6f27 Mesh: [skip ci] improve German translation 2022-06-09 12:56:43 +02:00
wmayer ecb1b3c3cc ReverseEngineering: [skip ci] improve German translation 2022-06-09 12:33:12 +02:00
wmayer 9a4ab21f2b FEM: improve German translation 2022-06-09 12:27:43 +02:00
Zheng Lei 9d7b7af48c Spreadsheet: fix range checking (#6997)
* App: add option to normalize a Range

- To make sure the range starts from top left and ends with bottom right
corner.
- Default is to not normalize on construction for backward compatibility.
-  fix range checking in range binding
2022-06-09 12:20:08 +02:00
wmayer 28c269cc5f Gui: improve German translation 2022-06-09 12:15:29 +02:00
Uwe 0f9ea612b6 [Spreadsheet] uniform and polish wording of binding feature 2022-06-09 02:14:14 +02:00
marioalexis 4148a33d15 Gui: Improve docstrings in AxisOriginPy.xml 2022-06-08 20:20:57 +02:00
marioalexis d7d22b1e7e App: Improve docstrings in GeoFeaturePy.xml 2022-06-08 19:20:04 +02:00
Zheng Lei 5864e17d9d Spreadsheet: improve range binding feature (#6995)
* Spreadsheet: improve range binding feature
2022-06-08 19:19:41 +02:00
0penBrain 920e8e0469 [FEM] Implement a better dialog layout management for histogram (#6989)
* [FEM] Implement a better dialog layout management for histogram
2022-06-08 16:51:01 +02:00
Chris Hennes c9cffae11d Sketcher: Tweak pluralization of DoF 2022-06-08 09:16:48 -05:00
Yorik van Havre c143d91978 Merge pull request #6991 from 0penBrain/draftGrid
Draft: fix grid spacing default initialization
2022-06-08 13:22:45 +02:00
wmayer f401cbe832 Part: in BRepOffsetAPI_MakeOffsetFix::MakeWire also consider the generated edges of the vertexes of the input shape 2022-06-08 13:02:07 +02:00
Yorik van Havre 2e4dcfc22a Generated ts files 2022-06-08 12:32:59 +02:00
Yorik van Havre b06f247f9f Merged crowdin translations 2022-06-08 12:28:54 +02:00
0penBrain e05e9a7247 Draft: fix grid spacing default initialization 2022-06-08 12:20:06 +02:00
Uwe 5792c502bf [TD] further dialog refinements to fix vertical spacing 2022-06-08 02:12:19 +02:00
Uwe ef1a835f4f [TD] fix dialog height settings 2022-06-08 02:05:44 +02:00
Uwe 18eb44d120 [TD] fix dialog height setting 2022-06-08 01:52:45 +02:00
Wanderer Fan d0323e13c1 [TD]add missing vertical spacer to ui 2022-06-07 19:18:39 -04:00
Wanderer Fan f31544dca8 [TD]missing vertical spacer in ui 2022-06-07 19:18:39 -04:00
Uwe f256e3caf4 [Gui] attempt to improve NaviCube rendering
When the NaviCube is relatively small, it looks clumsy on some screens. This PR tries to improve that.
2022-06-08 01:06:15 +02:00
marioalexis 0c6c3e5211 Base: Improve docstrings in PersistencePy.xml 2022-06-08 00:52:19 +02:00
Chris Hennes 9570d88a39 FEM: Enable translation of plot labels 2022-06-07 13:44:01 -05:00
Chris Hennes 6449e1bcf7 FEM: Enable translation of axis label 2022-06-07 13:10:42 -05:00
Chris Hennes 47bb1408da GUI: Add Vtk info to copied About data 2022-06-07 12:51:51 -05:00
wmayer 77627bbc23 Gui: add SoColorBarLabel as workaround for a Coin3D bug 2022-06-07 19:42:04 +02:00
Yorik van Havre b9b21ddac5 Merged crowdin translations 2022-06-07 13:34:53 +02:00
Yorik van Havre 242083bbf7 Merge pull request #6984 from Kuzma30/update_ts
Crowdin Run update.ts with latest source code.
2022-06-07 12:29:38 +02:00
Kuzemko Alexsandr eff8ecaafc Crowdin Run update.ts with latest source code. 2022-06-07 13:15:44 +03:00
wmayer 80bdc3f960 Gui: don't use cached value of color bar width if ratio of the canvas is less than 1.0 2022-06-07 11:30:00 +02:00
Wanderer Fan b4489422a5 [TD]abort dimensioning of spline edge 2022-06-06 18:47:51 -04:00
Wanderer Fan 8349a78dde [TD]fix icon in dialog 2022-06-06 18:47:51 -04:00
Chris Hennes fd47f2253a Draft: Fix menu text for Select Plane 2022-06-06 12:12:08 -05:00
wmayer 3cccd4d69e Gui: cache color bar width to avoid to compute it for every resize of the canvas 2022-06-06 19:11:00 +02:00
Kuzemko Alexsandr 721f253c59 Crowdin Update TechDraw.ts 2022-06-06 13:08:02 -04:00
Kuzemko Alexsandr 29cc754cfd [TD] Add ability to translate for some tooltip text. Fix incorrect use of tr(variable). 2022-06-06 13:08:02 -04:00
Chris Hennes af811b34b3 Addon Manager: Additional diagnostics for Macro updates 2022-06-06 11:46:56 -05:00
sliptonic 07422d2abe Merge pull request #6978 from sliptonic/bug/ghostpath
zero out Job.Path property if it exists
2022-06-06 11:43:13 -05:00
sliptonic 6462cdf231 zero out Job.Path property if it exists 2022-06-06 11:40:01 -05:00
Uwe 9156d591c9 [FEM] fix subsequent histogram plot call
fixes #6975
2022-06-06 18:26:18 +02:00
Uwe 4223e5d84d [skip CI] [Spreadsheet] change misleading word in dialog 2022-06-06 01:26:29 +02:00
Uwe 7955c0dfac [Spreadsheet] dialog fixes
- fixes to tooltips
- add 2 labels to make the dialog logic more clear
- remove non-functional help button
2022-06-06 00:46:42 +02:00
Wanderer Fan 681d961254 [TD]fix updating of shared view 2022-06-05 09:33:02 -04:00
Uwe 332cb9ec2f [FEM] fix wrong error message about comments
- fixes an annoying warning (that is output as error) about unused COMMENT
2022-06-05 13:42:41 +02:00
Uwe 34300c600f [FEM] add missing parser handling of '^' character (#6966)
* [FEM] add missing parser handling of '^' character

- it is common to use equations like "x^2" but one currently get only an error
- this PR fixes this by adding parsing support for the '^' character as power function

This way is it now also possible to calculate a root by e.g. "x^(0.5).
2022-06-05 13:13:49 +02:00
Kuzemko Alexsandr f7c64c7322 Crowdin Update Fem.ts 2022-06-05 12:38:12 +02:00
Uwe 7e638a624e [FEM] add missing tooltip
- should clarify the action of the button properly
2022-06-05 00:25:20 +02:00
Uwe b5b5375fe4 [FEM] result dialog: handle max shear stress
- max shear stress is supported but could not use in the Calculate section
- also sort the UI file with our sorting script
2022-06-05 00:12:51 +02:00
Uwe 23d65cc9f2 Merge branch 'master' of github.com:FreeCAD/FreeCAD 2022-06-04 22:42:13 +02:00
Uwe 75a8998432 [FEM] fix button text
- looking at the Git log this button never had a plot functionality
- for the discussion see: https://forum.freecadweb.org/viewtopic.php?f=18&t=69189
2022-06-04 22:41:58 +02:00
Ajinkya Dahale 6e97e9570c [Sketcher] Add missing newline 2022-06-04 22:35:55 +02:00
Kuzemko Alexsandr 27e3f3c153 Crowdin Update .ts after fixing script. 2022-06-04 15:09:19 -04:00
Kuzemko Alexsandr a42e1b0223 Crowdin Add full Part directory back to search path. 2022-06-04 15:09:19 -04:00
Kuzemko Alexsandr 176cf0d144 Part: Reformat JoinDeatures by Black, delete some comments. Reformat commented code too.
Now it proper recognize by lupdate.
2022-06-04 15:09:19 -04:00
Uwe 4d7e550d97 [FEM] fix results dialog equation input
- add missing tooltip and this way remove cryptic default input of the field
- since the field expects plain text, use a QPlainTextEdit
2022-06-04 19:58:31 +02:00
Uwe 3fe354718c [FEM] describe the tress variables
- there was no info what P1, P2 and P3 meant
- also rearrange to consume save horizontal space (was too wide on small screens)
2022-06-04 19:18:13 +02:00
Uwe 8567ef1849 [skip CI] [FEM] change strings to be consistent with the dialog 2022-06-04 19:06:14 +02:00
marioalexis 67c506d39e Base: Improve docstrings in VectorPy.xml 2022-06-04 15:39:05 +02:00
wmayer 9c8b21f5f4 Web: update browser commands after loading page 2022-06-04 13:21:41 +02:00
wmayer f37574e809 Base: raise TypeError if Vector is multiplied with unsupported type 2022-06-04 13:21:04 +02:00
wmayer 0d6b5b7f30 Base: use const char* 2022-06-04 13:20:07 +02:00
wmayer f7f85464a3 Base: include header in PCH 2022-06-04 13:18:08 +02:00
wmayer 31047be9fb Base: improve initialization according to cpp core guidelines 2022-06-04 13:17:27 +02:00
wmayer ca9355b5cb Base: remove redundant void 2022-06-04 13:14:55 +02:00
wmayer fc7f3f4e3d Base: avoid const_cast in FileInfo 2022-06-04 13:13:36 +02:00
Uwe 704feadc7c [skip CI] [FEM] fix typos 2022-06-04 01:33:34 +02:00
Uwe e41879c6ea [FEM] don't block FC by histogram plot window
fixes #6959
2022-06-04 01:28:55 +02:00
Wanderer Fan 2b0dd54fe7 [TD]fix preference file handling 2022-06-03 18:35:13 -04:00
Chris Hennes d73f9e3762 FEM: Add translation calls to task_result_mechanical.py 2022-06-03 11:42:52 -05:00
Uwe 134fa8b7ea [FEM] use proper histogram titles
- use for the histogram titles the same as in the CCX dialog and not our internal abbreviations
- in the CCX dialog don't use the term PEEQ but the common wording that also gives the user the info what this is about
2022-06-03 13:09:32 +02:00
Yorik van Havre e8f1bde367 Merged crowdin translations 2022-06-03 11:26:35 +02:00
Chris Hennes 2d32de3cd2 FEM: Tweak translatability of PEEQ 2022-06-02 16:26:05 -05:00
Wanderer Fan 56d289997c [TD]fix Dimension/Balloon movement 2022-06-02 16:33:25 -04:00
Chris Hennes 4dab407fbe Tools: Manually search for translatable files 2022-06-02 14:58:44 -05:00
Chris Hennes 34502193a2 i18n: Update TS files to ensure Python files are included 2022-06-02 14:57:49 -05:00
Chris Hennes d540de8bee i18n: TS files generated by lupdate 6.4.0dev 2022-06-02 13:41:37 -05:00
Chris Hennes acfbc72f50 Tools: Fix issues with updatets.py 2022-06-02 13:37:28 -05:00
Chris Hennes 3c1e446c2f Addon Manager: Don't translate placeholder text 2022-06-02 12:51:41 -05:00
Chris Hennes 2d5400f923 Sketcher: Fix typo in tooltip 2022-06-02 12:47:30 -05:00
Chris Hennes be16e1f52b Sketcher: Tweak tooltip language 2022-06-02 12:44:37 -05:00
Chris Hennes be8a4037db FEM: Fix typo 2022-06-02 10:49:55 -05:00
Wanderer Fan 977127012e [TD]fix misleading error messages 2022-06-02 11:39:21 -04:00
Chris Hennes 89432a969d TD: Set symbols to be non-translatable 2022-06-02 10:36:46 -05:00
Chris Hennes 7b204c01db Gui: Fix typo 2022-06-02 10:29:14 -05:00
marioalexis ee4f4e8cb7 Base: Improve docstrings in CoordinateSystemPy.xml 2022-06-02 16:26:31 +02:00
marioalexis 297e3520ec Base: Improve docstrings in TypePy.xml 2022-06-02 16:25:55 +02:00
Wanderer Fan 8891394d5a [TD]fix Rotation not applied 2022-06-02 09:09:53 -04:00
Wanderer Fan d223d4362c [TD]fix double draw on position change 2022-06-02 09:09:53 -04:00
Chris Hennes 213bf1ec61 Tools: Add Windows and Qt6 support to updatets.py 2022-06-01 21:30:27 -05:00
Chris Hennes d860c4bb2d PD: Fix w[z] plot in ShaftWizard 2022-06-01 19:48:42 -04:00
luz paz a0c0b2616c Fix various typos 2022-06-01 18:03:40 -04:00
Chris Hennes 07e38636b9 Addon Manager: Fix bug with updates being counted wrong 2022-06-01 15:01:38 -05:00
Chris Hennes a4b2bf584d Gui: Fix display of tooltips for GroupCommand
Fixes https://github.com/FreeCAD/FreeCAD-translations/issues/88 and https://github.com/FreeCAD/FreeCAD-translations/issues/72
2022-06-01 14:21:17 -05:00
Kuzemko Alexsandr 477eed10a4 [TD] Fix incorrect using of QT_TRANSLATE_NOOP in setText 2022-06-01 13:41:00 -04:00
Uwe 9946a3916e [FEM] TaskPostDataAtPoint: add missing support for electrostatics
- also update units to SI
2022-06-01 17:42:22 +02:00
Kuzemko Alexsandr a67701b85b Crowdin Add missing menu text for translation 2022-06-01 11:12:51 -04:00
Uwe 2de25dd04e [PD] fix Shaft wizard
- the functionality is now in FC's core, for more info see: https://forum.freecadweb.org/viewtopic.php?p=599044#p599044
and following
2022-06-01 16:13:09 +02:00
Kuzemko Alexsandr 3f04bf7b4d [TD] Add text to translate
This will fix https://github.com/FreeCAD/FreeCAD-translations/issues/47
2022-06-01 13:04:47 +02:00
wmayer 8c123bad50 App: add default macro directory to sys.path 2022-06-01 11:21:51 +02:00
Uwe eda43a2ef9 [Win installer] register all FC-specific file types
- to be able to get a clean system when uninstalling FC
2022-06-01 04:41:23 +02:00
Uwe 81d6401455 [Win installer] update website 2022-06-01 04:37:15 +02:00
Chris Hennes 5542bc9970 Addon Manager: Remove unnecessary translations 2022-05-31 20:35:10 -05:00
Chris Hennes 3dfb51d3ee Addon Manager: Expose pref page name to translate 2022-05-31 15:33:53 -05:00
marioalexis 79a5cde3b5 Base: Fix bad parse argument in AxisPyImp.cpp 2022-05-31 12:55:54 -04:00
Chris Hennes 33556d8a56 Part: Change _translate to translate 2022-05-31 10:05:44 -05:00
Chris Hennes b8952aaeb8 Image: Change _translate to translate 2022-05-31 10:05:22 -05:00
Kuzemko Alexsandr 819cfd7a11 [TD] Fix problem with translation (add TechDraw_ to context)
This will fix https://github.com/FreeCAD/FreeCAD-translations/issues 145-147
2022-05-31 09:30:48 -04:00
Yorik van Havre d447d75882 Merged crowdin translations 2022-05-31 13:31:52 +02:00
Kuzemko Alexsandr d920a5bf4d [Mesh] Add ability to translate
This fix https://github.com/FreeCAD/FreeCAD-translations/issues/53
2022-05-31 12:01:02 +02:00
marioalexis 35c872d4f2 Base: Improve docstrings in MatrixPy.xml 2022-05-31 11:48:04 +02:00
marioalexis 98cb5d50af Base: Fix undefined behaviour in row/col functions and code clean up 2022-05-31 11:48:04 +02:00
Kuzemko Alexsandr 62f65e12e2 Part: Change contex from AttachmentEditor to Part_EditAttachment
Add menu text "Create a copy" to translation
This may fix https://github.com/FreeCAD/FreeCAD-translations/issues/64
2022-05-31 11:25:44 +02:00
Chris Hennes f7b9a70ee5 Addon Manager: Build in error-checking in developer mode 2022-05-30 20:06:20 -05:00
Benjamin Alterauge 03f3852617 List all available test units, if none is selected.
From the command line (FreeCADCmd) only which not need the GUI.

A better description

Grammatically improvement

Use PrintMessage
2022-05-31 02:03:11 +02:00
Uwe 537acfdddd [Gui] code documentation of color bar 2022-05-31 01:59:54 +02:00
Chris Hennes 307cb3cda8 Gui: Check for Snap and add details to About 2022-05-30 13:19:02 -05:00
Kuzemko Alexsandr 0b574523e9 [TD] Fix redefine text in .ui (that has translation on crowdin) with English text without translation ability.
This will fix https://github.com/FreeCAD/FreeCAD-translations/issues/50
2022-05-30 10:41:00 -04:00
wmayer 8edb3e64cc Part: make DimensionLinear node kit unpickable
See forum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=69056
2022-05-30 15:43:27 +02:00
Yorik van Havre e13e3bcea3 Merge pull request #6899 from 0penBrain/draftGrid
Draft: fix issues with grid spacing parameter
2022-05-30 15:31:18 +02:00
Kuzemko Alexsandr c2e34be393 Part: Fix Chamfer parameter and Fillet parameter title. Also rename variable to more informative in .ui.
This will resolve issues https://github.com/FreeCAD/FreeCAD-translations/issues/74
2022-05-30 15:01:33 +02:00
wmayer c5296fbb92 Gui: initialize _bbox with correct default values and fix incorrect label postions if ratio of width/height is less than 1 2022-05-30 14:08:33 +02:00
wmayer 1723196166 Gui: fix shrinking and shifting of color bar if ratio of width/height is smaller than one 2022-05-30 12:59:55 +02:00
wmayer 37d2492719 Gui: refactor SoFCColorGradient::setViewportSize and SoFCColorLegend::setViewportSize 2022-05-30 12:49:48 +02:00
Yorik van Havre 47125d8fda Arch: Fixed position of rectangles in IFC export 2022-05-30 10:36:05 +02:00
Yorik van Havre d3d96816ce Merged crowdin translations 2022-05-30 10:01:02 +02:00
Uwe 7907b0f8b3 [Gui] describe gradient code better
- to make it easier to see what is happening (not yet perfect since the start numbers 4.0 and 5.0 are not clear yet)
- avoid a jump of the gradient bar when decreasing window size
- return for now only the direct bar width 8will be tested thoroughly now on several PCs if this will work)
2022-05-30 04:08:19 +02:00
wmayer c4cd127499 Gui: fix number display issue of color bar 2022-05-30 03:39:48 +02:00
wmayer 919271ed5e Gui: fix visibility of front nodes when moving an object to Part container 2022-05-30 03:21:52 +02:00
Uwe 79c218ad9a [Gui] fix default color gradient numbering
as reported here: https://forum.freecadweb.org/viewtopic.php?p=598390#p598390
we must assure the user sees not by default get several gradient labels
showing the same and labels showing 0.000
2022-05-30 02:57:29 +02:00
Wanderer Fan 7b79c9697c [TD]prevent spurious recompute on click/drag 2022-05-29 13:19:34 -04:00
wmayer 30f8015e71 Part: expose ChFi2d_ChamferAPI to Python 2022-05-29 12:24:32 +02:00
wmayer f94ab3ec84 Part: expose ChFi2d_AnaFilletAlgo to Python 2022-05-29 11:31:43 +02:00
wmayer b47f8d2605 Part: move ChFi2d wrappers to own sub-directory 2022-05-29 11:05:55 +02:00
marioalexis 8e1a23eadf Base: Improve docstrings in RotationPy.xml 2022-05-29 10:34:59 +02:00
Mateusz Skowroński 391c9a6bbf buttonClicked(int id) is deprecated since Qt 5.15. Use idClicked(int id) instead. 2022-05-28 16:46:59 -04:00
wmayer bf6dbd4606 Gui: react on picked point when double or right-clicking color bar 2022-05-28 18:25:52 +02:00
Yorik van Havre 8676d67a87 merged crowdin translations 2022-05-28 12:16:47 +02:00
wmayer a80d9e5ef8 Fem: [skip ci] fix deleting Result object if its children has been deleted beforehand 2022-05-28 12:08:44 +02:00
wmayer b07be87677 Part: expose ChFi2d_FilletAPI to Python and move to ChFi2d module 2022-05-28 11:10:45 +02:00
wmayer bd853e5ef2 Part: expose ChFi2d_FilletAlgo to Python 2022-05-28 10:37:04 +02:00
Chris Hennes 4c2972cb23 AddonManager: Work around thread-safety issue in update 2022-05-27 15:24:34 -05:00
Uwe 975b8eac52 [skip CI] add missing line ending 2022-05-27 20:39:22 +02:00
Uwe 836c6b889a add description on how to build installer from self-compiled FC 2022-05-27 20:37:26 +02:00
0penBrain 4474db7f50 Draft: force length unit in grid spacing in SelectPlane 2022-05-25 09:54:34 +02:00
0penBrain ccdbf99341 Draft: fix issues with grid spacing parameter 2022-05-25 09:02:12 +02:00
younghang 18120f8bcd Merge branch 'master' into master 2022-05-18 09:39:04 +08:00
younghang a21a5a2032 Fix whitespace 2022-05-18 09:36:16 +08:00
younghang 5ae3a0866e Merge branch 'master' into master 2022-05-17 09:03:56 +08:00
younghang 07d7ced8ec Path: Fix PointProjectionFailed in rebaseWire() 2022-05-16 10:08:35 +08:00
younghang 7630ee024b fix PointProjectionFailed 2022-05-16 00:04:44 +08:00
1292 changed files with 608488 additions and 477101 deletions
+1
View File
@@ -43,3 +43,4 @@ tags
src/Tools/freecad.zip
tsupdate_stderr.log
tsupdate_stdout.log
files_to_translate.txt
+10 -4
View File
@@ -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";
+12 -2
View File
@@ -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();
}
+21 -4
View File
@@ -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
+4 -4
View File
@@ -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;
}
+3 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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>
+10 -7
View File
@@ -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));
}
+70 -57
View File
@@ -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>
+75 -53
View File
@@ -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
View File
@@ -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
View File
@@ -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; }
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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);
}
+27 -19
View File
@@ -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>
+9 -1
View File
@@ -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();
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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)
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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
View File
@@ -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>
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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
+1
View File
@@ -66,6 +66,7 @@
#include <string>
#include <list>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>
#include <stack>
+99 -81
View File
@@ -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
View File
@@ -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
View File
@@ -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>
-17
View File
@@ -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
View File
@@ -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
View File
@@ -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>
+1 -3
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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());
}
}
+1 -1
View File
@@ -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;
+72
View File
@@ -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
View File
@@ -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);
+4 -4
View File
@@ -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);
+5 -1
View File
@@ -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);
+1 -1
View File
@@ -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>
+12
View File
@@ -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);
+12 -2
View File
@@ -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();
}
+19 -2
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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>
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
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