A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
This post was updated on .


Hello,

If anybody wants to try it, the source code is here https://www.dropbox.com/sh/5qi02kt3oe0x6es/AADuNoMC07iJCVWMy1TU6vxVa?dl=0

You will have to know how to set up and install a new plugin from scratch and build LibreCad from source.

I've built and tested on Windows using Qt Creator 4.7.0:-
   Version: 2.2.0-alpha
   Compiler: GNU GCC 5.3.0
   Compiled on: Aug 10 2018
   Qt Version: 5.11.1
   Boost Version: 1.68.0
   System: Windows 10 (10.0).

It compiles on linux without errors but I don't know how to set up an entry in the plugins menu on linux.
About MAC OS X, I have no idea.

TODO:-
At the moment it will not divide/break the entities but will draw tick marks where the divisions should be,
then you can manually divide.

Any questions, please ask.
Feedback is welcome.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

R. van Twisk
Administrator
super cool!

even with the manual division, this is still going to be a time saver for a lot of people

Ries
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

gabriel
This looks awesome. I' ll try it over the weekend. 

El vie., 10 de ago. de 2018 12:22, R. van Twisk [via LibreCAD] <[hidden email]> escribió:
super cool!

even with the manual division, this is still going to be a time saver for a lot of people

Ries


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/A-PlugIn-to-allow-Lines-Arcs-and-Circles-to-be-divided-into-even-sections-tp5716289p5716290.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

LordOfBikes
Administrator
Many thanks for sharing this.
I've taken the liberty to add your code to our main repository.
https://github.com/LibreCAD/LibreCAD/commit/c43f770a

The only difference on Linux and OS X is the path to the plugin binary. Menu entries are created automatically by plugin interface, when the binary is found in plugins folder.

I made some minor modifications:
- renamed plugin, it's simply Divide now
- split source files, one source and header file per class
- removed blue text color to match better with LibreCAD GUI

How about your git skills?
Do you have a github account?
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
This post was updated on .

 
Hello,

LordOfBikes wrote
- renamed plugin, it's simply Divide now
- split source files, one source and header file per class
- removed blue text color to match better with LibreCAD GUI

How about your git skills?
Do you have a github account?
Rename :- I used DivideOptions as you already have a menu entry and cmdline entry for Divide.
Split :-  I did them as one file, as they are quite short.
Git skills :- Non existant,
Github account :- I have one.

The source code has been revised serveral times and updated today 28-8-2013.

Edit:-
I've updated the source to split the the header & the *.cpp files. 13:30 today.
I've left the headers with *.hpp extensions.
https://www.dropbox.com/sh/5qi02kt3oe0x6es/AADuNoMC07iJCVWMy1TU6vxVa?dl=0

Regards
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

LordOfBikes
Administrator
Sorry, I lost focus on this.

First let me say again, that your efforts are more than welcome!

If you want to put more work in your plugin, I see two ways.

1) It is extra work for us to merge your contributions into code base manually, I won't do this too often. So if you won't invest in learning some git basics, I would wait for a more final version to merge manually again.

2) If you are willing to give git a try, I can merge latest changes when you are ready for it and then you can continue with your own forked repository. This allows automatic merge for us, which is much less time consuming.

For Windows you need git for Windows, which you find here: https://gitforwindows.org/
And I recommend TortoiseGit, a git GUI for git on Windows: https://tortoisegit.org/
All basics are explained on github: https://guides.github.com/activities/hello-world/

Important, when you go with git, is to work on a separate branch. Otherwise, working on forked master branch will mess up things and makes automatic merging impossible.

No matter how you decide to go on, you're contribution is welcome. Don't hesitate to ask if anything is obscure, this can save time for all of us.
You can also ping us on IRC channel #librecad or Zulip chat at https://librecad.zulipchat.com/

Armin
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
Hello,
LordOfBikes wrote
Don't hesitate to ask if anything is obscure.
At the moment, I have no idea how to 'Divide/Break' from a C++ program.
I did think of sending a string of commands but can't work out how to do this.
Any sugggestions would be appriciated.
I'll think about using github.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
Hello,

I'm still playing with this.

To actually divide the entites, I can save the comands to a file or send each command
in order.

Suppose I have this line "li;0,0;100,100;k;" as  an exmample, if I copy and paste into
LibreCad's command box and hit return it works as expected.

What I can't work out is how to write to the command line box from within my C++ program.

Any help/advice would be appriciated.

Regarrds
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

LordOfBikes
Administrator
The command box is not the correct place for plugins to modify entities.
There is no interface to communicate with command box from plugins.

My research shows that the plugin interface lacks some function for your needs.

What you can do with the current interface is to add entities, which represent the split entity.
Additionally to the tick entities, add multiple lines or arcs, e.g. on a new layer, to match the origin entity.

What the plugin interface is missing, is a method to delete the origin entity (Document_Interface::deleteEntity()). This is noted in the class header comment.

Another way would be to implement method Plugin_Entity::split() like Plugin_Entity::rotate() or Plugin_Entity::scale() to split the original entity.
You can look at RS_Modification::cut() to see how the divide function works in LibreCAD.
The origin entity is deleted and two new entities are inserted in place of the previous entity.
This is how your plugin should handle it too, delete the origin and insert multiple smaller entities to create the split contour.


Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
This post was updated on .

Hello,

Breaks & ticks are working on lines, circles and arcs.
Break entities will be drawn on a new layer that will be auto created as shown.
Tick entities will be drawn on the current layer or on a layer selected with the 'new' textbox on the plugin interface
DropBox has been updated.

Regards
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

LordOfBikes
Administrator
Many thanks for your improvement.

Here is the first response concerning your plugin
http://forum.librecad.org/compile-librecad-and-find-new-feature-tp5716473.html

When you will have a break for a couple days, let me know.
Then I can review and merge your changes to github and you can continue from official code after that.

Armin
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

mad-hatter
This post was updated on .
Hello,

LordOfBikes wrote
Then I can review and merge your changes to github and you can continue from official code after that.
I've finished for a while.

Regards

ps.

These work on the ticks and breaks.
Reply | Threaded
Open this post in threaded view
|

Re: A PlugIn to allow Lines, Arcs and Circles to be divided into even sections

gabriel
Wow, thanks, awesome work and dedication.

El dom., 7 de oct. de 2018 09:16, mad-hatter [via LibreCAD] <[hidden email]> escribió:
Hello,

LordOfBikes wrote
Then I can review and merge your changes to github and you can continue from official code after that.
I've finished for a while.

Regards


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/A-PlugIn-to-allow-Lines-Arcs-and-Circles-to-be-divided-into-even-sections-tp5716289p5716484.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD, click here.
NAML