AUGIWorld

Page 45

The ‘Select Drawing to Scrub’ section cleans up 2D and 3D backgrounds using normal Visual LISP and AutoLISP routines.

Then the line:

The ‘Select drawing for Uploading’ Section uploads AutoCAD drawing file(s) and uses the DOS batch script that was utilized from AutoLISP using: (StartApp “c:/UploadArch.bat”)

(setq ReadTxt (Read-line FileToOpen))

Then there are ways to get the Fabrication item information by using COD script and retrieving the information required to a TXT file and accessing them through LISP and DCL as shown in the screenshot of the script shown below.

(setq FileToOpen (open “C:/debug.dat” “r”)) ; Opens the file created and reads it (close FileToOpen) The above code would access data written to external DAT file and then can be reported on a dialog box value either as a string or as an integer.

PRODUCT FOCUS

AutoCAD MEP 2014

With the above-mentioned method, we were able to achieve automatic calculation such as piping weld lengths using different criteria. The script enables our shop fabrication personnel and spooler to reduce or eliminate tedious manual calculations. The time and cost savings of this are very high, and are more and more quantifiable the more we utilize these. The following dialog box is the end product of the scripting method described above where the Weld length value was calculated from an array of objects output to a data file as DAT generated through scripting.

For example, the following line of script selects an item to get the information needed to display in the Value text box and exports that info into a file: (setq Script (“c:/FabScript.cod”) ; Creates the Fabrication COD file ObjectsSelected (ssget “X” ‘((0 . “MAP_SOLID”))) ; Create selection set FileToWrite (open scr “w”)) (Write-line “dim var = item.path” fil) ; Writes the information needed to a variable (Write-line “object outfile = new file(\”C:debug.dat\”, foroutput+istext)” FileToWrite) (Write-line “if outfile.isopen then” FileToWrite) (Write-line “outfile.writeline(var)” FileToWrite) (Write-line “outfile.close()” FileToWrite) (Write-line “endif ” FileToWrite) (Close FileToWrite) ; Closes the file (ExecuteScript Script ObjectsSelected) ; Invokes the executescript command within AutoCAD without forcing the user to navigate through folders where the COD resides

December 2013

We then incorporate that value into our Spool Titleblock using Field information, reducing time spent on manual calculation as well as typing information. Reysteve Garcia currently works for ACCO Engineered Systems in San Leandro, CA. He is a Developer for ACCO’s BIMTech, BIM R&D group, within their 63-employee BIM & CAD Division. He has been using Autodesk products since 1994 and been exposed to the CAD environment and scripting sector ever since. He enjoys fishing, skiing and hiking.

www.augiworld.com

45


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.