Command line shortcut for executing a script

Command line shortcut for executing a script

chicoseanbrown
Participant Participant
742 Views
2 Replies
Message 1 of 3

Command line shortcut for executing a script

chicoseanbrown
Participant
Participant

What I'm trying to do is pretty basic but it has implications for what can be done in AutoCAD and how, so I think it's worth exploring.  I tend to use the command line, but I often need to draw lines by bearing and distance, so I use the Line by Bearing button from the draw toolbar:

chicoseanbrown_1-1705681866366.png

 

Now, I know I can invoke this like so: L<enter>'BD<enter>.  But I'd rather just type LBD (or something similar) to do that.  Is there a way to make that happen?

 

A couple ways I could see doing this, but I don't know how, or if it's possible:

1. Assign a command name to that button.

2. Assign a command name to the sequence _LINE 'BD.

3. Write a script file containing _LINE 'BD and assign a command name to execute that script.

 

Thanks in advance!

0 Likes
Accepted solutions (1)
743 Views
2 Replies
Replies (2)
Message 2 of 3

paullimapa
Mentor
Mentor
Accepted solution

Or create a lisp file that's called LBD.lsp

 

(defun c:LBD ()(vl-cmdf"_.LINE""_'BDEPENDENCYHIGHLIGHT"))

 

You'll just have to place this lisp file in a folder that's under AutoCAD's Support File Search Path & Trusted Locations

Then use Appload, select Contents on lower right corner & Add LBD.lsp to the Startup Suite.

This way every time you open a drawing AutoCAD will automatically load LBD.lsp so you can use it by entering at the command line: LBD


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 3

Sea-Haven
Mentor
Mentor

Paullimapa has answered your question but for future reference, a lot of the actual commands do not display when you select from a ribbon, but if you look inside CUI, you can with a little bit of effort find the command and it will have a line like ^c^cBDEPENDENCYHIGHLIGHT,

 

SeaHaven_0-1705729257272.png

 

This is an example of a CIV3D pull down where common used commands have been added to a pop menu, do not have to be in the CIV3D workspace to use.

 

 

***MENUGROUP=SURFAL
***POP15
**SURFALIGN
[Surfalign]
[SURFACES]
[--]
[Create Surface]^c^c_AeccCreateSurface
[Create Surface from DEM]^c^c_AeccCreateSurfaceGridFromDEM
[Create Surface from TIN]^c^c_AeccCreateSurfaceFromTIN
[->Edit Surface]
[Edit Surface Style...]^c^c_AeccEditSurfaceStyle
[Edit Surface Properties]^c^c_AeccEditSurfaceProperties
[Add Line]^C^C_AeccAddSurfaceLine
[Delete Line]^c^c_AeccDeleteSurfaceLine

SeaHaven_1-1705729520013.png

Do you use surfaces ? I have a shortcut toolbar,, what Civ3D should have for surface display properties via a toolbar rather than having to go to Toolspace. Contours triangles on/off etc.