1

(209 replies, posted in Import DXF)

Hi joao.silveira

joao.silveira wrote:

I’m a beginner when it comes to programming, and I’m not managing to use the software. Do you have any tutorial on how to use this software on Windows? If you could help me, I’d be very grateful.

I don't have a tutorial specifically but I can try and walk you through some steps quickly
- Launch QElectrotech
- Under Collections->User Collection (typically on the right hand side of the QET Window) right click on User Collection
- Click "New Element" in the pop up menu
- Select the folder you wan to put it in and click "Next"
- give it a file name, and click "Next"
- give it an element name, and click "Finish"

This will launch the Element Editor. From the Element Editor Window follow the below steps
- File->Import a dxf
- If you don't have the dxf2elmt software placed in the correct folder, it will open a popup window saying it can't find it. There will be a download button, which you should probably ignore, and a button to open the installation folder. Click that and drop a copy of dxf2elmt in that folder (there are Windows and Debian versions you can download from https://github.com/Vadoola/dxf2elmt/releases, and scorpio810 has attached some MacOS versions up a few comments in this thread).

Once you have the dxf2elmt program installed in the correct folder:
- go to File->Import a dxf
- In the popup select the dxf file and click ok.

That should pretty much be it, but you will need to add terminals and such yourself to connect wires to them in QElectrotech.




joao.silveira wrote:

For this type of application, can I use the program that converts DWG into ELMT? And how do I use this program?

The dxf2elmt program specifically converts DXF files, NOT DWG files. If you only have a DWG file you would need to convert it to a DXF first, there are some various programs available to do this, LibreCAD and QCad should be able to, I believe FreeCAD as well, but have less experience with it.

Hopefully this helps.

2

(209 replies, posted in Import DXF)

Salut Christophe,

totofe64 wrote:

I need to use recent KNX MDT modules and theses modules are not in default QT library.
So I would like to convert dxf files provided by MDT to elmt files.

I use the last version binary dxf2elmt.exe downloaded from this topic link. Not sure this is the last binary version regarding github speaking about 5.0.1. Unfortunately, except error, I dont found the 5.0.1 Windows X64 bnary.

C:\Users\christophe\Downloads\dxf2elmt>dxf2elmt.exe --version
dxf2elmt 0.4.0

I obtain an elmt file only with polygon object from the attached dxf file.

Any help would be very appreciated.
Best regards
Christophe

Version 0.4.0 is not the latest version. The latest version is what Laurent linked above and is version 0.5.1.

I actually just noticed that I forgot to bump the version in the cargo.toml file, so even though it is version 0.5.1, if you run dxf2elmt --version it will say it's version 0.5.0. There were some large changes and new features between 0.4.0 and 0.5.0 so it's possible the file that is failing in 0.4.0 will work in 0.5.0.

I'm not seeing any linked dxf files, and a quick glance shows several versions of KNX MDT modules. If it still fails to convert correctly once you download 0.5.1 can you link to the dxf files so I can find out where it's failing and try to fix it?

Thanks

sstteeff wrote:

Bonjour,

J'ai été chez Harting, mais il n'ont pas de fichiers .elmt   juste du DXF, mais impossible à charger dans qElectroTech malgré l'ajout du logiciel dédié.

English

As the maintainer of dxf2elmt, I would also ask what issue did you find getting the dxf to load? Was it installing the dxf2elmt plugin? Was the plugin failing to convert anything?

If the problem is with dxf2elmt itself, and you can link me to the dxf files you were using, I'll take a look and see what might have been going wrong.


Machine Translated - Traduction automatique
En tant que mainteneur de dxf2elmt, je voudrais également savoir quel problème avez-vous rencontré lors du chargement du fichier DXF ? Était-ce l'installation du plugin dxf2elmt ? Le plugin n'a-t-il pas réussi à convertir quoi que ce soit ?

Si le problème vient de dxf2elmt lui-même, et que vous pouvez me donner le lien vers les fichiers DXF que vous utilisiez, je vérifierai ce qui a pu poser problème.

4

(209 replies, posted in Import DXF)

Salut Laurent,

I don't have the binaries up on the release page yet, but I've fixed the bug that was causing you issues running it from QElectrotech on your Mac.

If it can it creates the log file, but if it fails, it just skips it and logs to stderr.

https://github.com/Vadoola/dxf2elmt/releases/tag/v0.5.1

5

(209 replies, posted in Import DXF)

scorpio810 wrote:

macOS arm64 binary

Btw, it's run well only CLI on terminal, on GUI import DXF segfault...

thread 'main' panicked at src/main.rs:65:58:
called `Result::unwrap()` on an `Err` value: Os { code: 30, kind: ReadOnlyFilesystem, message: "Read-only file system" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Are you only getting that on the Mac? Or on other machines too? It's interesting that it's only happening when being called from QET and not from the CLI.

Either way I see what the issue was. I finally added a bit of logging trying to troubleshoot some issues with the nested blocks. A bit of poor error handling on setting up the logging slipped through to the release....ah actually I think it makes sense now depending on exactly how you are running it. By default it just creates a dxf2elmt.log file in the same folder as the exe. If you have write permissions on the folder when running it from the CLI, no problem. If it doesn't have write permissions for the folder where the plugin is run from it will probably get that ReadOnlyFilesystem error, and then the poor error handling for the logging file is causing it to panic and halt execution. I'll see if I can get a bug fix release out shortly.

Do you know what the typical logging system on MacOS is? On Linux of course you have syslog, or the systemd journal. Windows you could use the Event System....The last Mac I used consistently was PowerPC based, so I don't really know the system well now. Trying to figure out what options I have for logging other than just creating a log file.

6

(209 replies, posted in Import DXF)

plc-user wrote:

Hi vadoola!

Can you please create win- and/or Linux-Binaries for dxf2elmt and put them also into the release at github?
So everyone gets the Software from "first hand"!

Yeah, I have no experience or familiarity with Github CI. I've been trying to hobble something together by copying how some others have done it, and have been completely unsuccessful. I probably need to set aside some time to sit down and learn it properly. The hope of course is that I can get it set up, and when a release is made CI will generate the binaries and attach them to the release.

For this release it will probably be faster and easier to just manually create them myself and get them uploaded.

7

(209 replies, posted in Import DXF)

Salut Laurent, Hallo plc-user,

I know it's been a while since I've been around. I hope everyone is doing well. I've had a lot going on, as well as a few injuries unfortunately that slowed down development for a bit.

There could be some other issues with it still, but I'm pretty happy with the nested block support as it stands currently. As there were a fair number of changes for this support, plus other things that have changes since the last release was cut, I decided it was worth marking as a new release. So version 0.5.0 was released about an hour ago.

Let me know if you find any specific issues with it.

8

(8 replies, posted in Import DXF)

NolanCarthy wrote:

Try checking DXF version compatibility or exporting with different settings.

The problem was that dxf2elmt didn't yet support nested blocks. I have a separate branch where I'm working on this. I actually had it working for this specific drawing, but I have another drawing with more deeply nested blocks and different scaling as they are nested. So far my attempts to get this working either correctly import one drawing or the other. I need to spend a bit more time to get it all working more consistently.

9

(209 replies, posted in Import DXF)

Wow...2.8MB that's a big dxf, Looks like it has a whole lot of blocks. Should be a good test drawing to find some deficiencies in dxf2elmt hopefully.

10

(209 replies, posted in Import DXF)

plc-user wrote:

Hello vadoola,

the file pxc_2700975_11_00_ILC-171-ETH-2TX_2D.dxf from Phoenix Contact seems to be a real challenge!
When converting exploded drawing from LibreCAD, the controller is found outside the drawing-area of the A3-sheet.
It is (of course) copyrighted, so no re-distribution here: --> Downloads --> Technische Zeichnung

Thanks I'll take a look at it.

11

(209 replies, posted in Import DXF)

Salut Laurent, Hallo plc-user,

And to anyone else willing to help out.

I created a branch to try and finish up on the issues with nested blocks: https://github.com/Vadoola/dxf2elmt/tree/nested_blocks, as originally brought up at https://qelectrotech.org/forum/viewtopic.php?id=2890

While there are still some minor issues (like text positioning but that's not exclusive to blocks), so far in my testing with a few files it seems to be pretty good.

If anyone has some good dxf files with nested blocks they want to test against let me know. I'll try and wrap up some of those minor issues, and merge it back into the main branch soon.

12

(209 replies, posted in Import DXF)

plc-user wrote:

@vadoola:

As also discussed in the other thread:
We are about to ship a few free fonts with QET. Among them is “osifont” which is often used as a font for CAD applications.
What do you think about specifying “osifont” as a font in converted elements for which no font is specified in the DXF?

When I look at the title block of the well-known “Wet Location Grip” file in LibreCAD and compare the font with “osifont” in QET, the font fits much better than a sans serif font.


Would like to have attached a screenshot, but something's still wrong with forum-settings: I cannot attach a file!

I've never heard of IS0 3O98, it looks like it's mostly a European thing, but it looks similar to other fonts I've seen used by AutoCad even outside of the Europe. I agree based on that screenshot you sent it does look a lot closer to what is being used by CAD that the Sans Serif font. Setting the default to "osifont" should be pretty straight forward. I'll see if I can do it tonight.

13

(8 replies, posted in Import DXF)

Salut Laurent, Hallo plc-user

Since it's unlikely that Antonioaja will be working on dxf2elmt going forward and and my fork has diverged quite a bit at this point, I was considering on disconnecting my fork from his. I still plan on giving him full credit for the work he did, and will update the Readme to link back to his repo, I just wanted to separate the fork.

There are some things I need to consider, I thought I saw somewhere that it might ruin any issues you have, but I'm not sure. Either way in order to separate it from Antonio's fork my repo can't have any fork's itself. Would you two be willing to delete the forks you have made from my repo so I can separate it from Antonio's? Then you can refork it if you need to.

14

(121 replies, posted in Code)

plc-user wrote:

The font-info-string is documented in Qt-docs: https://doc.qt.io/qt-5/qfont.html#toString (same for Qt6)
There it says, that it's a string of 16 entries.
But as we see in our element-files, the font-info-string is build with only 10 comma-separated entries.

Maybe that's what I was remembering that it was documented but wasn't quite right because the number of comma-seperated entries didn't match.

I looked into the Qt5 code to make sure the font string in dxf2elmt was being generated the same. I never looked at the Qt6 code since it wasn't relevant at the time. Looking at the doc for QFont::toString() in Qt5 and Qt6, it's identical, so I'm not really sure what the difference is or why it would have changed in the code. I'm just assuming the Wireshark issue is correct and there was a change however, and it might effect a future Qt6 version of QET, so it's good to be aware of it.

15

(121 replies, posted in Code)

Hello everyone,

A few months ago when I was looking to improve the font handling in dxf2elmt, I was trying to figure out what the font info string in the XML file is. I noticed it was using a built in method on QFontInfo that writes it out to a string, and I had to go dig into the Qt Source code to figure it out, as it appears to be undocumented.

I bring this up because back when I was researching this I came across this bug in Wireshark, that says the FontInfo string is not backwards compatible between Qt5 and Qt6: https://gitlab.com/wireshark/wireshark/-/issues/18553.

I forgot about it until just now when discussing a pull request plc-user made for dxf2elmt about text positioning. I just wanted to bring this to your attention since you guys are working on compiling it with Qt6, it's possible something will need to be done to make sure the font info from elemt files created with a Qt5 version works correctly with a version compiled with Qt6.

16

(7 replies, posted in Elements)

plc-user wrote:

Another reason to try to sort arrtibutes in element-file.
That's why valoola and I should use the same order for attributes in output of dxf2elmt and QET_ElementScaler. Seems that we do...


Good to know that we do, it was completely accidental, I mostly just stuck with the same general ordering of attributes Antonio was using in the original version. I'll try to make sure it stay's in sync with what QET_ElementScaler does.

17

(8 replies, posted in Import DXF)

So I did a quick look, I never quite finished the logic for nested blocks, so that is the problem here. I'll add it to the to do list. Thank you.

18

(8 replies, posted in Import DXF)

plc-user wrote:

The dxf contains Blocks in Blocks in Blocks in.....
That's currently not supported by dxf2elmt, but developer is working on it!

Blocks are currently supported. The way I wrote it I would have thought nested blocks would be supported, but I have not actually tested that yet.

I'll have to do some testing with your file and see why it's not working.

If it is due to nested blocks, what plc-user suggested: opening it in some CAD software and doing an explode on the blocks should work as a temporary solution until I can update the software.

I would agree with limiting it to 2 decimal places. I don't see any real benefit to that level of resolution in the element placement, and it bloats the XML file. Since you can't edit any more than 2 digits inside the element editor anyway, what need is there to store it in the XML.

20

(209 replies, posted in Import DXF)

I'm taking a closer look now that I'm on my lunch break, and it looks like I'm completely wrong about QET saying the font is in pt's. Nowhere does it say that, it simply refers to it as size. It's just so common for font to be stored as pt's instead of pixels I must have just assumed size meant font points instead of pixels. I clearly made a mistake here, downside of squeezing in time when I can even if that means I'm a bit distracted or tired. I'll try and find some time to get the code updated to scale the text correctly.

21

(209 replies, posted in Import DXF)

I think I see the confusion.

QET says it's measuring the font size in pts...but pts and pixels are not the same. Based on the file you just provided  (textsizes_in_QET.elmt) QET is actually storing the text size in pixels not points, despite it being labeled as in points. (I don't know if this is the case in all languages, or perhaps a mistranslation in the English text for QET). If that is the case, then you are correct that using the exact same scaling factor as the rest of the drawing should be accurate, since the text sizing is not stored how I though it was based on how QET labels it.

22

(209 replies, posted in Import DXF)

Hallo plc-user

I think I worded things in a way that did not translate properly for someone who is not a native English speaker. Sorry about that, I will try and word things better to make it more clear.

The current code is my first attempt and properly handling the text sizing, and text scaling over what Antonio had with just a fixed 12pt font. I based the conversion of the text size from real world units (which the text height is stored as in dxf) to font points using the defined definition of 1pt = 1/72 inch. In the couple of drawings I tested this scaling looked OK, but I knew it needed more testing and verification. I checked it in because it was already better than what was there. Perhaps I need to do a better job and work at some of these features in branches instead of on master so people don't think the checked in code is fully functional, however you testing against it and provided these files is very useful feedback for me to fix problems.

When you brought this up and provided the Schriftgroessen file I checked against some online calculators converting mm to pt to verify that I had done the math correctly in my code. Based on the conversion of 1pt = 1/72 inch, I did do the match correctly in my code, but this conversion factor clearly does not provide good results, after testing against some more files.

So the question is what conversion factor do I need to use? In the Schriftgoessen file you provided, if I had assumed that 1mm  = 1pt and then scaled it with the mm->px conversion of 2x, that actually would have been more accurate. It looks like it actually should be converted by a factor of 2.1, but 2 would have been closer than 2.8 used based on the mm->pt conversion I used. What I need to figure out is that roughly 2x height to pt conversion in the Schriftgroessen file something that could be valid or just coincidence in the factors similar?

Perhaps a better method here is assume that 1 unit (based on the file, mm, inches etc) is equal to 1pt and then scale based on the 1mm = 2px, perhaps I should always assume 1mm = 1pt, and then scale. I'm not really sure, I'll need to do more testing to try and narrow down what the right scaling factor might be, and need to make sure I'm testing against multiple units.

I think the next step for me to do is create a handful of files along the lines of Schriftgroessen but in several units like inches, ft, cm, etc and do some testing to try and narrow down a more accurate scaling factor.

Hopefully that makes things a bit more clear.

23

(209 replies, posted in Import DXF)

scorpio810 wrote:

My health is deteriorating and I find it hard to think and organise myself.


Laurent,

I'm sorry to hear about your health, and I hope you get better.

I wish I had more time to contribute and help out with QET, but I have young children which for the moment take a lot of time and energy.

24

(209 replies, posted in Import DXF)

Hallo plc-user,

plc-user wrote:

I noticed something similar with the imperial DXF from your American compatriot.!

I can double check, but I believe this extra scaling factor for the imperial unit drawing was fixed in the last commit.

plc-user wrote:

If we focus on the 20 mm font:
In LibreCAD (black background) it is good to see that both texts are the same size - I expect the same for the element.
In the element (white background), the polygon 20 mm are 40px high, but the 20 mm text has a font size of 57.
So there is still a factor of about 1.4 somewhere in there that doesn't belong.

The scaling for the font is handled separately from the rest of the drawing. This is because dxf stores text height in whatever unit the drawing is in (ie mm, inches, etc) and QET uses your stand font points. A font point is defined as 1pt = 1/72 inches, which comes out to 1pt = 0.3528mm.

Based on this conversion the values that are being generated are "correct", because text height in mm would be multiplied by a factor of roughly 2.83. instead of the 2 used to convert mm to pixels.

I checked a couple of online unit conversion calculators to verify my math and 20mm comes out to 56.692913386pt font, rounded to 57 in the element.

You are right though that this clearly isn't correct in the element file. Doing a quick hacky test of modifying the text element font size to try and match the polygon size, it looks like the factor in your sample file should be 2.1. (for the 20mm text, a font size of 42pts).  It's not clear to me where this 2.1 comes from...but it is close to the 2px per mm we use in the conversion of this drawing. Perhaps multiplying the text height in real world units by the same as the rest of the drawing instead of "properly" converting between font points and real world units would be better? I'll need to try and do more testing and see what I can come up with, and test it against some other drawings.

25

(209 replies, posted in Import DXF)

The font sizes should be correct in the latest commit (c3a5b2a). Before I had the real world units to Pt logic, I just scaled the text by the same scaling factor as the rest of the drawing as a temporary measure. I forgot to remove that code, so it was scaling it twice, once when converting between real world units and font points, and then again by the same factor the rest of the drawing was.

The handful of drawings I was using were in mm, so the extra scaling was 2x, but the drawing you were using was in inches, so the extra scaling was 50.8x.

There are still some other issues, with the text in that drawing for example in dxf the X and Y coordinates are based off alignment, in QET, they are always left and top regardless of alignment. So I need to add logic to do font measurements and that sort of thing. for this reason some of the text in the dxf is slightly off where it should be. Fixing is one of he things I was already starting to work on, but is more complicated, and will take a bit longer.