![]() |
WHIP! / Using WHIP! / Generating DWFs < You Are Here |
![]() Generating DWFs |
WHIP! Readme |
| | Installing WHIP! |
| | Viewing DWFs |
| | Generating DWFs |
| | Publishing DWFs |
| | Maintaining WHIP! Locally |
You can use AutoCAD 2000 or AutoCAD Release 14 to generate DWF (Drawing Web Format) files. For information on using AutoCAD 2000 to generate DWF files, refer to your AutoCAD 2000 documentation. This section describes how to generate DWF files using AutoCAD Release 14.
To generate a DWF file using AutoCAD Release 14, you first need to obtain the AutoCAD Internet Utilities. To use the AutoCAD Internet Utilities, you must have installed the following:
Installing the AutoCAD Internet Utilities The AutoCAD Internet Utilities are composed of three ObjectARX applications: DWFOut.ARX, DWFIU.ARX, and Internet.ARX. Because DWF is one of the available output types on the AutoCAD R14 File Export menu, the DWFOut.ARX application gets installed on your system as part of a Typical AutoCAD Release 14 installation; however, since all AutoCAD users do not have internet access, the other two applications are NOT part of a Typical Install. To use the URL related commands or perform drag and drop, you must have performed a Custom installation. To output DWF files from paper space, to generate ASCII DWF files, and to use international text, you must obtain Autodesk's newer DWFOut.ARX application. To attach and detach URLs in paper space, you must obtain Autodesk's newer DWFIU.ARX application. You can get both of these by downloading one self-extracting executable: aiu31.exe. This executable replaces the original applications with the newer ones.On a system where you have already performed a Custom install of AutoCAD Release 14:
Using the ObjectARX Applications to Generate a DWF File Once you have installed the AutoCAD Internet Utilities, you can begin using the AIU features. There are five commands available with AutoCAD Internet Utilities:
Saving DWG Files in DWF Format To Save DWG Files in DWF Format:
If you want to save a DWF file and generate an HTML file each time you save the DWG, you can download a lisp routine from ftp://ftp.autodesk.com/pub/whip/readme/saveall3.lsp. After loading saveall3.lsp through the AutoCAD Tools menu Load Application command, you can issue a saveall3 command and the lisp script will run. The saveall3 lisp code assumes that the DWG and DWF files already exist, so it issues a "y" (yes) to allow them to be overwritten. Turning Off File DialogsThe DWFOut command opens a dialog that enables you to supply a file name for the DWF file, to optionally turn off compression, or to adjust the precision. To facilitate DWF file generation in batch mode, the AutoCAD FILEDIA (FILE DIAlog) variable can be set to 0. When set to 0, prompting for the DWF file name, compression, and precision is done in the command window instead of through a file dialog box. From the command line, you can issue a command of the form: DWFOut <filename> {a | b} {l | m | h} {y | n} {y | n}where:
Under normal circumstances, all of the geometry contained in a DWG gets written to the DWF file. This is by design. The rationale behind this design is that this allows users the freedom to pan a DWF to see other parts of a drawing. Hence, the DWFOut command does not provide a means to crop a DWG to a particular subset. Using the word "all" is an oversimplification. Actually, the geometry that is written to the DWF file is all the geometry that AutoCAD has in its display list. In cases where the current view depicts a very large drawing that is tightly zoomed in, any geometry that falls outside of the AutoCAD display list will not be contained in the DWF file. Furthermore, commands such as VIEWRES, FACETRES, DISPSILH and HIDE that affect the visibility of geometry on the display screen also affect the contents of the DWF file. Images in a DWFOne of the advantages of the DWF format is that it is vector-based. DWF files are stored using high-level primitives such as polyline, polygon, polytriangle, marker, circle, ellipse, arc, and text. A vector-based format allows for speedier pans and zooms over other formats such as bitmaps. In contrast, AutoCAD Release 14 allows the insertion of images into DWG files. When a DWFOut command is issued for a DWG file with an image, the image data is compressed and saved into the DWF file in one of the following formats:
Since the DWFOut ObjectARX application determines the best format to use to save the image data, there is nothing that you need to do. To preserve the speediness of pans and zooms for a DWF file with an image, during a pan or zoom, the image is replaced with a purple bounding rectangle to represent the image. Raster images in DWG files are a challenge when generating the corresponding DWF. There are two problems:
This is how DWFOut works:
The DWF file is stored with the same background color as you have selected for the main AutoCAD window. The background color information (and other color information) normally adds about 1K of storage to a DWF file. Whenever a black or white background is used, this color data is reduced to only 3 bytes, which may be of interest when dealing with extremely small DWF files (less than 5K or so). As a result, using a black (or white) background with 16-bit precision can be a powerful combination to reduce file size. Precision & File Size of DWFWHIP! and DWF allow binary DWF files to be between 16 and 32 bits of precision. The AutoCAD Internet Utilities ObjectARX application features a variable precision selector that allows you to select the desired precision. For common drawings of CAD parts and basic AEC drawings, using 16-bit precision gives you 40% smaller DWF files! Before, with 32-bit DWF you were often getting 5-to-1 compression ratios of DWG-to-DWF. With 16-bit, often you can get as much as 8-to-1. Although they are less accurate, for sample drawings like HVAC.DWG, FILTER.DWG, and so on, there is little visual difference at 16-bit. One can see it, but for the untrained eye, it is hard to tell. Drawings of more complexity and fine details, like PLAN.DWG, RICHMOND.DWG, or MARINALL.DWG, and so on, would have accuracy problems if done at 16-bit. With the precision selector (low, medium, or high) you can get the level of precision you want. If 16-bit is not precise enough for you, you can use 20-bit precision. Using 20-bit precision ends up being 16 times more precise but only about a 20% larger file than a 16-bit file (and still about 30% smaller than a full 32-bit file). DWG Named Views in DWFAny named views that are present in the DWG file (when the DWF file is generated) get recorded in the DWF file. For convenience, if the named view INITIAL is not already specified in the DWG, this named view is automatically placed in the DWF file. The INITIAL view for the DWF matches the view of the DWG when the DWFOut command was issued. Named views of DWF files are available through a right click menu in WHIP!. Named views can also be used in DWF file references in HTML files. DWG Layers in DWF
When the DWFOut command is issued, the name of the current DWG file is written to the DWF file. This allows the drag and drop capability of WHIP! to grab the original DWG file when the DWF file is dragged and dropped. If a DWFOut command is issued before a drawing is ever saved, the file name Drawing.dwg will be present in the DWF. Furthermore if a DWG file is renamed after DWFOut has been issued, the DWG name inside the DWF file is not updated. Only the name of the DWG file is placed in the DWF file, not the path. This is why DWG files must reside in the same directory as their DWF counterparts for drag and drop to work. On the other hand, this strategy allows DWG/DWF files to be used locally and then moved to internet servers for public access. DWG file names embedded in a DWF file are case sensitive. This has created confusion for users who generate DWF files on Windows NT and then move those files (both DWG and DWF) to Unix-based servers. Consider the following scenario provided by a user.
AD01850T.dwg or AD01850T.dwfThis is the name that was stamped inside the DWF file. The next thing we did was ftp all of our files up to a Unix box. An extremely common thing to do when you ftp is to convert everything to lowercase. So after we pushed the files to our Unix server, our file name was this: ad01850t.dwg or ad01850t.dwfThis meant that when we initiated a drag and drop on the server, WHIP! looked inside the DWF file, pulled out the original file name of the DWG (AD01850T.dwg), looked in the same directory for it, and couldn't find it because the DWG file name was converted to lowercase (ad01850t.dwg). Simply put, Unix is case sensitive, NT is not. When you choose the About WHIP!... command from the right click menu in WHIP!, WHIP! displays information about the DWF file. One of the pieces of information is description. Prior to release 3, the description has always defaulted to <none>. The DWFOut.ARX ObjectARX application now uses the contents of the AutoCAD *USERS1 (User String 1) variable as the description. Although this variable is not saved with the drawing, it can be set prior to issuing a DWFOut command so that the desired description will appear in the DWF file: setvar *USERS1 This is the floor plan of my house.The *USERS1 variable was selected because it is long enough to contain a meaningful description. Other variables were considered, for example, PROJECTNAME which is saved with the drawing; however, setting these variables to contain the description led to adverse side-effects or the variables' maximum lengths were too short. The AutoCAD *USERS2 (User String 2) variable can be used to define what one unit in your drawing refers to as in: setvar *USERS2 feetYou can use *USERS2 to specify feet, miles, centimeters, or whatever units are implicit in your AutoCAD drawing. This information will then be recorded in your DWF file and visible as part of the Location display from the WHIP! right click menu. DWG Fonts in DWF When a DWG contains text written using a traditional AutoCAD SHX font, AutoCAD places geometry, for example, lines, in the DWF file to mimic the outlines of the characters represented by the font. As a result, users who use WHIP! to view the resulting DWF file do not need to have SHX fonts on their systems. When a DWG contains text written using a Windows TrueType font, AutoCAD records the text string and the font (for example, Arial) used in the DWF file. The primary advantage is that the DWF file is smaller. A second advantage is that the text rendering is more pristine since the system is used to draw the characters. The disadvantage is that users who view the DWF file must have the font on their systems. When users do not have the necessary font, jibberish appears which has been described in the newsgroups as "goofy text." Goofy text can also result when a low or medium precision DWF file is created from a paper space layout. For paper space, use high precision. Paper Space versus Model SpaceAutoCAD Release 13 and AutoCAD Release 14 (as shipped) did not output DWF files from paper space. Instead, the DWFOut ObjectARX application for those releases focussed on model space. When a DWFOut command was issued from a model space viewport, the application would dump all of the geometry in the DWG file (even vectors outside of the visible area of the viewport) to the DWF file. Technically what was happening was that all of the geometry contained in the AutoCAD display list was written to the DWF file. The new DWFOut ObjectARX application (included in aiu31.exe) enables DWF files to be created from paper space viewports. In an attempt to mimic the behavior of generating DWF files from model space, the application writes out the geometry for paper space viewports where those viewports are not currently visible. Although this approach makes the treatment of model space and paper space consistent, the side effect is that the application can appear to modify the DWG but actually does not. In other words, to be able to dump the geometry in viewports that are totally off of the screen, the application moves the current view so that the graphics system thinks that all viewports are visible. As one would expect, it restores the viewport when it is done; however, the changing and restoring of the offscreen viewports toggles the bit that indicates that the DWG has been modified. Thus, if you read in a DWG, view as paper space, and issue a DWFOut command, when you attempt to exit, AutoCAD will ask you if you wish to save your changes. You can chose to save or not save. It does not matter. A second issue with this strategy is that making the viewports visible requires a REGEN. For very large DWG files, this can be time consuming. If you would like DWFOut.ARX to ignore invisible paper space viewports and simply not write the geometry for those viewports to the DWF file, you can set the AutoCAD variable REGENMODE to 0. By default, REGENMODE is set to 1. You should only set REGENMODE to 0 if the REGEN takes too long. Converting All DWGs in a Directory to DWF FilesTo generate DWF files for all of the DWG files in a directory, you would run a Lisp routine that:
To use mapdir.lsp, AutoCAD must have a working directory that contains DWG files. The easiest way to accomplish this is to modify the "Start In" property of the icon that launches AutoCAD to point to the directory where the DWG files are located, for example c:\Program Files\AutoCAD R14\Sample. Return to Top
There are two basic ways to embed URLs in drawings. URLs can be attached to specified objects (that is, geometry) or attached to a specified area of a drawing. Regardless of whether URLs are attached by objects or by area, you can select geometry first and then attach the URL or issue the AttachURL command and then select the geometry. So there are four possible combinations. All four combinations are described later in this section.
The area mechanism is very effective for providing URLs in spots of a drawing where no geometry is present. AutoCAD Release 14 stores embedded URLs in the DWG file. Each time you save a DWF file, AutoCAD Release 14 copies the URLs from your DWG to the DWF file. Keeping the URLs in the DWG allows you to update your drawings without losing your links. Attaching a URL by objects with No Geometry SelectedTo attatch a URL with no geometry selected:
When users view the file across the web and select the URL, they will be linked to the associated web site. Attaching a URL by objects with Geometry Already SelectedTo attach a URL by objects with geometry already selected:
Attaching URLs by objects works equivalently whether geometry is selected before or after the AttachURL command is issued. Attaching a URL by area with No Geometry SelectedTo attach a URL by area with no geometry selected:
Attaching a URL by area with no geometry previously selected provides you with an opportunity to select the area using the mouse. A rectangle is created to match the area you selected with the mouse. The rectangle is placed on the URLLAYER layer. The URL is associated with the new rectangle. Attaching a URL by area with Geometry Already SelectedTo attach a URL by area with geometry already selected:
Attaching a URL by area with geometry already selected instructs the ObjectARX application to generate the area for you by computing the bounding box of the selected geometry. So unlike the previous case where no geometry had been selected and you circumscribed the area using the mouse, the ObjectARX application can determine the area based on the selected geometry. The ObjectARX application then creates a rectangle to match the computed area, places the rectangle on the URLLAYER layer, and associates the URL with the rectangle. Creating DWF Files with URLs Using LispThe internet lisp functions require that the DWFOut.ARX application is loaded to operate. In lisp, to check if the DWFOut.ARX application is loaded, use the following code: (if (/= (type geturl) 'EXRXSUBR) Two handy functions when working with URLs and lisp are seturl and geturl. (SETURL ename "URL string")The SETURL function expects two variables: the entity name and the URL string. Example: (seturl (car (entsel)) "http:/www.autodesk.com")This example prompts the user to select an object. Once the object is selected, the URL string is attached to that object. The counterpart to seturl is geturl. (GETURL ename)The GETURL function expects one variable -- the entity name. GETURL returns the URL string from an entity. If no URL string is found, it returns nil. Example: (geturl (car (entsel)))This example prompts the user to select an object. Once the object is selected, the URL string is displayed back to the user. If there is no URL string associated with the selected object, nothing happens. Example: Creating DWF Files Using Lisp
Creating DWF files using Lisp
is best illustrated by an example our QA legion uses to test
WHIP! and DWF. The file cdwf.lsp is provided
as a sample available at:
URLs are detached using the DetachURL command. You can select geometry and then issue the DetachURL command, or issue the command and then select the geometry. There are two types of URL removal that are automatically handled by the ObjectARX application:
To view URLs in a drawing:
An alternative method is to issue the SelectURL command to select all of the objects that have URLs associated with them, and then issue the ListURL command. Attempts to select geometry items without URLs and use ListURL results in the standard ObjectARX message: N items filtered out. Return to Top
Selecting Objects and Areas with URLs Attached You can select all objects and areas that have URLs attached. AutoCAD puts all objects and areas that have URLs attached into the current selection set so you can edit them. To select objects and areas with URLs attached:
Using Lisp to Access URL Information Accessing URL information in a DWG using Lisp is best illustrated by two lisp functions:
ftp://ftp.autodesk.com/pub/whip/readme/allurls.lsp. Return to Top
Uninstalling the AutoCAD Internet Utilities
The installer for the AutoCAD Internet Utilities does not feature an uninstaller.
The installer does not write any entries to the registry.
If for some reason you are having problems with the AutoCAD
Internet Utilities, you can easily revert back to the as-shipped Release 14
functionality. To do so, simply replace the following files with the
originals from the Release 14 CD: These files are all located in the directory where AutoCAD is installed. |
Download WHIP! |
Product Overview |
What's New |
Using WHIP! |
Developer Zone |
Redistributing WHIP! |
WHIP! Gallery
Home |
Products |
Tech Assist |
Autodesk |
Prof Net |
Search |
Sitemap |
Purchase
© Copyright 1999 Autodesk, Inc. All rights reserved.
Reproduction or copying of images is prohibited.
Autodesk Privacy Policy