Centreline Cross

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

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

Centreline Cross

Post by riverbuoy » Sat Dec 14, 2013 7:11 pm

Centreline Cross

This tool draws a centreline cross in arcs, circles, ellipses and elliptical arcs, as requested by Husky and seconded by J-J.
In the options toolbar there are two input boxes labelled X and Y.
The value in the X box refers to the horizontal line of the cross, and the value in the Y box refers to the vertical line of the cross. If you leave the Y box empty then the value in the X box is used for both lines of the cross.

To the right of these boxes is a drop-down combo box with two options, 'Extend' and 'Length'.

Extend mode is equivalent to 'overshoot' in Husky's diagram. A positive value will extend the lines past the circle. A value of zero will draw the lines to meet the circle. A negative value will draw the lines short of the circle. If the length of a line evaluates to zero or less than zero, then that line is not drawn.

Length mode draws lines with the specified length in the X and Y boxes. Again, if Y is empty then X is used for both lines. Also if the length of a line evaluates to zero or less than zero then that line is not drawn.

To the right of this is the 'Orient' box. This specifies the angle to draw the cross at. You can enter a value between 0.0 (default) and 180.0. A value greater than 180 would be the same as that value minus 180. (i.e. 181 - 180 = 1, so 1 will produce the same result as 181. A value of 91 will not produce the same result if the lines are of a different length.).
Ellipses and elliptical arcs have an angle associated with them, so the cross is drawn at that angle. That angle becomes the base angle to which the orientation is added. (i.e. if an ellipse is drawn at an angle of 45 degrees, then the cross is drawn at 45 degrees. If you then set an orientation of 20 degrees, the cross will be drawn at 45+20 = 65 degrees.)

The lines are drawn on the current layer so they can have different attributes from the arcs, circles etc.

Also the command does not check if a cross has already been drawn, so if you click on a circle more than once then you will have more than one cross.

If you wish to undo a cross use the 'undo; option in the 'edit' menu. Right clicking terminates the command. If you select an entity that is not an arc, circle, ellipse or elliptical arc, then a warning message is shown.

The shortcut for this command is CS.

The attached zip file contains the 'Cross' sub-directory.
Extract this to the 'scripts/Misc/MiscDraw' sub-directory, and you'll find the command in menu 'Misc->Drawing'.

Hope this is what you requested. I have only done limited testing of this, but it appears to be working correctly. However if you do find a bug, let me know so I can fix it.
Attachments
Cross.zip
(8.06 KiB) Downloaded 1376 times

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

Re: Centreline Cross

Post by Husky » Sun Dec 15, 2013 2:25 am

riverbuoy wrote:Hope this is what you requested.
Yes - that is absolutely that what I was looking for. It's a kind of early Christmas gift for me ... thank you very much to work on this nice execution!!! :D :D :D

So far it works really well and the rotated etc. ellipse functionality is amazing!!! I will test this new tool a bit further and if I experience any bug etc ... :wink:

For now ... only one question: :oops:
Would it be possible to get an extra Button for this new function in the "Line Icon bar"? Yes I know: Dirt on me ... a whole scoop! :lol:

However - really well done! Thanks again!

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

Re: Centreline Cross

Post by J-J » Sun Dec 15, 2013 6:08 pm

Hello riverbuoy
riverbuoy wrote: Centreline Cross

Hope this is what you requested.
It sure is, I love it, thanks again for sharing that handy addition.
JJ Win7 pro-64

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

Re: Centreline Cross

Post by riverbuoy » Sun Dec 15, 2013 8:40 pm

Hi Guys

Thanks

I'm just happy to help.

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

Re: Centreline Cross

Post by andrew » Mon Dec 16, 2013 2:08 pm

Thanks riverbuoy! This works great. I've added this tool to our repository for future QCAD releases.

I've only made one small modification to add the two center lines in one transaction, so the tool can be undone in one single step:
https://github.com/qcad/qcad/commit/eaf ... d4cc2b6482

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

Re: Centreline Cross

Post by riverbuoy » Tue Dec 17, 2013 12:49 am

Hi Andrew

Thanks for the tip. I am still fairly new to ECMAScript and QCAD's classes and methods, and frankly it hadn't occurred to me that you can add more than one entity in one operation. Thinking about it thought, it seems obvious that you could do this.
Anyway thanks again for the tip, and I'll keep it in mind for the future.

User avatar
caigner
Full Member
Posts: 83
Joined: Wed Jan 30, 2013 5:24 pm
Location: Austria

Re: Centreline Cross

Post by caigner » Wed Jul 23, 2014 3:36 pm

I just saw that this script is already in the new version. Works really great! Thanks!

One more request: Would be nice to enter the extension (overshoot) also as a relative value in percent of circle diameter.
QCAD Pro on Gentoo Linux

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

Re: Centreline Cross

Post by riverbuoy » Mon Jul 28, 2014 7:46 pm

caigner wrote:One more request: Would be nice to enter the extension (overshoot) also as a relative value in percent of circle diameter.
OK. Here it is. Replace the two existing files in '/scripts/Misc/MiscDraw/Cross' with the two attached files.

Enjoy

riverbuoy
Attachments
Cross.ui
(3.68 KiB) Downloaded 1216 times
Cross.js
(6.18 KiB) Downloaded 1081 times

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

Re: Centreline Cross

Post by Husky » Mon Jul 28, 2014 8:30 pm

riverbuoy wrote:Enjoy
I'll do that! 8)

Thank's! :D
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..."

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

Re: Centreline Cross

Post by Husky » Wed Jul 25, 2018 8:16 pm

Hi,

I noticed since a few QCAD updates that the "Centerline Cross" tool is a kind of instable. Many times it is not working and needs a "Wake up". A clear pattern isn't for me identifiable but in many cases it works when I restart QCAD, create the first Centerline Cross in the Start default drawing and then go ahead to work on my actual drawing. That is why I call it needs a "Wake UP" :wink:

Is there something what could be done to make it more stable?

QCAD Pro 3.21.2 / Win10/64
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..."

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

Re: Centreline Cross

Post by J-J » Wed Jul 25, 2018 8:35 pm

Hi Husky,
I also posted on that unpredictable behavior in the past year, glad I'm not the only one noticing it. I quite like that little tool and it bothers me when it stops working!

https://www.qcad.org/rsforum/viewtopic.php?f=33&t=4976
JJ Win7 pro-64

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

Re: Centreline Cross

Post by andrew » Wed Jul 25, 2018 8:58 pm

It's a third-party tool.. Everything in Misc is untested / contributed / unfinished / might work / might not.

Let me know if you find a reproducible case and I will look into it.

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

Re: Centreline Cross

Post by J-J » Wed Jul 25, 2018 9:14 pm

Reproducible will be the hard part as I always noticed that closing the file and restarting QCAD would reactivate a normal behavior of the tool e_confused
JJ Win7 pro-64

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

Re: Centreline Cross

Post by Husky » Wed Jul 25, 2018 9:57 pm

Yeeehaw! I found the first suspect. But I have the feeling there is a gang behind that behavior ... :wink:

start QCAD Pro.
draw 2 Circle,
draw a Rectangle,
use Centerline Cross on 1. circle = works,
use Stretch on the Rectangle,
use Centerline Cross on 2. circle = doesn't works anymore.
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..."

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

Re: Centreline Cross

Post by riverbuoy » Thu Jul 26, 2018 1:50 pm

Hi Husky,

I started up QCAD Pro Trial Edition. The behaviour is exactly as you describe. I then started the community edition (by renaming the plugins) and the problem went away. Centreline Cross was working exactly as it should. Finally, I have the source code of the community edition, which I have compiled. I started this version and again Centreline Cross worked exactly as it should. Therefore it would appear that the problem is somewhere in the Pro Plugin, and so, I can't help with that.

Regards

riverbuoy

Post Reply

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