Direct Distance Entry and Point Filters.

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

Post Reply
riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Direct Distance Entry and Point Filters.

Post by riverbuoy » Fri Oct 04, 2013 12:41 am

This has to be quick to avoid being logged off.

Extract files Library.js and CommandLine.js and replace the existing files. Or better still rename the existing files first.
You now have direct distance entry.

Extract directory PointFilter from the attached file and install it under the scripts directory. Add this directory to scripts.pro, or use the one in the attached file.
You now have .x and .y commands in the edit menu, and you can also use .x and .y in drawing mode or on the command line.

Hope someone finds these useful.
Attachments
qcad-dde-dotxy.tar.gz
(13.91 KiB) Downloaded 898 times

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

Re: Direct Distance Entry and Point Filters.

Post by andrew » Fri Oct 04, 2013 10:38 am

Hi Robert,

Many thanks for your contributions!

I've integrated direct distance entry in this commit:
https://github.com/qcad/qcad/commit/868 ... c1e2ab6196

Two quick questions about the point filters:
- How about adding them to the Snap menu instead of Edit? They are very similar to the snap restrictions 'Restrict Horizontal' and 'Restrict Vertical' but with position entry.
- Would you mind if I rename them to 'Restrict X' and 'Restrict Y' following the names of 'Restrict Horizontal' and 'Restrict Vertical'?

I can also imagine two future tools to 'Restrict Angle' or 'Restrict Distance' which would fit in nicely with the two new tools you've created..

Excellent work and great idea!

Andrew

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Direct Distance Entry and Point Filters.

Post by riverbuoy » Sat Oct 05, 2013 1:52 am

Hi Andrew,

Thanks for your kind words. I looked at the commit and see you've actually improved what I provided. Good stuff.

As to the point filters, I copied SnapMiddleManual.js and modified it to take the x coord from one point and the y coord from another, and return a new point. The way the preview works it may appear to restrict movement in the x and y direction, but the actual aim of the point filter is to construct a new point from the coordinates of two points. It doesn't actually restrict anything. I merely restrict the preview to the x or y coordinate while waiting for the user to enter a second point to complete the command.
'Restrict X' and 'Restrict Y' don't actually describe what's happening. The user is actually constructing a new point using the x coord from one point and the y coordinate from a second point and returning that new point. (DotY takes the y coordinate from the first point and x coordinate from the second point.)
So, because we're constucting a point, I felt that snap wasn't quite the right menu as we're not snapping or restricting anything. After some thought I decided the edit menu was the closest match to the action. (Although it's not quite right.)
I should explain that my background is Autocad, where I first came across these commands. (Autocad actually has six point filters:- .x, .y, .z, .xy, .xz and .yz).
These point filters do not appear in any of Autocad's menus, probably because they are only meant to be used inside another command (mainly drawing commands). They are not actual commands in themselves. I only added them to the edit menu so that you can type .x or .y in drawing mode, instead of just in command line mode. They should not really be in any menu. Perhaps you could create a hidden menu that could contain all such commands, but still allow the shortcuts to be used in drawing mode.

Restrict Angle. Instead of restricting the angle I have been thinking about a 'snap to nearest multiple of a given angle' for the Line2P command (with the default being 15 degrees). So it would snap to 0, 15, 30, 45........345 degrees. (360 would be set back to 0). To allow the user to change the angle I would have a spin box in the options toolbar. If I went for global 'snap to nearest multiple' where would the spin box go? It could go in the options toolbar, but snap middle used to put a spin box in the options toolbar, but no longer. Is there a reason not to use the options toolbar?
This option would obviously go in the snap menu.

Restrict Distance. I can't quite imagine exactly what you mean. Perhaps you could expand on the idea. There is already a snap to distance isn't there? Do you mean snap to a distance between two selected points? (SnapDistanceManual?)

Robert
Last edited by riverbuoy on Sun Oct 06, 2013 3:06 pm, edited 2 times in total.

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Direct Distance Entry and Point Filters.

Post by riverbuoy » Sat Oct 05, 2013 8:27 am

Andrew

Re: Point Filters

It has just occured to me that you could rename DotX and DotY to 'SnapConstructManual_X' and 'SnapConstructManual_Y'. Or SnapConstructPoint_X and SnapConstructPoint_Y. This seems logical as I used SnapMiddleManual as the basis for them. So you could then move them to the snap subdirectory and change the init files to add them to the snap menu. I would leave it up to you where they go in the snap menu.
As to shortcuts, both S,X and S,Y are taken, so I would suggest N,X and N,Y (N being the second letter of snap). But I would also like .X and .Y as alternative shortcuts, so old Autocad users like me can still use the same shortcut.
I hope this meets with your approval.

Robert

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

Re: Direct Distance Entry and Point Filters.

Post by andrew » Tue Oct 08, 2013 11:25 am

Thanks! I understand now. This seems like a powerful tool once you know how to use it.

I've added the two new tools to the snap menu as 'X/Y from Points' / 'Y/X from Points'. I didn't change the shortcuts, .x, .y seems fine.

https://github.com/qcad/qcad/tree/maste ... napXManual
https://github.com/qcad/qcad/tree/maste ... napYManual

I've also added you to the Help - About - Credits dialog. Please let me know under what name you would like to be mentioned (currently "Robert S."). Thanks.

riverbuoy
Senior Member
Posts: 121
Joined: Thu Oct 03, 2013 5:37 pm

Re: Direct Distance Entry and Point Filters.

Post by riverbuoy » Sat Oct 12, 2013 4:13 pm

Glad to be of some help.

As for reaching the credits dialog, Ah! Fame at last!! Seriously, thanks for the mention and I am quite happy to be listed as Robert S.
Thanks.

Robert

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

Re: Direct Distance Entry and Point Filters.

Post by andrew » Mon Oct 14, 2013 1:43 pm

You're welcome - I'm happy to see more and more of a community around QCAD development :)

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”