Author Topic: DrollTroll's Toolbox  (Read 5495 times)

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
DrollTroll's Toolbox
« on: June 23, 2011, 02:04:05 PM »
This thread (locked for my postings only, sorry) will be a growing collection of macros and other utilities that I hope users may find useful. As I add new entries, I will note them here in the first post, but the actual tool will be in its own reply.

HOW TO USE THESE MACROS:
Click on the macro name below to go directly to the post that contains the attachment. In the post, download the attached macro to your DesignCAD folder. To run the macro, choose Tools/Macro Execute, or press the '%' key, and select the macro from the list.

AVAILABLE MACROS:
FindMicroLines.d3m -- this macro will locate and select line, curve, arrow, and plane entities whose overall length is smaller than some user-specified minimum (default minimum is 0.000001). Added 06/23/2011.

FindTinySegments.d3m -- this macro will locate and select line, curve, arrow, and plane entities which contain one or more segments that is smaller than some user-specified minimum. (How is this different than FindMicroLines? That macro looks at the entire length of the object, this looks at each individual segment within each object.) Added 06/23/2011.

FindSwitchbacks.d3m -- this macro will locate lines, arrows, and planes that double back on themselves (ex. points 1-2 go right, then point 3 is directly to the left of point 2). Usually this is not a desirable thing, so being able to identify these objects can be helpful. Added 06/23/2011.

FindMicroText.d3m -- this macro selects text entities that are suspiciously small (length or height) or are empty strings. Added 06/23/2011.

NoSolids.d3m -- this macro will explode all solids in a drawing by setting everything's solid ID to 0. This is occasionally useful in the 2D version of DesignCAD, which has no command available to explode solids. Added 06/23/2011.

NewMakeXYZ.d3m -- this macro and associated d3i file will create an annotated xyz dump for all selected objects. Added 01/25/2012.
 
DeleteTinySegments.d3m -- this macro will remove very small segments from multi-segment lines. Added 10/30/2012. Updated 02/14/2013. Updated 03/26/2013. Updated AGAIN 03/29/2013. Thanks samdavo.
 
FlattenZ.d3m -- this macro will move all points in either the entire drawing or just the selection set to z=0. This can solve many weird problems in what *should* be a 2D drawing but isn't. (I know Lar posted something similar some time back, but I couldn't find it so I rolled my own.) Added 02/14/2013. Updated 04/26/2013 -- fixed problems with Selected Entities Only option. Thanks samdavo.

ApplyLayerStyles.d3m -- updates all entities to use Color By Layer and Linestyle By Layer and re-activates those drawing flags. Added 03/08/2013

Delta.d3m -- this macro measures the delta-x, delta-y, and delta-z offsets between two points that you set. Added 11/12/2014

BalloonsByNumber.d3m -- this macro draws balloons with consecutive numbers. Added 02/06/2015

ChangeCirclesRadius.d3m -- this macro adjusts all selected circles and arcs to a user-specified radius
« Last Edit: January 07, 2016, 01:30:24 PM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
FindMicroLines.d3m
« Reply #1 on: June 23, 2011, 02:04:58 PM »
FindMicroLines.d3m -- this macro will locate and select line, curve, arrow, and plane entities whose overall length is smaller than some user-specified minimum (default minimum is 0.000001). Added 06/23/2011.

2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
FindTinySegments.d3m
« Reply #2 on: June 23, 2011, 02:05:56 PM »
FindTinySegments.d3m -- this macro will locate and select line, curve, arrow, and plane entities which contain one or more segments that is smaller than some user-specified minimum. (How is this different from FindMicroLines? That macro looks at the entire length of the object, this looks at each individual segment within each object.) Added 06/23/2011.
 
« Last Edit: March 08, 2013, 08:50:03 AM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
FindSwitchbacks.d3m
« Reply #3 on: June 23, 2011, 02:09:25 PM »
FindSwitchbacks.d3m -- this macro will locate lines, arrows, and planes that double back on themselves (ex. points 1-2 go right, then point 3 is directly to the left of point 2). Usually this is not a desirable thing, so being able to identify these objects can be helpful. Added 06/23/2011.
« Last Edit: June 24, 2011, 03:45:39 PM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
FindMicroText.d3m
« Reply #4 on: June 23, 2011, 02:24:46 PM »
FindMicroText.d3m -- 'Checks for and selects all text with a height or width less than 1e-6 or some user-specified minimum, and all empty text.
This can be especially useful when exporting to DWG or DXF where empy text or text with no length or height can be problematic. Added 06/23/2011.

If any suspicious eintities are selected, the Info Box is opened to allow you to inspect the object(s). Or you can just delete them if you're feeling bold.
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
NoSolids.d3m
« Reply #5 on: June 23, 2011, 02:31:15 PM »
NoSolids.d3m -- this macro will explode all solids in a drawing by setting everything's solid ID to 0. This is occasionally useful in the 2D version of DesignCAD, which has no command available to explode solids. Really helpful for those rare occasions where somehow DesignCAD has decided that the entire drawing is a solid, and you can't edit individual entities. Added 06/23/2011.
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
NewMakeXYZ.d3m
« Reply #6 on: January 25, 2012, 10:30:58 AM »
NewMakeXYZ.d3m and NewMakeXYZ.d3i -- this macro and its associated include file will create an annotated xyz dump of the selected entities. This information can be used in a number of ways -- supplying raw point data to some other application for import or data processing, finding out the exact composition of the selected object(s), verifying that the points of the selected object(s) are in the correct locations, and so forth.

You are required to specify a filename for the xyz file to be created.
*You may supply just a filename (ex. "mydata"), or a full path and filename (ex. C:\Users\Public\mydata").
*The .xyz file extension will be automatically appended.
*If you supply the full path, the specified directory must already exist -- it won't create a new folder for you.
*If you supply the full path, you must have write permissions on the specified folder.
*If you only supply the filename, the data will be saved to one of two places -- either in your My Documents/DesignCAD folder, or in the same folder where DesignCAD was installed.

Be sure to download BOTH attached files to the same folder; the d3m file requires subroutines in the d3i file.

Added 01/25/2012
« Last Edit: April 27, 2012, 09:29:43 AM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
DeleteTinySegments.d3m
« Reply #7 on: October 30, 2012, 11:09:09 AM »
DeleteTinySegments.d3m -- locates and removes very short segments and duplicate points from lines, arrows, planes, and hatches.
While old versions of DesignCAD were quite tolerant of duplicate points in lines and other entities, newer versions are sometimes less so. Also these can cause problems when trying to export a drawing to dwg or dxf format. Hence this macro. It does NOT remove duplicate points from curves, because in a curve entity two consecutive identical points are used to represent a sharp corner.
Tested on versions 21 and 22, not tested on older versions but should work at least back through version 18.
Todo: Add an option to cancel the operation.
Updated 02/14/2013 -- added a Cancel option (Press Esc) and fixed a potential problem with arrows.
Updated 03/26/2013 -- fixed a problem with locked layers and entities pre-selected.
Updated 03/29/2013 -- sloppy code! Fixed some potential looping errors and other minor issues.
 
« Last Edit: February 06, 2015, 11:23:31 AM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
FlattenZ.d3m
« Reply #8 on: February 14, 2013, 05:10:35 PM »
FlattenZ.d3m -- this macro moves all points in either the selection set or the entire drawing (user's choice) to Z = 0. This solves many "weird" problems that may occur when a drawing *should* be 2D but in fact isn't. Should work at least as far back as DesignCAD 3D Max 18, possibly even back to 14.
 
Note: If your drawing contains 3D solids, or any objects that are not parallel to the XY plane, they can be changed drastically. There is no Undo for this macro, so you may want to save your work before using it. A tilted circle won't be converted to an ellipse, for example -- the center, radius, and orientation points will simply be moved to the Z=0 plane, possibly resulting in a new circle with a different radius.

Updated 04/26/2013 -- fixed some problems with "Flatten Selected Entities Only" option.
« Last Edit: February 06, 2015, 11:23:49 AM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
ApplyLayerStyles.d3m
« Reply #9 on: March 08, 2013, 08:46:30 AM »
ApplyLayerStyles.d3m -- this macro updates all entities in the drawing to use Color By Layer and Linestyle By Layer, and re-activates the Color By Layer and Linestyle By Layer drawing flags. This can be handy if someone has gone and drawn stuff on your preset layers in the wrong color or linestyle.
 
Added 03/08/2013
« Last Edit: February 06, 2015, 11:24:11 AM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
Delta.d3m
« Reply #10 on: November 12, 2014, 01:47:58 PM »
Delta.d3m -- this macro asks you to set two points, then displays the distance between them as separate dx, dy, and dz values. Handy if you want more detailed info than just absolute distance.

Note: For version 25, we added this additional information into the Angle and Distance Between Points command (in previous versions it only showed the overall distance).
« Last Edit: January 07, 2016, 02:17:28 PM by DrollTroll »
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
Balloons By Number
« Reply #11 on: February 06, 2015, 11:20:25 AM »
BalloonsByNumber.d3m --  this macro asks for some starting specifications for balloon text (balloon size, arrow size, and starting number), then continually draws balloons with incrementing numbers until you press the Esc key.
2016 marks my 24th year in DesignCAD-Land!

DrollTroll

  • Kindly Curmudgeon
  • Administrator
  • *****
  • Posts: 4121
Change Radii of all selected circles to a fixed value
« Reply #12 on: January 07, 2016, 01:29:09 PM »
ChangeCirclesRadius.d3m -- this macro asks for a new radius, then updates all selected circles and arcs to use the new radius. All other selected entity types are ignored.
2016 marks my 24th year in DesignCAD-Land!