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.

Copy and paste

Started by Leonard, April 16, 2012, 08:10:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

We could always gripe about having nothing to gripe about. In fact, I think I would like to try that sometime.

Phil
DesignCAD user since 1987

Lar

Quote from: Dr PR on April 25, 2012, 02:51:31 PM
Mark has a good point - the Flatten Z macro shouldn't be needed. The best solution would be to fix the bug (if we can find out what is causing it).

The version of flatten-z we use now was originated by Impulse and I can't say what was his reason for writing it but before dcad had the query and change functions (the heart of the macro) I had a macro that did the same thing, but not nearly as efficient. I did not write it as a bug fix for dcad itself. It was written to address drawings imported from acad that were supposed to be 2d but when in 3d mode the lines had acad's 'thickness' (2d lines were extruded to a certain height for a reason I can't remember now) ...Or was it acad's 'height'???. Can't remember exactly. The macro just found itself being used for more and more reasons by different people. I myself use it for many reasons, the least of which is z values being non-zero. This is demonstrated by the facts that I have flatten-x and flatten-y macros and why I added the ability to for 'selected only' and to set a point anywhere to flatten to, not just at z=0.

Lar

Leonard

HI GUYS, THANKS FOR ALL THE HELP, BUT I HAVE GONE TO MY BOUNDING BOX, BUT IT ONLY SHOWS X&Y COORDINATES, NO Z. ALSO, I HAVE DOWNLOADED THE PROGRAM, BUT AM AT A LOSE AS TO HOW TO INSTALL IT. PLEASE ADVISE, THANKS.

magic

Hi Leonard,

Go Tools > Macro Execute (or keyboard shortcut: %), find your macro and run it.

And please don't shout.
It's a kind of magic!




Dr PR

Leonard,

The program looks for macros in the assigned macro folder. That can be any folder in the computer, but you have to tell it where to look.

Open "Options/Options" (Q) and click the "File Locations" tab. In the "File Type" column locate "Macro" and the entry in the "Location" column will tell you where the program is looking for macros.  You can select the "Macro" row by clicking on it and the click the "Change" button to set a new location if you wish.

In any case, you should move the "Flatten Z" macro to the location shown in the "File Locations" tab. After that pressing the "%" key will open a list of macros in that folder and you can select the one you want to execute.

If you find a macro that you like to use often you can assign it to a key combination in the "Options/Options/Keyboard" dialog (click "Save" to save the modified keyboard file) or you can assign the macro to a custom toolbox button in the "Options/Options/Toolbox" dialog.

Phil
DesignCAD user since 1987

MarkX

Quote from: Rob S on April 25, 2012, 03:08:54 PM
QuoteA third party solution is a solution provided by someone other than the original manufacturer

That is exactly what I meant, the current programmers are third-parties to the manufacturer of the program, as are the writers of the macros.

No.  "Third party" means that someone not affiliated with the manufacturer produced the accessory product.   No matter who works on the program, DC is officially sanctioned, monitored, and controlled by the manufacturer. That same is not true of macros written by non-employees.

Mark

MarkX

Another reason to worry about a 3rd party bandage.

If the objects to be flattened are all parallel to the final working plane, no worries. But if, for instance, there are planes with edges at different heights ... how does the macro handle that?

There are two ways it could handle it that I can think of. Perhaps someone else could elucidate the mechanism the flatten macro uses.

One way would be to "rotate" the plane onto the final plane. Think of a book falling from an upright position onto your floor.  The other way would be to project the plane onto the floor. Think of holding a book at an angle under a light -- the shadow on the ground forms the projection.

Either of these approaches will introduce slight distortions compared to the original. This may mean that intersections that formerly touched no longer do, or vice versa. Walls that were square may now be rectangular, or vice versa. Circles become elliptical, and so forth.

Something to think about anyways.

Mark

Dr PR

Mark,

You are right, up to a point.

Case 1. If the drawing has a square that is rotated about the Y axis, it will project in 2D as a rectangle. Flattening the drawing by setting all Z values to zero will distort the original object, producing a rectangle instead of a square. To preserve the square it should be rotated into the XY plane.

Case 2. However, if the Z axis distortion was erroneously added when the user set points at the correct X and Y coordinates, then flattening by making the Z values zero will produce the correct drawing and rotating would produce an error.

Unfortunately, no matter whether they are "first party" or "third party" programmers there can be no perfect solution because the drawing history is not included. There is no way to distinguish between case 1 and 2 so it doesn't matter who writes the "fix."

Phil
DesignCAD user since 1987

MarkX

Quote from: Dr PR on April 25, 2012, 10:49:22 PM
Unfortunately, no matter whether they are "first party" or "third party" programmers there can be no perfect solution because the drawing history is not included. There is no way to distinguish between case 1 and 2 so it doesn't matter who writes the "fix."

People seem to be awfully tetchy about this 3rd party thing. As though referring to a macro as 3rd party was some sort of insult. Strange.

Yes, I wrote it in such a way that it was clear that either approach would be wrong sometimes. That was the point.  Also, to highlight that if you're using this technique for something other than a bug, you might want to consider the possibilities.

The third party solution isn't bad, but it does allow bad behavior to continue rather than creating a rally cry for a first party solution. The first party solution would be to not create the error in the first place. Or, if the error is created by external programs, to take appropriate actions such as alerting the user to the conflict during import and offering various ways of fixing the problem.

Mark

Lar

#39
Quote from: MarkX on April 25, 2012, 10:04:34 PM
... Circles become elliptical, ...

If a circle entity is flattened it remains a circle but it can either be changed or unchanged depending on its rotation in relation to the flattening plane. Remember a circle only as two points.

Eg, a circle has point1 at 0,0,0 and point2 at 10,0,0 and tilts so its top is leaning into positive-Z territory. Flatten-Z (without 'set-point') is used. The circle will not change. It will remain tilted because its two points are already at z=0. If Flat-Z is used with set-point and the point is set at Z=10 the circle will move to z=10 but remain tilted.

If, however, the circle's point2 was at 10,0,10 (radius = 14.142) and pointed upward, flatten-z would result in a z-flat but smaller circle (radius = 10).

If you desire the circle to become 'elliptical' you could vector convert it first or create an ellipse that is circular, ie, both radii are the same (the 3rd point at 0,14.142,0). Flatten-z will make the ellipse oval in shape.

Quote from: MarkX on April 26, 2012, 08:46:04 AM
The first party solution would be to not create the error in the first place.

Points going out of z=0 is not always a bug. many times it would be user error. I agree with you it should be built-in then users intimidated by macros could have access to it. Thing is, the ability is built-in. Before the macro was created I would use the info-box if I suspected points were out, highlight these points in point-select mode, then use one of the many means in the point menu to get those points in line. What the macro does is speed the process up, which is what macros are here for.

Still, I guess someone should make the request for the built-in command in the forum's feature request department.

Lar

DrollTroll

As has been pointed out, this issue is a hydra. DesignCAD (and by extension me, Egor, or any other programmer) has no way to determine whether those points off the z=0 plane are *supposed* to be off, or if they got there by accident. In many cases, the user won't know either. If we arbitrarily move all points z!=0 to z=0, we could be inadvertently destroying important data (it may not be important to the user who inherited the drawing for manipulation but it might be to his client).

What if you have a drawing done on the XZ plane with some points where y!=0? What about ZY plane? Must we handle those situations as well? If we do, are we expected to warn the user "WARNING! You may not know what you are doing and could destroy important data! Proceed at your own risk."?

25 years with DesignCAD

JJG

#41
I would add to what DT has explained, the following remark :

sometimes, in 2D-mode, I move some entities to a "level" where Z is not 0, to "protect" them from the stretch-function.
I.e. they are not in a locked-layer, but the result for stretch-function is the same.

Why ? This allows for example to "protect" these entities without moving them to another layer (which can then be locked). therefore these entities remain in their original layer, or all their original layers in case by example of a group consisting of entities belonging to different layers.
Then, I can do some drag-selects without having to pay too much attention to what is taken and what is not taken, those should not be changed are indeed "protected" from the stretch-function.

So what may seem like a disadvantage, or even a bug, can be very practical.

JJG

uh, it seems that since V18 or V19, in 2D-mode, the stretch-function works now across all, ie even if Z is not zero.

So what I said just before (concerning "level" in 2D-mode) remains valid for earlier versions of DesignCAD, but no longer works with current versions.

cavelamb

Quote from: Dr PR on April 23, 2012, 10:08:04 PM
cavelamb,

Careful! Just selecting everything and scaling it in the Z axis will make the Z offset smaller, but it will still be non-zero. It may display as zero if you have set the precision to just a few decimal places, but if you set it to 15 decimal places you will see a non-zero number.

If the Z value is non-zero the intersect functions may not work.

Phil


It has always worked for me. 
.00001 is as small as it gets.
That makes small enough values of Z that will meet for trimming.

When I'm paranoid, I do it twice...


Dr PR

cavelamb,

If you open "Options/Options" and click the "General" tab you can set the "Coordinate System Precision" to 15. Then the smallest it gets is 0.000000000000001.

Even if you set the Precision to 5 the program still calculates to 15 places - it just rounds off to 5 for displays.

If the Z value is non-zero you will get errors in a 2D drawing, and some intersections may fail.

Phil
DesignCAD user since 1987