Jump to content

Loading a templates: Unknown error


WPerciful

Recommended Posts

This code:

 

(command "new" "S:\\CADCore\\Titleblocks\\Facilities A Model.dwt")

 

Gives me this error:

 

Unknown command "DWT". Press F1 for help.

 

Please help

Link to comment
Share on other sites

Add your Template into the folder of templates then change the name of the template from the following code .

 

(vla-add (vla-get-documents (vlax-get-acad-object)) "acadiso.dwt") 

Link to comment
Share on other sites

Which post you picked ? :D

 

I am working on a new drawing DCL. But before I took that on I decided that I would work on loading templates first. To do that I have made scripts that would load them, then a menu that would run the scripts. We keep our templates on the network drive.

 

new "S:\CADCore\Titleblocks\Facilities FS Model.dwt" 

 

Then I have a routine that can fill out the attributed values of the titleblock. But I had issues running the one routine right after the script. So I thought I’d switch over to just using autolisp/visp to open the new drawing and fill out the titleblock.

Your method for loading the templates seems to be more in-line with what I’m attempting to do. But I’d need to copy the templates to the user’s pc.

I tried using your code to load them from the shared drive, since it’s pathed in the options. But it didn’t seem to work for me. It would start a new drawing but there would be nothing in it.

Link to comment
Share on other sites

  • 8 years later...
On 1/7/2014 at 4:27 PM, Tharwat said:

Add your Template into the folder of templates then change the name of the template from the following code .

 

 

(vla-add (vla-get-documents (vlax-get-acad-object)) "acadiso.dwt") 
 

 

How do I evoke this with a command, rather than run on load.

 

I get an error when I add a defun

 

Example

(defun C:QNewNT ()

(vla-add (vla-get-documents (vlax-get-acad-object)) "xxx.dwt") 

Link to comment
Share on other sites

You need to keep the name of the template the same or change it to the ones that are available in your AutoCAD and you can explore that once you invoke the new or qnew command.

You did miss one close bracket at the end of your example.

  • Like 1
Link to comment
Share on other sites

Example macro from the first location that sets you new drawing current once it's added:

^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat "S:" (chr 92) "template" (chr 92) "Titleblocks" (chr 92) "Facilities A Model.dwt"))) 

Entering the same thing at the command line without ^C^C^P part does the same thing.

(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) (strcat "S:" (chr 92) "template" (chr 92) "Titleblocks" (chr 92) "Facilities A Model.dwt"))) 

Like Tharwat said it's simpler if you add your Template into the default Template folder:

^C^C^P(vla-activate (vla-Add (vla-get-Documents (vlax-get-acad-object)) "Facilities A Model.dwt"))) 

 

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...