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.

Variable scaling

Started by Dempsey, February 08, 2011, 10:12:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dempsey

In this drawing of an eagle I like to keep the points A, B and C at the same position. Then I like the bring the A-D line towards the A-E line while scaling the area in between. So basically between A and B no scaling and gradually enlarging towards C to D until it becomes C to E.

Is there an easy way to do that in DC?

Dempsey

Lar

#1
Attached is an approach that uses the Edit menu> Selection Edit> 4-Point Move command (needs tweaking)...

Rob S

I can't think of any way to do this with existing DCAD commands, (have not yet read post from Lar) but I think it could be done with some kind of macro.  

Select each point in the drawing sequentially.

Determine its offset deltax from line B-A (baseline for beginning of area to be widened) and from a lengthwise baseline deltay (from which proportional scaling would occur)

(Another way of saying what is the present position of the point relative to where you want to start the stretch)

Then if deltax is positive, and deltay is negative - add to the x co-ordinate of the point - deltax times some factor of deltay

(Increase its distance from the starting point proportionally to how far away it already is)

Would be a challenge - not sure though if I'll have time to try and write it
User since forever

Dempsey

Lar, I will give your suggestion a try after dinner.

Rob S, your suggestion was something that I had vaguely in my mind too, while hoping that someone had already a macro. Anyway, I will have to add it to my to-do list as I have no time to do it right now.
Dempsey

Dr PR

This would be a nice new feature. It is similar to Photoshop's "Warp" function that allows you to pick a point in a picture and stretch it to a new position, with everything around it stretched proportionately.
DesignCAD user since 1987

Dempsey

Lar, I tried the 4-point move and it certainly does the lion share of the work. Good enough for my current application.

Dr PR, an equivalent of the "warp" function would be ideal.

Okay guys, thanks for the help. I'll think about the 'warp macro" while carving the Westcoast Native Sun Mask in the coming months.
Dempsey

Rob S

I was thinking of another way to do it, effectively determining a zone circular might be easiest, picking a start and end point for the centre of the zone, and then having the macro move all points within the zone proportionally by how far from centre they are.

Some issues are this would only work decently if all the lines consisted of very short segments, and it would bend such lines sharply at the edge of the zone, and at the centre.  To do a smooth transition would be more difficult.

It would work for your drawing above by picking the centre near the letter E, and the edge of the zone at line  AB.

To do a macro suitable for many different permutations of variable stretch is beginning to sound like a major project  ;D

User since forever

Dempsey

#7
I haven't done much thinking about this, but it is basically the same principle as the current Stretch function, but rather then stretching all X coordinates in the Y direction (using a "line") or stretching all Y coordinates in the X direction, we now do X and Y at the same time and doing a "point" stretch rather than a "line" stretch.


  • Set a window for the area to be manipulated.
  • Take one point in the window and move it to the a new location.
  • For each coordinate point (X,Y), or even (X,Y,Z), within the window we can calculate the new Y for a given X, and the new X for a given Y.

The mathematics is very basic and are equivalent to what I did in my "push apart" macro. We only have to go through the point list once; no iterative processing, so even a macro should be fast enough to get it done.

More complex are issues like:

  • Figure out how the internal structure is of the various objects. Is changing coordinates enough or do we have also to change "lengths"?
  • Do we select objects and let the macro determine the manipulation window?
  • Objects outside the manipulation window can get distorted.

Interesting problem for sure... next winter perhaps...
Dempsey

Lar

All we need is a way to determine the exact shape required for the new bounding shape and the 4-point move would do the job.

What makes this particular example difficult is that we have 3 anchor points that curve away from each other and a mobile point that moves to the right as well as down (not to mention that that last point curves inward from one of the anchor point). If the 4-point move worked where you set the 4 points anywhere (instead of the 4 corners) and after each point we set another point where we want the original to be moved to, with visual feedback, then the results would be more predictable.

Lar

Dr PR

When I reread this in Dempsey's wish list I was thinking of 3D drawings and surfaces. The "Hammer" tool does something like this but it is a lot less friendly to use than Photoshop's "Warp."

What would work in both 2D and 3D mode would be a "proportional" option (or whatever you want to call it) for moving points in Point Select mode. It would work something like this:

1. Switch to Point Select mode.
2. Select the object(s) to be edited.
3. Select the points to be modified.
4. Gravity snap to the point to be used as a handle for dragging.
5. Select the "proportional" option in a dialog box.
5. Reposition the drag point.

See the attached image.

The program should move the selection handle the greatest distance. Then it should move points nearest to the selection point a distance proportional to the original distance from these points to the nearest unselected point in the selected object. Then it should move outward to the next group of selected points and move them, etc.

In the picture the original grid is shown on the left. Notice that the center nine points have been selected (the point boxes are solid) and the center point has been selected as the drag handle.

The middle figure red grid shows a "proportional" drag. The drag handle has been moved the greatest distance. The eight surrounding points have been moved about half as far as the center point. The unselected points haven't moved at all. The cyan grid is a copy of the original grid.

For comparison, the right side figure shows the difference between "proportional" drag (the red grid) and the current way the points are dragged (the black grid). The cyan grid is the original grid.

The same principal could be applied to Dempsey's 2D drawing.

Phil
DesignCAD user since 1987

cavelamb

This won't help with the immediate question, but I seem to recall that the original DOS 2D version
did something like this - very much like the PS "warp" function.