Referring to:
https://qcad.org/rsforum/viewtopic.php?f=8&t=9493
https://www.qcad.org/bugtracker/index.p ... sk_id=2390
https://www.qcad.org/bugtracker/index.p ... sk_id=2272
I took the liberty to adapt ConvertUnit.js to include US Survey units.
And that only for a document as a source.
It is of no use to fully support US Survey units because by the end of this year the use of these units should be avoided.
I have no intentions to support a custom conversion factor as requested in the forum topic mentioned above.
For that one can better scale the whole drawing with a factor.
Files can't be saved again in US Survey units like Anđa has proposed in FS 2272.
The main idea is that one can convert documents from US survey units to common supported units.
And that one leaves such files as they originally are for historic and legacy applications as advised by NIST.
I don't have access to such a document, I only presume it opens with the Drawing unit = 'None'.
It would be great if someone would like to test this update or share such a document.
The package is intended to supersede the existing Convert tool.
The 7 files in the zipper must be installed in your QCAD installation path under ...\scripts\Edit\ConvertUnit\
Or in the local data location, see Changelog ... 3.26.2 (2021/04/15):
https://www.ribbonsoft.com/en/documentation/changelog
The folder construction is mandatory, the path to the main script itself should read:
...\scripts\Edit\ConvertUnit\ConvertUnit.js
Andrew may include this update in a next release of QCAD.
The current version is 3.27.6.0.
In such a case it is not required to install this package or if so one can remove it completely including emptied folders.
Regards,
CVH
Converting documents from US Survey units
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Re: Converting documents from US Survey units
Allowing a proper conversion is good for sure, however I think FS#2272 (https://www.qcad.org/bugtracker/index.p ... sk_id=2272) should still be implemented:
- Converting is not always an option, sometimes you want/need to keep within the given system.
- If the US states transition from US survey foot to international foot (which I think is a horrible idea), it should get more important to be able to distinguish them.
- Let's see how "should be avoided" looks in reality, I think this unit will still haunt us for years.
Re: Converting documents from US Survey units
Anda,
I hear your frustrations, but there's nothing I can do about that myself.
I am also just a user who voluntarily shares his scripts.
The QCAD side is just a matter of expanding the unit lists in ...\src\core\RUnit.cpp
Too simple to not fix this in over one year time.
The other player here are the OpenDesign libraries used by QCAD.
'Open' seems like a big word, apparently I can't even create an account to consult the technical data.
I have a related topic here:
https://qcad.org/rsforum/viewtopic.php?t=9506&p=38295
There are no replies there but understand that I investigated this in depth as far as I am able to.
Only the conversion factor for RS.Lightyear is picked up somehow.
https://github.com/qcad/qcad/commits/ma ... /RUnit.cpp
The presented conversion fix is based on:
https://qcad.org/rsforum/viewtopic.php? ... 493#p38249
Now, one can at least fully convert such a drawing and take it from there.
Leaving the original file 'as is' as advised by NIST.
And true, you need to know yourself that such a document uses US Survey units.
I even doubt that units 21-24 were defined in the 80s.
If so, they should be part of the dxf standard to start with.
And I really tried to stretch this.
With the script at hand, what is textual, one can tryout forcing docVars to be set for units 21-24.
Converting a mm drawing to A: Inch, B: Yard, C: Foot, and saving all trials with docVars = 21 to 24 ...
... $INSUNITS is equal to 1 in all 12 cases and the reported unit when re-opening them is Inch.
Regards,
CVH
I hear your frustrations, but there's nothing I can do about that myself.
I am also just a user who voluntarily shares his scripts.
The QCAD side is just a matter of expanding the unit lists in ...\src\core\RUnit.cpp
Too simple to not fix this in over one year time.
The other player here are the OpenDesign libraries used by QCAD.
'Open' seems like a big word, apparently I can't even create an account to consult the technical data.
I have a related topic here:
https://qcad.org/rsforum/viewtopic.php?t=9506&p=38295
There are no replies there but understand that I investigated this in depth as far as I am able to.
Only the conversion factor for RS.Lightyear is picked up somehow.
https://github.com/qcad/qcad/commits/ma ... /RUnit.cpp
The presented conversion fix is based on:
https://qcad.org/rsforum/viewtopic.php? ... 493#p38249
Now, one can at least fully convert such a drawing and take it from there.
Leaving the original file 'as is' as advised by NIST.
And true, you need to know yourself that such a document uses US Survey units.
I even doubt that units 21-24 were defined in the 80s.
If so, they should be part of the dxf standard to start with.
And I really tried to stretch this.
With the script at hand, what is textual, one can tryout forcing docVars to be set for units 21-24.
Code: Select all
150 docVars.setUnit(22);
... $INSUNITS is equal to 1 in all 12 cases and the reported unit when re-opening them is Inch.
Regards,
CVH
Re: Converting documents from US Survey units
I don't think that that script is a suitable solution.
I agree.Anda wrote: ↑Fri Sep 23, 2022 9:42 amAllowing a proper conversion is good for sure, however I think FS#2272 (https://www.qcad.org/bugtracker/index.p ... sk_id=2272) should still be implemented:
Right.
Yes, yes, nope ........... I'm sure it will hunt us for decades!Anda wrote: ↑Fri Sep 23, 2022 9:42 am
- Converting is not always an option, sometimes you want/need to keep within the given system.
- If the US states transition from US survey foot to international foot (which I think is a horrible idea), it should get more important to be able to distinguish them.
- Let's see how "should be avoided" looks in reality, I think this unit will still haunt us for years.
In short: Simplest solution in my opinion would be to integrate that missing unit in the QCAD unit list / Converting tool and yes - QCAD needs to be able to detect that unit itself if existent. In the case that a drawing is set to Unit "None" but you know that is in a US Survey unit drawn then you need simply to change the drawing unit below "Drawing Preferences". The advantage of that would be that from now on it is a piece of cake to convert the drawing to the new standards
The whole idea is not to keep this outdated US Survey unit alive - the idea is to make it easy to transform drawings from the old world to the new world.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: Converting documents from US Survey units
I can't add it to the units list but I included US Survey units and their factor to meters in the Converting tool.
Anda reported that drawings with $INSUNITS = 21 are openend with unit 'None' =0.
I can add that QCAD does reads the value perfectly, I would not have expected anything else.
When you open a file with $INSUNITS = 21 ... 24 the tool can detect that.
Internally QCAD will know that the file is in US Survey units.
Because Convert.js is also used to convert on the fly, one can copy/paste or import regarding the target document its unit.
If "Drawing Preferences" Units could be set, and saved, that would also mean that new files can be created in the 'outdated US Survey units'.
Further, I am not that skilled to adapt the preference page where that will default to 'None'.
The source for the combo's is hard-code there and not constructed from RUnit.cpp lists.
What you explain here is what the adapted tool does.Husky wrote: ↑Sat Sep 24, 2022 8:37 amThe advantage of that would be that from now on it is a piece of cake to convert the drawing to the new standards.
The whole idea is not to keep this outdated US Survey unit alive - the idea is to make it easy to transform drawings from the old world to the new world.
It only converts between units whenever required.
One can open, copy from or import files created in US Survey units.
One can not create such files.
But you are right,
"I don't think that that script is a suitable solution"
One should NEVER make an attempt to UPDATE files created in US Survey units.
The file is stored as inches without that unit conversion was involved.
Regards
CVH