PD NEXT: Mapping change and support

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

PD NEXT: Mapping change and support

Post by abdullah »

Hi!

One bug is annoying me lately.

In my workflow I generally attach a plane to a face via FlatFace because it is just selecting the face and clicking the sketch. Then I change to "translate" mapping via editing the property (either for robustness via expression, or to reposition it in case of a loft). When I do this the support is maintained (it is still the face I used for FlatFace). If I reposition this feature in another order (prior in the tree of the one that originally generated the face), the I get a DAG error.

I think that: when a mapping is changed, the support has to be evaluated to see if it is still compatible with the new mapping. Examples of non compatible supports can be:
1. From FlatFace to translate.
2. From FlatFace to onEdge.

There are basically tons of incompatible combinations.

The detection could be done as here:
https://github.com/abdullahtahiriyo/Fre ... 7cdabf128a

In that commit, it also deletes the support if the new mapping is not valid. I am not sure which should be the solution. I can think of:
1. Delete the support.
2. Annoy the user with a pop-up of TaskAttachment so that he can delete the support, or change it or add more supports to it. (this should be done by the Gui:DocumentObject)
3. Any suggestion?
ickby wrote: ... summoning ...
If you would check that commit and give me some feedback, I would welcome it.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PD NEXT: Mapping change and support

Post by DeepSOIC »

Hi!
I don't like the idea of clearing the support if the attachment mode is incompatible. This can mess with attachment editor quite seriously.

And I don't understand your problem. Can you explain it in a more bug-report manner, i.e. give step-by-step instructions, what you expect and what happens?
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PD NEXT: Mapping change and support

Post by abdullah »

DeepSOIC wrote:i!
I don't like the idea of clearing the support if the attachment mode is incompatible. This can mess with attachment editor quite seriously.
It is not necessarily the solution. Maybe only an specific solution for my particular problem. I just wanted to come having done the homework. The attachment editor seems happy in my trials ;)
DeepSOIC wrote:And I don't understand your problem. Can you explain it in a more bug-report manner, i.e. give step-by-step instructions, what you expect and what happens?
Sure!

Let's start from here:
pd_support_init.png
pd_support_init.png (32.34 KiB) Viewed 1749 times
All the datum planes are "translate" and the sketch of the following feature is on the previous datum plane.

Now with the latest feature (Pad002) active, lets select the bottom face and create a datum plane "FlatFace" on it:
pd_support_init1.png
pd_support_init1.png (41.51 KiB) Viewed 1749 times
Let's use the property editor to change the attachment mode to "translate". You can see in the python console that the support is still assigned.
pd_support_init2.png
pd_support_init2.png (93.97 KiB) Viewed 1749 times
Now let's create a sketch and a pocket on this plane:
pd_support_init3.png
pd_support_init3.png (78.33 KiB) Viewed 1749 times
continues...








The starting point in case you need it:
pd_support1.fcstd
(23.3 KiB) Downloaded 31 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PD NEXT: Mapping change and support

Post by abdullah »

Now let's reorder the features:
pd_support_init4.png
pd_support_init4.png (82 KiB) Viewed 1749 times
The support is in Pad002, so the DAG is very unhappy (see report window).

The solution is, to my knowledge, only possible from python, see python console:
pd_support_init5.png
pd_support_init5.png (90.85 KiB) Viewed 1749 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PD NEXT: Mapping change and support

Post by DeepSOIC »

So with your change, I can't change MapMode property to some nonsense, and then switch it back and get it all working as it used to... I'm afraid I can't like this behavior.

Translate mode with a face as support should cause an error, but seems like it doesn't.

With your example, I recommend you do this:
1. select face, click Datum Plane
2. in attachment editor, erase the linked face, and click OK.
Done! The plane is free to be moved around, not attached to anything so no dep. graph issues, and in right position.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PD NEXT: Mapping change and support

Post by abdullah »

DeepSOIC wrote:So with your change, I can't change MapMode property to some nonsense, and then switch it back and get it all working as it used to... I'm afraid I can't like this behavior.
No. You can't (to the first sentence). You have to choose among:
1. Allow an incorrect support and get it all working if you switch back to a map that does support your previous support.
2. Remove the support if incorrect.
3. Change the DAG algorithm so that it does not take into account the support if incorrect for the working mode.
4. Warn the user
4a. 4 and ask him what he wants to do.

In 4a, I guess that if it was changed by mistake he will go for 1, if the change is intended he will probably choose 2.
DeepSOIC wrote:Translate mode with a face as support should cause an error, but seems like it doesn't.
Yes, and it is not the only combination that should cause an error. Showing an error is the minimum it should do IMO. I have the code to check for an incorrect mode-support combination, so it costs me nothing to show an error in the error console. However, I was hopping for doing something more than that for the user.
DeepSOIC wrote:With your example, I recommend you do this:
1. select face, click Datum Plane
2. in attachment editor, erase the linked face, and click OK.
Done! The plane is free to be moved around, not attached to anything so no dep. graph issues, and in right position.
For the example with a datum plane, now I realised that I can double click to bring the attachment editor on screen. In the case of a sketch, I will have to "reorient sketch" and ok to remove support cancel to reorient. Is there any way to call on the attachment editor for a sketch? Shouldn't it be something like a button on the bar for both?

In any case, I deem unacceptable to silently ignore a wrong support. FreeCAD should do something. Minimum is throwing an error to the error console. I would welcome some kind of possibility to interact with the user. What do you think?
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: PD NEXT: Mapping change and support

Post by triplus »

abdullah wrote:In any case, I deem unacceptable to silently ignore a wrong support. FreeCAD should do something.
Exclamation mark in the tree view suggesting feature has a wrong support?
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: PD NEXT: Mapping change and support

Post by abdullah »

triplus wrote:
abdullah wrote:In any case, I deem unacceptable to silently ignore a wrong support. FreeCAD should do something.
Exclamation mark in the tree view suggesting feature has a wrong support?
I really do not know how that exclamation mark works. I will have to look it. I like the idea of seeing it in the tree view. I am not sure if the exclamation is the right thing, as I do not know if it is actually used with another meaning (like when the sketcher is unsolved and there is no way you can continue working with that, whereas you could theoretically continue working with this issue here, even if eventually you may encounter difficult to unveil trouble for a general user). I am not sure, but I add it to the brainstorming list.

So notification is:
1. Error in the error console.
2. Potentially an exclamation mark in the tree view.

I would welcome more user input. What does a user want here?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PD NEXT: Mapping change and support

Post by DeepSOIC »

abdullah wrote:Is there any way to call on the attachment editor for a sketch?
Yes. Switch to Part WB. Select the sketch, and invoke Part->Attachment from the menu.

I initially wanted to add it to Edit menu, to be available in all workbenches. However my change wasn't accepted because it was "spaghetti code" (FreeCAD itself requesting features from other module).
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: PD NEXT: Mapping change and support

Post by DeepSOIC »

triplus wrote:
abdullah wrote:In any case, I deem unacceptable to silently ignore a wrong support. FreeCAD should do something.
Exclamation mark in the tree view suggesting feature has a wrong support?
It used to do that in past. It looks like it's broken.
Post Reply