326

(193 replies, posted in Import DXF)

Salut Laurent !
Hello Vadoola!

I also played with the possibilities to give more information to the user and learned, that a MessageBox can have three texts:

QMessageBox msgBox;
msgBox.setText("QET_ElementScaler: \nadditional information about import / scaling");
msgBox.setInformativeText("See details here:");
msgBox.setDetailedText(error_output);
msgBox.exec();

That results in this MessageBox (details are hidden by default):

Hello hairy_kiwi,

there is no need to search the QET-Sourcecode to find the possible text-variables for references!
If an element is declared as coming / going reference the possible choices for the texts are shown in the drop-down.

O.k. ... that makes it clear what you mean.

In future versions of QET, such splices will have to be built in to make clear, in which way the cabling has to be done. However, this must be an automatic feature in the software when you make your connections between the terminals.
With the “Splice” or “ThruSomething” elements, you insert non-existent parts into your circuit diagram, which appear as empty lines in the bill of materials.

These “elements” also make my life quite difficult:
For some time now (not full time!) I am trying to develop a software-tool that automatically extracts a cabling plan from the QET schematic file. However, these “elements” are not allowed to appear in a cabling plan because they are not real components!
Not only these parts make it quite difficult to create such a diagram automatically - also the many possibilities to use references in circuit diagrams is quite complex...
But that's another topic!

Hello Saso!

It seems that you have not yet understood the principle of QET:
Connecting wires are only drawn from one terminal to another terminal! It is not intended to connect a new wire to a conductor somewhere: Only from terminal to terminal!
Connection points are set automatically by QET.
Therefore there is no need of connection-points etc. in the toolbars.

QET is not a paint program: You make connections between terminals.

As I see the "imported elements" - collection:

It is not made to sort or edit the elements you use.
The "imported elements" - collection can be used to choose elements you already use in your project on other folios, without needing to search them in QET- or user-collection again.

see also this thread: https://qelectrotech.org/forum/viewtopic.php?id=2119

If you edit an element in you company- or user-collection, QET will ask, if you want to replace any occurrence in your project, when you pull it onto a folio.

EDIT:
Removed text because of Laurent's message. Thank you!

You may now delete this message, too, Laurent! nomicons/wink

332

(193 replies, posted in Import DXF)

The idea of scaling came when I looked at the converted element: The screw terminals are no longer round, but jagged!
This is because we want to limit dxf2elmt to two decimal places due to the file size, but the values for the polygons only differ to the third or fourth decimal place at such small scales.

With auxiliary programs such as dxf2elmt (or QET_ElementScaler) we should limit ourselves to the command line with no further interaction with the user! An additional GUI would probably not fit into the "look and feel" of QET and increases dependencies for the executable. And: We do not know in advance which scaling factor we have to apply here. Most users will most likely not have a CAD program with which they can edit dxf to see in advance which factor should be applied. That is the difference to QET_ElementScaler: There, you stay with the workflow in QET.

Therefore:
If we can read a factor from the dxf file, we should apply it, but otherwise not put a lot of effort into having the user enter a factor.
Then we just have to bite the bullet and increase the number of decimal places to four, for example.

333

(193 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)

336

(8 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

339

(193 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 {

340

(193 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!

341

(193 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

342

(193 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.

343

(193 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

344

(193 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

345

(193 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

346

(193 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

347

(193 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.

348

(193 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!