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.

The Old N and M vs the New...

Started by Lar, May 15, 2007, 08:41:46 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

bdeck

#15
Quote from: Lar on May 18, 2007, 08:06:48 AM
Only suggestion I'll make is to check the status of the 'make a copy' option, before turning it off, and at the end of the macro return that status if it was changed (or just return the value whether it was changed or not - I think there is a way to run a command without completing it, which gives you the chance to set options).


Hi Lar,

Good suggestion.

Adding a line to run the mirror command once without point parameters resets the options, but it also wipes out the undo feature, which I find to be more troublesome.

There is no documented read/write SYS variable for mirror mode.

As a quick hack, I added a line to do a mirror copy, and then undo. (see below)

I've been trying to write a slicker version (the current version requires 3 undos), but manipulating symbols with handles in DC is frought with peril. See http://forum.designcad.com/index.php?topic=465.0 

The simplest solution to the reset options problem is to never use Mirror (or any other command with an unwanted dialog box) outside of a macro.



' FlipStick1.d3m   5/17/07  bdeck
'
' This version sets mirror mode to "make a copy" when completed
'
' Works only on selections having 2 handles exposed
'
' Select any symbol having 2 handles exposed, or make a selection and set 2 handles;
' Run macro.
' Set 2 points:
'     1  target point for duplicate
'     2  alignment point for placement and mirror
'
' Also works in preset point mode
'
' Note that sys(36) prevents dialog box cleanup errors.
' Sys(1)=0 does not clean up set points in preset point mode.

if sys(80) <1 then end (if no items selected)
sflag=sys(36)    ' archive silent
sys41=sys(41)    'archive rubberband style
sys38=sys(38)    ' archive text mirrro

dim x(6),y(6), z(6)
n=sys(1)   

if (n=2) then goto gottem                  'use correctly set points
sys(1)=0

Sys(41) = 1  'set rubber band style

setpoint "Set 2 points Target,  Axis" 2
   
n=sys(1)                   
if n<>2 then goto cleanup

gottem:

sys(36)=1

for i=1 to n
   pointval x(i) y(i) z(i) i
next i

if n=2 then   

  sys(38)= 0 'do not mirror text

   >Mirror
   {
         <Axis 4   'custom mirror, the only one worth using.
         <Type 0   ' dont make copy
         <Pointxyz [x(1), y(1), z(1)]
         <Pointxyz [x(2), y(2), z(2)]
   }
   >Duplicate ' MAKE A COPY OF THE FLIPPED

   {
      <Reference 0   ' 0 = use handle 1=from reference point
      <Type 1   ' 0 = fixed scale]
      <Pointxyz [x(1), y(1), z(1)]
      <Pointxyz [x(2), y(2), z(2)]              ' remove the ortho constraint and activate this line to improve functionality
   }

   >Mirror  ' PUT THE ORIGINAL BACK WHERE IT WAS
   {
         <Axis 4   'custom mirror, the only one worth using.
         <Type 0   ' dont make copy
         <Pointxyz [x(1), y(1), z(1)]
         <Pointxyz [x(2), y(2), z(2)]
   }
   >Mirror  ' RESET MakeCopy OPTION FOR DIALOG BOX DEFAULT
   {
         <Axis 4   'custom mirror, the only one worth using.
         <Type 1   '  make copy
         <Pointxyz -10000, 0, 0]
         <Pointxyz -10000, 1, 0]
   }
   >Undo
   {
   }


endif

cleanup:       
Sys(41) = sys41
sys(36)=sflag
sys(1)=0     'clean up unused points

REGEN  ' Necessary to cleanup mouse tracks if in preset point mode

Lar

BD,

While I was typing my previous post I was wondering if it was possible to actually check the status of each option in a command... Not too long ago, before typing something I would actually check it out but that use to take up too much of my time. Now'a days I'm trying to control the time I spend here. This forum is a guilty pleasure..
Sometimes in basiccad you are forced to be 'ungraceful' and employ the user as a function. By that I mean tell the user that the option is now off, and ask him if he wants it to remain off or to turn it back on. It's something I would do for myself in a macro that could mess me up later.

An even less slick solution, but one that would work, is, at the beginning of the macro, to: 1] check the total number of entities with sys(9), 2] create a new simple entity, like a circle, 3] mirror it, 4] check sys(9) again. If there is 1 more entity then 'make a copy' is off. If 2 more it is on, so, at the end of the macro turn it back on. Step 5 would be to Undo the mirror and the circle. This is pretty simple to write and would happen so fast the user may not even see it (the cursor would blink a few times). Actually, on 2nd thought, it is pretty slick.

Lar
(hey, what happened to the little devil smiley?)

(just teasing)

bdeck

Quote from: Lar on May 20, 2007, 09:18:59 AM
This forum is a guilty pleasure.

Lar,

Well put......., but when does the pleasure start?

BD