Up and Running with the 2013 Core Console

With the release of AutoCAD 2013, there is a new feature that is called the “Core Console.” This Core Console is a stripped down version of of AutoCAD that includes no buttons or user interface other than what looks like a cryptic command line.

If you have an AutoCAD 2013 product installed, you can open it and see for yourself what it looks like. It is located at C: drive > Program Files > Autodesk > AutoCAD 2013 > “accoreconsole.exe”Core Console 2

After  launching the Core Console it looks a lot like the windows command line…

Notice the size of the Core Console. It weighs in at only 27kb on my computer. compare that to the acad.exe which loads when you open the normal AutoCAD interface and you can see why this Core Console can be your new best friend when it comes to batch processing files.

Core Console 3

So if you need to run batch routines on files, the Core Console is meant to be quick and capable of running AutoCAD script files (.scr), LISP routines, .NET (dot net) dlls and other programming routines. (I am only familiar with script files and LISP so that is where I will focus my attention).

As I mentioned above, the Core Console is limited in what it can do. And luckily Kean Walmsley has already done the hard part and found out what commands the Core Console will recognize found [here] and Kean has also put together a nifty .txt file that contains the available commands as well found [here]. Thanks for putting that together Kean!!

If you have launched the Core Console as shown above go ahead and close it. You can see that it is a bit cryptic in that it isn’t obvious as to how to even use it even though they give an example of the syntax… It took me a while to get it to run for me and like the name of the post, I want to get you up and running with it as well.

For this post we will learn how to run the Core Console 2 ways. 1) by running ScriptPro 2.0 and 2) by running it by itself through a windows .bat (batch) file. Both ways we will use the same AutoCAD script file that prints the layout tab named “Layout1″ to a PDF file.

If you would like to follow along with this example – Create a folder on your C: drive and name it “Test”. Place some drawings that contain a layout tab called “Layout1″ and also place a copy of the below AutoCAd script file called “Plot2PDF.scr” in the C:\Test folder.

Link to script “Plot2PDF.scr” > https://docs.google.com/file/d/0B_y9I236zHwOYm00NllzbVRsQ2s/edit?usp=sharing

Core Console 4

Using ScriptPro 2.0
ScriptPro 2.0 is free and can be downloaded from the following [THIS] link. The old version of ScriptPro does not let you set the Core Console to run the batch. The old version automatically uses the full-blown acad.exe file.
Once you have it installed go ahead and launch ScriptPro 2.0
There should be a desktop icon that was installed or you can navigate to it by:
Start > All Programs > Autodesk > ScriptPro.exe (shown below)

Core Console 6

The only trick to using ScriptPro and the Core console is setting ScriptPro to use the correct .exe file.

Once ScriptPro is open,

  1. Click “Settings”
  2. Browse – navigate to C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe Select the .exe file.
  3. Click OK

Core Console 7

Now that the Core Console is set, you can build a list of files and select a script as normal.

To select files:
Click “Add From Folder” button and then browse to a folder from the list and then click OK.
One great thing about ScriptPro is that you can build a list

Core Console 8

To select a script file that will be run on each of the files:

  1. Click “Browse” in the “Script file” section
  2. Browse to the location of the script file
  3. Select the script
  4. Click “Open”

Core Console 9

Now that the files are listed and the script file is set the batch process can use the Core Console to process the files.
To process the files that have a check mark next to them press the button “Checked” (shown below)

Core Console 10

To use a batch file (.bat) use the following and adjust accordingly for your needs.

If you copy the following line into a Notepad file and save it with the extension .bat it will become a batch file.

But before you run it, it would be nice to know what it is doing so below is a simple explanation of what the .bat file does:

Core Console 11

Here is the content of the batch file:
FOR %%f IN (“c:\Test\*.dwg”) DO “C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe” /i “%%f” /s “c:\Test\Plot2PDF.scr” /l en-US

Make sure to copy it as it is shown in the picture -meaning in one line. I was not able to get it to run when the content was on multiple lines. It only worked for me when it was all in one line. (but then again, I am a novice at these batch routines….)

The result of this is the following: it created PDFs of Layout1 of each of the drawings and placed the PDFs in the same folder as the drawings.

Core Console 12

Posted in AutoCAD 2013, AutoLISP: Manage, Manage, Modifying, New In 2013, Printing - Plotting, TIPS | 9 Comments

Easily Create a Drawing List

This tip was tested and works with Windows Explorer and Google Chrome (and Microsoft Excel…)

To create a list of drawings, either for yourself or for a client, these steps can help save some time.

  • Navigate to the folder in Windows Explorer
  • Copy the folder location

Drawing List 1

 

  • Paste the folder location into Google Chrome and press enter
  • Note: I have not tried this with Firefox. I did try it with Internet Explorer and when I hit enter, it would open the folder location…

Drawing List 2

 

  • Highlight the files as they are displayed in the browser and copy

Drawing List 3

 

  • Paste the copied list of files into Excel in the upper left corner.

Note 1: After the initial spread sheet is created, you can add to this list by adding to the bottom row of the spreadsheet.

Note 2: You have 2 choices when Pasting the content

Drawing List 4

 

  • “Keep Source Formatting” will also create a link to the individual files (could be handy)

Drawing List 5

 

  • “Match Existing Formatting” will keep the formatting as simple text

Drawing List 6

 

After pasting the content into Excel, you may need to clean up some columns and rows… But this will save some time instead of manually creating a drawing list.

~enjoy

Posted in Manage, TIPS | 3 Comments

AutoLISP: Simple Numeric Array

Today’s featured routine is an example from a book about Visual Lisp Programming and was an example that we learned from as an example in class when I was in school.

It is a simple routine that lets you incrementally array a row of numbers. This might be helpful for creating numbered lists or placing numbers along a line…

Lee-Mac has made some pretty powerful numbering routines that can do a lot more than this routine does. These routines can be found here:

http://lee-mac.com/incrementalarray.html

http://lee-mac.com/numinc.html

Here’s how:

  • NUMROW <enter>
  • Specify the first text location – this will be # zero
  • Specify the distance – either by picking 2 points on screen or by entering the distance in the command line
  • Specify the angle – either by picking 2 points on screen or by entering the angle in the command line ACAD Angle
  • Specify the ending number of the array

~enjoy

NumRow


; Example from book: Visual Lisp Programming
; NumRow.lsp by Cal Clater
;
; 1/12/xx
;
; Purpose: To create an evenly spaced row of incrementally increasing numbers,
; such as might be required for a chart or graph. The beginning number is zero
; and the last number is as specified.
;
(defun C:NumRow (/ PT1 DST DIR NN HN)
    (setvar "CMDECHO" 0) (setvar "BLIPMODE" 0)
    (princ "\nText will be center justified.")
    (setq PT1 (getpoint "\nstart point of number row: ")
          DST (getdist "\nDistance between number: ")
          DIR (getorient "\nAngle: ")
          NN 0
          HN (getint "\nNumber sequence to be 0 through: ")
    )
    (command "TEXT" "C" PT1 "" "" "0")
    (repeat HN
      (setq PT1 (polar PT1 DIR DST))
      (command "TEXT" "C" PT1 "" "" (itoa (setq NN (+ NN 1))))
    )
)
Posted in AutoLISP, AutoLISP: Creating, AutoLISP: Text, Uncategorized | 2 Comments

AutoLISP: Fillet and Match PLINE Width

With the release of AutoCAD 2012 the JOIN command received some improvements. It will join all of the selected objects regardless of what type of objects they are (line, arc, polyline, 3Dpolyline, spline) and turn them into the most complicated object in the selection set. Because of this enhancement of the JOIN command, it appears that Autodesk took away a useful feature from the FILLET command. The missing feature that many are used to seeing is when you fillet a polyline that has  a width applied to it, the other objects would inherit the width of the polyline. This is no longer the case with the FILLET command in 2012 and 2013.

Luckily I found this routine that lets you FILLET objects just like before…

originally found here: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Join-then-fillet-polylines/m-p/811123/highlight/true#M36781

Fillet Behavior introduced in AutoCAD 2012:

Fillet 2012Fillet behavior prior to 2012 and that the lisp routine provides:

My Fillet New

fillet-new-1

 


;;; MY-FILLET.LSP Fillet PolyLines
;;; Fillets Any Type of Line (Line, PolyLine, LWPolyLine or Spline)
;;; by Ibro Vehabovic, March 1999.
;;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Join-then-fillet-polylines/td-p/.UNyL7-SLlyI

(defun c:my-fillet (/ getval spl2pl e1 e2 p2 l e ss)

;;; GETVAL - returns the group value of an entity.
;;; like the wellknown (dxf) function but accepts all kinds of
;;; entity representations (ename, entget list, entsel list)
  (defun GETVAL	(grp ele)		;"dxf value" of any ent...
    (cond ((= (type ele) 'ENAME)	;ENAME
	   (cdr (assoc grp (entget ele)))
	  )
	  ((not ele) nil)		;empty value
	  ((not (listp ele)) nil)	;invalid ele
	  ((= (type (car ele)) 'ENAME)	;entsel-list
	   (cdr (assoc grp (entget (car ele))))
	  )
	  (T (cdr (assoc grp ele)))
    )
  )					;entget-list

;;; "converts" SPLINE to PLINE
  (defun spl2pl	(ent / osm pdm deltaL pn pts e)
    (setq osm (getvar "OSMODE"))
    (setq pdm (getvar "PDMODE"))
    (setvar "OSMODE" 0)
    (setvar "PDMODE" 0)
    (setq
      deltaL (*	(/ (GETVAR "viewsize") (CADR (GETVAR "screensize")))
		(getvar "pickbox")
		2.0
	     )
    )					; max segment=2 * size of
    pickbox
    (if	(= (getval 0 ent) "POLYLINE")	; heavy pline
      (progn
	(setq e ent)
	(while (= (getval 0 (setq e (entnext e))) "VERTEX")
	  (setq pts (cons (getval 10 e) pts))
	)
	(setq pn  (car pts)
	      pts (list (last pts))
	)
      )
      (setq pts	(list (getval 10 ent))	; start pt
	    pn	(getval 10 (reverse (entget ent)))
      )
    )					; end pt
    (command ".POINT" pn)
    (setq e (entlast))
    (entdel e)
    (command ".AREA" "_O" ent)
    (command ".DIVIDE"
	     ent
	     (fix (/ (getvar "perimeter") deltaL))
    )
    (while (setq e (entnext e))
      (setq pts (cons (getval 10 e) pts))
      (entdel e)
    )
    (setq pts (reverse (cons pn pts)))
    (apply 'command (append '(".PLINE") pts '("")))
    (command ".CHANGE"
	     (entlast)
	     ""
	     "_P"
	     "_LA"
	     (getval 8 ent)
	     ""
    )
    (if	(getval 62 ent)
      (command ".CHANGE"
	       (entlast)
	       ""
	       "_P"
	       "_C"
	       (getval 62 ent)
	       ""
      )
    )
    (entdel ent)
    (setvar "PDMODE" pdm)
    (setvar "OSMODE" osm)
    (entlast)
  )					;defun spl2pl

  (setvar "cmdecho" 0)
  (command "._UNDO" "_BE")
  (while (null (setq e1 (entsel "\nSelect first object: "))))
  (if (= (getval 0 e1) "SPLINE")
    (setq e1 (list (spl2pl (car e1)) (cadr e1)))
  )
  (if (= (getval 0 e1) "POLYLINE")
    (if	(> (getval 70 e1) 1)
      (setq e1 (list (spl2pl (car e1)) (cadr e1))) ;fit or spline
      (command ".CONVERTPOLY" "_L" (car e1) "")
    )
  )					;heavy pline
  (redraw (car e1) 3)
  (while (null (setq e2 (entsel "\nSelect second object: "))))
  (if (= (getval 0 e2) "SPLINE")
    (setq e2 (list (spl2pl (car e2)) (cadr e2)))
  )
  (if (= (getval 0 e2) "POLYLINE")
    (if	(> (getval 70 e2) 1)
      (setq e2 (list (spl2pl (car e2)) (cadr e2))) ;fit or spline
      (command ".CONVERTPOLY" "_L" (car e2) "")
    )
  )					;heavy pline
  (redraw (car e2) 3)
  (setq p2 (cadr e2))
  (setq e2 (car e2))
  (if (and (= (getval 0 e1) "LWPOLYLINE")
	   (= (getval 0 e2) "LWPOLYLINE")
      )
    (progn
      (setq l (entlast))
      (command ".EXPLODE" e2)
      (setq ss (ssadd))
      (ssadd (setq e (entnext l)) ss)
      (while (setq e (entnext e))
	(ssadd e ss)
      )
      (command ".FILLET" e1 (nentselp p2))
      (command ".PEDIT" e1 "_J" ss "" "") ; join
      (command ".ERASE" ss "")		; erase unjoined segments
					; of the second polyline
    )					;progn
    (command ".FILLET" e1 (nentselp p2)) ;normal fillet
  )					;if
  (command "._UNDO" "_E")
  (princ)
)					;defun
Posted in AutoCAD 2013, AutoLISP, AutoLISP: Modify, AutoLISP: Polylines, Modifying, New in 2012, New In 2013, Polylines | 4 Comments

Set the Options Dialog to Specific Tab

Here is a quickie.

You can use this as a script or macro for a custom tool…

If you go to the OPTIONS dialog box often, you may want to open on a specific tab for whatever task you are doing.

Here’s how:

  • +OPTIONS <enter>
  • The default is <0> (zero) and if you simply hit <enter> again it will open the last tab that you were on. So if I want the Options dialog to open on the “Files” tab I would enter the following at the command line:
      1. +OPTIONS <enter>
      2. 0 <enter> (zero)

The thing to remember about this tip is to use the + (plus sign) at the beginning of the command….

Refer to the picture below that shows what tabs equal what number equals what tab.
Note that the Options dialog box shown below is from AutoCAD 2013

Options

(See below for the many ways to open the OPTIONS dialog “the normal way”)

  • Right-click anywhere in the drawing area and select “Options”

Options 1

  • Click on the Application Menu (Big Red A)
  • Then click Options at the bottom of the menu

Options 2

  • Type in either OP <enter> or OPTIONS <enter> in the command line

Options 3

Posted in Customization, Manage, TIPS | 3 Comments

Pre Selection Highlight

Here is how to change the setting that allows you to highlighting objects prior to selection. This feature is useful so that you can visibly see what you are about to select prior to actually selecting them.

OPTIONS <enter> or OP <enter>

Make the “Selection” tab current

To turn this feature on, make sure that the check marks are checked under the “Selection Preview” area  of the “Selection” tab (orange area shown below)

In the “Visual Effect Settings” dialog, you can define how the pre-highlighting is displayed: 1) Dashed lines, 2) Bold, 3) Both (the default = both)

Pre Selection Highlight

 

The Advanced options button will display a little dialog box that shows what items are excluded from being pre-highlighted

Prehighlighting 3

 

Shown below – hovering the cursor over objects with pre-selection highlighting turned OFF

Prehighlighting 1 OFF

 

Shown below – hovering the cursor over objects with pre-selection highlighting turned ON

Prehighlighting 2 ON

Posted in Customization, Manage, Settling In, TIPS | 4 Comments

How to show hidden folders

This might seem like an odd post but it is helpful because there is an AutoCAD support path that might be hidden thus preventing you from navigating to this location through Windows Explorer.

The desired support location is located within the “AppData” folder. This folder is unique for each user for a computer. The location is C:\Users\UserName\AppData\Roaming\Autodesk\AutoCAD 2013 – English\R19.0\enu\Support

If you navigate to C:\Users\Username folder you may not see the folder called “AppData”

(Note: My username folder is called “Trog”)

Hidden Files 1

  • If you press the ALT button you will see the below menus appear.
  • Click the tools button from the menu and then click “folder options”

Hidden Files 2

 

Click the “View” tab to make it active

  • Then scroll down and click to toggle to “Show hidden files, folders and drives”
  • This menu is also where you can change how the file types are shown, A file type is the three-letter file extension that is at the end of a file name. For example, a .dwg is an AutoCAD drawing file. Or a .pdf file is a PDF file…

Hidden Files 3

 

 

Click OK when you are finished.

You should know see the below folder “AppData”

Hidden Files 4

Posted in BASICS, Manage | Leave a comment