

The command and command-s functions allow you to start and pass values to an AutoCAD command. Sub SendCommandWithEcho(doc As Object, str As String)ĭoc.SendCommand ("(progn (princ ""> SENDING: \""" & str & "\"""") (princ)) ") ' No action just an echo.NET application. But the principle should also work in Excel.
Autocad lisp get variable from clipboard code#
The VBA code below was tested inside BricsCAD. Why are you using double tildes? Are you perhaps mixing up SendCommand and SendKeys?Īfter some testing and fixing 3 syntax issues (Properly 'escaping' double quotes Using " " (= space) instead of Chr(27) Adding " " to the end of the Lisp expression string) I find that my suggestion can work. This is Escape and not Enter (as I wrongly assumed when reading your code).ĪcadDoc.SendCommand ("_pasteclip" & Chr(27))ĪcadDoc.SendCommand ("_pasteclip ") ' Using space as Enter. There are several syntax issues with both of our suggestions. I am guessing that the ' mark toggles the color in and out of the green color. But, I wonder why my code above gets its apparently random coloring? I would think that the 1st two lines would get the same color scheme. The above was successfully converted to code format, by making shure each line was indented by at least 4 space. However, the above only generated "(progn (princ \ -insert \ ) (princ))" on the command line. CommandString = Cells(CurrentRow, CountX).Value & Chr(27) 'put command into string, so I can use it inside embedded LISPĬommandStringLISP = "(progn (princ \ " & CommandString & " \ ) (princ))" 'add the LISP partĪcadDoc.SendCommand (CommandStringLISP) 'No action, just showing it on the command line.ĪcadDoc.SendCommand (CommandString & Chr(27)) 'Actually implement the command I then tried to build up the part that seems to be the problem into a string, and then use that string in the acadDoc.SendCommand line. I tried to modify it by changing the /"" to "/" without any change in behavior.

In the above line, the variable commandString is not be recognized as a variable. acadDoc.SendCommand ("(progn (princ ~~\""~~ & commandString & "\") (princ))" & Chr(27)) 'No action just an echo.

However, this variable is not visible to BricsCAD. The command itself, should be stored inside the commandString variable. If I understand the program lines you show, it will use some lisp to put some text on the command line.

Then, the ' will not be read by Markdown. So, to avoid issues with this, you can indent your code by at least 4 characters. P.s, the support staff at Bricsys said that Markdown views the ' as a code indicator. ' this version wasn't working -> SendKeys "^v" & Chr(27), TrueĪcadDoc.SendCommand ("_pasteclip" & Chr(27)) '-but this doesn't work either 'Send the contents of the clipboard to BricsCAD. 'MsgBox ("Click OK when BricsCAD is ready") 'in case BricsCAD is not ready yet, pause a second. M圜lipboard.PutInClipboard 'step two, use putinclipboard M圜lipboard.SetText ScriptText 'step one, use settext '**** Create the script and send to Clipboard **** M圜lipboard.PutInClipboard 'I am not sure why this exists, but seems to be necessary M圜lipboard.SetText "" 'put empty string in text, to prepare to clear clipboard
Autocad lisp get variable from clipboard series#
It just puts a very brief series of commands into the clipboard, and then should paste them into BricsCAD's command prompt. Here is a simplified version of my program. But, for some reason it won't send the clipboard. My VBA is successfully talking to BricsCAD, because it is opening a template drawing that I plan to use. Also, it will show all the text that I enter, which makes it MUCH easier to debug a script.īut, when I try to do it using my program, it fails. I can get the script into my clipboard, and then physically go to BricsCAD and past the text into the command prompt, and it will function. My efforts so far, to use the copy/paste method has failed.
