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.

Flatten plane

Started by Dr PR, October 28, 2015, 08:57:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

Anyone have a macro to ensure that all points in a "Plane" object lie in a geometrical plane? This would be useful after a plane has been edited extensively to be sure that no points were moved out of the geometric plane of the Plane object

One way to do this is to set the working plane to three points in a plane, copy/paste the plane into a new file, set the origin at one corner of the plane, and then use the FlattenZ.d3m macro to move all points so Z=0. Then Copy the plane back into the original drawing, delete the original plane and move the new flattened plane to the position of the original plane.

That's a lot of work. A macro to do this in place in the original drawing would be nice. A DesignCAD command to flatten a Plane would be better.

Phil
DesignCAD user since 1987

samdavo

Wow :)
I agree, it sounds credible (but a fair bit of thought to set up that macro, including carefully defining the exact plane in the first place).   But having said that, isn't it great that such a macro is an option  (DesignCAD !)

DrollTroll

Let me dust off my vector math skills -- I haven't had to use them in a while. Should be fairly simple to make such a macro.
25 years with DesignCAD

Dr PR

#3
DT,

Another way I have flattened Planes is to just draw a new Plane over the old one (on another layer) , gravity snapping to points.

However, there is a catch to this method. The geometric plane for the new Plane object seems to be determined by the first three points. The program uses these to define the geometric plane, and all subsequent points in the new Plane entity will be placed in this plane - close to the points in the original Plane if those points are not in the geometric plane. So the program ensures that all points in the new Plane are in the same geometric plane.

However, if there is just one point out of plane in the original Plane, and you snap to this point for one of the first three points of the new Plane, the geometric plane of the new object will not be in the same geometric plane as the remaining points in the original Plane. So you must first decide which points in the original Plane are in the desired geometric plane and which aren't, and start with three neighboring points that are in the desired plane.

So, what are you going to do if you have a four point Plane with one point out of the geometric plane of the other three? Of course, ANY three points can be used to define the geometric plane and there are four possible three point combinations. So which of the four geometric planes is the "correct" plane?

I guess any such macro or function must require the user to set three points to define the geometric plane. It would be really nice if these three points did not have to be neighbors - so we could pick any three points on the original Plane to define the geometric plane.

Phil

PS: I have been fighting this problem for decades. I must have done this thousands of times!
DesignCAD user since 1987

DrollTroll

Yes, that is indeed a problem that I was already considering to be a necessary part of the macro.

Here's one manual method that may help:

Select the plane that is out of whack.
Use SetWorkingPlane, and define three points that *are* in the correct plane.
Use the coordinate lock to lock Z at zero.
Switch to the Front view, and select each point, then gravity-snap back to it; it will snap to Z=0 in the working plane.
When you're done use ResetWorkPlane, and unlock Z.

This is also generally useful if you want to trace a projection of something onto a particular plane; set the working plane, lock z, then snap around your outline.
25 years with DesignCAD

Dr PR

Pretty slick! I'll have to remember that.

Phil
DesignCAD user since 1987

Lar

Hi guys... just peeping in.

Phi, what I do to test if an edited plane is "proper" is 'vector convert' it then 'make plane' (to convert it back to a plane). If out of wack dcad will complain.

Lar

Dr PR

Lar,

That is a good test.

When the "Make Plane" function complains that the points are not all planar you have the option for the program to flatten them. However, this operation moves some of the points around so the resulting Plane may not have the same dimensions as the original. It may be rotated so it does not lie in the same geometric plane as most of the points of the original. So it isn't a solution to the need to flatten a warped Plane.

Phil
DesignCAD user since 1987

Lar

#8
Phil, my method is just to determine if any of the points are out of wack. It's up to the user to decide how best to flatten since there is no mathematical way to determine the required plane without user input.

Your 3-point idea is good so what I would do is set 3 handles on the improper Plane Entity, duplicate it right where it is, move the Plane Entity to the XY, YZ or XZ plane, use the Flatten macro, with the 'selected only' option, then move the plane entity back to its original position by snapping to the 3 points of the duplicate. Then delete the duplicate.

Lar

ps: it would be nice if DT&Co could enhance the plane flattening mechanism with the option of asking the user to snap on 3 points to determine the flattening plane (but there's always a high chance that the plane's bounding box dimensions will change).

Dr PR

Lar,

I agree. Flattening a warped plane is tricky, and really can't be done outside of the context where it exists.

For example, suppose you have a vertical plane that intersects an angled surface. But somewhere along the way you moved a point along the intersection to some other position along the angled surface. That point will be higher or lower in elevation than the true intersect point.

Now, if you just move the point along a line perpendicular to the geometric plane of the vertical Plane until it is in the plane of the Plane, the point will be above or below the actual intersection of the vertical Plane and the angled surface. The Plane will be planar again, but that point will not be in the correct position.

Nevertheless, flattening the Plane is the first step to fixing the problem. It is up to the user to make the necessary repairs.

Actually, it would be nice if the Flatten Plane function first highlighted out-of-plane points (or the points that were moved) so we would know where to make repairs.

Phil
DesignCAD user since 1987

Lar

Actually, I routinely move individual points in plane entities ...by snapping to existing points that are outside of the geometric plane... and dcad always locates the new point on the geometric plane. It seems that only when the point is highlighted that dcad will locate it exactly where the user snaps.

Lar

Dr PR

Lar,

I have noticed that DesignCAD really tries to keep Planes planar. But when it does snap a wayward point back into the geometric plane it seems to use a perpendicular from the point to the plane. But in some cases, such as the example I posted earlier, this isn't the correct position in the geometric plane. So I still have to find the intersection of the Planes geometric plane with other entities to determine the correct position for the point.

I guess the only real solution to this problem would be a "Plane Intersect" function that redraws Plane A so that it intersects another object and adds points at the intersections.

Basically, this is what I do by creating a work Plane coplanar with an existing Plane, but with the work Plane slicing through some other object. Then I use "Surface Intersect," "Line Plane," "Contour Line" or some other function to find the points where the work Plane intersects the object. Then I redraw the original Plane, adding/subtracting points to stretch it to intersect the other object.

Just today I'll bet I have done this at least a hundred times.

Phil

Phil
DesignCAD user since 1987

Dr PR

Lar,

How do you tell if a Plane is not planar? Here is a simple method:

1. If the Plane is parallel to one of the coordinate planes (XY, XZ, YZ) just select it and open the Info Box (CTRL I).

If the Plane is truly planar one of the "Bounding Box" values will be grayed out. For example, if the Plane is parallel to the XY coordinate plane (all Z values the same) it will have non-zero "Width" (X) and "Height" (Y), but the "Depth" (Z) field will be grayed out.

If one of the "Bounding Box" fields is not grayed out the Plane is non-planar.

NOTE: Sometimes one of the values will not be grayed out but will show a value of zero. This means a point on the Plane lies out of the geometrical plane, but by a very small distance (less than the "Coordinate System" "Precision" value set in the "Options/Options/General" dialog).

2. If a Plane does not lie parallel to one of the coordinate planes you can use "View/Working Plane/Set Working Plane" to establish a custom working plane by snapping to three points on the Plane. Then, if the Plane is planar the Info Box will show a grayed out "Bounding Box" value.

Phil
DesignCAD user since 1987

Lar

Nice and easy trick, Phil.

Lar

Lar

Phil, I've just been doing a bit of poking around and this is what I discovered: in point select mode, if you move an existing point, the point could move out of plane. However, if you create a new point, that point will stay in plane. So the trick may be, instead of moving existing points, create a new points (near the desired existing point) and snap it to the desired location, then delete the existing point.

In fact, it appears to be a perfect way to find a point on the plane that is perpendicular to an existing point.

Lar