NN.d3m -- an improved DC6 stye Array/Duplicate alternative

Started by bdeck, April 03, 2020, 09:43:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bdeck

Here is a quick and dirty macro that can be used to create either a linear array or an array of  sequential copies of a selection, in a single operation. (It's a faster and more versatile improvement over the "AA" macro presented earlier."

Before DC was ported from DOS to the Windows platform some 26 years ago (if I remember correctly), DC's "Duplicate" command worked much differently than it does today. One difference is that it could perform  one or a number of duplications at once (hence the "N" shortcut key), combining features of the present day Array and Duplicate commands into a single command,

The NN macro attached below, like the "N" macro from which it is derived, is an attempt to restore some lost functionality while adding new features. (Frankly, I don't remember the exact syntax of the original Duplicate command.)

1) Select one or more entities.

2) Run the "nn" macro (SPACE nn ENTER). An input dialogue will appear.

3) Enter the number of copies desired in the array, or hit Enter to default to serial mode.

4) A Status Bar menu will ask for 2 or 4 points.

5) For a simple linear array, set a reference point and a target point to indicate
   the relative displacement. Then hit Enter. (2 point method)

6) For an array of 4 point duplications, set 2 reference points and then 2 target points to indicate the relative displacement and rotation. Then set a fifth point or hit enter. (The 5th point allows you to check your first 4 points before committing to the duplications)

Results:
a) If a non-zero integer was entered, the macro will create an array of copies based on the relative point placement, then end.

b) If a zero or blank input field was entered, the macro will make a single copy, and then display a status-bar menu requesting key strokes to add or delete copies, or to exit.

c) With the "Tweak" constant optionally set to 1, the macro can be configured to create the number of copies entered, and then enter serial mode to allow copies to be added or deleted.

This macro does not have the bells and whistles of DC's Array command, but, where it applies, it is faster and simpler to use.

This version is streamlined to ignore the 180-degree rotation bug in DC versions prior to v18.

A prior, slower version, which compensates for the 180-degree bug in DC versions prior to version 18, but which lacks some features of this macro may be found here:
https://forum.designcad.com/index.php?topic=7396.msg52853#msg52853

The N macro, which also compensates for the 180-deg bug, can be found here:
http://forum.designcad.com/index.php?topic=322.msg1404#msg1404

The NN macro is attached below
Stay Well,
bd

Edit:  ' Version 0.3 corrects undo error caused by using ">EraseLast" to undo multiple entities

See reply  #4  for the most recent version..

bdeck

Oops,

File in the OP has been replaced with NN.d3m version 0.3, which fixes an undo bug caused by using "EraseLast" on multiple entities.

Please advise of any other issues.

Stay Well
bd

RobS,
Got any better ideas for stress relief?  ;)

Rob S


Not really, your doing fine, keep up the good work!!!

Well, on the other hand, maybe read samdavo second to last post in off topic, I was thinking to try that except the jeweler is currently closed.
User since forever

bdeck

Quote from: Rob S on April 10, 2020, 08:27:51 AMI was thinking to try that except the jeweler is currently closed.

Well, when the Jeweler opens, try it and report back to us.
I'm looking for pointers.   ;D

bdeck

Here's an alternate version of the NN macro that converts sequential 4-point copies into incremental angular copies about a common calculated centerpoint x0, y0.

Within the macro, the inital data setup is more complex, but processing is much simpler.

The result runs a bit faster with negligibly improved accuracy (less than one significant digit). The precision of all versions is about the same as DC's Circular Array command (9-10 significant digits), but the macros have the advantage of working even when the user does not know the location of the center point.

This macro contains two alternate methods to calculate the location of the 4th point in a copy, in case anyone wants to add additional features. The polar method is slightly faster and slightly more accurate.

Stay Well,
bd




bdeck

I have been informed by RobS of reports that files NN.d3m in the OP and NNN.d3m in Reply 5 have gone missing from the forum file system.

I replaced both today with what I believe are copies of the originals. Please advise of any problems.

Thanks Rob.
Best Regards,
bd

Cadcraft

Ever grateful, thank you Rob, BD
This forum works!:)
Cadcraft