[Feature Request] Wiring plan based on TechDraw

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by Evgeniy »

It is already possible to make a pathetic semblance of circuit into TechDraw. But this is extremely inconvenient.
And TechDraw does not allow to make accurate drawings.
tde.png
tde.png (28.58 KiB) Viewed 1869 times
But if start to turn Tech Draw into an electrical circuit editor... there is a chance it will turn to Frankenstein.

By the way, many people write here what they would like... Are you sure that Wandererfan will be able to implement all this?
As far as I understand, he writes a workbench almost alone.
user1234
Veteran
Posts: 3332
Joined: Mon Jul 11, 2016 5:08 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by user1234 »

tobiasfalk wrote: Sun Nov 20, 2022 1:28 pm There are some existing Programs where you can draw such wiring plans, but the only free that I could find was QelectroTech(https://qelectrotech.org/). My Problem with this is simple, you can not define the Page size in mm and do other things that are needed to make a good looking plan. The other options are all paid in one way or an other.
How about to make a feature request there for that little function and not a whole electro, wire and floating plan program in a CAD modeler. I also second @Evgeniy, this make in TechDraw (and FreeCAD) no sense at all. Electro, wire and floating plans are completely different to an CAD modeler. You need wire nodes diagrams (similar to footprints), blocks with nodes, terminal block diagrams, wire definitions, electro solvers, (and that all in different nation norms) and much much more. A CAD modeler is per construction completely different and not suitable for this.

Greetings
user1234
scorpio810
Posts: 1
Joined: Sun Nov 27, 2022 8:05 am
Contact:

Re: [Feature Request] Wiring plan based on TechDraw

Post by scorpio810 »

tobiasfalk wrote: Sun Nov 20, 2022 1:28 pm
Existing Programs
There are some existing Programs where you can draw such wiring plans, but the only free that I could find was QelectroTech(https://qelectrotech.org/). My Problem with this is simple, you can not define the Page size in mm and do other things that are needed to make a good looking plan. The other options are all paid in one way or an other.
QElectroTech is a program for electrical engineering drawing.

Please see this projects made with QElectroTech:
https://download.tuxfamily.org/qet/scor ... afloor.pdf
https://download.tuxfamily.org/qet/sche ... roject.pdf
https://download.tuxfamily.org/qet/sche ... a_bois.pdf
https://download.tuxfamily.org/qet/sche ... 19.qet.pdf
https://download.tuxfamily.org/qet/sche ... iagram.pdf

Other here:
https://download.tuxfamily.org/qet/schemas_pdf/

Good luck! ;-)
Last edited by scorpio810 on Sun Nov 27, 2022 11:00 am, edited 3 times in total.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by Evgeniy »

Question to @wandererfan and @edi is it possible to create a workbench like TechDraw entirely in Python?
I am a bit confused by such moments as tracking the position of the mouse, handle pressing of mouse buttons in real time,
for example for create lines etc...?
Is it possible to realize this fully by Python or this is possible only by C++ code?
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Feature Request] Wiring plan based on TechDraw

Post by wandererfan »

Evgeniy wrote: Sun Nov 27, 2022 5:31 pm Is it possible to realize this fully by Python or this is possible only by C++ code?
As far as I know, all of Qt's QGraphicsScene functionality is exposed through PySide. That would give you all the same sort of event handling and painting functions that TD uses.

What doesn't seem to work 100% is mixing C++ and Python together in the same scene. We have added objects created with Python to the QGraphicsScene in TechDraw, but then another object that should work, doesn't. Have not spent on lot of time on this, though.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by Evgeniy »

I am more interested in the moment when, say, the leader line is drawn. I.e., when the mouse moves along of the drawing, an intermittent line end is drawn at mouse position in real time at surface of draft. It seems to me so far that it is impossible to do this in Python. Or am I wrong?
If it's true, It seems to me that in order to implement such an editor, will still have to improve the C++ Tech Draw classes.
If of course you are ready to take part in it.
AnotLine.png
AnotLine.png (25.72 KiB) Viewed 1661 times
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by FBXL5 »

user1234 wrote: Sun Nov 27, 2022 2:18 am How about to make a feature request there for that little function and not a whole electro, wire and floating plan program in a CAD modeler. I also second @Evgeniy, this make in TechDraw (and FreeCAD) no sense at all. Electro, wire and floating plans are completely different to an CAD modeler. You need wire nodes diagrams (similar to footprints), blocks with nodes, terminal block diagrams, wire definitions, electro solvers, (and that all in different nation norms) and much much more. A CAD modeler is per construction completely different and not suitable for this.
At this point I would second that TechDraw is not the right place to put electric/electronic drafting tools as it is a workbench to derive views or view content from
- Objects, 3D and 2D
- Arch section planes
- Draft views
- Spreadsheets
- SVG symbols
- Bitmap images

I think electrics and electronics are complex enough to qualify for their own (addon) workbenches within FreeCAD or to use external software. TechDraw then "only" needs tools to derive views from their results and adds all the standards' stuff like frame and title block with legal notices.

If there is easy to use and to import/derive software that runs on all platforms it or its results should be integrated in a FreeCAD workflow.
If not, our swiss army knife has a few slots left to put new addon workbenches, even if it is not a 3D modeller's core competence.
User avatar
wandererfan
Veteran
Posts: 6268
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [Feature Request] Wiring plan based on TechDraw

Post by wandererfan »

Evgeniy wrote: Mon Nov 28, 2022 7:46 am I am more interested in the moment when, say, the leader line is drawn. I.e., when the mouse moves along of the drawing, an intermittent line end is drawn at mouse position in real time at surface of draft. It seems to me so far that it is impossible to do this in Python.
You can't access this in TechDraw using Python.

If you are building a new Workbench, adding a segment at the end of a line would be something like this (not complete, not tested):

Code: Select all

class myDiagramScene(QtGui.QGraphicsScene):
...
    def mousePressEvent(event):
        if self.mode == "DrawingALine":
            self.emit(QtCore.SIGNAL("addPoint(event.scenePos())")


class myLinePainter(QtGui.QGraphicsPathItem):
    def __init__(self, parentItem, scene):
        self.path = QtGui.QPainterPath()
        self.connect(self.scene(), SIGNAL("addPoint(QPointF)"), self.slotAddPoint(QPointF))

    def slotAddPoint(newPoint):
        self.path.lineTo(newPoint)
        self.setPath(self.path)
    
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by Evgeniy »

@wandererfan thanks but, unfortunately, this example will not be to make clear this theme to me. I don't have that much experience in Qt. I have not found nothing implementing something like Tech Draw in FreeCAD by Python.
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by edi »

Evgeniy wrote: Sun Nov 27, 2022 5:31 pm Question to @wandererfan and @edi is it possible to create a workbench like TechDraw entirely in Python?
Before thinking of the creation of a whole Python created workbench in FreeCAD I have three questions:

1) How to open a subpage in the mainwindow of FreeCAD ?

The new workbench has to do this when becomes started. TechDraw does this if you create a new Page. Its not just open a subpage. Inside this subpage it must be possible to manage your special created Document Objects using your Viewproviders. (TechDraw creates a Document Object of type 'TechDraw::DrawViewPart' which is managed by a viewprovider of type 'TechDrawGui::ViewProviderViewPart' see later)

2) How to define a Document Object in Python ?

A Document Object (in short) is everything you can see in the Model Tree. If you create a TechDraw view an object of type 'TechDraw::DrawViewPart' becomes created. If you create a leader line an object of type 'TechDraw::DrawLeaderLine' becomes created. As far as I know only Document Objects of type 'Part::FeaturePython' can be defined free in Python. If myObject is a Document Object you can find its type by typing myObject.TypeId in the Python console.

3) How to define a ViewProvider in Python ?

A ViewProvider (in short) is the program which does all the stuff on the screen, like move or stretch a Document Object. If you move a view it is done by an object of type TechDrawGui::ViewProviderViewPart. A leader line is managed by an object of type TechDrawGui::ViewProviderLeader etc. Each Document Object is connected to its own Viewprovider. The Viewprovider is called by signals emitted by the program which controls the mouse. If myObject is a Document Object you can find its Viewprovider typing myObject.ViewObject.TypeId in the Python console.

I am sure my list of questions is not complete. As long as this fundamental questions cannot be answered it makes no sense to discuss about details like how to draw a line.
Evgeniy wrote: Mon Nov 28, 2022 3:45 pm I don't have that much experience in Qt.
Documentation of the Qt graphic system: https://doc.qt.io/qt-6/qgraphicsscene.html Scroll down to Detailed Description. Some 100 pages. Without understanding this documentation it is not possible to create graphics in Qt. The Viewproviders use Qt graphics very intensive.
Post Reply