Jump to content

Recommended Posts

Posted

Dear friends,

 

I have used the following code but it returns the error as

"; error: Automation Error. AutoCAD is unable to service automation request"

what is wrong with this code?

 

(Setq cur_user_temp_location  (vla-get-QNewTemplateFile (vla-get-files (vla-get-Preferences (vlax-get-acad-object)))))
 (vlax-invoke-method (vla-get-activedocument (vlax-get-acad-object)) 'NEW cur_user_temp_location)
 (vla-new (vla-get-activedocument (vlax-get-acad-object))  cur_user_temp_location)

Posted

Hi muthu123

 

The AutoLisp help files seems to recommend using

 

(VLA-ADD <documentCollection> <dwt>) 

 

as opposed to the

 

(VLA-NEW <document> <dwt>) 

 

 

Maybe

 

(Setq cur_user_temp_location
      (vla-get-QNewTemplateFile
 (vla-get-files (vla-get-Preferences (vlax-get-acad-object)))
 )
     )

(VLA-ADD
 (vla-get-DOCUMENTS (vlax-get-acad-object))
 cur_user_temp_location
 )

Posted

It is ok. But i hope it will be applicaple for only When SDI set to 0. But i need in SDI mode.

 

Hi muthu123

 

The AutoLisp help files seems to recommend using

 

(VLA-ADD <documentCollection> <dwt>) 

 

as opposed to the

 

(VLA-NEW <document> <dwt>) 

 

 

Maybe

 

(Setq cur_user_temp_location
      (vla-get-QNewTemplateFile
    (vla-get-files (vla-get-Preferences (vlax-get-acad-object)))
    )
     )

(VLA-ADD
 (vla-get-DOCUMENTS (vlax-get-acad-object))
 cur_user_temp_location
 )

Posted

Correct, it would be for MDI as opposed for SDI.

 

I am not sure how to achieve this in SDI. There is some info on the error in the Quit Method of the AutoCAD developers help files

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...