470 likes | 678 Views
Hands-On Customizing in AutoCAD. Dan Abbott. Professor, Southern Maine Community College. John Jordan Volker Cocco. Lab Assistants. Agenda. External Commands and Aliases Tool Palettes – all releases Linetypes – all releases Tool Bars – CUI Tool Buttons – CUI Dashboard -- 2008
E N D
Hands-On Customizing in AutoCAD Dan Abbott Professor, Southern Maine Community College
John Jordan Volker Cocco Lab Assistants
Agenda External Commands and Aliases Tool Palettes – all releases Linetypes – all releases Tool Bars – CUI Tool Buttons – CUI Dashboard -- 2008 Menu customizing – CUI Scripts – all releases Intro to AutoLISP – all releases Demo Automating Drawing Update
Add A New User To Computer Control Panel User Accounts Create A New Account Any Name is Fine Make It Administrative Log Off Switch Users Start AutoCAD Before You Start Customizing
Autodesk University 2005 Anti-frustration Team: John Jordan Volker Cocco Just Raise Your Hand and They Will Come Schedule 9:30-10:00 – break for questions/water/relief AutoLISP after break Workshop Structure
Autodesk University 2005 Change Default Path Using OPTIONS Default path is C:\documents and settings\%username%\Local Settings\Application Data\Autodesk\AutoCAD 2006\R16.1\enu\template Consider placing files in a common network folder. Any drawing can become a template Make changes, and save with a .dwt extension Template Files – path
Autodesk University 2005 Template Files – OPTIONS
Autodesk University 2005 Layers with appropriate linetypes assigned Dimension styles with child variations Appropriate text styles with a height of zero Table Styles Mleader Style General block definitions, including title blocks Standard layouts for specific plotters and sheet sizes Variables that are saved in the drawing UCSICON; PLINEGEN; MIRRTEXT; LTSCALE; CELTSCALE; PSLTSCALE; MEASUREMENT; DIMASSOC; PSVPSCALE Template Files -- What to include
ACAD.pgp • Path is long: • C:\ Documents and Settings… • And includes a hidden folder Easy way to open a file in the search path: (Startapp "Notepad" (Findfile "Acad.Pgp")) Autodesk University 2005
Autodesk University 2005 WORD, start winword,1,, CALC, start calc,1,, PGP, start notepad C:\CP21-1L\acad.pgp AU, start iexplore www.autodesk.com/au,1,, WORK, explorer C:\Custom,1,, External Command Samples
Autodesk University 2005 RI, *REINIT CY, *CYLINDER DRG, *DIMREGEN ALIASEDIT Express Tool Command Alias Samples
Autodesk University 2005 Tools By Example: drag and drop nearly any object mleader, dimension, block, hatch, gradient fill, raster image, xref, or any geometric object Commands: drag and drop from customize window Groups of Blocks: Use Design Center, right-click Groups of Hatch Patterns: Use Design Center Tool Palettes
Autodesk University 2005 Tool Palettes – Tool Properties • Create a New Tool Palette • Create a MultiLeader Style [MLS] • Create a MultiLeader [MLD] • Drag Onto A tool Pallette • Modify Properites
Autodesk University 2005 Tool Palettes – Design Center
Autodesk University 2005 Enterprise CUI file -- custom company standards Partial CUI files -- third party menus or custom menus Main CUI file (ACAD.cui) – your personal preferences We’ll be modifying only the ACAD.cui file today CUI File Organizing
Autodesk University 2005 CUI command Right-click on Toolbars Select "New" Name your Toolbar Display at bottom Toolbars
Autodesk University 2005 Change to the "Commands" list window Pick a category Drag and drop any of the commands or control windows to your toolbar Toolbars
Autodesk University 2005 Toolbar Example
Autodesk University 2005 Types of Content – Control Windows
Autodesk University 2005 Select the "New" button in Command List pane Define the new command in the Properties pane Change the name, description and macro Tool buttons – new command
Autodesk University 2005 ^C^C^C-style;romans;romans;0;1;0;;;;dtext;\0.125;0; ^C cancel – same as pressing ESC key -style command line version of STYLE command ; represents an ENTER. ;;;; = 4 ENTERs \ causes the macro to pause once for input Tool button macro example
Add New Tool Button to Toolbar • Highlight New Command • Drag and Drop onto toolbar Autodesk University 2005
Add Icon to Tool Button • Select Button Image • Select Edit Button • Edit or Clear Image • Save With Name • Select Last Button Autodesk University 2005
Dashboard • Select “Dashboard Panels” • Add New Panel Autodesk University 2005
Dashboard • Select “Dashboard Panels” • Add New Panel Autodesk University 2005
Organize Dashboard • WorkSpaces • Add Panels for a Workspace • Change Order of Panels • Create Workspaces • Modify Other Aspects Autodesk University 2005
Autodesk University 2005 Osnap Cursor Menu Shift + Right-Click Contains OSNAPS Drag and Drop Reorganize Add from Command List Delete Right-Click on Command Short Cut Menus – Osnap
Autodesk University 2005 Pull Down
Autodesk University 2005 Redefine Function Keys: F1 ^C^C(sssetfirst nil) F12 'cal;(nea + nea)/2; Quick Keys
Autodesk University 2005 Grips Menu • Create a new rotate/copy/base command: • Rotate;Copy;Base; • Drag and drop it onto your Grips Cursor Menu
Autodesk University 2005 Create Additional Text-Based Linetypes Open ACAD.lin or ACADISO.lin – (startapp "notepad" (findfile "acad.lin")) Copy an existing linetype, like HW or GAS Change Properties and Edit Text Save File and Load your new linetype Linetypes: ACAD/ACADISO.lin
Autodesk University 2005 Linetypes: ACAD/ACADISO.lin Copy This: *HOT_WATER_SUPPLY,Hot water supply ---- HW ---- HW A,.5,-.2,["HW",STANDARD,S=.1,R=0.0,X=-0.1,Y=-.05],-.2 Change to This: *COLD_WATER_SUPPLY,Cold water supply ---- CW ---- CW A,.5,-.2,["CW",ROMANS,S=.1,R=30,X=-0.1,Y=-.07],-.2 A, = Alignment Code .5 = line segment length -.2 = size of gap "CW" = text "Romans" = style name S = txt height R = Rotation Angle (degrees) X & Y = Offset From Gap Center
Autodesk University 2005 Use the MKSHAPE and MKLTYPE expresstools For text Draw a repeatable pattern for linetype Execute the MKLTYPE command For shapes Draw a vector-based shape Execute the MKSHAPE command Load the new shape into the drawing Execute the MKLTYPE command Linetypes: Express Tools
Autodesk University 2005 You May NOT Want to Use Shape Files Shape Files Must Accompany Drawings Alternative Is to Use Blocks and MEASURE Layout a Spline Fit PLINE Linetypes: Express Tools
Autodesk University 2005 We will start with Scripts and AutoLISP after Break BREAK – 30 mlnutes
Autodesk University 2005 ASCII Text File Extension Must Be .SCR (same as Windows screen savers, by the way) Whatever You Would Type at Command Prompt Space or New Line = ENTER SCRIPT Command File Dialog Box Opens Find .SCR file Select A Script File SCRIPTS
Autodesk University 2005 STYLE romans romans 0 1 0 N N N LAYER N Lay1,Lay2,Lay3 C 1 Lay1 C 2 Lay2 C 3 Lay3 OSMODE 4135 Startup Switch /b Desktop Shortcut Icon "C:\program files\AutoCAD 2006\acad.exe” /b setup.scr Batch Files SCRIPTS – Sample
Autodesk University 2005 Type VLISP at command line to start program. Save as: "C:\custom\ACADDOC.lsp" Add this to top (with your own data) AutoLISP Create and save file
Autodesk University 2005 (defun c:ZX( ) (command"ZOOM" "E" "ZOOM" ".90x") ) Creates New AutoCAD Command named "ZX" Zooms to Extents of Drawing Reduces Screen Image to 90% Steal this code and write some more: ZA, ZP, etc. AutoLISP EX. 1 – New Command
Autodesk University 2005 (defun c:c( ) (command"circle" pause "d") ) Takes precedent over the alias "C" Gets Center Point and From Operator Draws Circle With Diameter, NOT Radius AutoLISP EX. 2 -- Mod Command
Autodesk University 2005 Transparent Conversions (defun i (i) (* i 25.4) ) (defun m (m) (/ m 25.4) ) AutoLISP EX. 3 – New Lisp Functions
Autodesk University 2005 Doing Calculations and Presenting Results (defun c:i2m (/ st1 st2 ) (setq in (getdist"\nGive value in inches: ")) (setq mm (* in 25.4)) (setq st1 (rtos in 2 3)) (setq st2 (rtos mm 2 2)) (alert(strcat"Value of " st1 " inches is " st2 " mm")) ) Rewrite this later as m2i so you can go the other way. AutoLISP EX. 4 – variables
Autodesk University 2005 Change objects to a named layer (defun C:CL(/ ss1 layname) (setq ss1 (ssget)) (setq layname (getstring"\nDestination layer:")) (command"LAYER" "N" layname "" "CHPROP" ss1 "" "LA" layname"") ) AutoLISP EX. 5 – GET functions
Autodesk University 2005 (defun c:number (/ st1 st2 point num) (setq num (getint"\nFirst number in sequence <1>:")) (if(= num nil) (setq num 1) ) (setq point (getpoint"\nInsertion point:")) (while point (setq st1 (itoa num)) (setq st2 (strcat"#" st1)) (command"TEXT" point "0.12""0" st2) (setq point (getpoint"Select insertion point:")) (setq num (+ num 1)) ) ) AutoLISP EX. 6 –counter
Autodesk University 2005 Ten Basic Rules for Lisp Programming 1. ASCII (DOS) text files. VLISP is the editor of choice. 2. BALANCE. Open and closed quotes and parentheses 3. DEFUN C:. Function as a new AutoCAD 4. ENTER and CANCEL. “” = ENTER; (command) = ESC 5. BACKSLASH. Separate folders with \\ or / AutoLISP – 10 Basic Rules
Autodesk University 2005 Ten Basic Rules for Lisp Programming 6. VARIABLES. Add them AFTER trouble-shooting (/ p1) 7. NEWLINE. Use \n (lower case) for new line alert 8. ANNOTATE. Use semi-colons (;) for comments 9. STRUCTURE. Get info from user or drawing first 10. PERSIST. Don't get discouraged and have fun! AutoLISP – 10 Basic Rules
Dan Abbott – Southern Maine Community College dan@DanAbbott.com 207 741-5564 Hands On Customizing