151 (edited by andrew 2025-01-19 06:33:10)

Re: New .dxf to .elmt Conversion Program

Howdy all, hope this is the correct place for bugs on DXF conversion, am playing around with doing an enclosure layout, so I grabbed a coordgrip dxf I could use off Mcmaster carr and the text is garbled to heck, may be useful for the "fun" text layout issues


Can grib dxf here since I can't upload it https://www.mcmaster.com/8302K738/

As a gift, a quick scale factor conversion sheet I made, after importing to ELMT if you know some dimension in real world units you can punch in coords of that in PX units and it will calculate scale factor based on 2px=1MM, its set in inches 'cause I'm 'Murican, but easy enough to knock the 25.4mm/inch out if needed

found best way to use is import -> save as element, measure, figure scale factor; delete contents of element, then do import and resize the element onto itself with calculated scale factor

Post's attachments

Attachment icon QTElementScaleFactor.ods 9.33 kb, 6 downloads since 2025-01-19 

Screenshot_2025-01-19_03-19-43.png, 88.72 kb, 1311 x 767
Screenshot_2025-01-19_03-19-43.png 88.72 kb, 4 downloads since 2025-01-19 

152 (edited by plc-user 2025-01-19 08:53:24)

Re: New .dxf to .elmt Conversion Program

I don't know what you are complaining about: the drawing is perfectly converted and the scale of 1mm = 2px is also correct!
And vadoola's statement is also correct: scaling of texts and their positioning still needs to be worked on.

What texts do you want to use for the front view of the element? You know the name, the part-number and the manufacturer...

Post's attachments

Attachment icon 8302K738_Wet-Location Cord Grip.dxf.zip 252.38 kb, 9 downloads since 2025-01-19 

Attachment icon 8302K738_Wet-Location Cord Grip.pdf 126.01 kb, 7 downloads since 2025-01-19 

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

Re: New .dxf to .elmt Conversion Program

Hello Andrew,
thanks for your convertion spreadsheet, maybe be interesting plc-user and Vadoola

https://download.qelectrotech.org/qet/forum_img_2/andre_dxf.png

Tried with lastest vadoola github commit, same thing like you for texts.
But the drawn piece is perfectly converted. Thanks Vadoola. nomicons/wink
https://download.qelectrotech.org/qet/forum_img_2/andre_part_draw.png

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New .dxf to .elmt Conversion Program

I saw these fonts size was so biggest, like size= 1298 px ....

<description>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,779,-1,0,0,0,0,0,0,0" y="210.57" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="187.3" rotation="0" uuid="{efa63688-1d59-4f48-b7c6-e61cac5ce680}">
            <text>2 1/2 NPT</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,519,-1,0,0,0,0,0,0,0" y="325.1" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="157.78" rotation="0" uuid="{be6ff0b9-bd03-40df-9d2d-182c19e78a07}">
            <text>© 2023 McMaster-Carr Supply Company</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,649,-1,0,0,0,0,0,0,0" y="332.53" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="353.73" rotation="0" uuid="{cf71a1f6-e8f6-468e-9a03-fc9026ffb867}">
            <text>Cord Grip</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,649,-1,0,0,0,0,0,0,0" y="316.3" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="354.07" rotation="0" uuid="{3042b1a4-c128-4152-9e52-7059ad56692c}">
            <text>Wet-Location</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,1298,-1,0,0,0,0,0,0,0" y="286.92" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="370.46" rotation="0" uuid="{bb0c5380-9eb0-4539-a6ba-e6747f8200e8}">
            <text>8302K738</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,390,-1,0,0,0,0,0,0,0" y="339.87" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="159.08" rotation="0" uuid="{80473fb0-b6c7-44f1-9ad5-ef7252fb981a}">
            <text>Information in this drawing is provided for reference only.</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,519,-1,0,0,0,0,0,0,0" y="288.12" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="275.08" rotation="0" uuid="{c0f52eaf-f682-4c51-8acc-94f969a7314c}">
            <text>PART</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,519,-1,0,0,0,0,0,0,0" y="297.72" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="276.03" rotation="0" uuid="{5de7a2d5-516d-4d82-ac48-a286a2614338}">
            <text>NUMBER</text>
        </dynamic_text>
        <dynamic_text Halignment="AlignHCenter" text_width="-1" font="Arial Narrow,519,-1,0,0,0,0,0,0,0" y="313.47" frame="false" z="0" keep_visual_rotation="true" text_from="UserText" Valignment="AlignVCenter" x="157.18" rotation="0" uuid="{4ce33b0a-4f95-43cf-bb60-4f832b127733}">
            <text>http://www.mcmaster.com</text>

https://download.qelectrotech.org/qet/forum_img_2/andre_dxf.png
If I divide the size of all the fonts by ~100, the appearance and positioning are quite good.


https://download.qelectrotech.org/qet/forum_img_2/andre_elmt-divide_text_font.png


https://download.qelectrotech.org/qet/forum_img_2/andre_elmt-divide_text_font2.png


Edit: for this DXF file the fonts was so big, but I tried other DXF files and fonts seem's good.

Post's attachments

Attachment icon test-def.elmt 169.02 kb, 8 downloads since 2025-01-19 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

155 (edited by andrew 2025-01-19 15:08:31)

Re: New .dxf to .elmt Conversion Program

plc-user wrote:

I don't know what you are complaining about: the drawing is perfectly converted and the scale of 1mm = 2px is also correct!
And vadoola's statement is also correct: scaling of texts and their positioning still needs to be worked on.

What texts do you want to use for the front view of the element? You know the name, the part-number and the manufacturer...


No complaints sir, I am happy and thankful for the work on the importer and your resizer. I only bring it up because the text issue was mentioned and I saw the issues on the USA based DXFs I tried which leads me to wonder if they have a 3rd party backend generating these and if so fixing may be worth it. (as it would affect a ton of these DXFs)

Also if it's prescaled, I wonder if prev document I converted from DWG->DXF->Element was messed up or if I did some dragging around 1st by mistake

@Scorpio810, I may have to look into file format, but I assume the DXF has font size and QET has font size, so can't we get a porportion based on doc size and then just hit the font sizes with that (rounded as needed)

Re: New .dxf to .elmt Conversion Program

@Andrew: The Vadoola code shown here may be of interest to you:
https://github.com/qelectrotech/new_dxf … d.rs#L1165

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New .dxf to .elmt Conversion Program

New packages build based of Vadoola commit: 4ecce24

See https://qelectrotech.org/forum/viewtopi … 827#p20827

Post's attachments

Attachment icon linux64_dxf2elmt.tar.gz 1.38 mb, file has never been downloaded. 

Attachment icon macOS_intel-dxf2elmt.zip 1.29 mb, file has never been downloaded. 

Attachment icon Win_64_dxf2elmt.zip 1.36 mb, 2 downloads since 2025-01-19 

"Le jour où tu découvres le Libre, tu sais que tu ne pourras jamais plus revenir en arrière..."

Re: New .dxf to .elmt Conversion Program

Let's not guess what might be wrong with the fonts, but wait for Vadoola's answer when he has looked at the dxf and the resulting element-file!

andrew wrote:

(...) I wonder if prev document I converted from DWG->DXF->Element was messed up (...)

I'm also not asking why you took the additional conversion route via dwg when there is a dxf available from the supplier that can be converted directly. I achieved the perfect results I described in the post above (https://qelectrotech.org/forum/viewtopi … 822#p20822) - with Vadoolas latest code and without any additional scaling!
In any case, the downloaded dxf is attached to that post, too.

Fragen zu QET gehören in dieses Forum und werden nicht per PM beantwortet! – Questions regarding QET belong in this forum and will NOT be answered via PM! – Les questions concernant QET doivent être posées sur ce forum et ne seront pas traitées par MP !

Re: New .dxf to .elmt Conversion Program

plc-user wrote:

Let's not guess what might be wrong with the fonts, but wait for Vadoola's answer when he has looked at the dxf and the resulting element-file!

I'm also not asking why you took the additional conversion route via dwg when there is a dxf available from the supplier that can be converted directly. I achieved the perfect results I described in the post above

No worries, if I get time later I may run the conversion in debugger and trace code myself, Scorpio810 showed me where to start.

As for the DWG conversion, completely different item from different vendor that had DWG only, I'll try reimporting from the DWG and see if it scales correctly later, not relavent to the text issue, but I wanted to include my sheet in case it could help anyone else with conversions (maybe rescaling existing wrong scaled drawings)

Re: New .dxf to .elmt Conversion Program

Lots to respond to...

andrew wrote:

Howdy all, hope this is the correct place for bugs on DXF conversion

The QET Forums, either this thread or creating a new one, are probably the best place for this. I do use Github Issues (https://github.com/Vadoola/dxf2elmt/issues) for tracking problems or enhancements etc., but if you make a post here, there can be a bit more discussion about it and I can make an Issue on Github, you are more then welcome to make a Github Issue as well though.


Thanks for the spreadsheet, I can take a look at it. The scaling should be in there already, but only recently and includes all the units supported by DXF. The code can be seen here: https://github.com/Vadoola/dxf2elmt/blo … od.rs#L213. Perhaps you grabbed a slightly older version of the conversion utility, because I only checked in that code a few days ago.

andrew wrote:

its set in inches 'cause I'm 'Murican

Now worries, I to am 'Murican, but have been living in New Zealand (where my wife is from) for a while now, that's why I'm late to the party here, I was asleep for most of this conversation.

andrew wrote:

and the text is garbled to heck

Yeah there is still quite a bit of work to do on the text but I'm slowly chipping away at it.
There are multiple text types in DXF
    * ArcAlignedText
    * MText
    * RText
    * Text
Right now Text should be somewhat well supported, but there are issues. MText has some very early and crude support, and the other two have no support. Just looking at the screenshot you shared (without having looked at the DXF yet) I'm guessing these are regular "Text" objects.

scorpio810 wrote:

I saw these fonts size was so biggest, like size= 1298 px ....

andrew wrote:

@Scorpio810, I may have to look into file format, but I assume the DXF has font size and QET has font size, so can't we get a porportion based on doc size and then just hit the font sizes with that (rounded as needed)

A font size of 1298 certainly seems wrong, I'll have to do some testing on that file to see what's going on. The DXF actually stores font height in drawing units, so if the drawing defaults to inches, the text height will be stored in inches not font points. I convert between real world units and font points at the code Laurent linked above and round it to a whole number. The conversion is based on the definition of a PostScript font point where 1pt is defined as 1/72 of an inch, and in my testing so far this seems to work well.

andrew wrote:

Also if it's prescaled, I wonder if prev document I converted from DWG->DXF->Element was messed up or if I did some dragging around 1st by mistake

It's certainly possible and hard to know. I'll take a closer look at the dxf and see what I can find, it might be a couple of days before I can get to it though.

161

Re: New .dxf to .elmt Conversion Program

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.