276

(193 replies, posted in Import DXF)

Hello Vadoola,

about the definition-line.

The definition-line describes the dimensions of the element and is calculated by the element editor. It is therefore not noticeable that the values have not been calculated (correctly) if the import is carried out directly in the element editor.
If the element is converted on the command line and the element is used directly in the diagram editor, it is not displayed correctly because the width, height and hotspots are not set correctly.
This is particularly noticeable when dragging the element onto the folio, see appendix.

You already write it in a comment in your code (src/qelmt/mod.rs from line 59:

//The original code had the height, and width hard coded to 10
//and the hotspots hard coded to 5. I'm not sure why this is?
//Maybe actually calculating the size wasn't worth it? I'm not sure
//if that info is part of the dxf. And maybe when you open he elemnt
//in the elemtent editor it corrects it anyway. Just look into it, and
//se if this is something that needs to get adjusted.

The values for the definition line can only be calculated correctly if all information about all graphical elements is available.
In QET_ElementScaler I keep the whole QET-element in memory and recalculate the definition-line after scaling and before writing anything to stdout.
The calculation is specific to QET and it took me some time and help from Laurent and Joshua to implement it accordingly.

If you read in the file sequentially and output everything immediately to stdout, the definition-line values can not be correct. As far as I know, the necessary information is not in the dxf...

277

(29 replies, posted in Import DXF)

Kellermorph wrote:

Ne das DXFtoQET von der Homepage von QElectrotech hat eine eigene GUI.

Jetzt verwirrst Du mich völlig:
Die ganze Zeit schreibst Du von dxf2elmt und auf einmal sagst Du, Du benutzt DXFtoQET ...

Daß das zwei unterschiedliche Paar Schuhe sind, ist Dir klar?
Und daß seit Längerem bevorzugt dxf2elmt benutzt werden sollte, weil es aktiv weiterentwickelt wird, ist Dir auch klar?

Ziemlich verwirrt ... Gute Nacht!

278

(29 replies, posted in Import DXF)

Kellermorph wrote:

Ich wusste nicht, dass der Import über den Element Editor gestartet wird, da bei der eigenen Version eine eigene GUI kommt.

Das verstehe ich nicht!
Wo kommt eine eigene GUI mit?
Bei dxf2elmt ist mir noch keine aufgefallen.
Und auf der github-seite steht ja auch explizit: "Dxf2elmt is CLI program ..."

Es ist auch keine Pflicht, das über den Element-Editor zu importieren:
Es ist ein Kommandozeilen-Programm, das Du auch zum Beispiel in Skripten verwursten kannst, um ganze Verzeichnisse direkt ohne Umweg über eine GUI zu konvertieren.

Im Anschluß an die Konvertierung ist es nur nötig, das neu erstellte Element einmal im Element-Editor zu öffnen und wieder zu speichern, da das Kommandozeilenprogramm (zumindest in der letzten Version, die ich kenne) die Werte für die sog. "Definition-Line" des Elements nicht korrekt berechnet und daher im Diagram-Editor die Elemente nicht korrekt dargestellt werden.
Aber die Elemente müssen ja ohnein im Element-Editor weiter bearbeitet werden, um auch die Eigenschaften (Bezeichnung, Hersteller, Artikelnummer, etc.), die Texte und die Anschlüsse einzubauen...

Kellermorph wrote:

Natürlich werden diese geteilt, auch wenn ich nicht glaube, dass diese viele brauchen werden, da es nur ein kleiner deutscher Hersteller ist. Aber das ist ja der Grundgedanke hinter Opensource.

Wenn mich nicht alles täuscht, ist mir hier im Forum der Hersteller schon mal "über den Weg gelaufen"...

279

(29 replies, posted in Import DXF)

Hallo Kellermorph!

Der DXF-Import ist ja nur für Bauteile bzw. Elemente vorgesehen. Deswegen gibt es auch nur im Element-Editor den Menüeintrag "DXF import".

Da wirst Du ja schon mal draufgeklickt haben und dann hat sich ein Fensterchen mit einer Kurzanleitung geöffnet (siehe Anhang).
Für den Download empfehle ich inzwischen die neue Version, die Vadoola programmiert und scorpio810 (Laurent) im anderen Beitrag verlinkt hat.
Die kopierst bzw. entpackst Du in den "Installationsordner", der mit dem lokalen Dateimanager geöffnet wird, wenn Du auf den Button klickst.
Auf Linux-Systemen muß die Datei erst noch als ausführbar deklariert werden, bevor sie genutzt werden kann. (Rechtsklick -> Eigenschaften, o.Ä.)

Aber:
Verspreche Dir nicht zu viel vom DXF-Import!
In den DXF-Dateien der Hersteller sind meist nur irgendwelche 2D-Ansichten der Bauteile drin, die sowieso im Element-Editor weiter bearbeitet werden müssen, da oftmals so viele grafische Details der Bauteile drin sind, die einfach nur die Element-Datei aufblähen und keinen weiteren Nutzen haben. Die Anschlüsse (Terminals) mußt Du sowieso selber in das neue Element einfügen, da die nicht vom dxf dargestellt werden. Und auch bei den Texten und Beschriftungen wirst Du Hand anlegen müssen.

Oftmals kommt es dann zur späten Erkenntnis:
"Mensch, das hätte ich schneller und mindestens genauso schön direkt im Element-Editor selber machen können...!"
Und wenn Du dann erst einen Grundstock an schönen Elementen hast, wirst Du dann nur noch diese als Basis für neue Elemente nutzen. So meine Erfahrung!

Dann freuen wir uns natürlich darüber, wenn Du diese schönen Elemente mit uns teilst!
https://qelectrotech.org/forum/viewforum.php?id=10

280

(29 replies, posted in Import DXF)

Kellermorph wrote:

Ich glaube, ich bin zu doof, das hinzukriegen.
Geht das nur über das Terminal und nicht per GUI?

Viele Leute sind wohl einfach überfordert, sich selber schlau zu lesen, bevor sie in einem Forum Fragen posten, die bereits x-mal beantwortet wurden!

Zitat von hier (https://qelectrotech.org/download.php) gleichlautend von hier (https://github.com/antonioaja/dxf2elmt) und hier (https://github.com/Vadoola/dxf2elmt)
"Dxf2elmt is CLI program which can convert .dxf files into .elmt files."

Und im Forum gibt es bereits viele Anfragen zu dem Thema!

Zusätzlich bekommen wir keine Informationen von Dir, auf welchem System Du das alles versuchst.
Was hast Du überhaupt alles schon versucht? Auch dazu nur eine unvollständige Aussage...

Ich kenne Dich nicht und möchte Dir auch nicht Unrecht tun: Du warst nur der Auslöser für diesen Beitrag!

Deswegen:
Wer Hilfe braucht, dem wird auch geholfen!
Ihr müßt nur mitmachen (wollen) und bereit sein, dafür etwas mehr zu tun als immer dieselben Fragen im Forum zu stellen!

  • Benutzt die Forums-Suche

  • Nutzt auch die anderssprachigen Foren

  • Liefert Informationen zu eurem System (OS, QET-Version, etc)
    Zum Beispiel so:
    Hilfe -> Über QElectroTech -> Tab "Version" -> Inhalt kopieren

  • Stellt konkrete Fragen

  • liefert aussagekräftige Fehlermeldungen: "Geht nicht!" ist nicht genug

In diagram-editor you can insert pictures.
Convert your pdf to png-images and insert one per folio.

282

(193 replies, posted in Import DXF)

Such an additional MessageBox should only popup, when there really is information for the user: When everything's fine there should be no additional Box to close...

This means that we should be very frugal with any outputs in our CLI software!
If there is nothing to report, then shut up!   nomicons/wink

283

(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

289

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

290

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

293

(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

296

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

297

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

298

(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

299

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

300

(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