Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

manuelkrause wrote: Wed Oct 03, 2018 10:27 am @wandererfan:
I'm not used to compound shapes. Would it be able to keep per face color & transparency info for the single faces - in combination with the proper toponaming relative info?
Colours are (usually) a ViewProvider Property and ViewProviders don't know anything about Shapes. And Shapes are a thin layer over OCC TopoDS_Shapes which don't know anything about colour.

So, if you're willing to save the ViewProviders for all the components of the Compound, you can keep all your Appearance settings.

But! We don't use the original VPs. We just keep the Shape. So you'll have to save your color info outside of the DocumentObject/ViewProvider framework.

wf
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

wandererfan wrote: Wed Oct 03, 2018 12:57 pm
manuelkrause wrote: Wed Oct 03, 2018 10:27 am @wandererfan:
I'm not used to compound shapes. Would it be able to keep per face color & transparency info for the single faces - in combination with the proper toponaming relative info?
Colours are (usually) a ViewProvider Property and ViewProviders don't know anything about Shapes. And Shapes are a thin layer over OCC TopoDS_Shapes which don't know anything about colour.

So, if you're willing to save the ViewProviders for all the components of the Compound, you can keep all your Appearance settings.

But! We don't use the original VPs. We just keep the Shape. So you'll have to save your color info outside of the DocumentObject/ViewProvider framework.

wf
Thank you that you even try to explain it to me. But I'm really lacking knowledge. It's a wonder that my previous coding attempt worked somehow like the-inspired-by-you @kbwbe's compound shape code.

What's a ViewProvider doing?
OCC TopoDS_Shapes are shipping the basic geometrical info, and the 'Shapes' you mention make them usable for FC, am I right?

According to debug info, my old coding stored the unified colors&transparency into diffuseColor per face of each importableObject. Nothing else does the currently not implemented compound-shapes code, IMO. Am I wrong with this assumption?

TIA, for adding some light!
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

kbwbe wrote: Wed Oct 03, 2018 12:43 pm ...
@manuelkrause:
Hi Manuel,
just at moment i am not working on file importer, as there is still no decision how to handle basic topological naming. I will need some time. Because this, there is no activity ATM regarding improved color management.
Hi Klaus,
ATM I'm quite glad that you don't intend immediate forced development on "improved color management".
I'd need quite some time to figure out what portions of my coding were only workarounds to overcome the effects of what is fixed by recent "viewProviders" fix by @wandererfan (highly recommended IMO BTW) and what were adding the advantages of preserving colors&transparencies from imported parts and sub-assemblies.
As these issues/ tasks were mixed at the time of my coding, I admit that it's a tough job ahead for me...
Please keep in mind, I'm repeating myself, that the compound-shape aproach is still working on here.
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

kbwbe wrote: Wed Oct 03, 2018 12:43 pm Hi @Turro75, @manuelkrause, @wandererfan,

i tried to fix Turro's issue on win10 regarding updateImportedParts(). Working on this, i found another unicode issue during duplicating parts. Both things are hopefully fixed now. Devel branch has been updated again.

Please test, as i want to update master-branch as soon as possible. @wandererfan 's improvements regarding display modes are inside of devel, but not in master. So it will be good to update master soon.
...
@kbwbe:
Just tested with devel of 1/2h ago:
Importing, duplicating, updating, converting and 'edit Part' on my Linux: Still everything working fine !
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Another approach to assembly solver (A2plus)

Post by wandererfan »

manuelkrause wrote: Wed Oct 03, 2018 5:09 pm What's a ViewProvider doing?
OCC TopoDS_Shapes are shipping the basic geometrical info, and the 'Shapes' you mention make them usable for FC, am I right?

According to debug info, my old coding stored the unified colors&transparency into diffuseColor per face of each importableObject. Nothing else does the currently not implemented compound-shapes code, IMO. Am I wrong with this assumption?
Most modules are divided into an App side and a Gui side. A ViewProvider is the connection between the two sides. If you look at the "View" tab in the property editor, you are looking at the ViewProvider's properties. The "Data" tab is from the Feature on the App side.

If you're using DiffuseColor, you're into the Material module Material) and the Appearance option from the RMB context menu. I'm not familiar with Material, so I can't help you much. I believe the components of a Compound can have different Materials(and therefore different DiffuseColor, etc), but don't bet too much money on that.
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

Turro75 wrote: Wed Oct 03, 2018 7:36 am
kbwbe wrote: Tue Oct 02, 2018 1:28 pm
@Turro75,
please test whether it is working for you on windows or not...
Ok it is working on Win10,
I still get the error if the edited obj hasn't closed

Code: Select all

Running the Python command 'a2p_updateImportedParts' failed:
Traceback (most recent call last):
  File "C:\Users\xxxx\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_importpart.py", line 443, in Activated
    updateImportedParts(doc)
  File "C:\Users\xxxx\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_importpart.py", line 413, in updateImportedParts
    importPartFromFile(doc, absPath, importToCache=True) # the version is now in the cache
  File "C:\Users\xxxx\AppData\Roaming\FreeCAD\Mod\A2plus\a2p_importpart.py", line 171, in importPartFromFile
    importDoc = FreeCAD.openDocument(filename)

The project 'C:\Users\xxxxreplacement\cubo1.FCStd' is already open!

@Manuel

the importer is ignoring the color of the single face, it imports only the whole shape color. May be I miss something in the previous posts, it is an intended behavior?

cubo1 is fully green while cubo2 has a violet face over a green shape. both are imported as green only.


regarding the complete FC version output: menu help->about FreeCAD -> copy to clipboard
then paste in a text field.
Do you like someting like this:
I don't see 'violet' color but 'blue'. But the Face color can get duplicated with my code.

I've now reduced my "improved-color-import" locally to the lowest possible degree from former states and added all nice features.

@kbwbe: Please reset my "improve-color..." branch(es) to the current devel-branch.

@Turro75: I'm even able to gather your single face color. Although I don't get it as "violet". In my eyes it's blue:

Screenshot_20181005_191152.png
Screenshot_20181005_191152.png (69.15 KiB) Viewed 1098 times
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

manuelkrause wrote: Fri Oct 05, 2018 5:29 pm @kbwbe: Please reset my "improve-color..." branch(es) to the current devel-branch.
Hi Manuel,
please find fresh branch "improve-color-import" on github, based on recent "devel" branch.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
User avatar
manuelkrause
Posts: 442
Joined: Thu Jul 05, 2018 7:16 pm

Re: Another approach to assembly solver (A2plus)

Post by manuelkrause »

kbwbe wrote: Fri Oct 05, 2018 5:45 pm
manuelkrause wrote: Fri Oct 05, 2018 5:29 pm @kbwbe: Please reset my "improve-color..." branch(es) to the current devel-branch.
Hi Manuel,
please find fresh branch "improve-color-import" on github, based on recent "devel" branch.
Thank you very much,
I'd prepare something usable for github, during tomorrow. I just want to be sure on here, before you gonna test it.
Then I'd post a PR.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Another approach to assembly solver (A2plus)

Post by triplus »

How extensively is NumPy being used for A2plus (solver) purposes? If the usage is noticeable it might be worth to keep an eye on performance:

https://forum.freecadweb.org/viewtopic. ... 40#p260580

That is measure the difference between PPA and Conda based AppImage:

https://github.com/FreeCAD/FreeCAD/releases
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

triplus wrote: Fri Oct 05, 2018 7:37 pm How extensively is NumPy being used for A2plus (solver) purposes? If the usage is noticeable it might be worth to keep an eye on performance:

https://forum.freecadweb.org/viewtopic. ... 40#p260580

That is measure the difference between PPA and Conda based AppImage:

https://github.com/FreeCAD/FreeCAD/releases
Hi @triplus,
the solver of A2plus is not using NumPy. It uses FC's Vector+Placement Interfaces for Python.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Post Reply