Convert Drawing Units
Moderators: andrew, Husky, J-J
Convert Drawing Units
Hi,
I have read Husky's chat about the new 'Convert To Inch' tool. Looking at the script, Andrew has written it in such a way that it can be used to convert between any units. Therefore I have altered it to do just that.
As you can see, I have added two drop-down combo boxes, and a convert button, to the options toolbar. When the tool starts it reads the current drawing units and set the 'From' unit box to that value (in this case Millimeter). The 'To' unit box is set to None. Simply set the units you wish to use and click the convert button.
I have attached a zip file containing a directory called 'ConvertUnit'. Unzip it and put it in the 'scripts/Misc/MiscModify' directory. You will find the command in the menu 'Misc->Modify->Convert Drawing Units'. The two letter shortcut is 'CU'.
I have done some testing of this and it appears to work correctly.
Note: This will only work with version 3.16.0 and above
Perhaps you could let me know what you think (and perhaps do some rigorous testing).
Thanks
riverbuoy
I have read Husky's chat about the new 'Convert To Inch' tool. Looking at the script, Andrew has written it in such a way that it can be used to convert between any units. Therefore I have altered it to do just that.
As you can see, I have added two drop-down combo boxes, and a convert button, to the options toolbar. When the tool starts it reads the current drawing units and set the 'From' unit box to that value (in this case Millimeter). The 'To' unit box is set to None. Simply set the units you wish to use and click the convert button.
I have attached a zip file containing a directory called 'ConvertUnit'. Unzip it and put it in the 'scripts/Misc/MiscModify' directory. You will find the command in the menu 'Misc->Modify->Convert Drawing Units'. The two letter shortcut is 'CU'.
I have done some testing of this and it appears to work correctly.
Note: This will only work with version 3.16.0 and above
Perhaps you could let me know what you think (and perhaps do some rigorous testing).
Thanks
riverbuoy
- Attachments
-
- ConvertUnit.zip
- (6.58 KiB) Downloaded 855 times
Re: Convert Drawing Units
Year ............ that is what I'm looking for!
I tested this nice little tool a bit and here are my first thoughts:
Let me start with a question. Your tool is able to read (nice!) the actual used drawing unit - for what do I need a drop-down field to change the "From" unit?
Ok, the tool works great for new drawings and never closed drawing. Scale for Entities , text, Dim looks absolute ok. A couple test back and forth .... no problems so far!
Then I figured out that the dim scaling isn't anymore proper working after closing and reloading the drawing. What basically means for all stored drawings. I haven't noticed that before but Andrews tool (Convert Drawing to inch) has the same problem and one of the nieces and biggest benefits of a tool like this one is the overall scaling function for everything (incl. text and dims) in a drawing and in already existing drawings.
The undo function works what is important in my opinion but the Zoom Focus is way of after using undo. Yes - that is more or less cosmetic but it would be nice to have the same view on my drawing like before ...
I have to go ............................ playing around with a new tool!
Thanks riverbuoy for looking into this!
I tested this nice little tool a bit and here are my first thoughts:
Let me start with a question. Your tool is able to read (nice!) the actual used drawing unit - for what do I need a drop-down field to change the "From" unit?
Ok, the tool works great for new drawings and never closed drawing. Scale for Entities , text, Dim looks absolute ok. A couple test back and forth .... no problems so far!
Then I figured out that the dim scaling isn't anymore proper working after closing and reloading the drawing. What basically means for all stored drawings. I haven't noticed that before but Andrews tool (Convert Drawing to inch) has the same problem and one of the nieces and biggest benefits of a tool like this one is the overall scaling function for everything (incl. text and dims) in a drawing and in already existing drawings.
The undo function works what is important in my opinion but the Zoom Focus is way of after using undo. Yes - that is more or less cosmetic but it would be nice to have the same view on my drawing like before ...
I have to go ............................ playing around with a new tool!
Thanks riverbuoy for looking into this!
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: Convert Drawing Units
One additional note:
The unit "None" is often used in CAD drawings - they declare the used unit as text info in that drawing.
If I use this new tool to convert from inch to mm then it will also change the info in Drawing Preferences / General / Drawing Unit into mm. Perfect! The same with all other units ... except "None".
If I "convert" a "None" drawing to mm then the unit will not be changed below Drawing Preferences. I think mathematically correct but now this drawing has a named unit and I think it should be changed below Drawing Preferences to mm. QCad will use this info (if I'm correct???) to convert Library items and the content in the clipboard to insert / copy/past them into a drawing with a different target unit.
The unit "None" is often used in CAD drawings - they declare the used unit as text info in that drawing.
If I use this new tool to convert from inch to mm then it will also change the info in Drawing Preferences / General / Drawing Unit into mm. Perfect! The same with all other units ... except "None".
If I "convert" a "None" drawing to mm then the unit will not be changed below Drawing Preferences. I think mathematically correct but now this drawing has a named unit and I think it should be changed below Drawing Preferences to mm. QCad will use this info (if I'm correct???) to convert Library items and the content in the clipboard to insert / copy/past them into a drawing with a different target unit.
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: Convert Drawing Units
Hi Husky,
Thanks for your testing and feedback.
Anyway, something at the back of my head is telling me not to change this.
I hope this explains everything.
Regards
riverbuoy
Thanks for your testing and feedback.
Good question. I can't think of a single reason why you would need to change the 'From' unit, but, experience tells me that someone might have a use for this, or they may just want to do something daft.Husky wrote:Let me start with a question. Your tool is able to read (nice!) the actual used drawing unit - for what do I need a drop-down field to change the "From" unit?
Anyway, something at the back of my head is telling me not to change this.
You are correct. The scale factor for dimension text is not being adjusted once the drawing has been saved. I have changed this so that the scale is adjusted correctly. I have attached the changed file (ConvertUnit.js). Replace the existing file in 'scripts/Misc/MiscModify/ConvertUnit'.Husky wrote:Then I figured out that the dim scaling isn't anymore proper working after closing and reloading the drawing. What basically means for all stored drawings. I haven't noticed that before but Andrews tool (Convert Drawing to inch) has the same problem and one of the nieces and biggest benefits of a tool like this one is the overall scaling function for everything (incl. text and dims) in a drawing and in already existing drawings.
When you convert the units, the tool automatically adjusts the view, but 'Undo' does not. What I would suggest is you use the menu option 'View->Zoom->Previous zoom' (shortcut 'ZV').Husky wrote:The undo function works what is important in my opinion but the Zoom Focus is way of after using undo. Yes - that is more or less cosmetic but it would be nice to have the same view on my drawing like before ...
If either unit is 'None', then this tool does not do anything, as it (meaning me) doesn't know what to do.Husky wrote:The unit "None" is often used in CAD drawings - they declare the used unit as text info in that drawing.
I hope this explains everything.
Regards
riverbuoy
- Attachments
-
- ConvertUnit.js
- (5.47 KiB) Downloaded 819 times
Re: Convert Drawing Units
Yes it does and I (we?) have to thank you again!!!!riverbuoy wrote:I hope this explains everything.
Happy Holidays!
Husky
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: Convert Drawing Units
I've added this to the Edit menu for the next release, thanks riverbuoy!
https://github.com/qcad/qcad/tree/maste ... onvertUnit
https://github.com/qcad/qcad/tree/maste ... onvertUnit
Re: Convert Drawing Units
I've changed the icon a bit to avoid confusion with the tool to scale the drawing. Hope you don't mind.
Re: Convert Drawing Units
Hi,
I have discovered a weird bug. I am using the tool matrix, rather than the standard toolbar, and after clicking the convert button, the focus is set to the filter box at the top of the tool matrix. Therefore I have changed it so that the tool changes the focus to the drawing just before terminating.
Secondly, there is just an outside chance that the dimension text might be scaled twice. This is because of the order in which I have done things, so I have changed the order to avoid this.
I have attached the changed file (ConvertUnit.js). Replace the existing file in 'scripts/Misc/MiscModify/ConvertUnit'.
Anyway, i am signing off for Christmas. Happy holidays to everyone.
Regards
riverbuoy
I have discovered a weird bug. I am using the tool matrix, rather than the standard toolbar, and after clicking the convert button, the focus is set to the filter box at the top of the tool matrix. Therefore I have changed it so that the tool changes the focus to the drawing just before terminating.
Secondly, there is just an outside chance that the dimension text might be scaled twice. This is because of the order in which I have done things, so I have changed the order to avoid this.
I have attached the changed file (ConvertUnit.js). Replace the existing file in 'scripts/Misc/MiscModify/ConvertUnit'.
Hi Andrew. I don't mind a bit. Designing icons has never been my strongest suit, and you have come up with a much better icon.andrew wrote:I've changed the icon a bit to avoid confusion with the tool to scale the drawing. Hope you don't mind.
Anyway, i am signing off for Christmas. Happy holidays to everyone.
Regards
riverbuoy
- Attachments
-
- ConvertUnit.js
- (5.63 KiB) Downloaded 806 times
Re: Convert Drawing Units
OK, thanks for the update. I've merged the changes:
https://github.com/qcad/qcad/tree/maste ... onvertUnit
You too have a great time off! Merry Christmas!
https://github.com/qcad/qcad/tree/maste ... onvertUnit
You too have a great time off! Merry Christmas!
Re: Convert Drawing Units
Thanks riverbuoy. Happy holidays too!riverbuoy wrote:Anyway, i am signing off for Christmas. Happy holidays to everyone.
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: Convert Drawing Units
Hi Guys,
I noticed a weird behavior after converting the unit to a "bigger" unit like mm to meter. The preview of the Extension Iine is way of. Is that fixable?
Dim on the same rectangle before and after converting from mm to meter ...
... the final click for the position is OK.
I noticed a weird behavior after converting the unit to a "bigger" unit like mm to meter. The preview of the Extension Iine is way of. Is that fixable?
Dim on the same rectangle before and after converting from mm to meter ...
... the final click for the position is OK.
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: Convert Drawing Units
Thanks for the report.
I cannot reproduce this behavior here.
Can you please attach your DXF file, thanks.
I cannot reproduce this behavior here.
Can you please attach your DXF file, thanks.
Re: Convert Drawing Units
Sure, this is a mm to meter converted dxf
Try a Horizontal Dim, click the first point and watch the preview. Maybe you have to zoom out ...
Try a Horizontal Dim, click the first point and watch the preview. Maybe you have to zoom out ...
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: Convert Drawing Units
Got it, thanks.
Should be fixed:
scripts/Draw/Dimension/DimAligned/DimAligned.js
and
scripts/Draw/Dimension/DimRotated/DimRotated.js
Should be fixed:
scripts/Draw/Dimension/DimAligned/DimAligned.js
and
scripts/Draw/Dimension/DimRotated/DimRotated.js
Re: Convert Drawing Units
Works beautiful - thank you very much!
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..."