Break Command

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

Break Command

Post by riverbuoy » Thu Mar 20, 2014 4:25 pm

I have created a new command to break entities. It is very similar to 'Break out Segment', but instead of automatically selecting the nearest intersections, the command prompts the user to select the object to break, followed by two break points. Because the user selects the points manually, I have called this 'Break out Manual' in the 'Modify' menu, with the shortcut 'B2'.
The points which you select can be anywhere in the drawing. The command projects the points onto the closest point on the selected object, and uses that point as the break point. As you move the cursor around, a temporary line is drawn from the cursor position to the nearest point on the entity. (You can also select points on the entity. The temporary line is drawn using the 'Auxiliary Shapes' colour. You can change this in 'Edit->Application Preferences->Graphics View->Colors'.)
You can break lines, arcs, circles, ellipses or elliptical arcs. If you select another type of objrect, a warning message is shown.
If one breakpoint maps onto an endpoint and the other breakpoint maps to the other endpoint then the whole entity is removed. If both breakpoints map to the same endpoint then nothing is removed. If one breakpoint maps to an endpoint and the other breakpoint maps to a point on the entity then that portion of the entity is removed. If both breakpoints map to the same point on the entity then the entity is divided, but nothing is removed.
For circles and full ellipses, after choosing the two breakpoints you are prompted to select the part of the circle or ellipse, to remove. (This doesn't use the selection point, or direction of circle/ellipse to determine which part to remove.) If both breakpoints map to the same point on a circle, the circle is replaced with an arc, and you are not prompted to remove anything. For ellipses, the ellipse is replaced with another ellipse. When the startpoint and endpoint of an ellipse are the same then QCAD draws an ellipse rather than an elliptical arc.
There is one option in the options toolbar, a checkbox 'Remove segment'. The default is checked. If you uncheck it the part between the breakpoints is not removed, but the entity is divided at the breakpoints.
I have attached the file 'Break.zip', which contains the 'Break' directory. Copy this directory to the 'scripts/modify' directory.

Hope you find this useful.

riverbuoy
Attachments
Break.zip
(11.05 KiB) Downloaded 833 times

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

Re: Break Command

Post by Husky » Fri Mar 21, 2014 9:16 am

Hello riverbuoy 8)
riverbuoy wrote:Hope you find this useful.
I just started to test it for me but till now I already like it. Thank you very much!!!

First thing what I realized was that this new tool doesn't likes Polylines (you mention that in your description) and the same warning will pop up with blocks.
If I explode a Polyline or also a block and break it down to an accepted entities everything works fine.
Yes I know - the already existing tools in QCAD "Break out segment" D2 and "Auto Trim" AX are working with the same restrictions.

But if I use the "Clip to rectangle" CLR tool I haven't this restriction. It seems to me that this tool will explode automatically a Polyline or a Block before it will finish the task of itself.

Now my question .... e_surprised
Would it be possible to implement this "automatically break down function" also in your new tool to have a "unlimited" tool for all situation?

However. Thank you very much to figure out what could be improved in QCAD and working so hard on such nice solutions. I really appreciate that!!!
I'm sure that I'm not alone with this opinion .... :wink:
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
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Break Command

Post by andrew » Fri Mar 21, 2014 2:41 pm

Would it be possible to implement this "automatically break down function" also in your new tool to have a "unlimited" tool for all situation?
This is a tricky request. The problem is that this would automatically break up blocks without the user necessarily knowing that fact.
If a user tries to modify entities that are part of a block reference, it is not clearly defined what s/he wants to achieve:
A. should the block definition be modified?
B. should the block be exploded and the modification be done on the exploded contents of the block, leaving the block definition untouched?
C. should a new block be created with the modified contents as block definition?

Whenever it is unclear what the user wants, the user is required to go through some extra steps to make it clear what s/he wants:
A. open the block definition before the modification
B. explode the block before the modification
C. create a new block, etc.

I think this restriction prevents a lot of accidental, unnoticed mistakes. Only if user deliberately goes through the steps A, B or C, it is unmistakable clear what s/he wants.

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

Re: Break Command

Post by Husky » Sat Mar 22, 2014 9:06 am

andrew wrote:This is a tricky request. The problem is that this would automatically break up blocks without the user necessarily knowing that fact.
I absolutely understand your idea behind this but on the other hand there are a lot of user out there which are aware of what will happen if they use those tools.

By the way: Why is the "Clip to rectangle" tool an exceptional case?
andrew wrote:Whenever it is unclear what the user wants, the user is required to go through some extra steps to make it clear what s/he wants:
Before you send ALL user through some extra steps would it be not more efficient to pop up a warning with the message what will happen if they go further this way? And an option to kill this warning message for ever or to show it always again in combination with the use of these particular tools?
I could also imagine a "Switch" in the "Application Preferences" for "Tools with Polyline/Block restrictions": "Automatically explode a selecting". Yes/No
andrew wrote:I think this restriction prevents a lot of accidental, unnoticed mistakes. Only if user deliberately goes through the steps A, B or C, it is unmistakable clear what s/he wants.
But if you know what you are doing and how QCAD will handle your action there are a lot of unnecessary extra steps to get the job done.
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: Break Command

Post by riverbuoy » Tue Mar 25, 2014 6:26 pm

Husky wrote:
Thank you very much to figure out what could be improved in QCAD and working so hard on such nice solutions. I really appreciate that!!!
Thanks for your kind words and support. However I think you give me too much credit. Most of what I have done is take existing code and tweak it to create a new command. Especially for this break command. I took a big chunk from Autotrim and a chunk from Breakout Segment, and then tweaked them to create this command.
Husky wrote:
Would it be possible to implement this "automatically break down function" also in your new tool to have a "unlimited" tool for all situation?
Thinking about this, might it be that your blocks are too big? Too big in the sense that they containg too many objects. This sounds counter-intuitive, but as I'm sure you know, the block is stored only once in a drawing and when you insert a block only a reference to that block is saved in the drawing. Therefore the more objects in the block, the more space is saved with each insertion. However, if the block contains objects which need to be changed, you need to explode the block to make the changes, thereby negating the benefits of using blocks in the first place.
If this is the case, it would be better to remove the objects that need to change, from the main block, and put these into a seperate block using the same reference point for each block. Then when you insert the main block you can also insert the block containing the objects which require changing, and explode that block, so only the objects that need changing are exploded.
Sometimes a little planning beforehand can save time in the long run.

riverbuoy

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

Re: Break Command

Post by andrew » Thu Apr 10, 2014 1:44 pm

This tool and translations / doc is now checked in at:
https://github.com/qcad/qcad/tree/maste ... kOutManual

Thanks!

Post Reply

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