CAD PANACEA HAS MOVED TO http://cadpanacea.com
03 November 2008
Knowledge Base question...          
Here is a new KB article that appeared today.



I just don't understand how you are going to select the Move option using your arrow keys if you can't see the menu. The solution of course is to press "M" on the keyboard after pressing ALT+Spacebar.

Labels: , , ,


PermaLink       Posted 11/03/2008 07:04:00 PM      Comments (0)
21 October 2008
Saving your drawing          
One of the most misunderstood commands in AutoCAD is the SAVE command. Note that SAVE, QSAVE, and SAVEAS all do different things.


  • SAVEAS saves the current drawing to a new file name. Example: If you are working in "A.DWG" and you run the SAVEAS command and specify "B.DWG", then "B.DWG" is created and is now the current drawing in the editor.

  • QSAVE simply saves the current drawing. If the current drawing is unnamed (not yet saved) or it is read-only, then QSAVE behaves like the SAVEAS command and allows you to specify a file name and location.

  • SAVE writes the contents of the editor to disk. It is like SAVEAS in that you get to specify the file name and location, but the currently loaded drawing remains unsaved and unchanged, even though DBMOD is reset to zero in the current drawing. Using the above example, if you are working in "A.DWG" and you run the SAVE command, and specify "B.DWG", then "B.DWG" is created from the contents of the editor, but "A.DWG" remains loaded, unchanged, and unsaved.

    The exception to this rule is that when the SAVE command is executed in an unnamed drawing, it behaves like the SAVEAS command and names the current drawing.


To confuse things even more, the pull-down menu entry titled SAVE, actually executes the QSAVE command. The SAVE command is only available at the command prompt.

Labels: , ,


PermaLink       Posted 10/21/2008 06:22:00 AM      Comments (0)
20 August 2008
Exploring the autolisp SSGET function - part 2          

Ok, getting back to the last (ssget) call in part 1...

(ssget "_W" 
(list 5.0 5.0)(list 8.0 8.0)
'((0 . "CIRCLE")(-4 . "<")(40 . 1.0))
)

The "_W" is the window selection method. Then we are passing it two points (5,5 and 8,8). Then we are telling it to only accept circle entities. The last two pieces tell it to only accept circles whose radius (DXF code 40) is less than 1.0.

So in summary, this bit of code will search the entire database and return only circles whose radius is less than 1.0 who also lie inside a polygon defined by the corners of 5,5 and 8,8.

The -4 group code is a special code that lets you perform relational testing. There are codes for equal, not equal, less than, less than or equal, greater than, greater than or equal, and two bitwise operators.

This type of filtering works great for locating entities on a certain layer, or that have a certain color or linetype.

(ssget "_X" 
'((0 . "LINE")(8 . "TEMP"))
)

The code above will select all LINE entities on the TEMP layer.

(ssget "_X" 
'((8 . "TEMP")(62 . 3))
)

The code above will select all entity types on the TEMP layer whose color is green (3). Be careful when filtering for color, linetype and lineweight. These filters only apply if the particular property is explicitly set. In the example above, if the color of all entities on the TEMP layer is set to BYLAYER, the selection set will be empty, even if the color of layer TEMP is green (3). 


You can use wildcard matching in selection set filtering also.

(ssget "_X" 
'((0 . "DIMENSION")(3 . "DIM##"))
)

The code above will select all dimensions whose dimstyle is DIM## (where the # represents a single numeral). For example, a dimension whose dimstyle is DIM55 or DIM39 will be selected. Dimensions with a dimstyle of DIM4T, DIM777, DIMKK, or DIM are not selected. Other wildcard syntax can be found under the (wcmatch) function in the Autolisp Reference Guide.

You may have figured it out by now, but "AND" is implied when when combining multiple filters such as above. In other words, in the above example, it's going to find entities that have the type dimension AND whose dimension style is DIM##. There may be cases were you want to specify "AND", especially if you are using an "OR" also.

(ssget "X" 
'(
(-4 . "<OR")
(-4 . "<AND")
(0 . "CIRCLE")
(40 . 1.0)
(-4 . "AND<")
(-4 . "<AND")
(0 . "LINE")
(8 . "ABC")
(-4 . "AND<")
(-4 . "OR<")
)
)

The code above is straight out of the Autolisp Developer's Guide. It creates a selection set out of CIRCLE entities that have a radius of exactly 1.0 and LINE entities on the ABC layer. If you did not use the "OR" condition, then the (ssget) function would be trying to find entities that are a CIRCLE and a LINE, which is obviously impossible. Let's look at one more example.

(ssget '((0 . "POLYLINE,LWPOLYLINE")(-4 . "&")(70 . 1)))

Last, but not least... The code above uses a "bitwise AND" to filter on a bit coded DXF code. In this case, DXF code 70 on a POLYLINE and/or LWPOLYLINE. The goal here is to create a selection set of closed polylines. If DXF code 70 has the "1" bit set, this indicates a closed polyline. However, we cannot simply filter for DXF code 70 = 1, because this is a bit coded field. If LTGEN is turned on and it's a closed polyline, then DXF code 70 will equal 129, not 1. This is why you must use the "&" (Bitwise AND) special filter.

There is much more information in the Autolisp Developer's Guide on advanced selection set handling. Good luck and post some of your examples in the comments section if you want.

Labels: , ,


PermaLink       Posted 8/20/2008 08:59:00 PM      Comments (1)
Exploring the autolisp SSGET function - part 1          

If you have written routines with Autolisp, then you have probably used the (ssget) function to select entities on the screen, either automatically or by prompting the user.

(ssget) is a powerful function that can do more than you probably realize. Let's look at a simple example.

(ssget '((0 . "TEXT")))

This prompts the user for a general selection set, but only TEXT entities are added to the resulting selection set.

(ssget '((0 . "*TEXT")))

Notice the wild card that was added. This is the same as above, except now any entity type that ends in TEXT is added to the selection set. At first, this looks like a good way to select TEXT and MTEXT, and it is. However, you have to be careful because this will also select RTEXT entities, and if your code is not equipped to deal with RTEXT, it may fail.

(ssget '((0 . "MTEXT,TEXT")))

This is a better way to select MTEXT and TEXT entities. But what if you don't want to bother the user to select entities, you just want to select ALL the MTEXT and TEXT entities in the drawing?

(ssget "_X" '((0 . "MTEXT,TEXT")))

Notice the "_X" that was added. This tells the (ssget) function to evaluate every entity in the drawing and then the filtering mechanism will filter out everything except MTEXT and TEXT. Entities on frozen layers are included when using the "_X" selection method.


Let's look at some other selection methods.

(ssget "_W" (list 5.0 5.0)(list 8.0 8.0))

Above is an example that will select objects inside a window from 5,5 to 8,8.

(ssget "_CP" (list (list 5.0 5.0)(list 8.0 8.0)(list 8.0 3.0)))

The line above will select all entities inside or touching a triangle defined by the points 5,5; 8,8; and 8,3. The CP is for crossing polygon.


The power of (ssget) comes from the incredibly fast filtering that it performs. Can you imagine having to evaluate an entire database of entities and manually filter out all the circles whose radius is less than 1.0 that fall inside a particular polygon? (ssget) can do this very fast. Example below.

(ssget "_W" 
(list 5.0 5.0)(list 8.0 8.0)
'((0 . "CIRCLE")(-4 . "<")(40 . 1.0))
)

More details on this code and other examples in part 2.

Labels: , ,


PermaLink       Posted 8/20/2008 07:10:00 AM      Comments (1)
18 August 2008
S::STARTUP Function          
In the previous post about Startup Lisp Functions, the special (S::STARTUP) function was mentioned. Startup lisp code is loaded before the drawing is initialized, but you cannot call the (COMMAND) function until after the drawing is initialized. The solution is to place your (COMMAND) calls inside the (S::STARTUP) function. For example, if you want to reset the scale list and purge out regapps each time a drawing is opened, you could use something like this:
(defun-q mystartup ()
(command "._purge" "_R" "*" "_N")
(command "._-scalelistedit" "_R" "_Y" "_E")
)
(setq S::STARTUP (append S::STARTUP mystartup))

Notice that we did not directly define (S::STARTUP). Because this function can be defined in other places, it is best to append to it rather than overwrite it. Use (defun-q) to create a function defined as a list, so it can be appended. To finish the example from the previous post...

;;; acaddoc.lsp
(load "mylisp")
(load "another_lisp")
(load "\\\\server\\share\\a_lisp_and_specify_the_path")
(setvar "blipmode" 0)
(setvar "highlight" 1)
(defun-q mystartup ()
(command "._purge" "_R" "*" "_N")
(command "-scalelistedit" "_R" "_Y" "_E")
)
(setq S::STARTUP (append S::STARTUP mystartup))
;;; end acaddoc.lsp

Labels: , ,


PermaLink       Posted 8/18/2008 08:10:00 PM      Comments (4)
11 August 2008
Startup Lisp Functions          

If you have lisp routines that you want to make available in each drawing session, forget the "Startup Suite" and load them using the "acaddoc.lsp" file. "acaddoc.lsp" is not included with AutoCAD, you create it yourself. But it is nothing more than a plain lisp file, except that the first one found at drawing startup (just put it in your support file search path), is loaded automatically each time a drawing is opened.

Why use this approach instead of the "Startup Suite"? Ease of migration for one thing. When you upgrade from your current version of AutoCAD to the next version, simple add the path of your "acaddoc.lsp" file to the support file search path and your done. More details about this can be found here in a earlier article.

The second reason is that if you have more than one AutoCAD install to manage, using a networked copy of "acaddoc.lsp" means that you can control each machine using a single file as opposed to using the "Startup Suite" where your startup routines would have to be updated one machine at a time.

Remember that the file "acad.lsp" can contain startup code also, but "acad.lsp" is only loaded once per session of AutoCAD (assuming that the system variable ACADLSPASDOC is set to it's default value of zero). Each drawing has it's own lisp environment so it's necessary to load your startup lisp routines using "acaddoc.lsp" so that they will be loaded for each drawing.

Since "acaddoc.lsp" is like any other lisp file, it can contain functions and/or lisp code itself. Be careful when including lisp code because the (command) function should not be called until after AutoCAD initializes. You can do this safely by using the (s::startup) function. More on that next time.

Here is a sample "acaddoc.lsp" file.

;;; acaddoc.lsp
(load "mylisp")
(load "another_lisp")
(load "\\\\server\\share\\a_lisp_and_specify_the_path")
(setvar "blipmode" 0)
(setvar "highlight" 1)
;;; end acaddoc.lsp

Labels: , ,


PermaLink       Posted 8/11/2008 12:59:00 PM      Comments (1)
13 July 2008
Reading a TXT file using LISP          

Here is a simple example of how to read a TXT file into lisp and then do something with the contents. In this example, the TXT file contains coordinates, and the code will draw either points or lines.

One thing to keep in mind. Most times when you open a file for read or write, you should open the file, perform the entire operation, then close the file. Keep the code to a minimum while the file is open. This way if you run into an unhandled error, the file isn't stuck open, and in the case of shared files, you are not locking the file for an extended amount if time.

Here is a sample of the TXT file we are reading with the code. It contains X and Y values, separated by commas.

3121284.38296466,882181.92380207
3121277.99413417,882267.69275572
3121275.35443066,882375.23306138
3121272.51513517,882482.87407333
3121262.35874024,882580.84966059
3121233.10972356,883133.60346681
3121224.47339393,883240.46739907

Here is the code. Keep in mind that this code was left in a simple form to help show the steps involved. It is not optimized and there is no error checking and/or restoring of changed sysvars. These are topics for a different tutorial.

 

(defun c:foo ( / fn fp lst l)
;; Prompt the user to select a .TXT file.
(setq fn (getfiled "Select ASCII file" "" "txt" 4))

;; Prompt the user for what type of entity to draw
(initget "L P")
(setq e (getkword "\nWhat type of entity [Line/] "))

;; Open the file and create an empty list
(setq fp (open fn "r") lst '())

;; Iterate the file, writing each line to
;; the list

(while (setq l (read-line fp))
(setq lst (cons l lst))
)

;; Close the file.
(close fp)

;; Reverse the list
(setq lst (reverse lst))

;; At this point, the data is stored in
;; a variable and the file is closed.

;; Turn off OSMODE

(setvar "osmode" 0)

;; Draw the requested entity type
(cond ((eq e "L")
;; iterate the list and create lines
(command "._line")
(foreach item lst
(command item)
)
(command "")
)
         ;; --or-- 
	(t	 
;; Set a couple of variables
(setvar "pdmode" 34)
(setvar "pdsize" -1.0)

;; Iterate the list and draw a point
;; entity at each coordinate

(foreach item lst
(command "._point" item)
)
)
)

;; Close quietly
(princ)

)

Labels: , ,


PermaLink       Posted 7/13/2008 07:24:00 PM      Comments (0)
03 July 2008
Quick access to layer states manager          

Starting with AutoCAD 2008, you now have direct access to the Layer States Manager, without opening the LAYER dialog first.

In AutoCAD 2008, click the button on the far right of the LAYERS toolbar.

2008lsm

In AutoCAD 2009, click the button shown below:

2009lsm

Once you get the Layer States Manager dialog open, don't forget to click the lsm4 button to expand the dialog and reveal more options.

Labels: , , ,


PermaLink       Posted 7/03/2008 06:05:00 AM      Comments (0)
07 May 2008
AutoCAD 2009 vs. AutoCAD LT 2009          

I frequently see the question "What is the difference between AutoCAD and AutoCAD LT?" Autodesk provides a comparison matrix that highlights some of the differences. (That particular document compares the 2008 versions).

But there really doesn't seem to be a comprehensive comparison of what the actual differences are. I imagine many new LT users figure out a command is missing when they go to use a familiar command and it tells them...

Command: XCLIP

Unknown Command "XCLIP". Press F1 for HELP.

Below I have listed a quick summary of major differences, a quick summary of the new features in LT, and then a list of 323 commands and 175 system variables that are available in AutoCAD, but not available in AutoCAD LT 2009.

 

General list of what is missing in LT...

Here is a summary of the major features that are not included in LT 2009.

  • Sheet Set Manager
  • Network licensing
  • CAD standards management
  • Most 3D tools and commands
  • Express tools
  • Action recorder
  • Support for Autolisp, VBA, .NET and other programming languages.

New for LT 2009...

Besides the normal UI upgrade to match AutoCAD, the following previously unavailable features have been added to LT 2009.

  • Image referencing
  • Non-rectangular viewports
  • Truecolor
  • Fields
  • 64-bit support

List of unavailable commands in LT 2009

Below is a list of 323 commands that are available in AutoCAD 2009, but not available in AutoCAD LT 2009.

*SCROLL
-3DCONFIG
-ACTSTOP
-ACTUSERMESSAGE
-ARCHIVE
-DWFADJUST
-EATTEXT
-INTERFERE
-MLEDIT
-OPENSHEETSET
-PARTIALLOAD
-PARTIALOPEN
-PUBLISH
-REFEDIT
-SHADEMODE
-VBALOAD
-VBARUN
-VISUALSTYLES
..ACADSTATUS
3D
3DALIGN
3DARRAY
3DCLIP
3DCONFIG
3DCORBIT
3DDISTANCE
3DDWF
3DDWFPUBLISH
3DFACE
3DFLY
3DFORBIT
3DMESH
3DORBIT
3DORBITCTR
3DRENDER
3DROTATE
3DSIN
3DSOUT
3DSWIVEL
3DWALK
ACISIN
ADCCUSTOMNAVIGATE
ACTRECORD
ACTSTOP
ACTUSERINPUT
ACTUSERMESSAGE
AI_BOX
AI_CIRCTAN
AI_CONE
AI_CUSTOM_SAFE
AI_DIM_TEXTABOVE
AI_DIM_TEXTCENTER
AI_DIM_TEXTHOME
AI_DISH
AI_DOME
AI_FMS
AI_INVOKENFW
AI_MOLC
AI_PRODUCT_SUPPORT
AI_PRODUCT_SUPPORT_SAFE
AI_PSPACE
AI_PYRAMID
AI_SELALL
AI_SPHERE
AI_TORUS
AI_TRAINING_SAFE
AI_WEDGE
ALIASEDIT
ALIGN
ALIGNSPACE
ALLPLAY
AMECONVERT
ANIPATH
APPLOAD
ARCHIVE
ARCTEXT
ARX
ASSIST
ASSISTCLOSE
ATTIN
ATTOUT
ATTREDEF
ATTSYNC
BACKGROUND
BATTMAN
BCOUNT
BEXTEND
BLOCK?
BLOCKREPLACE
BLOCKTOXREF
BORROWLICENSE
BOX
BREAKLINE
BREP
BROWSER2
BSCALE
BTRIM
BURST
CAMERA
CDORDER
CHECKSTANDARDS
CHURLS
CLIPIT
COMPILE
CONE
CONVERTOLDLIGHTS
CONVERTOLDMATERIALS
CONVTOSOLID
CONVTOSURFACE
COPYM
CYLINDER
DATAEXTRACTION
'DBCCLOSE
'DBCONNECT
DBLIST
'DDGRIPS
'DDSELECT
DIMEX
DIMIM
DIMREASSOC
DISTANTLIGHT
DVIEW
DXBIN
EATTEDIT
EATTEXT
EATTEXTEDIT
EATTEXTUPDATE
EDGE
EDGESURF
EDITTIME
EDITSHOT
EXOFFSET
EXPLAN
EXPRESSMENU
EXPRESSTOOLS
EXTRIM
EXTRUDE
FILTERS
FINISH
FLATSHOT
FLATTEN
FOG
FREESPOT
FREEWEB
FS
FSMODE
GATTE
GETSEL
GIFIN
GRADIENT
HELIX
HYPERLINKOPEN
IMAGEAPP
IMAGEEDIT
IMPRESSION
IMPRINT
INTERFERE
JOGSECTION
LAYERP
LAYERPMODE
LAYOUTMERGE
LAYTRANS
LAYVPMODE
LIGHT
LIGHTLIST
LIGHTLISTCLOSE
LIVESECTION
LOAD
LOFT
LSP
LSPSURF
MATERIALASSIGN
MATERIALATTACH
MATERIALMAP
MATERIALS
MATERIALSCLOSE
MENU
MINSERT
MIRROR3D
MKLTYPE
MKSHAPE
MLEDIT
MLINE
MLSTYLE
MOCORO
MOVEBAK
MPEDIT
MSTRETCH
MVSETUP
NAVSMOTION
NAVSMOTIONCLOSE
NAVVCUBE
NCOPY
NETLOAD
NEWSHEETSET
NEWSHOT
NEWVIEW
OLDMTPROP
OLELINKS
OPENSHEETSET
OVERKILL
PAINTPROP
PARTIALOAD
PARTIALOPEN
PFACE
PLANESURF
PLJOIN
PLT2DWG
POINTLIGHT
POLYSOLID
PRESSPULL
PROPULATE
PSBSCALE
PSELECT
PSFILL
PSTSCALE
PYRAMID
QDIM
QLATTACH
QLATTACHSET
QLDETACHSET
QQUIT
REDEFINE
REDIR
REFCLOSE
REFEDIT
REFSET
RENDER
RENDERCROP
RENDERENVIRONMENT
RENDEREXPOSURE
RENDERUNLOAD
RENDERUPDATE
RENDERWIN
RENDSCR
REPLAY
REPURLS
RETURNLICENSE
REVERT
REVOLVE
REVSURF
ROTATE3D
RPREF
RPREFCLOSE
RTEDIT
RTEXT
RTUCS
RULESURF
SAVEALL
SAVEIMG
SECTION
SECTIONPLANE
SEQUENCEPLAY
SETIDROPHANDLER
SHAPE
SHEETSET
SHEETSETHIDE
SHELL
SHOWURLS
SHP2BLK
SKETCH
SLICE
SOLDRAW
SOLIDEDIT
SOLPROF
SOLVIEW
SPHERE
SPOTLIGHT
SSX
STANDARDS
STATS
'STATUS
STLOUT
SUNPROPERTIES
SUNPROPERTIESCLOSE
SUPERHATCH
SWEEP
SYSVDLG
TABSURF
TARGETPOINT
TBCONFIG
TCASE
TCIRCLE
TCOUNT
TEXTFIT
TEXTMASK
TEXTUNMASK
TFRAMES
THICKEN
TJUST
TORIENT
TORUS
TRACE
'TREESTAT
TSCALE
TUTCLEAR
TUTDEMO
TXT2MTXT
UNDEFINE
VBAIDE
VBALOAD
VBAMAN
VBARUN
VBASTMT
VIEWPLAY
VISUALSTYLES
VISUALSTYLESCLOSE
VLIDE
VLISP
VPSCALE
VPSYNC
VSCURRENT
VSSAVE
WALKFLYSETTINGS
WEBLIGHT
WEDGE
XCLIP
XDATA
XDLIST
XEDGES
XLIST
XOPEN
XREFCLIP

List of unavailable system variables in AutoCAD LT 2009

Below is a list of 175 system variables that are available in AutoCAD 2009, but not available in AutoCAD LT 2009.

*_TOOLPALETTEPATH
_LINFO
_SERVER
3DCONVERSIONMODE
3DDWFPREC
ACADPREFIX
ACADVER
ACIS15
ACISOUTVER
APSTATE
ASSISTSTATE
AXISMODE
AXISUNIT
BINDTYPE
CAMERADISPLAY
CAMERAHEIGHT
CMATERIAL
CMLJUST
CMLSCALE
CMLSTYLE
COMPASS
CPROFILE
CPUTICKS
CSHADOW
CURRENTPROFILE
DBCSTATE
DBGLISTALL
DEFAULTLIGHTING
DEFAULTLIGHTINGTYPE
DEMANDLOAD
DRAGVS
DWGWRITE
DXEVAL
ENTERPRISEMENU
FACETRATIO
FFLIMIT
FLATLAND
FULLOPEN
GFANG
GFCLR1
GFCLR2
GFCLRLUM
GFCLRSTATE
GFNAME
GFSHIFT
GTAUTO
GTDEFAULT
GTLOCATION
HPASSOC
IMPLIEDFACE
INTERFERECOLOR
INTERFEREOBJVS
INTERFEREVPVS
LASTPROMPT
LAYOUTREGENCTL
LAZYLOAD
LEGACYCTRLPICK
LIGHTGLYPHDISPLAY
LIGHTINGUNITS
LIGHTLISTSTATE
LIGHTSINBLOCKS
LINEARBRIGHTNESS
LINEARCONTRAST
LISPINIT
LOFTANG1
LOFTANG2
LOFTMAG1
LOFTMAG2
LOFTNORMALS
LOFTPARAM
LOGEXPBRIGHTNESS
LOGEXPCONTRAST
LOGEXPDAYLIGHT
LOGEXPMIDTONES
LOGEXPPHYSICALSCALE
LOGINNAME
LONGFNAME
MATSTATE
MENUCTL
MENUNAME
NOMUTT
OFFSETGAPTYPE
OSNAPZ
PFACEVMAX
PLOTID
PLOTTER
PLQUIET
POPUPS
PROJECTNAME
PSOLHEIGHT
PSOLWIDTH
PSQUALITY
PSVPSCALE
PUBLISHCOLLATE
QAUCSLOCK
QUEUEDREGENMAX
RE-INIT
REFEDITNAME
RENDERPREFSSTATE
RENDERUSERLIGHTS
RIASPECT
RIBACKG
RIEDGE
RIGAMUT
RIGREY
RITHRESH
SAVEIMAGES
SCREENBOXES
SCREENMODE
SHADOWPLANELOCATION
SHOWHIST
SHPNAME
SKETCHINC
SKPOLY
SOLIDCHECK
SOLIDHIST
SPACESWITCH
SSFOUND
SSLOCATE
SSMAUTOOPEN
SSMPOLLTIME
SSMSHEETSTATUS
SSMSTATE
STANDARDSVIOLATION
STARTUPTODAY
STEPSIZE
STEPSPERSEC
SUNPROPERTIESSTATE
SUNSTATUS
SURFTAB1
SURFTAB2
SURFTYPE
SURFU
SURFV
TBCUSTOMIZE
TEMPPREFIX
TEXTOUTPUTFILEFORMAT
UCSDETECT
UCSVP
UNDOONDISK
USERS1
USERS2
USERS3
USERS4
USERS5
VSBACKGROUNDS
VSEDGECOLOR
VSEDGEJITTER
VSEDGEOVERHANG
VSEDGES
VSEDGESMOOTH
VSFACECOLORMODE
VSFACEHIGHLIGHT
VSFACEOPACITY
VSFACESTYLE
VSHALOGAP
VSHIDEPRECISION
VSINTERSECTIONCOLOR
VSINTERSECTIONEDGES
VSINTERSECTIONLTYPE
VSISOONTOP
VSLIGHTINGQUALITY
VSMATERIALMODE
VSMONOCOLOR
VSOBSCUREDCOLOR
VSOBSCUREDEDGES
VSOBSCUREDLTYPE
VSSHADOWS
VSSILHEDGES
VSSILHWIDTH
VSSTATE
WHIPTHREAD
WRITESTAT
XFADECTL
XREFNOTIFY

If you spot a mistake or would like to add something, leave a comment please. Thanks.

Labels: , , ,


PermaLink       Posted 5/07/2008 11:57:00 AM      Comments (11)
29 April 2008
Scale List Fix          

So you have installed SP1 and you know how to fix drawings with a bloated scale list. But what if you have dozens or hundreds or thousands of "infected" drawings each containing hundreds of scale list entries?

Autodesk has released a tool to fix these bloated drawings. You can select any number of drawings and batch process them.

image

You have heard about this tool, haven't you? If not, that means you are not reading Shaan Hurley's Between the Lines blog. Here is the link to the Scale List Cleanup Utility. While you are there, I suggest subscribing to this blog to keep up to date with the latest happenings at Autodesk.

Labels: , , , , , ,


PermaLink       Posted 4/29/2008 06:58:00 AM      Comments (1)
22 April 2008
API Wishlist          
Help shape the future of the API for various Autodesk products, including AutoCAD, AutoCAD Architecture, AutoCAD MEP, AutoCAD Civil 3D, AutoCAD Map 3D, Revit, and Autodesk Inventor. You have until May 1 to provide your input to Autodesk via online surveys. These API surveys were previously only available to ADN members, but they have been opened up to the public.

More details can be found on the Through the Interface blog.

Labels: , , , , ,


PermaLink       Posted 4/22/2008 06:55:00 AM      Comments (0)
01 April 2008
AutoCAD 2009 Drawing Tool Buttons          

New to 2009 is the default icon mode for the drawing tool buttons. You know what these are, the SNAP GRID ORTHO POLAR OSNAP, etc. buttons down in the status bar. They take up less room as icons, but you will need to figure out what each one does.

Out of the box, they look like this:

 Drawing Tools as Icons

If you right click on any button, you will get this menu:

Context menu for drawing tools

Uncheck the Use Icons item to restore the previous TEXT buttons, like this:

status2

Polar Tracking, Object Snap, and Object Tracking include a context menu to quickly change settings without having to open a dialog.

New to this bunch of tools is the QP, or Quick Properties button. Heidi Hewett has put together a nice article on Quick Properties.

Labels: , , ,


PermaLink       Posted 4/01/2008 05:30:00 PM      Comments (2)
19 February 2008
AutoCAD 2009 - QUICK VIEW DRAWINGS          

There are various "Drawing Tabs" add-ons for AutoCAD available, I created a quick review of some popular ones last January.

Autodesk released one themselves back in October 2006, for AutoCAD 2007. It was OK for a first effort, but not the greatest.

Now in AutoCAD 2009, you will find the "Quick View Drawings" feature. This is "drawing tabs" on steroids (no offense to current MLB players....)

Essentially, it's a button in the status bar that when you pick it, a display appears in the lower part of your drawing area that shows you a preview of each currently open drawing. As you move the mouse to hover over a drawing preview, the drawings shrink and you then get a preview of the layouts in that particular drawing. All this is done with a smooth effect. (See the animated GIF below.)

If you are hovering on a drawing file preview, you can pick it to switch to that drawing. You can also Save or Close that drawing by picking the appropriate icon. You can also right-click on the preview and choose from other options including "Close All", "Save All", and "Close other files".

If you are hovering on a layout preview, you can click to switch to that drawing and set that layout current, and there are plot and publish icons available. You can also right-click on a layout preview to get the standard layout tab context menu, including "New Layout", "Page Setup Manager", and the new command "Export Layout to Model".

Labels: , ,


PermaLink       Posted 2/19/2008 11:30:00 AM      Comments (0)
12 February 2008
AutoCAD 2009 in 2 minutes          

Well, it's that time again. Another 12 months, another version of AutoCAD, whether you are ready or not. You will find all sorts of detailed reviews at various websites. This is not meant to be a detailed review. This is simply a quick look at some of the highlights in AutoCAD 2009.

AutoCAD 2009 is going to blow you away at first, not because of any spectacular new features, but because the UI has changed in such a dramatic way. So where to start...?

First off, there is the Ribbon, copied from the latest Office versions. You might think of it as a sort of meshing of toolbars and the Dashboard (in fact the Dashboard is gone). So you are probably looking at the image below thinking "where are the pull-down menus???"... Well, hang on a minute. While you are looking at that image, notice that the Communication Center is buried in the Title Bar now, which saves a bit of space.
(Note: Image below is broken horizontally so it will fit on this page)
AutoCAD 2009 Ribbon


AutoCAD 2009 Ribbon


Ok, where are the pull-down menus? Do you see that Big Red "A" in the upper left corner? Click on that to expose the Menu Browser. This is sort of like the Windows Start Menu, except it's in the upper left hand corner. Judge for yourself, if you want the old style pull-down menus, set MENUBAR to 1. 
menubrow

Quick Properties is a mini version of the properties palette that automatically appears when you select one of more objects. It is customizable. 
qprops

Quick View Drawings is basically a version "Drawing Tabs" on steroids... Rather than just a set of tabs with drawing names, you get a preview of the drawing and a preview of the layouts in the drawing. Click on a drawing or a layout and you are taken directly there. 
qview

Quick View Layouts is similar to Quick View Drawings, except that this shows you are preview of the layouts in the current drawing. Click on one to switch to it. 
qvlayout

The Layer Properties Manager is now a floating palette. You can leave it open while working. Changes are applied immediately which sounds like a good thing, but if you are manipulating many layers at once it could slow things down - as opposed to making all your layer changes and then pressing Apply. CLASSICLAYER will open the 2008 and earlier version of the Layer Manager. 
laymgr

Regular and super-sized ToolTips are everywhere. Hover over a button in the Ribbon and a regular tooltip appears, wait a second and the larger one appears. This may be helpful for new users, but thankfully you can disable this feature. 
tooltip

Action Recorder is a tool that you can use to record drawing and editing activities, and play these back later. It does not write VBA code like the Macro Recorder in MS Office. Editing capabilities are limited. 
acrecord

There are some new 3D visualization tools such as the Steering Wheel and ViewCube. 
 
sterwhel

viewcube

By default the buttons in the status bar for things like ORTHO, SNAP, and OTRACK are now icons. You can revert back to "text" buttons if you want to. 
cmdbutt

XCLIPFRAMEs now include grips for on the fly editing and a "flip" grip to switch from a regular clip to an inverted clip.

What should have been a bug fix in 2008 is now available, and that it the ability to suppress XREF scales from the Scale List. Set HIDEXREFSCALES to 1.

That is it for now. The big change is the UI for this release.  The DWG format is unchanged (still 2007). On the programming side, nothing major has changed from 2008. VBA is still available. The VLIDE is unchanged.

Below are the new and changed commands and system variables.

***NEW COMMANDS***
ACTRECORD
ACTSTOP
-ACTSTOP
ACTUSERINPUT
ACTUSERMESSAGE
-ACTUSERMESSAGE
ALLPLAY
BACKGROUND
CLASSICLAYER
-DGNEXPORT
-DGNIMPORT
DGNLAYERS
DGNMAPPING
DWFFORMAT
EDITSHOT
EXPORTLAYOUT
HIDEPALETTES
IMPRESSION
LAYERCLOSE
NAVSMOTION
NAVSMOTIONCLOSE
NAVSWHEEL
NAVVCUBE
NEWSHOT
QVDRAWING
QVDRAWINGCLOSE
QVLAYOUT
QVLAYOUTCLOSE
RIBBON
RIBBONCLOSE
SEQUENCEPLAY
SHOWPALETTES
VIEWGO
VIEWPLAY
***CHANGED COMMANDS***
DASHBOARD
DASHBOARDCLOSE
DGNATTACH
-DGNATTACH
DGNEXPORT
DGNIMPORT
GEOPGRAPHICLOCATION
LAYER
NEWVIEW
QUICKCUI
VPLAYER
***NEW SYSTEM VARIABLES***
ACTPATH
ACTRECORDSTATE
ACTRECPATH
ACTUI
CAPTURETHUMBNAILS
DGNIMPORTMAX
DGNMAPPINGPATH
GEOLATLONGFORMAT
GEOMARKERVISIBILITY
HIDEXREFSCALES
LAYERDLGMODE
MENUBAR
MTEXTTOOLBAR
NAVSWHEELMODE
NAVSWHEELOPACITYBIG
NAVSWHEELOPACITYMINI
NAVSWHEELSIZEBIG
NAVSWHEELSIZEMINI
NAVSWHEELWALKSPEED
NAVVCUBEDISPLAY
NAVVCUBELOCATION
NAVVCUBEORIENT
NAVVCUBESIZE
NAVVCUBOPACITY
OPENPARTIAL
PREVIEWTYPE
PUBLISHHATCH
QPLOCATION
QPMODE
QVDRAWINGPIN
QVLAYOUTPIN
RIBBONSTATE
ROLLOVERTIPS
SHOWMOTIONPIN
SHOWPALETTE
STATUSBAR
THUMBSIZE
*** CHANGED SYSTEM VARIABLES***
CROSSINGAREACOLOR
GRIPCOLOR
GRIPHOT
GRIPHOVER
OSMODE
TABLETOOLBAR
WINDOWAREACOLOR

Labels: ,


PermaLink       Posted 2/12/2008 10:39:00 AM      Comments (16)
24 January 2008
Free Autolisp Resources          
If you are looking for some free Autolisp resources including tutorials and sample code, take a look in the sidebar on the right (under "Autolisp Resources").

There are 4 websites with a lot of good information.

Oh well, I'll just paste the links in this post also:

  • ABC's of Autolisp
  • Visual Lisp Developers Bible
  • Ron Autolisp
  • Afralisp.net

    ...and one more - Hot Tip Harry's latest article on Lisp Symbols.

    Labels: , , , ,


    PermaLink       Posted 1/24/2008 05:42:00 PM      Comments (0)
  • 14 December 2007
    Command vs. entmake vs. vla-add          
    If you program with autolisp, you have probably used the command function at some point, probably to construct drawing entities. There is certainly nothing wrong with that. However, if you are working on a large program that constructs a lot of drawing entities, you may have noticed that the command function runs pretty slow.


    I put together some tests to compare the (command) function to two other methods of entity creation, (entmake) and (vla-add...). The test constructs 1,999 line entities using various methods.


    I originally posted this on 13 DEC 2007, but after receiving a couple of good comments, I decided to edit this original post rather than make a separate entry. Thanks to the comments by Petri and Matt, I added a couple of new tests to the roundup.


    Test1 - Uses the (command) function with CMDECHO set to 1

    Test2 - Uses the (command) function with CMDECHO set to 0 and NOMUTT set to 1 (this basically turns the command line off...)

    Test3 - Uses the (entmake) function.

    Test4 - Uses the (vla-add...) function

    Test5 - Uses the (vla-add...) function, but moves (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object))) outside the timer, which make sense because the time to do this task should not be included. Surprisingly, it didn't make much differance at all.

    The results are shown below. The times represent the average of 5 consecutive runs.


    • Test1 - 11.7 seconds
    • Test2 - 5.50 seconds
    • Test3 - 0.44 seconds
    • Test4 - 0.94 seconds
    • Test5 - 0.90 seconds

    So (entmake) is still the fastest method, (vla-add...) takes about twice as long as entmake, and the most efficient (command) method about 12X longer on average. Removing the command line echoes from the (command) method speeds this up considerably.

    In summary, if you are only drawing few entities, you won't notice any difference by modifying your code. On the other hand, if you code is drawing hundreds of entities, you might consider a change. Keep in mind that these numbers are relative and will vary depending on the system.

    The lisp code used is shown below


    (defun date2sec ()
    (setq s (getvar "DATE"))
    (setq seconds (* 86400.0 (- s (fix s))))
    )

    (defun C:test1 ( / i timer endtimer)
    (setvar "cmdecho" 1)
    (setq i 1 timer (date2sec))
    (while (< i 2000)
    (command "._line" (list i i 0.0) (list (+ 2 i)(+ 3 i) 0.0) "")
    (setq i (1+ i))
    )
    (setq endtimer (date2sec))
    (alert (rtos (- endtimer timer) 2 8))
    )

    (defun C:test2 ( / i timer endtimer)
    (setvar "cmdecho" 0)
    (setvar "nomutt" 1)
    (setq i 1 timer (date2sec))
    (while (< i 2000)
    (command "._line" (list i i 0.0) (list (+ 2 i)(+ 3 i) 0.0) "")
    (setq i (1+ i))
    )
    (setq endtimer (date2sec))
    (alert (rtos (- endtimer timer) 2 8))
    (setvar "cmdecho" 1)
    (setvar "nomutt" 0)
    )

    (defun C:test3 ( / i timer endtimer)
    (setq i 1 timer (date2sec))
    (while (< i 2000)
    (entmake (list
    (cons 0 "LINE")
    (cons 10 (list i i 0.0))
    (cons 11 (list (+ 2 i)(+ 3 i) 0.0))
    )
    )
    (setq i (1+ i))
    )
    (setq endtimer (date2sec))
    (alert (rtos (- endtimer timer) 2 8))
    )


    (defun C:test4 ( / i timer endtimer)
    (vl-load-com)
    (setq i 1 timer (date2sec) ms
    (vla-get-modelspace
    (vla-get-ActiveDocument
    (vlax-get-acad-object))))
    (while (< i 2000)
    (vla-addline ms
    (vlax-3d-point (list i i 0.0))
    (vlax-3d-point (list (+ 2 i)(+ 3 i) 0.0))
    )
    (setq i (1+ i))
    )
    (setq endtimer (date2sec))
    (alert (rtos (- endtimer timer) 2 8))
    )

    (defun C:test5 ( / i timer endtimer)
    (vl-load-com)
    (setq ms (vla-get-modelspace
    (vla-get-ActiveDocument
    (vlax-get-acad-object)
    )
    )
    )
    (setq i 1 timer (date2sec))
    (while (< i 2000)
    (vla-addline ms
    (vlax-3d-point (list i i 0.0))
    (vlax-3d-point (list (+ 2 i)(+ 3 i) 0.0))
    )
    (setq i (1+ i))
    )
    (setq endtimer (date2sec))
    (alert (rtos (- endtimer timer) 2 8))
    )

    Labels: , , ,


    PermaLink       Posted 12/14/2007 07:10:00 AM      Comments (6)
    12 December 2007
    Selection highlighting in AutoCAD          


    Starting in AutoCAD 2006, you can specify a highlight color and opacity to your selection areas as illustrated by the green area shown in the example below.






    Below is a description of these options and how to change them.




    If you want to go through the OPTIONS dialog, open it up and switch to the Selection tab. Click on the Visual Effect Settings button. Everything you need to control is there on the right half of this dialog, shown above.

    If you want to change these options with code or a macro, here are the system variable names to do that.


    • SELECTIONAREA - turns this feature off (0) or on (1).
    • WINDOWAREACOLOR - sets the color used during a window selection (1-255)
    • CROSSINGAREACOLOR - sets the color used during a crossing window selection (1-255)
    • SELECTIONAREAOPACITY - determines the amount of transparency used by the selection area colors (0-100)





    Here is an example of setting these variables using lisp


    (setvar "selectionarea" 1)
    (setvar "windowareacolor" 30)
    (setvar "crossingareacolor" 51)
    (setvar "selectionareaopacity" 30)

    Labels: , , , ,


    PermaLink       Posted 12/12/2007 12:36:00 PM      Comments (0)
    06 December 2007
    AutoCAD Polyline Types          
    Confused about the various polyline types that you see in AutoCAD?

    From the end user perspective there are 3 polyline types listed in the PROPERTIES command, even though there are only two "entity" types.

    • polyline - this is an LWPOLYLINE entity, always 2D.
    • 2d polyline - this is a POLYLINE entity, also 2D.
    • 3d polyline - this is a POLYLINE entity, usually 3D, with each vertex at a different elevation. It is possible to have a "3d polyline" and have each vertex at the same elevation.

    If you use the LIST command on any polyline, you will only see the
    entity names (POLYLINE or LWPOLYLINE).

    POLYLINE entities are the original type. LWPOLYLINE entities were introduced in R14.

    If PLINETYPE = 0 (zero), then the PLINE command will create POLYLINE entities.
    If PLINETYPE = 1 or 2, then the PLINE command will create LWPOLYLINE entities.

    To create 3d polylines, use the 3DPOLY command.

    To convert between POLYLINE and LWPOLYLINE entities, use the CONVERTPOLY command.

    If you are using Autolisp, you only need to worry about the entity names (POLYLINE and LWPOLYLINE.) A "3d polyline" is simply a POLYLINE entity with a special flag set. When this flag is set, each vertex subentity can be set to a different elevation.

    Depending on what else you may be doing, you may also see
    names like:
    Acad3DPolyline, or AcDb3dPolyline
    AcadPolyline, or AcDb2dPolyline
    AcadLWPolyline, or AcDbPolyline

    Labels: , ,


    PermaLink       Posted 12/06/2007 05:23:00 PM      Comments (4)
    05 December 2007
    Linetypes on 3D Polylines          
    In AutoCAD, you can assign a non-continuous linetype to a 3D polyline, but it will not display or plot.

    If you need 3D polylines, and you need a non-continuous linetype, for example to represent the flowline of a ditch - there are a couple of workarounds. Both assume that you have assigned the correct linetype to your 3D polylines.


    1. Copy all the 3D polylines in place, explode the copies and place them on a new layer. Create a "plot only" layer state that freezes the layer containing the 3D polylines and thaws the layer containing the 2D polylines. Set this layer state current before plotting.
    2. Before you get ready to plot, save the drawing. Now explode all your 3D polylines, then plot and quit without saving.

    Labels: , , , ,


    PermaLink       Posted 12/05/2007 08:13:00 PM      Comments (0)
    30 November 2007
    AU2007 Report          

    Autodesk University 2007 is over. There were a lot of good classes, and a couple that....well, I'll get to that later...


    Here were some of my favorites.


    • DEA path to Civil 3D migration - DEA presented a class on their migration from Land Desktop to Civil 3D. You can read all the blogs and websites you want, talk to all the resellers you want, but this was first hand info from a consumer on what worked and what didn't. Excellent class. Most of our assumptions were confirmed, one being the expected 5-6 days of training required for each user.
    • The Secrets of cutting plan and profile sheets in Civil 3D - Michelle Rasmussen from IMAGINiT Technologies was easily the best speaker I had last week. The content fit the time slot, and it was presented in a logical and easy to understand manner.
    • Vaulting the Civil 3D Data Chasm - Mark Evinger from Cowhey Gudmundson Leder presented a fairly technical class on why they decided on Vault over Data Shortcuts, the cost, time, and hardware needed to set up a Vault, and even shared their internal training schedule.
    • Filling the gaps in the Sheet Set Manager - If you use SSM, you probably wish it could do some things that it can't. R. Robert Bell demonstrated how to use VBA to solve some of the shortcomings of the SSM.
    • Anonymous - I did sit in on one class however that was brutal. It was advertised to users of the product, however the speaker spent the majority of the time talking about doing stuff like manually editing XML files using different 3rd party programs, and using VBA to edit files supplied by Autodesk. I do a fair amount of programming and I barely understood what was going on. About 3/4 of the 400+ user class left in the first 45 minutes.

    That last example is an exception to the rule of course.


    Outside of class...


    • The exhibit hall was huge. Hundreds of booths with a variety of products exhibited.
    • I met several people, some for the first time - others I have met before. Allow me to drop some names....


    Other notes...


    I even ran into Shaan (camera in hand of course) out on the strip Wednesday night. Does he ever sleep?

    During my 3:00-4:30 class on Thursday, my wife was out shopping and ran into Pete Rose over at a sports shop in Caesars Palace. You just never know who you might run into in Vegas I suppose....

    Labels: , , , , , ,


    PermaLink       Posted 11/30/2007 02:20:00 PM      Comments (0)