26

(129 replies, posted in Import DXF)

Do dxf files include scaling or dimensioning for the existing values?

When I look at the file Laurent attached in this post (https://qelectrotech.org/forum/viewtopi … 379#p20379), I see a value of 0.7158 for the terminal strip width, for example. That won't be millimetres and inches don't seem to be the unit for the values either. A suitable value might be something like 35 mm, as the terminal spacing (from screw to screw) would then be about 5 mm or 2/10 of an inch.

Since this drawing has to be scaled anyway in order to use it sensibly in QET, it would be very practical if the dimensioning of the values came directly from the dxf file. Then no additional effort would be required to obtain a suitable size of the element.

First of all: Use Forum-search!

With the words/phrases "color", "colour" and "to all conductors" I found these threads that should help with your problem:
https://qelectrotech.org/forum/viewtopi … 710#p19710
https://qelectrotech.org/forum/viewtopi … 263#p20263
https://qelectrotech.org/forum/viewtopi … 350#p20350

What Operating-System and what QET-Version do you use?
Menu -> Help -> about QElectroTech -> Tab: Version
Then copy contents and post here.

1. (second part): use QET_ElementScaler

2.: see (and read) longest thread in "Import" - forum

3.: pull the new/reworked element in Circuit-Editor. QET will ask, if you want to replace existing elements.

4.: depends on number of rows and columns you use: You decide!

5.: there is no grouping-function in Element-Editor (yet)

29

(2 replies, posted in Import DXF)

What do you mean with "can't use it"?

An element with the name 942315m is in the user-collection.
So just pull it onto the schematic!

Can you open the element in Element-Editor by double-clicking?
Then save it before trying to use it in Circuit-Editor.

Maybe the use of dxf2elmt results in a better element?
Give it a try...

did you read here?
https://qelectrotech.org/forum/viewtopi … 620#p19620
Not exactly what you mean, but the possibility to show the desired information in a schematic.

Hello wilko67,

create a splice element that is NOT defined as a terminal, then you can use any conductor or colour.
To do this, drag the existing element from the QET collection into the user collection and double-click on it. The element editor opens and you set the desired properties for the element there.

You and the users of the circuit diagram should be aware that this has nothing to do with rule-compliant electrical engineering. nomicons/wink

32

(129 replies, posted in Import DXF)

Hello Vadoola,

the angles for the graphic element "arc" are available as integers without decimal places in QET.
I have not made a local git-repository of your code, so here only as git-style diff:

--- arc_org.rs    2024-09-11 13:01:30.000000000 +0200
+++ arc.rs    2024-09-15 19:00:49.030338390 +0200
@@ -10,9 +10,9 @@
         arc_xml.add_attribute("width", two_dec(self.radius * 2.0));
         arc_xml.add_attribute("height", two_dec(self.radius * 2.0));
         if self.start_angle < 0.0 {
-            arc_xml.add_attribute("start", two_dec(-self.start_angle));
+            arc_xml.add_attribute("start", -self.start_angle.round());
         } else {
-            arc_xml.add_attribute("start", two_dec(self.start_angle));
+            arc_xml.add_attribute("start", self.start_angle.round());
         }
 
         let temp = if self.start_angle > self.end_angle {
@@ -22,9 +22,9 @@
         };
 
         if temp < 0.0 {
-            arc_xml.add_attribute("angle", two_dec(-temp));
+            arc_xml.add_attribute("angle", -temp.round());
         } else {
-            arc_xml.add_attribute("angle", two_dec(temp));
+            arc_xml.add_attribute("angle", temp.round());
         }
         arc_xml.add_attribute("antialias", "false");
         if self.thickness > 0.1 {

33

(129 replies, posted in Import DXF)

Hello Vadoola!
Salut Laurent !

With such conversion tools, we should always consider what the end result should be used for!
As we say in German: "The worm must taste good to the fish, not to the fisherman!"

I have already said this in other forum posts:
QET is primarily a program for electrical (pneumatic, hydraulic, etc.) circuit diagrams with the additional function of also sketching assembly plans.
QET is not a tool for drawing exact scales on a specific paper format. Therefore, in my opinion, we do not need the full precision with 14 decimal places and the 100% precise approximation of polygons to splines from the dxf file.

This is also the reason why I try to reduce the size of polygons in the QET_ElementScaler if, for example, two successive points lie on top of each other, but that's another topic...

My knowledge of DXF is poor, but as I see it, many commercial programs, for example, export single circles as multiple splines, which can never become a space-saving circle or ellipse again when converting. Unless you rework the element in the element editor by hand, which in the end often leads to the realization that you could have drawn the element yourself more easily and, above all, more quickly...

So here, too, we have to find a good compromise between "I recognize the essential features of the element" and the absolute precision of the original drawing. This also includes the polygons with only one point each: The original dxf program must have "thought" of representing some parts as 1-point polygons, but do we need that in the QET element? I didn't find anything missing from the example!

On the contrary:
In the dxf and therefore also in the resulting QET element, there are very often polygons that lie directly on top of each other, but which are not recognizable as individual graphic elements.
Nowadays, this is often due to the fact that devices are no longer made from several 2D drawings, but are created directly as 3D models. A 2D dxf drawing is then made from this, which accordingly also contains many hidden lines that inflate the resulting QET element, but do not provide any additional information.

This is in no way intended to criticize antonioaja's and Vadoola's work: On the contrary!
I really appreciate the work, but we should also think about the purpose of the result.
With this discussion I would like to make the program even better!

34

(129 replies, posted in Import DXF)

Hello Vadoola!
Salut Laurent !

Some questions about default settings in dxf2elmt:

In all dxf drawings I had to convert so far, the individual splines were not really long or complex. That's why I'm wondering whether we really need 100 segments in the corresponding polygon for each spline as a default setting for the conversion to QET elements?
I have tried a few files with different numbers of polygon segments and I think that 10 or 12 points should be enough for good results.

Do we really need the full precision of up to 14 decimal places from dxf for use in QET elements?
For all graphical elements in the element editor, a maximum of two decimal places can be entered or edited and the graphical editor only allows changes in the tenths range. Therefore, in my opinion, it is completely sufficient to use a maximum of two decimal places in conversion programs for QET elements.

Both default settings lead to the element files being unnecessarily bloated, which can only be corrected very poorly or not at all with the element editor's on-board tools.

An example is attached:
One of the two elements "weighs" only 292.9 kB, the other "weighs" 3.4 MB! A factor of almost 12 – in this case I would say: Size does matter!  nomicons/wink
(Remark: In the elements used in the appendix, I have inserted a meaningful definition line by hand so that QET displays the elements correctly.)

I can correct the number of decimal places with QET_ElementScaler, but I can't reduce the number of polygon points of converted splines with it...

In this context:
I also noticed that the converted element file contains polygons with a only one point! QET_ElementScaler filters them out, but should they not be eliminated from the element file in the first place? 

Best regards
  plc-user

35

(129 replies, posted in Import DXF)

vadoola wrote:

Thanks this gives me a place to start looking.

Maybe just look at this post: nomicons/wink
https://qelectrotech.org/forum/viewtopi … 299#p20299

The compiler shows no warnings or errors and the result works for my example-files.

36

(129 replies, posted in Import DXF)

plc-user wrote:

So the information, if a polyline is closed or not, is already available in the code ... somewhere.
But with NO knowledge of rust and the internals of dxf2elmt it's hard for me ...  nomicons/wink

Please try with the modified code from the attachment.
It seems to be working that the "closed-Flag" is read correctly...   nomicons/smile

37

(129 replies, posted in Import DXF)

In a deep subdirectory, from the compiled result I find the file "entities.rs" with (among other things) this content:

impl LwPolyline {
    pub fn get_is_closed(&self) -> bool {
        self.flags & 1 != 0
    }
    pub fn set_is_closed(&mut self, val: bool) {
        if val {
            self.flags |= 1;
        }
        else {
            self.flags &= !1;
        }
    }
    pub fn get_is_pline_gen(&self) -> bool {
        self.flags & 128 != 0
    }
    pub fn set_is_pline_gen(&mut self, val: bool) {
        if val {
            self.flags |= 128;
        }
        else {
            self.flags &= !128;
        }
    }
}

So the information, if a polyline is closed or not, is already available in the code ... somewhere.
But with NO knowledge of rust and the internals of dxf2elmt it's hard for me ...  nomicons/wink

38

(129 replies, posted in Import DXF)

the commandline for dxf2elmt is put together here:
https://github.com/qelectrotech/qelectr … mt.cpp#L42

<pathToBinary>dxf2elmt <dxf-file> -v

39

(129 replies, posted in Import DXF)

about "closed=true" or "closed=false"

when I look at the dxf-documentation there is a flag with POLYLINEs and LWPOLYLINEs that declares closed or not with groupcode 70:
https://help.autodesk.com/view/OARX/202 … F04D757A50
(sorry, it's German language)

in the dxf-file "Arrows.dxf" (see previous post) from line 2682 I find this:

AcDbPolyline
 90
    5
 70
    1
 43
0
 10
143.090474
 20
250.418834

and similar from line 2724 for the other lwpolyline.

When I change the entries "70  1"  to "70   0" the polygons are shown open in LibreCAD.
I therefore think that it should be possible to be implemented in dxf2elmt...  nomicons/wink

40

(129 replies, posted in Import DXF)

here some information with different calling of the original binary downloaded from release-section of repo:

calling the original binary produces elmt-file:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt Arrows.dxf 
Arrows.dxf loaded...
Arrows.elmt was created... 
Now converting Arrows.dxf...
Conversion complete!

STATS
~~~~~~~~~~~~~~~
Circles: 0
Lines: 0
Arcs: 0
Splines: 0
Texts: 0
Ellipses: 0
Polylines: 0
LwPolylines: 2
Solids: 0
Currently Unsupported: 0

Time Elapsed: 4 ms
--------------------------------------------------------------


with additional parameter "-v" at the end outputs to stdout:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt Arrows.dxf -v
<?xml version = "1.0" encoding = "UTF-8"?>
<definition height="10" width="10" hotspot_x="0" hotspot_y="0" version="0.80" link_type="simple" type="element">
    <uuid uuid="{6aafe71d-c84c-4072-9428-13dd585a4568}" />
    <names>
        <name lang="en">Arrows</name>
    </names>
    <informations>Created using dxf2elmt!</informations>
    <description>
        <polygon x1="143.090474" y1="-250.418834" x2="136.739192" y2="-242.452654" x3="139.746475" y3="-242.452654" x4="139.74493" y4="-218.55257" x5="143.092019" y5="-218.55257" closed="false" antialias="false" style="line-style:normal;line-weight:thin;filling:none;color:black" />
        <polygon x1="144.367876" y1="-232.490765" x2="150.717614" y2="-240.456945" x3="147.711876" y3="-240.456945" x4="147.711876" y4="-250.418918" x5="144.363242" y5="-250.418918" closed="false" antialias="false" style="line-style:normal;line-weight:thin;filling:none;color:black" />
    </description>
</definition>
--------------------------------------------------------------

change the order of the parameters does not work at all:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt -v Arrows.dxf 
Error: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })
ich@home:~/.qet/binary$ 
--------------------------------------------------------------

now some tests with Vadoolas code:

calling Vadoolas code without parameters produces elmt-file:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt Arrows.dxf 
Arrows.dxf loaded...
Arrows.elmt was created... 
Now converting Arrows.dxf...
Conversion complete!

STATS
~~~~~~~~~~~~~~~
Circles: 0
Lines: 0
Arcs: 0
Splines: 0
Texts: 0
Ellipses: 0
Polylines: 0
LwPolylines: 2
Solids: 0
Currently Unsupported: 0
--------------------------------------------------------------

additional parameter "-v" at the end only outputs info, no elmt-file:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt Arrows.dxf -v
Conversion complete!

STATS
~~~~~~~~~~~~~~~
Circles: 0
Lines: 0
Arcs: 0
Splines: 0
Texts: 0
Ellipses: 0
Polylines: 0
LwPolylines: 2
Solids: 0
Currently Unsupported: 0

Time Elapsed: 1 ms
--------------------------------------------------------------

here the order of parameters does not matter:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt -v Arrows.dxf
Conversion complete!

STATS
~~~~~~~~~~~~~~~
Circles: 0
Lines: 0
Arcs: 0
Splines: 0
Texts: 0
Ellipses: 0
Polylines: 0
LwPolylines: 2
Solids: 0
Currently Unsupported: 0

Time Elapsed: 1 ms
--------------------------------------------------------------

with the suggested parameters "-i -v" between app-name and dxf-file
produces output on stdout:
--------------------------------------------------------------
ich@home:~/.qet/binary$ ./dxf2elmt -i -v Arrows.dxf 
<?xml version = "1.0" encoding = "UTF-8"?>
<definition height="10" width="10" hotspot_x="5" hotspot_y="5" version="0.80" link_type="simple" type="element">
    <uuid uuid="{e379fd21-8e8f-47f4-95c3-bdafb965b09c}" />
    <names>
        <name lang="en">Arrows</name>
    </names>
    <informations>Created using dxf2elmt!</informations>
    <description>
        <polygon x1="143.090474" y1="-250.418834" x2="136.739192" y2="-242.452654" x3="139.746475" y3="-242.452654" x4="139.74493" y4="-218.55257" x5="143.092019" y5="-218.55257" closed="false" antialias="false" style="line-style:normal;line-weight:thin;filling:none;color:black" />
        <polygon x1="144.367876" y1="-232.490765" x2="150.717614" y2="-240.456945" x3="147.711876" y3="-240.456945" x4="147.711876" y4="-250.418918" x5="144.363242" y5="-250.418918" closed="false" antialias="false" style="line-style:normal;line-weight:thin;filling:none;color:black" />
    </description>
</definition>
--------------------------------------------------------------

In summary, it can be said that the order of the parameters is decisive for the original code.
With Vadoola's code, the call in QET would have to be adapted.

41

(129 replies, posted in Import DXF)

Salut Laurent !

scorpio810 wrote:
git clone https://github.com/Vadoola/dxf2elmt.git  dxf2elmt_vadoola
cd dxf2elmt_vadoola
rustup update
cargo build

try this:

git clone https://github.com/Vadoola/dxf2elmt.git  dxf2elmt_vadoola
cd dxf2elmt_vadoola
rustup update
RUSTFLAGS='-C strip=symbols' cargo build --release

That results in a 2.4MB executable.
But it does not solve the Problem of not outputting to stdout...

The commandline-parameter "-v" that is used in QET-GUI does not produce anything: No elmt and no output to stdout.

EDIT:
What bothers me more about dxf2elmt:
The default behavior for polygons of dxf2elmt seems to be "closed=false", but for QET the default behavior is "closed=true". (see attachments)
Isn't it defined in the dxf or in the dxf-library if a polygon is closed or not?
If there are only a few polygons, this can be fixed quickly, but for complex elements ...

Hello Edson,

what do you mean with the word "Unifilar"

Is it a single line? Then you choose the elements from the sub-dir "Single pole": see attachment

From an electrician's point of view, this is not permitted for safety reasons!
If the 25 mm² cable is appropriately fused and you have a short circuit on the 1.5 mm² cable, the 1.5 mm² cable will burn away!

And:
One terminal = one voltage = one color = one wire-gauge

From thin wire to thick wire may (!) be permitted, but will lead to misunderstandings!

Salut Laurent !

You can of course create a totally new element without needing to delete anything...
Just read the illustrated quick-guide I wrote: See attachment!

Salut Laurent !

Thank you for the quick reaction!  nomicons/smile

I guess it should be enough to have a w64-version on QET-Website:
QET is only available for w64 so there is no need for w32, when it is called by QET.

The w32-Build is mainly meant for educational- and standalone-use.
... and for promotion of the great project "ReactOS" (no, I'm not involved there)

rvamerongen wrote:

Does it work for macOS ( intel or arm )?

I guess it should work.
But as always with free software:
No guarantee!  nomicons/wink

EDIT:

Can you compile and run QET_ElementScaler on your macOS-Systems from commandline?
Then it should also work in combination with QET.

Best regards
  plc-user

Salut Laurent !

plc-user wrote:

Maybe "we" should update the information on QET-Website:
QET_ElementScaler is available in version 0.5.0beta19 already...
https://github.com/plc-user/QET_ElementScaler/releases
What do you think, Laurent? nomicons/wink

Now, that QET_ElementScaler can be used from Element-Editor ...

The versions available from QET-Homepage seem to be very old, too.
We don't want to unnecessarily confuse users with old junk, do we?  nomicons/angel
Maybe you can upgrade the versions there too, Laurent? 
https://download.qelectrotech.org/qet/b … entScaler/

Thanks in advance!
  plc-user

Diese Variablen sind für zusammengesetzten Text verfügbar.
Da ist ja einiges Schönes dabei...  nomicons/wink

Maybe "we" should update the information on QET-Website:
QET_ElementScaler is available in version 0.5.0beta19 already...
https://github.com/plc-user/QET_ElementScaler/releases
What do you think, Laurent? nomicons/wink

Nicken83 wrote:

(...) but i'm not able to get this to work.

What exactly is the problem with calling of the program?
What lies where (program and elements) and what have you tried?

Zugschlus wrote:

Ich muss also wirklcih ernsthaft das Element mit einem externen Tool bearbeiten bis es zufällig passt?!?

Solange die Funktion nicht in QET vorhanden ist, ...
Und: Ein bisschen rechnen wirst Du können, damit Du nicht auf den "Zufall" angewiesen bist:

Zoomfaktor = (gewünschte Größe) / (aktuelle Größe)

und dann ist der Aufruf des QET_ElementScaler ziemlich einfach:

QET_ElementScaler -F <Zoomfaktor> -f UrprungsElement.elmt

Wobei:
<Zoomfaktor> durch ermittelten Wert (s.o.) ohne Klammern ersetzen

Und wenn für X- und Y-Richtung verschiedene Faktoren nötig sind, ist das auch kein Problem:

QET_ElementScaler -x <FaktorFürX> -y <FaktorFürY> -f UrprungsElement.elmt

Ergänzend zu den Ausführungen von acolomb:
Ich habe es selbst bei kommerzieller CAD-Software erlebt, daß Konstrukteure die für Ihre Firma typischen Symbole und Schaltzeichen selber erstellen, weil die vorhandenen einen anderen Stil verfolgt haben...!

Da wirst Du Dir einen eigenen, benutzerdefinierten Verweis erstellen müssen.
Ist aber gar nicht kompliziert:
Ziehe den vorhandenen Verweis per Drag-and-Drop in Dein Benutzerverzeichnis und bearbeite ihn.

In diesem Thread sind nähere Informationen zu Verweisen:
https://qelectrotech.org/forum/viewtopi … 986#p18986