|
Sharing your work with others is a necessity in the fast
paced computer driven world. For many modern businesses hardcopy is not
enough, and inserting CAD drawings into other programs is commonplace. From
patent office details to desktop publishing layouts, CAD drawings fit hand and
glove with part manifests, blueprint material keys and similar documents,
which are more easily maintained and updated in a word processor than a CAD
program. For this reason and others, the marriage of CAD data and other types
of eRecords requires that your data play well with others.
Of course DesignCAD lets you copy and paste your work
into any other Windows program and supports many export formats including
version specific DWG and DXF output. In fact, with our Save Image command,
you can even choose many popular image types such as JPG, TIF and BMP. But
for 2D drawings, the best way to get your work into Word is through the WMF
format. WMF stands for Windows MetaFile, and many of the 2D objects in your
drawing will be translated into vector items when imported into Word, giving
you a much higher quality result than using a bitmap.
But the size of your drawing in DesignCAD has no real
relationship to the size of the drawing in a word processor like Word. Most
word processors in the US use inches to fit standard paper sizes, but a unit
in DesignCAD does not have to equal an inch unless you want it to, and can be
equal to a mile, a millimeter, a light year, or whatever you decide it’s equal
to when you start your drawing. So how do you control the output size of the
WMF file before it gets into Word? If you have a copy of DesignCAD 3D Max, or
DesignCAD Express 12, you’re in luck!! We’ve answered these questions by
adding a couple of SYS functions to control WMF output size in the latest
versions of DesignCAD.
What is a SYS Function?
SYS functions are settings, that let you control
DesignCAD options that you’d normally set manually in the program through
BasicCAD macros. SYS functions are easy to use because they accept a single
numeric parameter. For example in BasicCAD macros, SYS(3) stands for the
current layer. So to change the current layer to 5 in a macro, just type
SYS(3) = 5. When run in a macro, this one simple statement
does the same thing as if you’d manually changed the current layer to five in
the layer dialog box.
What is a BasicCAD Macro?
BasicCAD macros are just raw text (ASCII) files that
contain lines of macrocode in them. When saving macros, make sure there is no
formatting saved with the file, and that it has a .D3M extension.
.D3M is the extension DesignCAD uses to recognize macros. When run,
macros either draw items on the DesignCAD screen, or set settings within the
program. Writing a macro is easier than you might think. For example,
if you opened Notepad, and typed SYS(3) = 5, then saved the file
with a .d3m extension, you’d have a completed macro, ready to run in
DesignCAD.
How do I run a BasicCAD Macro?
To run any BasicCAD macro, just click Tools in the menu
bar, and then choose Macro Execute. When the Run BasicCAD dialog box appears,
simply browse to the macro file and double-click it to see your macro work in
DesignCAD.
How do I make it work?
Just copy the seven lines of code below into a blank file
in Notepad, save the file with a d3m extension, and then run the macro from
within DesignCAD.
b = 0.125
Input "Please enter WMF
Output Width or Height in inches:" a
Sys(45) = a
Input "Please enter WMF
border in inches: (Default=1/8inch or 0.125)" b
Sys(46) = b
c$ = "WMF Output Longest
Size is now ",a," WMF Border is now ",b
Message c$
Under the Hood . . .
In current versions of DesignCAD, SYS(45) is the size of
the exported WMF file, and SYS(46) is the WMF file border size. Both of these
values are in inches. In this macro you simply ask the user for the width or
height in inches they want the WMF file to be when it’s inserted into Word.
If you’re drawing is drawn in landscape mode (meaning it’s wider than it is
tall) just enter the desired width. If you’re drawing something that’s taller
than it is wide, just enter the desired height. The next line simply sets
SYS(45) to the value the user entered for size. Then ask the user for the
border width around the image. There is a 1/8th of an inch border
around the image by default so vertical or horizontal lines on the edges of
the image will not be clipped and disappear in Word if they are at the very
edge of the image boundary. The next line simply sets SYS(46) to the value
the user entered for the border. Finally, the last two lines in the macro
display a message to the user, confirming these values have been set.
continue story next column
|
|
Getting Results
Once the macro has been run just click File
in the menu bar, then choose Export. In the Export File
dialog box which appears, click the Save As Type drop down, and
choose WMF from the choices listed there. Next specify a
location for the file by browsing to that location in the Save In
drop down at the top of the dialog box, then give the file a name and
click Save. The file is exported at the size you specified in
the macro. The settings will stay in effect for WMF export for this session
of DesignCAD, and if you need to change the size or border values, just run
the macro again, then re-export your file.
To see the results just open Word, and click Insert
from the menu bar. Next choose Picture, and from the
Fly out menu that appears, choose From File. In the Insert
Picture dialog, which appears, browse to the WMF file, and double-click it to
add it to your Word document. Its size will be what you told the macro, plus
the border size you entered in the macro on all four sides of the image.
What if I don’t have the latest version of DesignCAD?
Again, you’re in luck! Just call our helpful sales
staff, and mention that you’re reading our newsletter, and you can upgrade
on the spot from any previous version of DesignCAD for just $49.95
(a new lower upgrade price). That’s a savings of over $30 off the regular
upgrade price, and by far the best upgrade offer in the industry!!
Stuck with an older version for now?
DesignCAD 3000, and DesignCAD 3000 Express users can copy
the code below into an ASCII text file, save the macro, and run it before
exporting a WMF file to control their output WMF size.
pix = sys(25)
if pix = 0.0 then pix = 67
Message "Current drawing
units per inch: ", 576/pix
Input "Desired drawing
units per inch: ", scale
if (sys(999)) then End
if scale <= 0.0 then
sys(25) = 0
scale = 576/67
else
sys(25) = 576/scale
end if
m$ = "Scale is now ",
576/sys(25), ". A 10-unit line will be ", 10/scale, "inches long."
Message m$
' "Scale is now ",
576/sys(25), ". A 10 unit line will be ", 10/scale, " inches long."
End
This macro works a little differently from the previous
example, but does the same thing. Since only current DesignCAD versions
support SYS(45) and SYS(46), DesignCAD 3000 users will have to use SYS(25)
which controls the number of metafile units per drawing unit. One metafile
unit is roughly 1/576th of an inch, so unlike the previous example,
when users run this macro, they will have to tell it how many units per inch
to export the WMF file to. This is easy; just enter the bottom half of the
fraction, which represents the scale you are exporting to. For example if you
want your output file to be a quarter inch scale, it’s represented by the
fraction ¼, so when prompted for the drawing units per inch in this macro,
enter a 4. So if you’re drawing is ten units wide, and you run the macro,
then enter a value of 4 for the drawing units per inch, the resulting WMF
image will be 2.5 inches wide in Word. Remember that DesignCAD 3000 does not
add a border of any kind to the WMF output. To give you a reference point,
entering a value of zero in the macro creates a WMF file five inches wide or
high, whichever is longer.
Conclusion
A fully commented version of this and many other helpful
macros can be found in the Sample Macros folder under the DesignCAD program
directory. Just associate the .D3M file extension with notepad, or any text
editor of your choice for easy viewing of these files.
|
Do you have a macro you'd
like to share with the rest of us in DesignCAD News? Email you submission to
newsletter@upperspace.com
|
Register Your Version of DesignCAD!
You can register at
www.Upperspace.com, by calling 800/233-3223, by mailing your
registration card, or faxing it to 918/825-6359. Here why you should …
#1 All registered
software gets free technical support. Even when new versions released,
you can still take advantage of free technical support.
#2 When you
register it gives us a copy of your serial number. If you should lose
your serial number sometime in the future, you can call us and we’ll
read it back to you. This can be a real life-saver when upgrading to a
new computer or if you’re forced to reformat your hard drive. It can
save you from having to buy another package of the software!
|
|