Pretty please...

Started by M.E., January 06, 2023, 06:25:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

M.E.

MATCH POINT, X,Y, Z. or at least X,Y. My boat design software, ProSurf has this function that is so necessary that it wouldn't work otherwise because of the pain involved. Select which axis you're working, click on the point you want to MATCH TO, click on point you want to move.

Rob S

It sounds like a great idea, but I fear it night be a while coming!!

Have you found any workarounds, ie how do you do it now???

I can do it more or less by using a temporary ortho line, and point move.

Maybe one of the macro gurus here on the forum will have a go at it.
User since forever

M.E.

Thanks for the reply. I've found no work around other than a painful one using Point XYZ. I understand these sorts of things are nits to pic and I'm sure EVERYONE has a whoopy-do they are certain would be useful for however they work. In my case it would be particularly useful to me when I import a DXF from ProSurf, which lays out curved surfaces flat for to be router or plasma cut, but need a good deal of work (in DC, drawing slots, holes, limbers etc.) in order to be constructible.

bdeck

#3
Quote from: M.E. on January 07, 2023, 02:08:16 PMI've found no work around other than a painful one using Point XYZ. I understand these sorts of things are nits to pic and I'm sure EVERYONE has a whoopy-do they are certain would be useful for however they work. In my case it would be particularly useful to me when I import a DXF from ProSurf.

Hi M.E.

I agree that some of the point manipulation capabilities in DC should be combined into more streamlined commands.

I had made a similar request in 2018. https://forum.designcad.com/index.php?topic=7102.msg51087
Perhaps my request was too utilitarian.

That said, here's a rough example of how I would perform an occasional point move aligned with an axis, ortho or not. This is essentially the method Rob S described above.
.
In Point Select Mode:

1) Create a new temporary line of arbitrary length from your moveable point aligned with the axis of your choice using the shift key. ( v, rmb-click near your moveable point, then shift-lmb for ortho constaint in the direction of your choice)

Alternatively, just use the = key to make a new copy of any (ortho) line of your choice, gravity snapped to your moveable point.(rmb-click)

2) Select the new line, being careful not to set a selection handle near any important points.

3) Extend the free end of your new line toward your target point. (While holding the shift key, move the cursor toward the free end. When 3 dots appear on the cursor, lmb-click to grab the free end. Then gravity snap to your target point to complete the extension.

4) Deselect the new line. (esc for deselect all, or shift-lmb on the line to deselect just the new line)

5)  Select the entity containing your moveable point, if it is not already selected. (again, being careful not to set a handle any where near your points of concern)

6) Gravity snap to "grab" your moveable point

7) Gravity snap to the free end of your temporary line to complete the point move..

8) EraseLast (Ctrl-e) to delete the new line. (Or use any other method to delete without risk to your other entities.)


At first glance this method may look daunting, but it should take fewer than 20 seconds. For me, using these common every-day methods is easier than resorting to possibly more capable commands that I rarely or never use.

You may find ways to speed it up or tailor it to your needs. With a macro assigned to a keyboard shortcut, it could execute with one key press and 2 mouse clicks. (For cleaner Undo, I would avoid using a temporary line in the macro.)

Best Regards
bd

PS: To avoid cluttering your drawing with unnecessary selection handles, you might want to look at the 3 macros in the file posted here, especially the S macro: https://forum.designcad.com/index.php?topic=322.msg1404#msg1404

M.E.

Thanks DB, I've got the picture and will employ it.

While I'm at it: I wish, for the lack of better wording, a 'Freeze Entity or Object' right click command that would turn on/off editability. I know one can 'Copy to Layer" and achieve more or less the same with fiddling, but it would certainly be handy for the way I work.

Thanks all, again.

bdeck

#5
Quote from: M.E. on January 16, 2023, 12:19:12 PM
I wish, for the lack of better wording, a 'Freeze Entity or Object' right click command that would turn on/off editability.

Hi M.E.,

Good idea.

It sounds from your request that you might have been experimenting with the PointMove command. If so, perhaps the command has an unpublished parameter for "Selected Entities Only". If not, it should. But your idea is better.

I found 3 commands that can be used perform an axially constrained point move in a macro

PointMove
Change ENT_POINT
GroupPointsMove


Here are some observations after a few test macros::

PointMove is the simplest to use, as it works on both selected and unselected entities. Its only shortcoming is that it cannot discriminate between the two. Also, if a reference point falls on a point is shared by multiple entities, it will reshape all of them. It does not require selected points or Point Select Mode, so it is quick and dirty.

Change ENT_POINT also works on both selected and unselected entities, and a macro can can be set up to discriminate between them. It also does not require selected points or Point Select Mode, so it is quick and dirty. Its downfall is a BUG that corrupts or ignores the UNDO buffer, so it must be used with caution. Pressing (Cntl-Z) to UNDO the move will not undo the move, but instead undo the prior operation in the stack. So unless you press (Cntl-Y) immediately thereafter, your drawing may be permanently changed in some way that may not be visible at your current zoom setting.

GroupPointsMove works only on points selected in Point Select Mode. The benefit is that it can move 1 or more points in a single operation. The startiing point of the move may be a selected point or an unrelated reference point. It is the simplest of the 3 methods to implement. Its one shortcoming is that it is  undocumented.

A nasty feature of DC in general is that after moving a large set of selected points in Point Select Mode, pressing (Cntl-Z) to UNDO the move will also deselect the selected points.

I've attached a copy of a macro to "Match Points"  in the Y direction, modified from my first attempt to use "GroupPointsMove" here https: https://forum.designcad.com/index.php?topic=7167.msg51522#msg51522

It solves the deselecting UNDO problem by offering an undo option within the macro itself that retains the point selection set.

Feel free to modify it to suit your needs (and of course please advise of any bugs)

Best Regards,
bd

SEE FILE YGG02.D3M ATTACHED  (with improved documentation and ortho switch)

Rob S

#6
Thanks for that, BD

I figured you might rise to the challenge!!

Make sure ortho mode is not on or it can fail if the points are far off to one side!!!  Don't ask me how I know this.
User since forever

bdeck

Quote from: Rob S on January 19, 2023, 10:15:52 AMMake sure ortho mode is not on or it can fail if the points are far off to one side!!!  Don't ask me how I know this.

Ok. I'll bite.

Rob S

Ouch.

So I went to try your macro, and by chance I used a point way off to the right for the second point, and nothing moved.

Tried a few more times, and finally it worked, using a closet located point.

Watched how my points were being set, and noticed them not appearing where I clicked but Ortho from previous point.

Hit the H key and all was well after that.

Suppose the macro could turn off Ortho mode to avoid this.

I was thinking to modify it to ask which axis to use first, and constrain accordingly
User since forever

bdeck

Rob,

Good sleuthing!

I modified the download file to archive the ortho setting, sys(347), and then reset it upon completion.

I haven't had time to see exactly what part of the code breaks in ortho mode.

That would allow a more surgical correction.

Many Thanks,
bd

M.E.

WOW. I guess I'm gonna have to figure this macro thing out. Even though I'm a user since '97, I'm not in any way shape or form technically savvy. 

Rob S

#11
OK, I have re-written this macro and called it Align.d3m so you can choose X, Y, or Z axis for the pointmove, or enter 0 to move in any direction.  To align things the reference point can be one of the selected points or some other starting point.

Please let us know any issues.     (revised to fix the UNDO for 0 option)


' align.d3m         v0.02              BDeck / Rob S         01/22/23
'
' Move a Selected point or points along an Axis to align Reference point with target point using GroupPointMove or
' Move Selected points in any direction by reference and destination
'
' 1) In point select mode select one or more entities.
' 2) Select one or more points, eg using area select and/or shift area select.
' 3) Execute the macro
' 4) Set or Snap a reference point for the move (on a selected point or elsewhere)
' 5) Set or Snap a target point for the move.
' 6) Set a final random third point to execute the move.

' use ESC anytime before the move to cancel most recent click.

' Instructions appear in status bar
'

k_spc=32
k_bkspc=8

SETSELECTEDPOINTS
nselpts=sys(1)   
if nselpts=0 then
Message "You must first select point(s) to be moved in Point Select Mode."
end
endif
Pointval xr yr zr 1 'use the first selected point as an arbitrary move handle
sys(1)=0     ' clear point buffer

sys347=sys(347)  ' archive ortho setting       
sys41=sys(41)   ' archive rubber band setting 

Sys(347) = 0    ' turn off ortho mode for now
Sys(41) = 0     ' choose a rubberband mode (0=no rubberband)
dim x(6), y(6), z(6)  'dimension point data arrays

Print  "  SELECT AXIS FOR MOVE DIRECTION"

setaxis:

prompt$ = "DCAD Version is ", sys$(105),", Move selected points along axis X, Y, or Z, enter 0 for free movement"

Input [prompt$], ts$

If ts$ = "0" then goto continue

If ts$ = "x" then ts$ = "X"
If ts$ = "y" then ts$ = "Y"
If ts$ = "z" then ts$ = "Z"

If ts$ = "X" then goto continue
if ts$ = "Y" then goto continue
if ts$ = "Z" then goto continue

goto setaxis

continue:


' SET TWO POINTS TO DEFINE MOVE
n=0
retry:
if n>0 then message "Retry. Set THREE points"     'Optional
setpoint "Point Move (Set or Snap Reference point and Target point, then set a Third point to execute)" 3   
n=sys(1)
if n>3 then n=3
if n=0 then goto cleanup
if (n<>3) then goto retry                     


for i=1 to 2          ' STORE THE 2 USER POINTS IN X,Y,Z ARRAYS
pointval x(i) y(i) z(i) i
next i
sys(1)=0     ' clear point buffer

' calculate move distances
dx=x(2)-x(1)
dy=y(2)-y(1)
dz=z(2)-z(1)

if ts$ = "0" then goto Bypass

'CONSTRAIN MOVE TO AN AXIS
If ts$ <> "X" then dx=0
If ts$ <> "Y" then dy=0    ' do not zero the distance for the move axis
If ts$ <> "Z" then dz=0

Bypass:

gosub gpm

Print   " [Backspace] or [Spacebar] to UNDO;  any other key or click to accept"
anykey k
if k=k_spc or k=k_bkspc then gosub undoit     


cleanup:       'vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
     
sys(41)=sys41   ' restore prior values
sys(347)=sys347  ' restore prior values

sys(1)=0
sys(36)=0
'REGEN   'show result  (optional, but necessary if sys(36) was set in gpm subroutine)

END
' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ end Cleanup

undoit:  'internal undo to preserve point selection
        dx=-dx
dy=-dy
dz=-dz
SETSELECTEDPOINTS
Pointval xr yr zr 1 'get the new location of first selected point
gosub gpm
return

gpm:
'sys(36)=1      'optional
>GroupPointsMove
{
  <Pointxyz [xr, yr, zr]
  <PointRel [dx,dy,dz]
}
return


User since forever