(command "NEW" ...)

(command "NEW" ...)

Anonymous
Not applicable
608 Views
4 Replies
Message 1 of 5

(command "NEW" ...)

Anonymous
Not applicable

Does anybody know if it is possible to have equivalent of NEW, ENTER, prompt to select template ENTER, by using (command "NEW" ...) ?

 

I have tried (command "NEW" "" "") and many other ways but none of them would work.

 

Issue is that drawing is opened and I am trying to open another tab using format (command "new" ... ), accepting template ACAD suggests by default as the template I would like is loaded into first dwg. I know it can be done by using scr file but creation of the file would be much simpler if I could use format (command ...) CAD version is 2015.

 

Thanks in advance.

0 Likes
609 Views
4 Replies
Replies (4)
Message 2 of 5

hmsilva
Mentor
Mentor

Using command, I think it will not be possible, but something like this will do the trick

(vl-load-com)
(vla-activate (vla-add (vla-get-documents (vlax-get-acad-object))))

 

Hope that helps

Henrique

EESignature

Message 3 of 5

ВeekeeCZ
Consultant
Consultant
(defun C:NewSTB ()
  (vl-load-com)
  (vla-activate (vla-add (vla-get-documents (vlax-get-acad-object)) "__acadISO -Named Plot Styles.dwt"))
  (princ)

 

Message 4 of 5

paullimapa
Mentor
Mentor

Another option is to use lisp to set the QNEW default drawing template and then use VLisp to send the QNEW command to the command line:

 

; DNew.lsp to Open New drawing with set default Template
(defun c:DNew (/ keystuff)

 ; keystuff function to send command using vlisp to the command line
 (defun keystuff (cmd-arg) (vl-load-com)(vla-Sendcommand(vla-Get-ActiveDocument(vlax-Get-Acad-Object))cmd-arg))

 ; set default dwg template for QNew command
 (setenv "QnewTemplate"(strcat"\"" (getenv"localappdata") "\\autodesk\\autocad 2015\\r20.0\\enu\\template\\acad.dwt\""))

; send QNew to command line
 (keystuff"_.QNEW\n")
)

 

Save above lines of code to file called DNew.lsp

At command line type: (load"DNew)

Then enter command: DNew

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales |Exchange App Store


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

Anonymous
Not applicable

Thanks alot on all replies, they are all giving me insight and new directions how I could do things.

 

Did anybody managed to change new tab name without saving a file, or to set it before new tab opens?

 

eg. when I say NEW and open new tab it opens with a default name "Drawing<<counter>>" (Drawing1, Drawing2, ...).

These values seem to be read-only, but being able to set them on fly would be of great time saving. We sometimes open dwgs

where we just DXFIN files, and not save them, leaving up to user to save them or not. If they already had names set properly

and even paths, it would be great.

0 Likes