Python Forum
Projected Surface in 2D [Difficult topic] - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Projected Surface in 2D [Difficult topic] (/thread-4236.html)



Projected Surface in 2D [Difficult topic] - Hans_K - Aug-01-2017

Hello Phyton colleagues ,

The difficulties I face:

When I import a part in Freecad I want to know the projected surface of the part automatically.

In the Phyton code below, I have to :
1. Select the faces Individually
2. Run the script
3. Place all the values of the calculated areas in Excel so I can make an Autosum and have the total area.

This is a lot of work if there are more then 15 faces. Can this be improved in some other way? Automatic selection and calculation?

Notice: This is my third day I work with Phyton, The script I use is from the forum because I first searched if there was a solution to this problem.
I have installed the latest version of Phyton + Freecad.

I will check for answers regularly .
Thank you in advance.


Used script:


area = 0.0
>>> for o in Gui.Selection.getSelectionEx() :
... for s in o.SubObjects:
... area = s.Area
... print area


RE: Projected Surface in 2D [Difficult topic] - nilamo - Aug-01-2017

I don't even know what these are: https://phyton.com/

I'm not sure what you're trying to do, but it probably can't be done automatically until you write the code to make it happen automatically.


RE: Projected Surface in 2D [Difficult topic] - Hans_K - Aug-02-2017

It is in FreeCAD But I think I am on the wrong forum


RE: Projected Surface in 2D [Difficult topic] - Larz60+ - Aug-02-2017

Perhaps not this question, but, reading the the who for statement
Quote:Who is FreeCAD for? A couple of user cases:
...
The programmer. Almost all of FreeCAD's functionality is accessible to Python. You can easily extend FreeCAD's functionality, automatize it with scripts, build your own modules or even embed FreeCAD in your own application.



RE: Projected Surface in 2D [Difficult topic] - Hans_K - Aug-02-2017

Yes, but this is more a forum where freecad isn't implemented I think.
Because most of the topics aren't related to 2 and 3D questions.
Although I think my question isn't that difficult.


RE: Projected Surface in 2D [Difficult topic] - Larz60+ - Aug-02-2017

you are correct, but if you need python help (later on) you know where we are


RE: Projected Surface in 2D [Difficult topic] - Hans_K - Aug-02-2017

Yes that's true . I have posted the question also in the freecad forum but hadn't got an answer either.
Thanks in advance.