[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
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: [Feature Request] Wiring plan based on TechDraw

Post by onekk »

wandererfan wrote: Sat Jan 21, 2023 2:37 pm ...
Why SVG, as a symbol could be a simple "trace" maybe traced using a Macro or code that will use Part or Draft primitives, ISO symbols are not too difficult to implement, and many things, could be resued in the code, an inductor and a variable inductor or resistance has many thing in common.

Similar approach is used as exmaple in CircuiTikz to draft schematics using Latex, each component expose the position of pins as "nodes" and route wires are attaching to these nodes, if you change something, like the position of the component, chances are that you have to modify very few things.

as example a resistors could be coded to have some properties:
- orientation (horizontal or vertical)
- value (it has to see how text could be managed across different OS)
- variable True or False

and expose three properties:

P1
P2
P3 for variable resistors

quite the same for an inductor that could be reused as a coil in a relay "assembly" that could be reusing a swich for the contacts and nmaybe names (S1, S2, S3 and so on).

The relay is an "aggregation" of a switcth, an inductor and a box that surround them plus few other things.

pins could be exposed as "global coordinates" to be retrieved for connecting wires, so R1.P1 in an expression could be used to specify the position of the P1 of the object named R1, if you change orientation the values in P1 and P2 are modified and the schematics could be modified.

What I don't know it this could be easily done in TechDraw, and if properties could be retrieved easily as global coordinates to be used to retrieve start and ending point for a wire route.

Sorry for the intrusion.

Regards

Carlo D.
Last edited by onekk on Sun Jan 22, 2023 6:58 am, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
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 »

onekk wrote: Sat Jan 21, 2023 4:50 pm Why SVG, as a symbol could be a simple "trace" maybe traced using a Macro or code that will use Part or Draft primitives, ISO symbols are not too difficult to implement, and many things, could be resued in the code, an inductor and a variable inductor or resitance has many thing in common.
That's why I wanted to separate the representation from the definition. I hadn't really thought beyond pictorial representations (svg, png, QPainterPaths, etc), but an executable "proxy" sounds slick.
User avatar
tobiasfalk
Posts: 93
Joined: Fri Feb 05, 2021 2:35 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by tobiasfalk »

The reason why I personally think that using SVG's is a good Idea is that, they can be seen with other programs and even on github, this would make managing a symbol library easier.
Using SVG's would also have the benefit of not needing to create a own editor for creating symbols, this is because with svg's you could use inkscape for creating the drawing and the description tag and so you add with the xml editor or if made with a special inkscape plugin(A FreeCAD TD inkscape plugin is in my a mus especially for creating templates but this is a other discussion).
The reason why would do the description and so also in to the same file as the symbol is simple, if you do them in different file it will be kind of a mess to manage them.
But then again making a FreeCAD own language would have the benefit of creating features specific to FreeCAD and give some kind of control over what things are allowed and what not.
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by edi »

wandererfan wrote: Wed Jan 18, 2023 11:36 pm try the latest version, it should make traces. ...
unfortunately traces start allways at position 100/-100.

In "Add Trace to Diagram", after fixing the two symbols and their ports in the dialog, the next called slot is TracePencilController.begin
In this situation TracePencilController.startPos is allways 100/-100 which has been set by the function symbolAdd.

SvgPainter.setSymbol has not been called, because repaintDiagram is not called before starting the creation of the trace. Following in SvgPointer.itemChange the value self.Symbol is allways false, furthermore the moved symbol never receives a new position.
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 »

edi wrote: Sat Jan 28, 2023 3:26 pm
There is a new version on Github. I think it solves the issues you've reported. It also redraws the trace as the from or to symbol is dragged. Next task is to edit the intermediate points.
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: [Feature Request] Wiring plan based on TechDraw

Post by edi »

wandererfan wrote: Mon Jan 30, 2023 2:10 pm There is a new version on Github. ...
- Trace is starting at the from symbol, OK.
- Trace is moving if the symbols are moved, OK.

Existing workflow:
- The user has to load each symbol (Key, Switch, Lamp) several times. Problem: each Lamp has the name lamp, all switches have the same name etc.
- then insert the symbols. Here you may confuse the three lamps.

My workflow idea is:
- The user loads several symbols from files into the symbol list, e.g. one Key, one Switch, one Lamp.
- Then inserts the symbols into the diagram. e.g. three lamps, two switches etc.
- After this creates traces between this symbols.

In the existing version the program becomes confused if there are two or more copies of the same type of symbol in the diagram. The end of the trace switches between the symbols of same type if they are moved.
I think it is necessary to have two different symbol lists:
1. The existing list of available symbols, as shown in the "Symbols in Diagram" window. The list should be named "Available Symbols".
2. A second (internal) list of all symbols actual added to the diagram. In this list one type (e.g. Lamp) can exist several times.
maxwxyz
Posts: 159
Joined: Sat Dec 31, 2022 2:42 pm
Location: Munich, Germany
Contact:

Re: [Feature Request] Wiring plan based on TechDraw

Post by maxwxyz »

Take a look here: viewtopic.php?t=75340
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 »

maxwxyz wrote: Wed Mar 15, 2023 5:45 pm Take a look here: viewtopic.php?t=75340

From TechDraw_Roadmap
"allow graphics to be added to a drawing page as on a transparent overlay in traditional drafting. This will build on the SymbolsAndTraces research project and @Evgeniy's schematic workbench."
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 wrote: Wed Mar 15, 2023 6:18 pm
maxwxyz wrote: Wed Mar 15, 2023 5:45 pm Take a look here: viewtopic.php?t=75340

From TechDraw_Roadmap
"allow graphics to be added to a drawing page as on a transparent overlay in traditional drafting. This will build on the SymbolsAndTraces research project and @Evgeniy's schematic workbench."
maxwxyz wrote: Wed Mar 15, 2023 5:45 pm Take a look here: viewtopic.php?t=75340
I understand someone wants to borrow my Qt source 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: Sat Mar 18, 2023 7:10 pm I understand someone wants to borrow my Qt source code...
Possibly. Depends on whether or not we can negotiate a suitable licensing arrangement. :)

The SymbolsAndTraces proof of concept is heavy on object management and light on drawing at the moment.

From what I've seen, FreeCAD_Electric makes a lot of DocumentObjects, which may cause problems down the road, but the drawing function are much more developed.

A blend of the two seems like a good fit.
Post Reply