[PR 3747] CheckGeometry advanced properties shape content

Merged, abandoned or rejected pull requests are moved here to clear the main Pull Requests forum.
Post Reply
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

[PR 3747] CheckGeometry advanced properties shape content

Post by TheMarkster »

https://github.com/FreeCAD/FreeCAD/pull/3747

There are a few changes to CheckGeometry in the Shape Content panel.

The motivation for this PR is sometimes CheckGeometry shows incorrect values for the various subshape counts. See this topic for an example:

https://forum.freecadweb.org/viewtopic.php?f=22&t=48792

In the above referenced topic a shape with 20 faces is created with a python script, but when checked with CheckGeometry, OCCT says it has 19 faces. This issue is corrected by counting all the edges, vertices, faces, etc. and displaying that information rather than using the OCCT tool to do this. And, since FreeCAD will have more control over this process I have added some additional "advanced" information for each checked shape.
Snip macro screenshot-d2256c.png
Snip macro screenshot-d2256c.png (91.87 KiB) Viewed 11554 times
Different shape types might have different advanced properties shown, where relevant to that shape type.
Snip macro screenshot-b95dbd.png
Snip macro screenshot-b95dbd.png (125.67 KiB) Viewed 11554 times
Snip macro screenshot-23ae49.png
Snip macro screenshot-23ae49.png (104.6 KiB) Viewed 11554 times
The advanced properties can be disabled in the settings:
Snip macro screenshot-93908a.png
Snip macro screenshot-93908a.png (66.66 KiB) Viewed 11554 times
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR 3747] CheckGeometry advanced properties shape content

Post by chrisb »

There are other discussions about shortcuts: https://forum.freecadweb.org/viewtopic.php?f=8&t=44973.
Yorik mentioned something very important:
yorik wrote: Fri Jul 17, 2020 12:31 pm Don't forget even if you are in one workbench, the commands from all other loaded workbenches stay available.

So the shortcuts should not be discussed for each workbench separately.

Wrong topic!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [PR 3747] CheckGeometry advanced properties shape content

Post by openBrain »

chrisb wrote: Sun Jul 26, 2020 8:45 pm There are other discussions about shortcuts: https://forum.freecadweb.org/viewtopic.php?f=8&t=44973.
Yorik mentioned something very important:
yorik wrote: Fri Jul 17, 2020 12:31 pm Don't forget even if you are in one workbench, the commands from all other loaded workbenches stay available.
So the shortcuts should not be discussed for each workbench separately.
Hey chrisb, I think you failed to post on the right topic. ;)
Could you also please move this one to 'Pull requests' subtopic ?
You can delete your post I quoted as well as this one from me, so everything stays clear. ;)
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: [PR 3747] CheckGeometry advanced properties shape content

Post by chrisb »

openBrain wrote: Mon Jul 27, 2020 8:51 am Hey chrisb, I think you failed to post on the right topic. ;)
:oops: I considered to remove my post, but that would have invalidated yours. And I don't like removeing other people's posts.
Could you also please move this one to 'Pull requests' subtopic ?
Done.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: [PR 3747] CheckGeometry advanced properties shape content

Post by TheMarkster »

Since it's in the development section now, of interest to developers:

There is a new function in Base::Interpreter() called runStringWithKey()

Code: Select all

std::string runStringWithKey(const char* psCmd, const char* key, const char* key_initial_value);
psCmd is python code in a string, e.g.: "print(key)"
key is the identifier of a python variable, e.g. "key"
key_initial_value is the value key will already have when examined by the python script, e.g. "value for a key"

Code: Select all

Base::Interpreter().runStringWithKey("print(key)\nkey='new value'\n","key","value for a key");
would execute the script and print the value of key and reset it's value to 'new value', which will be the return value of runStringWithKey().

If there is a run time error when executing the script, runStringWithKey() will return key_initial_value, so that's a way of checking if there was an error, assuming the script modifies key. If there is a runtime error the key will not be modified even if the error happens after modification.
Post Reply