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.

Stretch feature and Nudge ABility

Started by jrrushmeyer, April 28, 2008, 05:47:39 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

prl

#15
Animated graphic attached.

bdeck

#16
Lar,

Here's a macro that gets around the shortcomings of both Stretch and Point Select mode.

All it needs to be complete is a toggle to display rectangles on screen . A modification to stretch  dimensions would also be good.

Thanks to prl for the keyoff input routine, and to DT for a robust interpreter with virtual stack management.

BD

Note 1: For those who have not already done so, in the interests of uniformity, I recommend remapping the "Fit To Window" command to the unshifted "w" keyboard shortcut. 

Note 2: Also, because this macro uses the anykey command, the only DC keyboard commands that are available while waiting for key input are unshifted "w" and "z", and the numeric "+" and "-".  While setting points, normally available commands are available in this macro as well.


' ss.d3m,   Super Stretch Macro,  BDeck  4/08

' If no entities are selected, it will select all entities and act like a super stretch command
' All instructions appear in status bar.
' Note shift and control keys are pressed before subsequent selections, not during.
'
'Allows gravity snap in point select mode

sys(470)=1
sys345=sys(345)
sys41=sys(41)
ns=sys(80)

k_spc=32
k_shft=16
k_cntrl=17
k_click=1
k_esc=27
k_w=87
k_z=90
k_plus=107
k_minus=109

if ns=0 then
   >SelectAll
   {
   }
endif

If Sys(80) < 1 Then gosub cleanup

If Not Sys(345) Then
  >PointSelectMode
  {
  }
End If

t=0

do while 1
   Sys(41) = 2 'rubberband box for user points

   Setpoint "Set two points for a selection box", 2

   If Sys(1) < 2 Then gosub cleanup

   >DragSelect
      {
        <Type [t]
        Pointval x y z 1 ' get the first point the user set
        <Pointxyz [x, y, z]
        Pointval x y z 2 ' get the second point the user set
        <Pointxyz [x, y, z]
      }
   SETSELECTEDPOINTS

   t=0
   do while t=0     
      print "Shift=select more pts, Cntrl= deselect pts, Spc = enter offset data, Click = set offset points.   Also w, z, +, -"
      anykey k
      if k=k_click then gosub clickoff
      if k=k_spc   then gosub keyoff
      if k=k_shft  then t=1
      if k=k_cntrl then t=2
      if k=k_esc  then gosub cleanup     
      if k=k_w then
   >FitToWindow
   {
   }
      endif
      if k=k_z then
    >ZoomWindow
   {
   }
      endif      
   if k=k_plus then
    >ZoomIn
   {
   }   
   endif
   if k=k_minus then
    >ZoomOut
   {
   }   
   endif

     loop
loop

end

cleanup:
    If sys(345)<>sys345 Then   'restore original mode
          >PointSelectMode
          {
          }
    End If
   sys(41)=sys41
   if ns=0 then   
        >DeSelect
        {
        }
    else       ' comment these next lines out to keep points highlighted at end of macro
         >DeSelect
         {
         }
        >SelectPrevious
         {
         }
   endif
   end
return

clickoff:
   Sys(41) = 1 'rubberband line for user points
   Setpoint "Set two points to define displacement", 2
   If Sys(1) < 2 Then return
   Print "Moving the selected points..."
   >MovePoints
   {
       Pointval x1 y1 z1 1 ' get the first point the user set
      <Pointxyz [x1,y1,z1]
        Pointval x2 y2 z2 2 ' get the second point the user set
      <Pointxyz [x2,y2,z2]
   }
       gosub cleanup
return

keyoff:     'Thanks to prl for contributing the following code

   dx$ = "0"
   dy$ = "0"
   dz$ = "0"

   fmt$ = "%s %s %s"
   input "Enter dx dy dz  for desired displacement.    Examples - 0 0 4.73 ", b$
   if sys(999)>0 then return

   Parse b$, fmt$, dx$, dy$, dz$

   precision 15
   dx = val(dx$)
   dy = val(dy$)
   dz = val(dz$)

        Print "Moving the selected points..."

   >MovePoints
   {
   <Pointxyz 0.0000000000,0.0000000000,0.0000000000
   <Pointxyz [dx,dy,dz]
   }
   gosub cleanup
return


prl


bdeck

#18
Prl,

Thanks.

It appears I had previously underestimated ( forgotten ) the ability of Basiccad to handle aborts.

BD

jrrushmeyer

OK guys.  I was able to write a macro and put it in D15 Macro Samples and run it  but I am at a loss on DC18.  I printed out the MACRO section of the manual but that doesn't seem to help.  Where should I look in the manual to help me.  Even though I can get Point Select to do what I want at this point I really want to try out those offset macros.

JR

prl

Quote from: jrrushmeyer on April 30, 2008, 07:40:20 AM
OK guys.  I was able to write a macro and put it in D15 Macro Samples and run it  but I am at a loss on DC18.

In version 18, they have moved a lot of things.  Default location is here:

C:\Documents and Settings\User Account\My Documents\DesignCAD 3D MAX 18\Sample Macros

Lar

Word of caution: put your macros in your own macro folder and then use 'file locations' in the Options dialogue to set it as the default. Sometimes when you install new versions your personal stuff in the program folders get deleted (goes for all programs).

Lar

Dr PR

prl,

Thanks. Polygon Selection is what I was talking about (like Photoshop's lasso function). When did Polygon Selection get added?
DesignCAD user since 1987

prl

Quote from: Dr PR on April 30, 2008, 10:11:50 AM
When did Polygon Selection get added?

Not sure.  An older laptop of mine has version 13 on it and it's there.

Lar

#24
Polygon Selection only selects entities. It doesn't highlight points in Point Select Mode.

To modify your highlighted points selection you do the same as when expanding an entity selection: Shift+drag to add points and Ctrl+drag to remove points.

Lar

jrrushmeyer

BD
Nice macro.  Finally able to write and save it.  It will definately get some miles put on it!!

JR