Request - Shape/Polygon created with Center+incircle radius

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
User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 2131
Joined: Wed May 11, 2011 9:25 am
Location: USA

Request - Shape/Polygon created with Center+incircle radius

Post by Husky » Tue Apr 07, 2015 10:06 pm

Hi everybody! 8)

Right now I have again to design a lot of hexagons with different sizes (Bolts and nuts - A/F [across flats]). It isn't easy to do that with the current tools of QCad - you need to use a couple of construction lines to get this simple task done.That brings me back to an old Feature Request of mine ...
http://www.qcad.org/bugtracker/index.ph ... ask_id=388

Goal:
We have already the Shape/Polygon tools to create multiple corner Polygons - created with a "Center/circumradius" or a "Two corner" determination (Symbol 1+2).
I like to ask for additional options:
"Incircle radius + center between two corners" (Symbol 3)
and/or
"Incircle Diameter (A/F) + center between two corners". (Symbol 4)
Husky-2015.04.07-02.png
Husky-2015.04.07-02.png (23.54 KiB) Viewed 8993 times
I guess that isn't to complicated - but I'm not a programmer .... :oops:
It would be really nice to have all usual possibility's covert for the Shape/Polygon tool similarly to the Arc / Circle / Ellipse tools.

What do you think?
Work smart, not hard: QCad Pro

User avatar
J-J
Moderator
Posts: 396
Joined: Tue Mar 24, 2009 9:48 pm

Re: Request - Shape/Polygon created with Center+incircle rad

Post by J-J » Wed Apr 08, 2015 7:33 pm

Hi,
I sustain this idea, I have come across that need a few time, and yes, it would save some construction, but our favorite developer may have other priorities... :wink:
JJ

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by riverbuoy » Thu Apr 23, 2015 6:12 pm

Hi Husky,

Finding myself with some time on my hands, I decided to give this a try.
Husky wrote:I like to ask for additional options:
"Incircle radius + center between two corners" (Symbol 3)
and/or
"Incircle Diameter (A/F) + center between two corners". (Symbol 4)
I have added two options to the shape toolbar.
PolygonAF-Toolbar.png
PolygonAF-Toolbar.png (3.41 KiB) Viewed 8925 times
The current shortcuts for the existing polygon options are 'pg1' and 'pg2'. So I have added the shortcuts 'pg3' and 'pg4' for the two extra commands.
I have also changed the prompt in the options toolbar from 'No. of corners' to 'No. of sides', and added a checkbox labelled 'Corners'.
PolygonAF-Options.png
PolygonAF-Options.png (5.89 KiB) Viewed 8925 times
pg3 prompts for a centre point and a side (or corner, if the Corners check box is selected).. It then draws a polygon that is twice the distance between the center point and selected point.
Note: Because the center point doesn't change, the polygon for odd numbered sides are slightly offset from the current mouse pointer.
PolygonCS-Offset.png
PolygonCS-Offset.png (4.39 KiB) Viewed 8925 times
Here the mouse pointer is 10 units away from the center point, but the line of the polygon is drawn approximately 9 units from the center point.

Instead of selecting the distance between sides, you can specify the distance between corners by selecting the 'Corners' checkbox.

pg4 works the same as pg3, except it asks for the two sides (or corners) instead of a center and side. Also because the center point changes, when drawing odd sided polygons, they display correctly, passing through the two points selected.

The attached file 'ShapePolygon.zip' contains two directories. Copy these to the 'scripts/Draw/Shape' directory.

Instead of a long-winded explanation, just start using these to see what you think. Because I am not an engineer, I don't know if this is what you envisioned. Perhaps you could let me know.

Thanks

riverbuoy
Attachments
ShapePolygon.zip
(25.53 KiB) Downloaded 176 times

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by andrew » Fri Apr 24, 2015 9:06 am

Thanks riverbuoy! Looks great :)

Somehow, I find the behavior of ShapePolygonAFCP more intuitive without the special treatment for an odd number of corners:
Screen Shot 2015-04-24 at 10.06.12.png
Screen Shot 2015-04-24 at 10.06.12.png (11.53 KiB) Viewed 8901 times
Or maybe I didn't get the point of having the cursor offset from the corner? What do you think?
Attachments
ShapePolygonAFCP.js
(5.43 KiB) Downloaded 172 times

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 2131
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Request - Shape/Polygon created with Center+incircle rad

Post by Husky » Fri Apr 24, 2015 9:17 am

riverbuoy wrote:Hi Husky,

Finding myself with some time on my hands, I decided to give this a try.
Nice! Thank you very much for your effort!!! :D :D :D
riverbuoy wrote: ... just start using these to see what you think. Because I am not an engineer, I don't know if this is what you envisioned. Perhaps you could let me know.
I did ... here are my thoughts ... :shock:
... and I like to show you one example why I'm asking for something like this.
If I need to draw fasteners like bolts and nuts with a hex head I have to design it as a hexagon.
I will find the correct dimensions in my Table book or also, by this time, online. I'm looking for the in-circle or the out circle diameter.
Something like this - check the first table: http://www.fastenerexperts.com/

Now I have to check for the "s" or "e" dimensions and I'm ready to design my hexagon for a bolt and/or a nut.
Husky-2015.04.24-01.png
Husky-2015.04.24-01.png (4.7 KiB) Viewed 8901 times

Your first tool PG3 is pretty good for all shapes of Polygons with even numbers of sides (4, 6, 8, 10, 12 etc etc sides). But I still need to use construction lines.
It would be nice to have also the option to work with a diameter (radius?) value - maybe with an on/off switch to use it on both ways.
Uneven numbers of sides: Right now I can't imagine how to solve the problematic with the uneven number behavior. Would it make sence to restrict this tool just to even numbers of sides ..... I'm not sure. :cry:

The same with PG4. Very nice but I need also the possibility to work with/without diameters and or radian. And I think we have not the problem like PG3 with uneven numbers of sides. What do you think?
Work smart, not hard: QCad Pro

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by riverbuoy » Sat Apr 25, 2015 5:57 pm

Hi,
andrew wrote:Or maybe I didn't get the point of having the cursor offset from the corner? What do you think?
The reason for this is to meet Husky's original request, where, for polygons with an odd number of sides, the user could enter the distance from the centre of a flat side to the opposite corner. In this case the user selects a centre point, and then either a flat side point or a corner. If treats the distance entered as half the height of the polygon. So if you enter a distance of 10, the height is 20 units. If the distance from the centre point to the line is 10 units, then the height of the polygon is just over 22 units. Similarly if the distance to the corner is 10, then the height is less than 20 units. So I made the assumption that because the user selected the centre point, it should probably not be changed without the user's knowledge. This results in the behaviour you see.
Perhaps an option could be provided so the user could decide if the centre can be changed for polygons with an odd number of sides. This would then allow the flat side and corner to pass through the mouse pointer position (as is the case in pg4, where the centre does change). Or perhaps the command takes the decision to move the centre for all polygons with an odd number of sides. What do you think?
Husky wrote:But I still need to use construction lines.
You can enter relative coordinates when prompted for the second point. (In fact you can use them at any time a point is expected).
Husky wrote: I'm looking for the in-circle or the out circle diameter.
The distance entered with pg3 is the in-circle radius, if the distance is to a flat side. If the distance is to a corner then that is the out-circle radius.
pg4 is the same except the distance between the two points is the diameter of a circle. If the distance is between flat sides, then that is the in-circle diameter (s in your example) . The distance between corners is the out-circle diameter (e in your example).
Husky wrote:I will find the correct dimensions in my Table book or also, by this time, online. I'm looking for the in-circle or the out circle diameter.
Something like this - check the first table:
I looked at the table but discovered the sizes don't tally with the generated polygons. For example, if you draw a polygon at 4mm between the flat sides, the distance between the corners is 4.62mm, not 4.32 as stated in the table. If you draw a polygon with a distance of 4.32mm between the corners, then the distance between the flat sides is 3.74mm. What am I missing?

riverbuoy

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 2131
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Request - Shape/Polygon created with Center+incircle rad

Post by Husky » Sat Apr 25, 2015 8:46 pm

Hi riverbuoy,
riverbuoy wrote:
Husky wrote:But I still need to use construction lines.
You can enter relative coordinates when prompted for the second point. (In fact you can use them at any time a point is expected).
Yes you are right. That would work perfectly for a clear vertically or horizontally orientation.
But ...
1. I have to start additional the relative coordinate tool and I have to put in 2 values. To define a diameter I need only one value.
Remark: That would also work with many other tools e.g. "Circle/Center point". But for an easier and faster work flow QCad provides also the Circle/Center radius tool without the need to start the relative coordinate tool. Very convenient!
Husky-2015.04.25-03.png
Husky-2015.04.25-03.png (27.32 KiB) Viewed 8868 times
2. If you don't have a straight x or y orientation - how will you define a A/F diameter of e.g. 13 on a rotated hexagon like this one?
Husky-2015.04.25-02.png
Husky-2015.04.25-02.png (2.07 KiB) Viewed 8868 times

riverbuoy wrote:I looked at the table but discovered the sizes don't tally with the generated polygons. For example, if you draw a polygon at 4mm between the flat sides, the distance between the corners is 4.62mm, not 4.32 as stated in the table. If you draw a polygon with a distance of 4.32mm between the corners, then the distance between the flat sides is 3.74mm. What am I missing?
Maybe that wasn't a good example - sorry for that. The table is used for the dependency between a bolt / screw Hex Head and the size of a wrench / socket tool etc.

My intention was only to show that I'm looking for the possibility to use a diameter to determine the Corner/Corner or the Flat/Flat distance on an even side polygon.
Right now I'm not sure what would be the best solution for an uneven side polygon ...
Work smart, not hard: QCad Pro

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by riverbuoy » Sat Apr 25, 2015 11:08 pm

Hi Husky
Husky wrote:2. If you don't have a straight x or y orientation - how will you define a A/F diameter of e.g. 13 on a rotated hexagon like this one?
Use relative polar coordinates. So for your example, using pg4, select the first point and enter in the command line:-
@13<45
This will draw a polygon rotated 45 degrees and distance between flat sides of 13.

Hope this helps.

riverbuoy

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 2131
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Request - Shape/Polygon created with Center+incircle rad

Post by Husky » Sun Apr 26, 2015 9:32 am

riverbuoy wrote:Use relative polar coordinates. So for your example, using pg4, select the first point and enter in the command line:-
@13<45
This will draw a polygon rotated 45 degrees and distance between flat sides of 13.
Works for me! I guess I would prefer more the "Restrict Angle or length" option but that works on a similar way.
andrew wrote:Thanks riverbuoy! Looks great :)

Somehow, I find the behavior of ShapePolygonAFCP more intuitive without the special treatment for an odd number of corners:
Screen Shot 2015-04-24 at 10.06.12.png
Or maybe I didn't get the point of having the cursor offset from the corner? What do you think?
This solution works much better for me because I don't know how I could handle an offset at the corner ... :oops:
Work smart, not hard: QCad Pro

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by riverbuoy » Sun Apr 26, 2015 4:44 pm

Hi Husky,
Husky wrote:Works for me! I guess I would prefer more the "Restrict Angle or length" option but that works on a similar way.
You can actually use the 'Restrict Angle or Length' option here. The shortcut is EL. This works the same way as it does in line. You can in fact use this restriction any time a point is expected, in any command. The command button in line is there more as a convenience (in case the user doesn't remember the shortcut, or the fact that you can restrict the angle and length).
Note: EL is a toggle. So if the angle and distance boxes are not currently displayed, typing EL will display them. If the boxes are currently displayed, typing EL switches them off.

Perhaps the button in 'Line' and 'Draw Polyline' has given the impression that you need the button to use this restriction. You don't. This could be made more clear to users.

Again, I hope this helps.

riverbuoy

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 2131
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Request - Shape/Polygon created with Center+incircle rad

Post by Husky » Mon Apr 27, 2015 8:44 am

Hi riverbuoy,
riverbuoy wrote:Again, I hope this helps.
Yes - thats helps a lot. Thank you very much!!!


@Andrew
Any chance to get this in the next update? With your modified ShapePolygonAFCP?
Work smart, not hard: QCad Pro

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

Re: Request - Shape/Polygon created with Center+incircle rad

Post by riverbuoy » Mon Apr 27, 2015 5:21 pm

Hi Andrew,

OK, I took the decision to have ShapePolygonAFCP.js alter the centre point automatically without asking the user. So the polygon flat side and corner point now pass through the mouse pointer position, for polygons with an odd number of sides.
I have attached the new version.
If a user wishes to find the centre point, you can draw a line from a corner to the opposite middle point of the flat side. Draw a second line from another corner again to the opposite middle point. The centre is the intersection where the two lines cross.

riverbuoy
Attachments
ShapePolygonAFCP.js
(5.78 KiB) Downloaded 186 times

Post Reply

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