Add new line and annotation to a drawing in Techdraw

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
chrisb
Veteran
Posts: 54280
Joined: Tue Mar 17, 2015 9:14 am

Re: Add new line and annotation to a drawing in Techdraw

Post by chrisb »

vocx wrote: Tue Apr 16, 2019 10:08 pm Somebody should rewrite the entire thing in Python. It's surely possible but not an easy or quick task.
Could you elaborate why this would be an improvement? I would guess that from the performance side C++ is better than Python, and performance is already critical with having it in C++.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Add new line and annotation to a drawing in Techdraw

Post by wandererfan »

doubters wrote: Tue Apr 16, 2019 5:47 pm Doesn't the FreeCAD modular structure imply the development of modules regardless of the core?
It isn't a development issue, it is a release/packaging issue. Making the change is straight forward enough. Distributing it on all the supported platforms is hard work.
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Add new line and annotation to a drawing in Techdraw

Post by wandererfan »

vocx wrote: Tue Apr 16, 2019 10:08 pm As to why TechDraw is developed in C++ and not Python, well, that's just how it went. Wandererfan knows C++, so he did it in C++.
Credit where credit is due. @mrlukeparry is the father of TechDraw.

As to why it is in C++, it was originally envisioned as an update to the Drawing module, which was written in C++. Eventually the two code bases diverged so much that it wasn't practical to continue development as Drawing2.

At the time TechDraw development started, Draft was probably the only core module written in Python.

As for rewriting it in python, sloccount says 1 year, $1M and 7 developers

Code: Select all

Total Physical Source Lines of Code (SLOC)                = 34,332
Development Effort Estimate, Person-Years (Person-Months) = 8.19 (98.33)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 1.19 (14.29)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 6.88
Total Estimated Cost to Develop                           = $ 1,106,944
 (average salary = $56,286/year, overhead = 2.40).
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Add new line and annotation to a drawing in Techdraw

Post by vocx »

chrisb wrote: Tue Apr 16, 2019 11:08 pm Could you elaborate why this would be an improvement? I would guess that from the performance side C++ is better than Python, and performance is already critical with having it in C++.
I don't think it's a question of performance, but of flexibility. Python is just better to quickly prototype new functionality; no recompilation necessary. What makes FreeCAD "slow" isn't the use of Python, it's the way the internal document object system works. That's already in C++, but we don't know if the way it was coded originally was the best way it could have been done. Maybe at some point in the future somebody will have to rework that.

Python is only slow if you have to iterate a million times doing some mathematical calculations. But that doesn't really happen in a user program like FreeCAD. The only time it really takes a long time is during loading of a file. In most user applications, 90% of the time the program just sits there waiting for input from the user. This is the same thing with our personal computers. We may have an 8-core processor and a powerful GPU card, and yet we spend most of our time reading stuff online or writing in a word processor. That takes very little processing power. Unless you are constantly playing video games, rendering photorealistic images and animations, or running complex numerical simulations (mining crypto coins), most computing power in the world is "wasted".
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Add new line and annotation to a drawing in Techdraw

Post by vocx »

wandererfan wrote: Tue Apr 16, 2019 11:33 pm ...

At the time TechDraw development started, Draft was probably the only core module written in Python.

As for rewriting it in python, sloccount says 1 year, $1M and 7 developers

Code: Select all

Total Physical Source Lines of Code (SLOC)                = 34,332
Development Effort Estimate, Person-Years (Person-Months) = 8.19 (98.33)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 1.19 (14.29)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 6.88
Total Estimated Cost to Develop                           = $ 1,106,944
 (average salary = $56,286/year, overhead = 2.40).
I seem to recall Arch, which is also in Python, already existed around FreeCAD 0.14, so that's quite a long time. I'm not sure if TechDraw was already there in the plans.

Only one million?! Huh. Let me check my wallet... eh, you know what, I don't have money at this time, but you get to it, and I'll pay you later. Deal?
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
doubters
Posts: 168
Joined: Fri Mar 18, 2016 12:53 pm

Re: Add new line and annotation to a drawing in Techdraw

Post by doubters »

wandererfan wrote: Tue Apr 16, 2019 11:18 pm It isn't a development issue, it is a release/packaging issue. Making the change is straight forward enough. Distributing it on all the supported platforms is hard work.
Means, you have already made the changes and now us just have to wait for the program to be built?
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Add new line and annotation to a drawing in Techdraw

Post by wandererfan »

doubters wrote: Wed Apr 17, 2019 8:26 am Means, you have already made the changes and now us just have to wait for the program to be built?
More or less. The Balloon feature is available in v0.19. Once the v0.18 deployment is complete, plans for backports and point releases can be developed. Usually backports are for serious flaws and glaring omissions, not so much for additional features.
User avatar
wandererfan
Veteran
Posts: 6324
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Add new line and annotation to a drawing in Techdraw

Post by wandererfan »

vocx wrote: Wed Apr 17, 2019 2:47 am Only one million?! Huh. Let me check my wallet... eh, you know what, I don't have money at this time, but you get to it, and I'll pay you later. Deal?
I think the limiting resource is the 7 developers, not the money!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Add new line and annotation to a drawing in Techdraw

Post by vocx »

That's amazing. It seems that by that time Arch already existed, as mentioned by Parry. So Arch, coded in Python, was there before Drawing2 (TechDraw).
Luke Parry wrote:It would be interesting to look at ArchVRM.py - especially for the clipping / section views. I am still terrible at python but it might be a good exercise to convert it to c++ for you :)
LOL. And this is the reason TechDraw is in C++. Basically, the developer decides what language to use. If he knows C++ he'll do it in C++. Imagine if he had converted Arch into C++. Oh, noes.
Last edited by vocx on Wed Apr 17, 2019 4:19 pm, edited 2 times in total.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply