How to combine entities to a new outline? [SOLVED]

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules
Always indicate Operating system, QCAD version
Attach Drawing files, Screenshots
Post one question per topic.
User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

How to combine entities to a new outline? [SOLVED]

Post by plaatjesprater » Thu Dec 19, 2019 2:37 pm

Hello there,

I'm an experienced cad-user and I like Qcad, but here I'm a new user and I have difficulies in a recent design for a coaster. The design is made with a lot of ovals (see image). Now I want tot make it ready for a lasercutter. The lines you see now will be halfcut and there is an outline to be made for the overall form and two small inner lines too (for the 'eyes'). But how to make this outline/inline? In my old cad-program I could unite all the entities to a new path/spline/polyline-like object.For the inner open zone (eyes) I could have used a bucket tool to define such a ployline/spline. How can I perform such actions in Qcad?

Regards,

Kasper


systems Win 10, Qcad 3.23
Attachments
onderzetter.png
onderzetter.png (180.89 KiB) Viewed 2063 times
Last edited by plaatjesprater on Sun Dec 22, 2019 5:17 pm, edited 1 time in total.
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

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

Re: How to combine entities to a new outline?

Post by andrew » Thu Dec 19, 2019 9:14 pm

QCAD does not have tools for boolean operations on closed shapes nor a bucket fill type tool. Both are very complex operations when arcs, ellipses, splines are involved.

For an approximation of the union (outer most contour), you can use a simple script as follows:

1. Open the script shell (Misc > Development > Script Shell)
2. Select all ellipses
3. Paste the script below in to the command line of the script shell. Note that this is extremely crude code without any checks that might crash your QCAD. Be sure to save your work first. You also might want to do this with a copy of the ellipses as the ellipses will be converted into polylines in the process.

Code: Select all

RSettings.setValue("Explode/EllipseSegments", 1024);
doc=getDocument()
ids=doc.querySelectedEntities()
clipper=new RPolygonClipper()
for (i=0; i<ids.length; i++) {
    clipper.addSubjectPath(doc.queryEntity(ids[i]).getData().getVertices());
}
clipper.execute(RS.Union, RS.NonZero, RS.NonZero);
addPolyline(clipper.getSolutionPath(0), true)

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline?

Post by plaatjesprater » Sat Dec 21, 2019 2:09 pm

This could have been a simple and elegant solution, but it didn't work because qcad crashed. I tought: let's do the boolean trick in Inkscape and work on in Qcad but that wasn't easy as well.
Exported the drawing to Inkscape as svg and made the outline (that was the easy part).
Imported the new made outline in qcad but it would not show. Strange because other shapes I made as svg had no problems. Then I exported from Inkscape as dxf12 with a better result. Transformed the splines and lines to a new polyline to find out there was a little vertical scale problem (see picture, the white outline doesn't really fit). It is still a funny drawing but not exactly following the plan I had.

Nobody is to blaim because of my strange workflow of exporting and importing but I don't exactly understand what goes wrong.

Is there a reason boolean actions are not supported in qcad, or is this the reason? Is there a change qcad will have them in the future or is this a irrelevant question?
Attachments
onderzetter2.png
onderzetter2.png (186.64 KiB) Viewed 1974 times
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline?

Post by plaatjesprater » Sat Dec 21, 2019 3:09 pm

I tried another way of solving the issue. In the picture is seen that two circles with offset distance deliver a nice result. When I try this with 34 elipses it doesn't. My idea was to do it with the offset tool and then make an inner offset line as well. That one should then correspond with the orginal form of the 34 elipses. Next time I tried with 4 elipses it crashed.
Attachments
onderzetter3.png
onderzetter3.png (126.05 KiB) Viewed 1969 times
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

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

Re: How to combine entities to a new outline?

Post by andrew » Sat Dec 21, 2019 5:26 pm

Can you attach an example that crashes? Does it really crash or just hang, i.e. the operation takes very long? Note that if QCAD is "not responding" that does not mean it crashed but simply that it's busy.

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline?

Post by plaatjesprater » Sat Dec 21, 2019 6:16 pm

OK finally I found a way to realize it. The critical mistake was that I accidentally scaled the group of entities in Inkscape. So I tried everything again and then it finally worked.

So in short description:
Export to Inkscape with advanced svg export
In Inkscape everything disapeared, set linewidth to 0,1 and the lines appear again
The import from Qcad is twice grouped: Object > ungroup > 2x
copy all lines to keep the originals (just to be sure)
select all lines: path > unite
The result is exported as dxf r14 lwpolyline selected
Imported in the qcad drawing
select the lines and convert to polyline by 'polyline from segments' (OG)
a little scaling was needed: modify > scale > by mouse (choose in dialog)

Result in the image
Afterwards the offset tool (offset with distance) worked fine

So for other users who want to perform tricks like this, this is a way to do a boolean operation nice and pretty easy if you follow these steps.
Attachments
onderzetter4.png
onderzetter4.png (162.32 KiB) Viewed 1964 times
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

CVH
Premier Member
Posts: 672
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How to combine entities to a new outline?

Post by CVH » Sat Dec 21, 2019 7:56 pm

plaatjesprater wrote:
Sat Dec 21, 2019 3:09 pm
Next time I tried with 4 elipses it crashed.
Hi,
I tried 4 ellipse and it works using polylines as intermediate.
4xEllipse + offset.png
4xEllipse + offset.png (18.67 KiB) Viewed 1958 times

Regards,
CVH
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline?

Post by plaatjesprater » Sun Dec 22, 2019 9:54 am

@CVH Did you change the elipses into polylines first? What function did you use for that? I still feel like a greenhorn in Qcad, but getting more used to it day by day. :oops:
I ordered the qcad-book on lulu, but it is little delayed by christmas madness.

@Andrew: The crash did happen, but I couldn't reproduce it. It might be something like I was impatiened and doing too much at the same time. Nonetheless here is the file that I finally made with Inkscape, perfect result in the end. I'm still curious how to do this within qcad because that is obviously my goal. The closed white contour is made in Inkscape, the second is an offset in Qcad.

Is it a good idea to make a proposal for a uniting boolean tool? This is by far the most used variation and maybe almost there by the offset tool. Or maybe is a handy workflow of the offset tool allready good enough?

Regards, Kasper
Attachments
QC forum coaster that crashed.dxf
(163.06 KiB) Downloaded 83 times
Last edited by plaatjesprater on Sun Dec 22, 2019 12:12 pm, edited 1 time in total.
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

CVH
Premier Member
Posts: 672
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How to combine entities to a new outline?

Post by CVH » Sun Dec 22, 2019 11:19 am

Hi,

Selection -> Modify / Explode
But in the end there is something limiting in offsetting a multi selection off polys. :oops:
Will file a bugreport.

It's a long way around. Left - Right - twice selecting where to offset.

It doesn't come out perfect also due to the limited approximation.
Used 64 segments to explode the ellipses.
Further, an offset of an ellipse is never an ellipse itself. :(
Offsettting non-ellipses back or one further and two back is never ellipsoid.
Flaws add up. :cry:

Regards,
CVH
Attachments
QC forum coaster that crashed.rev.dxf
(660.2 KiB) Downloaded 82 times
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

CVH
Premier Member
Posts: 672
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How to combine entities to a new outline?

Post by CVH » Sun Dec 22, 2019 11:30 am

QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline? [SOLVED]

Post by plaatjesprater » Sun Dec 22, 2019 6:08 pm

Very convincing result CVH! Now i see how to do this easy within Qcad. I'm still curious wether it is a good idea to propose a new feature with one or a few boolean functions. On the other hand, this is the 'brainpower method' as Husky stated. Thanks for your help!
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

CVH
Premier Member
Posts: 672
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How to combine entities to a new outline? [SOLVED]

Post by CVH » Sun Dec 22, 2019 6:34 pm


Very bad result too
:!:

Did not need 'Brainpower', Divide et impera.
plaatjesprater wrote:
Sun Dec 22, 2019 6:08 pm
'brainpower method' as Husky stated.
Where did he that :?:

Thanks all together,
CVH
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline? [SOLVED]

Post by plaatjesprater » Sun Dec 22, 2019 8:05 pm

The quote of Husky was made in a basic tutorial on youtube. It was a funny quote so I remenbered it.

Last question for the moment: you said the elips was divided in 64 points in a polyline. When I repeated your action, it made only 32. Do you know where this can be ajusted, or is it in the program preferences?
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

CVH
Premier Member
Posts: 672
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: How to combine entities to a new outline? [SOLVED]

Post by CVH » Sun Dec 22, 2019 8:26 pm

Edit / Application Preferences / Modify / Explode. 8)
Not happy with the segments thing =relative accuray.

Using offsets a lot.
Fighting errors a lot.
I come by there more than once a day.

Regards,
CVH
QCADpro 3.24.3.0 / win7pro 32 bit / 4GB / 1e generation i7 2.6Ghz / HDD GeForce GT 520

User avatar
plaatjesprater
Junior Member
Posts: 14
Joined: Thu Dec 19, 2019 2:09 pm

Re: How to combine entities to a new outline? [SOLVED]

Post by plaatjesprater » Wed Dec 25, 2019 12:21 pm

I still have issues combining polygons with offset. See these results in the images. Maybe I do something wrong but I can't find out what it could be. 3 polygons are selected but only 2 want to offset. Is there something to prevent this? In the case wilt elipses there were 4 of them perfectly combined?
Attachments
Schermafdruk 2019-12-25 12.14.58.png
Schermafdruk 2019-12-25 12.14.58.png (151.96 KiB) Viewed 1749 times
Schermafdruk 2019-12-25 12.14.39.png
Schermafdruk 2019-12-25 12.14.39.png (151.9 KiB) Viewed 1749 times
a good design is like love at first sight
system: win10 HE, i7 266GHZ, 32Gb RAM, Geforce RTX 2060, qcad: 3.23

Post Reply

Return to “QCAD 'How Do I' Questions”