This routine uses the k-factor method with the specified k-factor and metal thickness to calculate the developed length of a sheet metal part by selecting the lines and arcs from a cross-section of the part. This is from my "Sheet Metal Flat Development with AutoCAD" course. If invoked transparently the result is returned directly to an AutoCAD command (such as OFFSET). Editable parameters let you put the balloon on a specific layer, adjust the gap between text and balloon and the balloon's lineweight, and specify whether the leader is a block or individual entities.įor sheet-metal fabricators, this routine calculates some common bend-allowance related quantities from specific bend parameters. Both text and balloon continue at the same angle as the last line in the leader. If the text has fewer than 3 characters, the balloon is a DONUT if longer, the balloon is an ELLIPSE. This program creates leaders and encloses the leader text in a 'Balloon'. If a directory path is supplied, (findfile) searches only the designated directory.Įxample Command: (findfile “acad.mnu”) “C:\\PROGRAM FILES\\AUTOCAD 2000\\support\\acad.mnu”Ī function that requires an AutoCAD support file, such as ACAD.MNU or ACAD.PGP, could include a (findfile) function to locate the file on any machine.Redefines the FILLET command to allow filleting of non-UCS coplanar lines, and allows radius definition during FILLET. The (findfile) function checks the current directory, the ACAD.EXE directory, and the support files search path set in the OPTIONS dialog box, in that order. If multiple copies of the file exist, the first copy found is returned.If the file is not found, (findfile) returns nil.
#AUTOCAD LISP FILE FULL#
AutoLISP provides the capability to check for the path and returns the full pathname and filename as a string. Tip: Finding Files When a routine calls for an external file, it is often inconvenient or impossible for the user to supply the full pathname. (setq PT1 (list (car PT1) (- (cadr PT1) SPACE))) (setq PT1 (getpoint “\nStarting Point: “)) (setvar “cmdecho” 0) (setq FILENAME (getfiled “Bill of Materials Files” “” “bom” 4)) (setq FILE (open FILENAME “r”)) Then add the file dialog in place of the existing prompt to name the file. Open READ.LSP and save it to a file called READ-BOM.LSP. Text in the alert box is left-justified.The string argument is displayed as the warning message in the alert.Notice that we had to translate the integer supplied by the color dialog box to an ASCII character that the system variable “cecolor” could read.Īnother way to make sure users know what is going on in an AutoLISP routine is to post an alert dialog with a single OK button.You could use a dialog choice: (setvar “cecolor” (itoa(acad_colordlg 4))) (initget 1 “Red Yellow Blue”) (setq CLR (getkword “\nSelect Red/Yellow/Blue: “)) See also AutoLISP Evaluates every Expression Instead of using a list of colors to choose from like we did in our box routine earlier: The color_number argument is the default color choosen. If your user needs to choose a color in the middle of an AutoLISP routine you can also call up the color dialog box. (setq FILENAME (getfiled “LISP FILES” “” “lsp” (+ 1 4))) The flags argument is the sum of specific values shown below. The extension argument specifies the default file extension used to filter the files–if a null string “”, it defaults to * (all file types). The filename argument specifies a default filename for the dialog. The title argument specifies the text in the title bar of the dialog. ( getfiled title filename extension flags) It returns the name of the file selected by the user, or nil if no file was selected. This function displays the standard AutoCAD file dialog box. Other dialog boxes that might help in your work are the color dialog, (acad_colordlg), and alert box, (alert). The (getfiled) function brings up a file dialog where you can specify the default extension. Sometimes it helps to bring up a dialog box instead of having the user type in information.