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.

How to change just one position point of solid

Started by MarkX, November 13, 2011, 02:40:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarkX

Hi Bob,

That's great! But I'm not sure if the macro is necessary with the F6 key. To be really useful, the macro would have to accept input for X, Y, or Z since you could need to move to any one of those.

Thanks!
Mark
Quote from: Bob P on November 14, 2011, 04:39:38 PM
'Program mpx.d3m
'I've put an extra line (message X1, ...) which can be removed or commented out if desired.

Setpoint "Gravity-snap onto the point that you want to move", 1
GETXYZ X1, Y1, Z1
sys(1)=0
message X1, "is the old x value"
INPUT "Enter a new x value ", X2
>Pointmove
{
<pointxyz [X1, Y1, Z1]

<pointxyz [X2, Y1, Z1]
}

END:

------------------------------

On a separate note, I had forgotten that the macro help files pertaining to pointxyz are misleading.  They all show real values without the brackets.  But - variables must be within brackets.  Drove me crazy until I looked at some of my other macros.


Rob S

OK, this should move any point of any single object along any of the 3 axes to a desired offset from the origin.

Run the macro, enter x, y, or z for the direction, snap to any point on the object, and enter the co-ordinate



' Program moveobjectxyz.d3m

INPUT "Enter axis you want to move in, X, Y, or Z? Then pick point to move.", axis$


Setpoint "Gravity-snap onto the point that you want to move", 1
GETXYZ X1, Y1, Z1
sys(1)=0


If axis$ = "Y" then goto moveY

If axis$ = "y" then goto moveY

If axis$ = "Z" then goto moveZ

If axis$ = "z" then goto moveZ

prompt$ = "Enter a new X value for", X1
INPUT [prompt$], X2

>PointSelect
{
<Pointxyz [X1, Y1, Z1]
}

>selectmove
{
<Type 1
  <Reference 0
<pointxyz [X2, Y1, Z1]
}


END

moveY:

prompt$ = "Enter a new Y value for", Y1
INPUT [prompt$], Y2

>PointSelect
{
<Pointxyz [X1, Y1, Z1]
}

>selectmove
{
<Type 1
  <Reference 0
<pointxyz [X1, Y2, Z1]
}

end

moveZ:

prompt$ = "Enter a new Z value for", Z1
INPUT [prompt$], Z2


>PointSelect
{
<Pointxyz [X1, Y1, Z1]
}

>selectmove
{
<Type 1
  <Reference 0
<pointxyz [X1, Y1, Z2]
}

end
User since forever

JJG

#17
Now, simply, without macro :

Quote from: MarkX on November 14, 2011, 01:25:50 PM
Quote from: JJG on November 14, 2011, 12:39:21 PM
You forget to say that your object must first be selected.

In this case, without even using the coordinate bar, there is another solution:

Often I move any object (entity, groups of entities, etc ... and therefore solids too) by this procedure:
1) keyboard shortcut "Ctrl H", then click for a first point of reference, then open the "point relative" window (with the key ' ) and fill in the desired movement in X, Y, and Z together , and take care to check "Last point "; validate ;
2) issue the command "Move" (keyboard shortcut "M"), then validate again.

So the selection was moved automatically to the desired amount.
QED
Hi JJG,

Yes, there are apparently many ways to perform RELATIVE motion. But I was looking for a method to move one or more XYZ coordinates ABSOLUTELY while leaving the others unchanged. In other words, given X=1,Y=1,Z=2.7812 change to X=1,Y=1,Z=3.14159265368 WITHOUT having to do calculations like 3.14159265368 - 2.7812 before the movement and without having to first capture the values of existing locations.

This is a straight-forward process in other systems, and I'm glad to see that there's at least a back-door to the process via F6.

Thanks!
Mark

OK, I now understand better what "tool" you are needing : in this case, simply check "origin" instead "Last point" in the procedure I describe above !

JJG

Or, better :

1) keyboard shortcut "Ctrl H", then click for a first point of reference (i. e. this one that must be at the desired future target coordinate), then open the "point XYZ" window (with the key : ) and fill in the desired target coordinates in X, Y, and Z together , and take care that "Move cursor without setting point" is unchecked "; validate ;
2) issue the command "Move" (keyboard shortcut "M"), then validate again.

So the selection was moved automatically to the desired target coordinate.
QED

Rob S

JJG, the only difference with the macro is that you only concern yourself with the destination coordinate in one direction, and do not want to make any change in the other two directions, and thus may not know what those co-ordinates are or should be.

It is a bit of a unique requirement, and I sort of doubt it has enough demand for it to be included in the program, compared to some other things we've been asking for..
User since forever

MarkX

Quote from: Rob S on November 15, 2011, 07:49:50 AM
JJG, the only difference with the macro is that you only concern yourself with the destination coordinate in one direction, and do not want to make any change in the other two directions, and thus may not know what those co-ordinates are or should be.

It is a bit of a unique requirement, and I sort of doubt it has enough demand for it to be included in the program, compared to some other things we've been asking for..
Hi Rob,

Its really not that unique -- its the standard operating system in other programs. And, its the way it already works with vectors and planes with the info-box. If it just worked that way for solids, or if the ":" dialog used the existing point values as default, it would already be there. I'd say that not having this feature frequently increases fidgeting to get a point positioned by 50% or more.

Thanks!
Mark

Rob S


Markx, so, did you try my macro above, does it work for you?

You just copy the text into notepad, save it as something like "moveobjectxyz.d3m", and then run it.

Pick a direction, set a point on your object, and the object moves so that point is at that offset fvrom the origin.
User since forever

MarkX

Quote from: Rob S on November 15, 2011, 08:58:04 AM

Markx, so, did you try my macro above, does it work for you?

You just copy the text into notepad, save it as something like "moveobjectxyz.d3m", and then run it.

Pick a direction, set a point on your object, and the object moves so that point is at that offset fvrom the origin.
Hi Bob,

I've set it up to key off of ? which is right next to gravity snap. Now I'll have to see if its as useful as I conjectured ;-)

One thing I've immediately run into, when I tried to grab a coordinate value using F6, is that the coordinates apparently don't copy. This leaves me back in the business of having to create a pointmark, looking at its XYZ value, and copying it, deleting the pointmark, and then running the macro.

Hmm ... we'll see.

Thanks!
Mark

Lar

#23
RobS,

I tried your macro and it worked fine except that it only works on a single entity, group or solid and I was right then testing with multiple stuff. I then went about modifying your macro to set a handle rather than use getxyz, which I did but then the macro-bug bit me and I fixed it for the following:
1] Added a loop in case neither x, y nor z is entered, with the option to abort...
2] It now uses the existing handle-1 so you don't lose your sticky handles. You have to make the selection and maybe set the handle before running the macro...
3] You now have the option of entering the new x, y or z value OR snapping to an existing point for the new x, y or z (note that only the desired value is taken from the snapped point).

Lar

ps: One little user-issue... if you attempt to set a point rather than enter a value and the selection moves before you set the point, or does not move at all, it is because you are pressing the OK button rather than the Cancel button. (if your handle is at 0 then the selection will not move at all). If this happens just Undo and rerun the macro.


' Program moveobjectxyz.d3m
'original by RobS, 14 Nov 2011,
'modified by Lar, 15 Nov 2011

'if nothing is selected...
if sys(80)=0 then
message "Nothing is selected. Make a selection and set the handles as needed then restart this macro..."
end
end if

INPUT "Enter axis you want to move in (X, Y, or Z)", axis$

'get existing handle-1 xyz values...
X1=sys(190)
Y1=sys(191)
Z1=sys(202)

inpt:
If axis$ = "X" then goto moveX

If axis$ = "x" then goto moveX

If axis$ = "Y" then goto moveY

If axis$ = "y" then goto moveY

If axis$ = "Z" then goto moveZ

If axis$ = "z" then goto moveZ

'if none of the above are entered (by mistake)...
input "You did not enter X, Y or Z. Please correct or press Cancel to abort..." axis$
if sys(999) then end
goto inpt

moveX:
prompt$ = "Enter a new X value for", X1," or click Cancel to snap to an existing point.."
INPUT [prompt$], X2
if sys(999) then
setpoint "Snap to an existing point for the new X location..." 1
GETXYZ X2, Y2, Z2
sys(1)=0
end if

>selectmove
{
<Type 1
 <Reference 0
<pointxyz [X2, Y1, Z1]
}


END

moveY:

prompt$ = "Enter a new Y value for", Y1," or click Cancel to snap to an existing point.."
INPUT [prompt$], Y2
if sys(999) then
setpoint "Snap to an existing point for the new X location..." 1
GETXYZ X2, Y2, Z2
sys(1)=0
end if

>selectmove
{
<Type 1
 <Reference 0
<pointxyz [X1, Y2, Z1]
}

end

moveZ:

prompt$ = "Enter a new Z value for", Z1," or click Cancel to snap to an existing point.."
INPUT [prompt$], Z2
if sys(999) then
setpoint "Snap to an existing point for the new X location..." 1
GETXYZ X2, Y2, Z2
sys(1)=0
end if

>selectmove
{
<Type 1
 <Reference 0
<pointxyz [X1, Y1, Z2]
}

end

MarkX

Quote from: Lar on November 15, 2011, 10:12:41 AM
ps: One little user-issue... if you attempt to set a point rather than enter a value and the selection moves before you set the point, or does not move at all, it is because you are pressing the OK button rather than the Cancel button. (if your handle is at 0 then the selection will not move at all). If this happens just Undo and rerun the macro.

Hi Lar,

I've been using this macro quite a bit. I don't know how you guys have gotten along without it. Good catch on needing to move an entire selection. Great idea to make position "same-as" existing object. Something like this really ought to be in DC by default -- it already is for simple objects like lines and pointmarks.

Thanks!
Mark