DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Polygon Subtract

Started by Dr PR, August 30, 2012, 08:40:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

If you use "Polygon Subtract" to cut a hole into a polygon, the result is two independent polygons.

It would be better if only one polygon was created, wrapped around the hole, with a common side from the outside perimeter to the inside edge. See the attached picture.

Something like this has already been implememted for "Solid Subtract".

Phil
DesignCAD user since 1987

MarkX

That would be a good change.

While we're at it, why can't the connecting line be hid, the way it is for solids? That way we can pretend that DC is state-of-the-art.

I suspect most modern CAD programs either don't use connecting lines, or hide them so well that the user never knows they are there. Sketchup for instance, lets you pop holes into planes easily.

Mark



JJG

Sorry guys,

but in v21, french version, and on my machine at least, if you apply the Solid/Solid Define command (even in 2D !!!) to each ones of the both polygons before substracting them,
then when you "polygon-substrac" one from other one, you got the result you are expected ... the result is not two independent polygons, but one "solid", which you can then extrude if you want ... (but before, if the polygons were created as lines, don't forget to apply the Edit/Selection Edit/Convert/Make Plan command )

(it's "twisted" and "hard", huh, as idee, but it works ;    Phil, before jumping to the ceiling, put a helmet, it hurts less! )

see please the file below, where I've do this operation.

Dr PR

JJG,

That's a good idea. I have used the solid definition as a type of special group many times.

In V22.0 if you do this the resulting object looks like the attached image. It behaves like a single object, but it has two "unhidden" lines. Are these lines hidden in the French version?

In any event, you either have to group the two parts after the Polygon Subtract, or make the two starting polygons "solids" before subtracting, and there are two lines to hide. It would be nice if all ths wasn't necessary.

Phil
DesignCAD user since 1987

JJG

#4
Phil,

no, in the french version, these lines are not hiden.

What is surprinsing an amazing, in this trick, is that I apply Solid Define to both polygons (line's or plan's type, it is the same) before ploygon-subtracting them, and the result is ... one solid, ie as if it was the Solid substract command ;
but the Solid substract command don't work in such a case.

The other way you can use, to have the result you want, is to use the DT's trick he presented here : http://forum.designcad.com/index.php?topic=3628.msg20166#msg20166
ie Use Surface connect to connect the two squares polygons
Snap to a point on each line to create a grid surface connecting them.

The result is a grid, you may then extrude.

Dr PR

#5
JJG,

Thanks again. I had forgotten the Surface Connect trick.

However, I am VERY sensitive to file size and Surface Connect generates a lot of facets in the grids. When extruded these result in many more elements in the extruded objects, and that means larger file size. Also, surface Connect is another complex function and you must be very careful about the number of points on the inner and outer polygons, and where you set the starting (selection) points when generating the grid. It is a lot more work than simply subtracting polygons.

I think the object shown in my original post would have the least number of facets (1) of any we have talked about.

****

I thought up a way to achieve what I was looking for, but it is a bit round-about. See the attached image.

1. I drew the vector circle and the box on the left.

2. I traced around the outer polygon and then around the inner polygon, and back to the original starting point with the Vector function to get the vector shown in the middle. Normally I would erase the first two figures, but here I just moved the new polygon away from them for illustration purposes.

3. I used "Edit/Selection Edit/Convert/Make Plane" function to convert the vector to the polygon with a hole in it.

4. I tried to use "Edit/Hidden Edge By Section" to hide the lines connecting the outer perimeter with the inner hole (in wireframe view). However, this actually converted the plane back to a vector! Bug?

5. I tried extruding the single facet plane with a hole in it and it worked nicely. See the second image. At left is a normal straight "Draw/Extrude" and at right is an extrusion along a curve.

****

The extruded solid contains an inner surface created by the lines connecting the outside of the polygon to the inside. I'm not sure what these will do if the extrusion is used with a Boolean operation.

Phil
DesignCAD user since 1987

JJG

Quote from: Dr PR on August 30, 2012, 11:44:25 PM
...
However, I am VERY sensitive to file size ...

Yes, Phil, on my side too !

That's why, generaly, before to extrude something, I redraw the profil/plan by hand, in order to be sure of a minimal number of points, and to be sure too that the profil is completly closed ;
sometimes, some operations are creating some points distant each other of eg. .00000000001 unit, so that you can't see them at screen, but they exist ... and increase the size's file, without talking from other problem(s) they can done too.

Thanks again for your always very clear and usefull tutorials.

MarkX

Quote from: JJG on August 30, 2012, 10:18:16 PM


see please the file below, where I've do this operation.
When I load yours into v21 English, the lines are plainly visible.

Also, before you can use this object in an extrude, you have to explode it, then redefine the vector as a plane.

Too many steps!

Let's just be able to cut holes in polygons like you can in most modern CAD programs! No 3 step shuffle!

Mark

Dr PR

I decided to tempt fate and performed a "Solid Add" using the extrusion from my previous post.

It appears to have worked OK - see "solid add 1.jpg." The program added the two solids and removed the common interior parts of the green cylinder and red extrusion. As you can see the parts of the green cylinder that were inside the hollow center of the red extrusion are still there, as they should be.

The second image shows the shaded result. You can also see a problem resulting from "Solid Add" when the objects (especially the cylinder) do not have enough facets. Where the facets of the cylinder intersect with the surface of the red solid the smooth rendering (Gouraud) fails. This cylinder had only 18 facets. If I had used 72 facets the results would have shaded much smoother.

Frankly, I am amazed that it did work - it would have created a real mess just several versions ago. Kudos to DT and the programmers!

Phil
DesignCAD user since 1987

JJG

#9
Quote from: MarkX on August 31, 2012, 06:34:44 AM
...
Also, before you can use this object in an extrude, you have to explode it, then redefine the vector as a plane.
...
Mark

sorry, I dont understand why ?

because I've drawn the polygons as lines, the result is not a plan : that's why I explained "but before, if the polygons were created as lines, don't forget to apply the Edit/Selection Edit/Convert/Make Plan command" ; Do you have read this ?
I think not, since you say "before you can use this object in an extrude, you have to explode it";
No, sorry, explose the object is unnecessary ; directly apply the command "Edit/Selection Edit/Convert/Make Plan, and done !

And if I had drawn the polygons without uncheking "draw as line", they would have been plan directly, and the result would have been a plan too, inside a "solid".
Understand ?
;)

Dr PR

JJG,

I also had to redefine my polygon to be a plane, as mentioned in my earlier post. I attributed it to having tried to use "Hidden edge by section" to hide the lines connecting inside to outside edges of the polygon, but maybe something else is also undoing the plane and turning it into a vector. This is something to watch.

Polygons with overlapping edges seem to cause problems in CAD programs. This is why I thought it might be tempting fate to try to use these extrusions with Boolean operations.

I first encountered troubles in printed circuit board (PCB) design programs, where you sometimes want to draw a large complex polygon to define a "copper pour" where a large surface of the board will be unetched. Overlapping polygon edges crashed some programs and caused strange problems in others. I should say that every PCB design program I have used has been extremely primitive compared to DesignCAD, and very poorly written.

Phil
DesignCAD user since 1987

SciGraphics

Dear guys:
  A bit off subject. Being old(er), and subject to fuzzy memory, I try to keep sharp by following your threads using only my mind. No DCad, no paper and pencil, just mind (Einstein also used these "mind experiments"). So I say thank you for providing challenging work. It does help. Sometimes it gives me a head ache.
Jim A., Tucson, AZ

MarkX

Quote from: JJG on August 31, 2012, 12:31:29 PM
Quote from: MarkX on August 31, 2012, 06:34:44 AM
...
Also, before you can use this object in an extrude, you have to explode it, then redefine the vector as a plane.
...
Mark
because I've drawn the polygons as lines, the result is not a plan : that's why I explained "but before, if the polygons were created as lines, don't forget to apply the Edit/Selection Edit/Convert/Make Plan command" ;
You know, it really shouldn't be possible to define a solid as a plane. DC has too many "secret-handshake" exceptions to logic like that in it.

Mark

MarkX

Quote from: SciGraphics on August 31, 2012, 02:46:45 PM
Dear guys:
  A bit off subject. Being old(er), and subject to fuzzy memory, I try to keep sharp by following your threads using only my mind. No DCad, no paper and pencil, just mind (Einstein also used these "mind experiments"). So I say thank you for providing challenging work. It does help. Sometimes it gives me a head ache.
Jim A., Tucson, AZ
Einstein did mind experiments on things that actually were consistent. Doing mind experiments where the results can be as arbitrary as in DC is definitely a recipe for a headache.

Lar

Quote from: Dr PR on August 30, 2012, 11:44:25 PM
4. I tried to use "Edit/Hidden Edge By Section" to hide the lines connecting the outer perimeter with the inner hole (in wireframe view). However, this actually converted the plane back to a vector! Bug?
Phil, I tried this (v22) and the plane remained a plane. I have never known a plane to be converted into a vector unless the 'vector convert' or 'explode' commands were used on them.

Quote from: Dr PR on August 30, 2012, 11:44:25 PM
The extruded solid contains an inner surface created by the lines connecting the outside of the polygon to the inside. I'm not sure what these will do if the extrusion is used with a Boolean operation.
The inner surface should cause no problems in a boole operation, except maybe you will have to hide that inner line in the newly cut surfaces.

Quote from: MarkX on August 31, 2012, 04:40:17 PM
Doing mind experiments where the results can be as arbitrary as in DC is definitely a recipe for a headache.
Even with Dcad's bugs you get the same results virtually every time on the same machine. What can be more consistent than that?

Lar