woodman78 Posted April 13, 2011 Share Posted April 13, 2011 This might seem very simple but I want to create a new drawing with a specified template using Lisp. I was going down the command route. This is what I had: (defun c:Part8 () (command "filedia" "0") (command "new" "T:/Drawing Tools/Templates/CCC Part 8 Cover Sheet.dwt" "") (command "filedia" "1") (princ) ) If I run through this on screen it works but no in a lisp. Can anyone help? Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 13, 2011 Author Share Posted April 13, 2011 I got a bit further. This version will create the drawing based on the new template but it returns to the drawing that was open when the command was run. How do I avoid that? (defun c:Part8 () (vla-Add (vla-get-Documents (vlax-get-acad-object)) "CCC Part 8 Cover Sheet.dwt") (princ) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 13, 2011 Share Posted April 13, 2011 vla-activate Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 13, 2011 Author Share Posted April 13, 2011 how do i work that in? Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 13, 2011 Share Posted April 13, 2011 (vla-activate (vla-add ... Quote Link to comment Share on other sites More sharing options...
BlackBox Posted April 13, 2011 Share Posted April 13, 2011 I recently began writing a routine which is meant to automate some of our sheet creation too... but I went the ObjectDBX route, in lieu of the Documents collection. From our master file, the user selects the frames (which represent the visible area for our plan sheets), and a new drawing is created for each programmatically, using the vla-attachexternalreference, and vla-insertblock functionality. The former to XREF our master file in Model Space, and the latter to insert our title block, logo, etc. into Paper Space. I did include vla-addpviewport which correctly draws the Paper Space Viewport for our title block's dimensions, but for the moment I'm stuck with how to manipulate it's displayed view based on the associated frame selected in the Active Document (our master file). If I can get that to work, then populating the station range for the view in the title block attributes will be fairly easy. I *think* the Target, and Snap* properties have something to do with it... but I need to make some time to test, in order to know for sure. Otherwise, I'll have to drop Visual LISP and go .NET (which I'd rather not do). Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 14, 2011 Author Share Posted April 14, 2011 Thanks for the help alanjt. Quote Link to comment Share on other sites More sharing options...
Kapanther Posted May 4, 2011 Share Posted May 4, 2011 cheers alanjt Just what i needed. My finish lisp asks for a template location. For use as a reference lisp for creating a dwt from a tool palette button. ;New From Template (defun c:nft () (setq template(getstring "Specify Template Location:")) (vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) template)) (princ) ) Regards Kapanther Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.