Designates a particular view of the drawing for display at startup of AutoCAD. Designates support fold ers other than the current folder. Support files include text fonts, menus, AutoLISP files, linetypes, and hatch patterns. The maximum number of folders you can specify in the path is 15. Each folder name is delimited by semicolons. Above splines are polylines created with autolisp routine which converts spline to polyline, so you can see how splines should actually be drawn. First spline is created with fit points: 2,2 4,4 6,2 Then copied and applied weight of 2 on central control point. Then copied again and applied weight of 0.5 on central control point.
The AutoLISP language provides several functions for handling errors.
The proper handling of errors allows your program to exit gracefully and with an expected result. Using the error handling functions of the AutoLISP programming language allows you to do the following:
- Provide information to users when an error occurs during the execution of a program.
- Restore the AutoCAD environment to a known state.
- Intercept errors and continue program execution.
The following functions are useful to handle errors encountered by your programs:
- *error* - A user-definable error-handling function.
- *pop-error-mode* - Error-handling function that ends the previous call to *push-error-using-command* or *push-error-using-stack*.
- *push-error-using-command* - Error-handling function that indicates the use of the command function within a custom *error* handler.
- *push-error-using-stack* - Error-handling function that indicates the use of variables from the AutoLISP stack within a custom *error* handler.
- vl-catch-all-apply - Passes a list of arguments to a specified function and traps any exceptions.
If your program contains more than one error in the same expression, you cannot depend on the order in which AutoLISP detects the errors. For example, the inters function requires several arguments, each of which must be either a 2D or 3D point list. A call to inters like the following:
Two errors are encountered: too few arguments and invalid argument type. You will receive either of the following error messages:
Your program should be designed to handle either error.
Note: AutoLISP evaluates all arguments before checking the argument types. In earlier releases of AutoCAD, AutoLISP evaluated and checked the type of each argument sequentially. To see the difference, look at the following code examples:
Observe how an expression using the inters function is evaluated in AutoCAD:
Command: (inters (foo) (bar) (baz))
'Evaluating foo'
'Evaluating bar'
'Evaluating baz'
; *** ERROR: too few arguments
Each argument was evaluated successfully before AutoLISP passed the results to inters and discovered that too few arguments were specified.
In AutoCAD R14 and earlier, the same expression evaluated as follows:
Command: (inters (foo) (bar) (baz))
'Evaluating foo'
'Evaluating bar' error: bad argument type
AutoLISP evaluated (foo), then passed the result to inters. Since the result was a valid 2D point list, AutoLISP proceeds to evaluate (bar), where it determines that the evaluated result is a string, an invalid argument type for inters.
Related Concepts
Hey peeps, just stretching out my lisp skills, they're really rusty.
What I'm trying to do a lisp that will prompt for a text height and a dimscale.
Then insert a text style
Change the default text height to the prompted text height times the dimscale.
Lastly create a dimstyle with a title that references the text height and the company abbreviation.
One of my known problems is trying to string text with a real value to name the dimstyle.
I took the list of variables (minus a few) from a dimstyle I set up and turned that into set vars, this is huge! Is there a way I can clean this up a bit?
Thanks in advance!
![Erro Dimdsep Autolisp Erro Dimdsep Autolisp](http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/images/PTDCPM/Gator-All/English/plt_externalreferences.png)
(defun c:test(/ th cth ds dsn)
(setq th (getreal 'nSheet Text Height [(1/8),(3/32),.1]: ')) ;Prompt for Text Height
(setq ds (getint 'nDimscale Factor: ')) ;Prompt for Dimscale
(setq dsn (strcat 'CEI-' th)) ;Creates Dimstyle Name
(setq cth (* th ds)) ;Multiplies the Sheet Text Height by the Dimscale
(command '-style' 'ROMANS' 'romans.shx' '0' '.85' '0' 'n' 'n' 'n' ) ;Creates ROMANS text style
(command 'textsize' th ') ;Adds the Sheet Text Height
(command 'textsize' cth ') ;Sets the Current Text Height
(SETVAR 'DIMADEC' 0) ;Angular decimal places
(SETVAR 'DIMALT' 0) ;Alternate units selected
(SETVAR 'DIMALTD' 2) ;Alternate unit decimal places
(SETVAR 'DIMALTF' 25.4000) ;Alternate unit scale factor
(SETVAR 'DIMALTRND' 0) ;Alternate units rounding value
(SETVAR 'DIMALTTD' 2) ;Alternate tolerance decimal places
(SETVAR 'DIMALTTZ' 0) ;Alternate tolerance zero suppression
(SETVAR 'DIMALTU' 2) ;Alternate units
(SETVAR 'DIMALTZ' )0 ;Alternate unit zero suppression
(SETVAR 'DIMARCSYM' 0) ;Arc length symbol
(SETVAR 'DIMASZ' 0.125) ;Arrow size
(SETVAR 'DIMATFIT' 3) ;Arrow and text fit
(SETVAR 'DIMAUNIT' 0) ;Angular unit format
(SETVAR 'DIMAZIN' 0) ;Angular zero supression
(COMMAND 'DIMBLK' '.') ;Arrow block name
(COMMAND 'DIMBLK1' '.') ;First arrow block name
(COMMAND 'DIMBLK2' '.') ;Second arrow block name
(SETVAR 'DIMCEN' 0.0625) ;Center mark size
(SETVAR 'DIMCLRD' 1) ;Dimension line and leader color
(SETVAR 'DIMCLRE' 1) ;Extension line color
(SETVAR 'DIMCLRT' 2) ;Dimension text color
(SETVAR 'DIMDEC' 4) ;Decimal places
(SETVAR 'DIMDLE' 0) ;Dimension line extension
(SETVAR 'DIMDLI' 0.0625) ;Dimension line spacing
(SETVAR 'DIMDSEP' '.') ;Decimal separator
(SETVAR 'DIMEXE' 0.0625) ;Extension above dimension line
(SETVAR 'DIMEXO' 0.0625) ;Extension line origin offset
(SETVAR 'DIMFRAC' 1) ;Fraction format
(SETVAR 'DIMFXL' 1) ;Fixed Extension Line
(SETVAR 'DIMFXLON' 0) ;Enable Fixed Extension Line
(SETVAR 'DIMGAP' 0.0625) ;Gap from dimension line to text
(SETVAR 'DIMJOGANG' 45) ;Radius dimension jog angle
(SETVAR 'DIMJUST' 0) ;Justification of text on dimension line
(COMMAND 'DIMLDRBLK' '.') ;Leader block name
(SETVAR 'DIMLFAC' 1.0000) ;Linear unit scale factor
(SETVAR 'DIMLIM' 0) ;Generate dimension limits
(SETVAR 'DIMLTEX1' 'ByLayer') ;Linetype extension line 1
(SETVAR 'DIMLTEX2' 'ByLayer') ;Linetype extension line 2
(SETVAR 'DIMLTYPE' 'ByLayer') ;Dimension linetype
(SETVAR 'LUNIT' 4) ;Linear unit format
(SETVAR 'DIMLWD' '-1') ;Dimension line and leader lineweight
(SETVAR 'DIMLWE' '-1') ;Extension line lineweight
(SETVAR 'DIMPOST' ') ;Prefix and suffix for dimension text
(SETVAR 'DIMRND' 0) ;Rounding value
(SETVAR 'DIMSAH' 0) ;Separate arrow blocks
(SETVAR 'DIMSCALE' ds) ;Overall scale factor
(SETVAR 'DIMSD1' 0) ;Suppress the first dimension line
(SETVAR 'DIMSD2' 0) ;Suppress the second dimension line
(SETVAR 'DIMSE1' 0) ;Suppress the first extension line
(SETVAR 'DIMSE2' 0) ;Suppress the second extension line
(SETVAR 'DIMSOXD' 0) ;Suppress outside dimension lines
(SETVAR 'DIMTAD' 1) ;Place text above the dimension line
(SETVAR 'DIMTDEC' 4) ;Tolerance decimal places
(SETVAR 'DIMTFAC' 1.0000) ;Tolerance text height scaling factor
(SETVAR 'DIMTFILL' 0) ;Text background enabled
(SETVAR 'DIMTFILLCLR' 0) ;Text background color
(SETVAR 'DIMTIH' 0) ;Text inside extensions is horizontal
(SETVAR 'DIMTIX' 0) ;Place text inside extensions
(SETVAR 'DIMTM' 0) ;Minus tolerance
(SETVAR 'DIMTMOVE' 1) ;Text movement
(SETVAR 'DIMTOFL' 0) ;Force line inside extension lines
(SETVAR 'DIMTOH' 0) ;Text outside horizontal
(SETVAR 'DIMTOL' 0) ;Tolerance dimensioning
(SETVAR 'DIMTOLJ' 1) ;Tolerance vertical justification
(SETVAR 'DIMTP' 0) ;Plus tolerance
(SETVAR 'DIMTSZ' 0) ;Tick size
(SETVAR 'DIMTVP' 0.0000) ;Text vertical position
(SETVAR 'DIMTXSTY' 'ROMANS') ;Text style
(SETVAR 'DIMTXT' th) ;Text height
(SETVAR 'DIMTXTDIRECTION' 0) ;Dimension text direction
(SETVAR 'DIMTZIN' 0) ;Tolerance zero suppression
(SETVAR 'DIMUPT' 0) ;User positioned text
(SETVAR 'DIMZIN' 2) ;Zero suppression
(command '-dimstyle' 's' dsn 'Y')
)
(setq th (getreal 'nSheet Text Height [(1/8),(3/32),.1]: ')) ;Prompt for Text Height
(setq ds (getint 'nDimscale Factor: ')) ;Prompt for Dimscale
(setq dsn (strcat 'CEI-' th)) ;Creates Dimstyle Name
(setq cth (* th ds)) ;Multiplies the Sheet Text Height by the Dimscale
(command '-style' 'ROMANS' 'romans.shx' '0' '.85' '0' 'n' 'n' 'n' ) ;Creates ROMANS text style
(command 'textsize' th ') ;Adds the Sheet Text Height
(command 'textsize' cth ') ;Sets the Current Text Height
(SETVAR 'DIMADEC' 0) ;Angular decimal places
(SETVAR 'DIMALT' 0) ;Alternate units selected
(SETVAR 'DIMALTD' 2) ;Alternate unit decimal places
(SETVAR 'DIMALTF' 25.4000) ;Alternate unit scale factor
(SETVAR 'DIMALTRND' 0) ;Alternate units rounding value
(SETVAR 'DIMALTTD' 2) ;Alternate tolerance decimal places
(SETVAR 'DIMALTTZ' 0) ;Alternate tolerance zero suppression
(SETVAR 'DIMALTU' 2) ;Alternate units
(SETVAR 'DIMALTZ' )0 ;Alternate unit zero suppression
(SETVAR 'DIMARCSYM' 0) ;Arc length symbol
(SETVAR 'DIMASZ' 0.125) ;Arrow size
(SETVAR 'DIMATFIT' 3) ;Arrow and text fit
(SETVAR 'DIMAUNIT' 0) ;Angular unit format
(SETVAR 'DIMAZIN' 0) ;Angular zero supression
(COMMAND 'DIMBLK' '.') ;Arrow block name
(COMMAND 'DIMBLK1' '.') ;First arrow block name
(COMMAND 'DIMBLK2' '.') ;Second arrow block name
(SETVAR 'DIMCEN' 0.0625) ;Center mark size
(SETVAR 'DIMCLRD' 1) ;Dimension line and leader color
(SETVAR 'DIMCLRE' 1) ;Extension line color
(SETVAR 'DIMCLRT' 2) ;Dimension text color
(SETVAR 'DIMDEC' 4) ;Decimal places
(SETVAR 'DIMDLE' 0) ;Dimension line extension
(SETVAR 'DIMDLI' 0.0625) ;Dimension line spacing
(SETVAR 'DIMDSEP' '.') ;Decimal separator
(SETVAR 'DIMEXE' 0.0625) ;Extension above dimension line
(SETVAR 'DIMEXO' 0.0625) ;Extension line origin offset
(SETVAR 'DIMFRAC' 1) ;Fraction format
(SETVAR 'DIMFXL' 1) ;Fixed Extension Line
(SETVAR 'DIMFXLON' 0) ;Enable Fixed Extension Line
(SETVAR 'DIMGAP' 0.0625) ;Gap from dimension line to text
(SETVAR 'DIMJOGANG' 45) ;Radius dimension jog angle
(SETVAR 'DIMJUST' 0) ;Justification of text on dimension line
(COMMAND 'DIMLDRBLK' '.') ;Leader block name
(SETVAR 'DIMLFAC' 1.0000) ;Linear unit scale factor
(SETVAR 'DIMLIM' 0) ;Generate dimension limits
(SETVAR 'DIMLTEX1' 'ByLayer') ;Linetype extension line 1
(SETVAR 'DIMLTEX2' 'ByLayer') ;Linetype extension line 2
(SETVAR 'DIMLTYPE' 'ByLayer') ;Dimension linetype
(SETVAR 'LUNIT' 4) ;Linear unit format
(SETVAR 'DIMLWD' '-1') ;Dimension line and leader lineweight
(SETVAR 'DIMLWE' '-1') ;Extension line lineweight
(SETVAR 'DIMPOST' ') ;Prefix and suffix for dimension text
(SETVAR 'DIMRND' 0) ;Rounding value
(SETVAR 'DIMSAH' 0) ;Separate arrow blocks
(SETVAR 'DIMSCALE' ds) ;Overall scale factor
(SETVAR 'DIMSD1' 0) ;Suppress the first dimension line
(SETVAR 'DIMSD2' 0) ;Suppress the second dimension line
(SETVAR 'DIMSE1' 0) ;Suppress the first extension line
(SETVAR 'DIMSE2' 0) ;Suppress the second extension line
(SETVAR 'DIMSOXD' 0) ;Suppress outside dimension lines
(SETVAR 'DIMTAD' 1) ;Place text above the dimension line
(SETVAR 'DIMTDEC' 4) ;Tolerance decimal places
(SETVAR 'DIMTFAC' 1.0000) ;Tolerance text height scaling factor
(SETVAR 'DIMTFILL' 0) ;Text background enabled
(SETVAR 'DIMTFILLCLR' 0) ;Text background color
(SETVAR 'DIMTIH' 0) ;Text inside extensions is horizontal
(SETVAR 'DIMTIX' 0) ;Place text inside extensions
(SETVAR 'DIMTM' 0) ;Minus tolerance
(SETVAR 'DIMTMOVE' 1) ;Text movement
(SETVAR 'DIMTOFL' 0) ;Force line inside extension lines
(SETVAR 'DIMTOH' 0) ;Text outside horizontal
(SETVAR 'DIMTOL' 0) ;Tolerance dimensioning
(SETVAR 'DIMTOLJ' 1) ;Tolerance vertical justification
(SETVAR 'DIMTP' 0) ;Plus tolerance
(SETVAR 'DIMTSZ' 0) ;Tick size
(SETVAR 'DIMTVP' 0.0000) ;Text vertical position
(SETVAR 'DIMTXSTY' 'ROMANS') ;Text style
(SETVAR 'DIMTXT' th) ;Text height
(SETVAR 'DIMTXTDIRECTION' 0) ;Dimension text direction
(SETVAR 'DIMTZIN' 0) ;Tolerance zero suppression
(SETVAR 'DIMUPT' 0) ;User positioned text
(SETVAR 'DIMZIN' 2) ;Zero suppression
(command '-dimstyle' 's' dsn 'Y')
)