dwg2svg - text coordinates are always 0

If you are having problems with QCAD, post here. Please report bugs through our Bug Tracker instead.

Always attach your original DXF or DWG file and mentions your QCAD version and the platform you are on.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
mhagstroem
Newbie Member
Posts: 3
Joined: Tue Jan 19, 2021 10:49 am

dwg2svg - text coordinates are always 0

Post by mhagstroem » Tue Jan 19, 2021 11:11 am

We're using the paid version 3.25.2. Using the dwg2svg converter leads to the following result:
...
<g transform="">
<text x="0" dx="0" y="0" dy="2" font-family="Arial" font-size="2.8" line-height="1.1" fill="#000000" transform="translate(542.2,418.4046) translate(0,1) scale(1,-1)" text-anchor="middle">UNITE</text>
</g>
...

Our testing was done with the trial version 3.24.3 and there we've got the results:
...
<g transform="">
<text x="542.2" dx="0" y="-419.4188" dy="2" font-family="Arial" font-size="2.8" line-height="1.1" fill="#000000" transform="scale(1,-1) rotate(360 542.2,-419.4188)" text-anchor="middle">UNITE</text>
</g>
...

Is there a way to achive the "old" behavior with text coordinates different from 0?

Thanks & kind regards

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg - text coordinates are always 0

Post by andrew » Tue Jan 19, 2021 11:24 am

The text position has moved to the "transform" attribute of the text. Both SVGs should display exactly the same.

May I ask what your use case is for having x/y attributes instead of transforms?

mhagstroem
Newbie Member
Posts: 3
Joined: Tue Jan 19, 2021 10:49 am

Re: dwg2svg - text coordinates are always 0

Post by mhagstroem » Tue Jan 19, 2021 11:45 am

We've written a parser to identify partiuclar text elements. Does this mean, that we've to adapt our parser? Or do you recommend to use the "old" version from March 2020?

User avatar
andrew
Site Admin
Posts: 9052
Joined: Fri Mar 30, 2007 6:07 am

Re: dwg2svg - text coordinates are always 0

Post by andrew » Tue Jan 19, 2021 12:00 pm

I'd recommend to adapt the parser to parse the first "translate" function inside the transform attribute.

Note that unlike in previous versions, this is exactly the position the user clicked when creating the text label, i.e. the reference point of the text. The second "translate" is the offset to account for the vertical alignment of the text (top, middle, base or bottom).

mhagstroem
Newbie Member
Posts: 3
Joined: Tue Jan 19, 2021 10:49 am

Re: dwg2svg - text coordinates are always 0

Post by mhagstroem » Tue Jan 19, 2021 1:52 pm

Thanks a lot. We'll follow your suggestion...

Post Reply

Return to “QCAD Troubleshooting and Problems”