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.

Combine hatch points

Started by adriank, May 19, 2010, 10:17:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Adrian 2.0

Thanks for the extra help guys.
I have never had the time to explore the whole macro side of DCad - I have been able to 'tune' the program so it works really efficiently for me over the years without bothering to find out more.
Throwing away the drawing board was a quantum leap for me, maybe time to take another leap!

Adrian 2.0

Now I have another problem, I had trouble locating new points after removing a bunch of obsolete ones.
It is the same symptom that we used to see adding to curves that had been trimmed, where the point locates itself in the 'next' bay.
I replicated it easily.
Draw a square hatch, starting at origin in lower left (so you can track which point you started it with)
Select it - info box, you have 5 points, not 4. the fifth point is over the original point (origin)
If you drag-select the origin point & delete it the whole hatch disappears.
If you hover-point with ctrl/shift (as Rob mentioned) you delete only one point, the hatch remains intact BUT you now cannot place any new points where you want them.
If you delete ANY of the 4 remaining points the hatch disappears.

If you draw a hatch with more than 4 points, then drag-delete the origin point the hatch remains, but you can't place new points where you want them.
Note: you have to hover close to a point to be able to place the new point in the WRONG position - otherwise it does not give the option to place it at all.

The bottom line is, if you happen to delete the origin point on any complex hatch, you will not be able to add new points to it.

Lar

#32
Wow. This is all new to me. I tested in v20 and 17 and the same thing happens.

These are my conclusions:
1] It seems like the developers decided a hatch can have no less than 4 points, based on the assumption that 4 points mean 3 corners (the 4th point is below the 1st)... less than 3 corners means a straight line and a hatch that is a straight line is useless because no hatch pattern would show.

2] The reason I say the last point is below the 1st is because if you shift+ctrl+click to delete at the position of the 1st/last point the 1st is deleted and point2 becomes the 1st. If the original shape was 3 sided (4 points) the entire hatch is deemed redundant by the program and is removed (deleted by the program). If the shape was 4 sided (had 5 points, like in adriank's rectangular example) it is now technically 3 sided (with 4 points) but its shape does not change. The 1st and last points are not in the same position anymore and there is actually no 'side' between the 1st and last point (although the hatching process still fills it in). If you try to add a point at this 'nonexistent side' you won't be able to because... well, there's nothing there.

Quote from: adriank on May 25, 2010, 12:42:15 AM
If you drag-select the origin point & delete it the whole hatch disappears.
This is because the delete command works on the whole entity, not the point. To delete points either shift+ctrl+click a point or highlight and 'deletepoints' from the command line or macro. **Edit: Sorry, I thought Adrian meant delete by the delete key but he meant by 'deletepoint' and he is right: the whole entity does disappear**

Quote from: adriank on May 25, 2010, 12:42:15 AM
If you draw a hatch with more than 4 points, then drag-delete the origin point the hatch remains, but you can't place new points where you want them.
I've found it to be only at the 'nonexistent side'. I had no trouble adding at any other side.

Lar

bdeck

#33

Edit:

As Lar and AK point out, any DeletePoints Macro could benefit from some non-trivial logic to prevent deleting the first/last point of a hatch.

Back to the drawing board...

BD


Adrian 2.0

Guys,
To be clear. In any  hatch, if you delete the origin point (either by select point with ctrl/shift - or by drag-selecting points and using 'deletepoints' -my new discovery) then - as Lar correctly pointed out - you cannot add points back into the freshly created 'bridging' side of the hatch.

If the original hatch had 4 sides and you delete only the origin point (by drag-select + deletepoints), the hatch will disappear.
Or if you delete all but 3 points on any polygon hatch, it will disappear IF the origin is amongst the deleted points.

Lar, I think your description is spot on & it explains DCad's logic.
Knowing this, a workaround seems to be:
Mark one side of the hatch's 'open side' with a temporary point, move that hatchpoint onto the other end of the 'open side' and then add a new point, pulling the hatch back to the temporary point.

bdeck

#35
It turns out that in DC a 4 sided hatch does not have 5 points, but 6.

Deleting point 1 and 5 also deletes that extra point, leaving only 4 points to describe a 3 sided hatch.

While 4 would be enough for me, apparently DC needs more.


Here's a workaround,

For any hatch of  n sides (greater than 4),  if you delete point 1, you will also delete point n+1, and it will not be replaced. The remaining hatch has m=n-1 sides and m points.

To restore the hatch, gravity move point m to the location of point 1. Then create a new point m between point m-1 and point 1, and move it to the prior position of point m.

Now all is well. (Or at least hover works in point select mode)

BD

Thanks AdrianK and Lar for tracking this down.

Who knew?

Edit
The strikeout above is due to a later discovery that it is point n+1 that is permanently discarded, not the extra point.

Rob S

I've been following with some fascination this thread which seems to be growing out of all proportion to the original question!!!

Now, as to the 4-sided hatch, when I draw a new 4-sided hatch in V17 or V20, by setting either 4 or 5 points, the end result is an entity which show 5 points in the info box - not six.

Bdeck - where did you find the sixth one???

User since forever

bdeck

#37
Hi Rob,

I use the query ENT_NPTS command in a macro.

See http://forum.designcad.com/index.php?topic=130.msg8469#msg8469

(Be careful, it actually draws pointmarks on screen, which may need to be cleaned up in event of a bailout.)

BD

PS:  Perhaps DC is simply making a math error. When it sees 3 points being deleted from a 4 sided shape, it may fail account for the 6th point, and simply declare the shape null.  At any rate, having that 6th point makes no sense to me. It appears to be vestigial. But vestigial from what?

Lar

Quote from: adriank on May 25, 2010, 10:04:26 AM
...
To be clear. In any  hatch, if you delete the origin point (either by select point with ctrl/shift - or by drag-selecting points and using 'deletepoints' ... ...
Adrian, I only get the entire 4-side/5 point being deleted when drag selecting that point then using deletepoints. On the other hand, whenever I use shift+ctrl+click to delete points on top of each other (in most - if not all, entities) it only deletes one point.

I think this is because when you drag you capture both the 1st and last points. Deletepoints gets rid of 2 points leaving a 3 point hatch entity. This is deemed to be redundant by dcad so it deletes the whole hatch entity.

One other thing I discovered is that if I shift+ctrl+click to get rid of point1 in a 4 sided hatch then use the info box to move the new point1 (the previous point2) dcad corrects the 'nonexistent-side' situation by automatically placing the last point at the point1, resulting in a visual 3-sided hatch.

All this highlights the dilemmas developers have to sometimes resolve and shows why some bugs come about and can't be fixed.

Lar

bdeck

#39
On further review, the extra point is not precisely located on the first and last points.

It is slightly offset, and appears to be used to set the angle of the hatch pattern.

On an n sided hatch, when points 1 and n+1 are deleted, the extra point survives.

Old point 2 becomes the new point 1. But point (n+1)  is not being replaced with a new point n as it should be.

You can see this by zooming in on the new point 1 and running the apw macro. There is no new point n. The point marker jumps directly from point (n-1) to the extra point without closing the hatch.

The extra point may not be a total red herring; it may be the culprit that confused the programmers and led to this bug originally. It confused me.

This "appears" to be a simple bug to fix, but who knows what danger lurks in the depths of DC code.

BD

PS: RobS, Rather than use APW.d3m, you could  just save the hatch as a .dc2 file, and look at the coordinates.

bdeck

Quote from: Lar on May 25, 2010, 11:46:54 AM
One other thing I discovered is that if I shift+ctrl+click to get rid of point1 in a 4 sided hatch then use the info box to move the new point1 (the previous point2) dcad corrects the 'nonexistent-side' situation by automatically placing the last point at the point1, resulting in a visual 3-sided hatch.

Lar,

That's a very cool obervation.  It appears that whenever you change point 1 or point n+1 in the infobox, the box knows to change the other to the same coordinates as well, and it does so correctly without knowing or caring that they were not previously identical. That doesn't and shouldn't happen when you move points with the mouse.

The first part of the observation I find even more interesting. When you delete point 1 with shift+ctrl+click, DC moves point 1 to the location of old point 2. And it moves point 6 relative to point 1. But I think the programmers simply forgot about point 5 (the new point 4).

I can see how they might have gotten confused. 

In checking back to version 14, I see that the feature you describe predates the DeletePoints function.

When was hatch angle added to DC?

BD










Lar

Quote from: bdeck on May 25, 2010, 02:32:08 PM
...
The first part of the observation I find even more interesting. When you delete point 1 with shift+ctrl+click, DC moves point 1 to the location of old point 2.
...
I don't think point1 is actually moved to point2's location. Point1 is gotten rid off so the remaining points are just renumbered.

Quote from: bdeck on May 25, 2010, 02:32:08 PM
...
When was hatch angle added to DC?
...
Hatch always had the angle option, far as I know.

Lar

bdeck

#42
Quote from: Lar on May 25, 2010, 03:13:28 PM
Point1 is gotten rid off so the remaining points are just renumbered.

Correct.

Or more precisely, the entire hatch is discarded, and a new one is created at the end the list, with a new entity number, and with all new points, matching the location of the remaining original points.

DC doesn't make it easy on us poor macro writers.

BD

Adrian 2.0

I'm not a macro writer - thankfully it seems, but there is another way to count the points, and I get a different answer!
If I take a new empty file (help/drawing info = 0 points) and draw a 3 sided hatch, help/drawing info = 7 points - not 5.
with a 4 sided hatch, help/drawing info = 8 points - not 6...etc.
So there is one point to nominate hatch angle, and 2 more. Maybe hatch scale?

Rob S

If I take a new empty drawing and draw a simple two-point line, which AFAIK only creates two points, help, drawing info shows 4 points.

I think two of them are "drawing extents", ie bottom left and top right corner.
User since forever