Jump to content

Getting error while running Visual lisp program in ACAD2007.


drawings

Recommended Posts

Trying to run any visual lisp code in AutoCAD 2007, but end up in getting an error.

; error: ActiveX Server returned an error: Error loading type library/DLL

Is it a virus which is causing problem ? Becuase on other PC with same AutoCAD 2007 I don't get above error.

Link to comment
Share on other sites

Without seeing the code you're attempting to run, the error message above does not provide me enough information to know exactly what is the cause.

 

Try running (vl-load-com) at the command line, to load the Visual LISP extensions, and try your code again. If this fixes the problem, then be sure to add (vl-load-com) to either your routine (at the top), or to ACAD.lsp / ACADDOC.lsp so you only need it once.

 

If (vl-load-com) does not solve the issue then you are tapping into another external object's interface, and the specified file path for said type library (i.e., Excel.exe) cannot be found... in order to correct something like this, the file path must be corrected.

 

Hope this helps!

Link to comment
Share on other sites

Thanx Renderman,

Here is the code which I am trying to run.

 

;;Program to get Mass Propertise of the objects....
(defun C:mass_p ()

(vl-load-com)

(while
(setq sset (ssget))
(setq ctr 0)
(repeat (sslength sset)
(setq item (ssname sset ctr))
(setq item (vlax-ename->vla-object item))

(setq vol (vla-get-volume item))
(princ (strcat "\nVolume: " (rtos vol)))
(setq ctr (1+ ctr))
 
);repeat
);while
 (princ)

);defun
(princ)

 

As I select object & hit Enter, I receive error :

; error: ActiveX Server returned an error: Error loading type library/DLL

 

I trying to figure out the problem from last 3 days. I need help.

 

 

:ouch::ouch::ouch::ouch:

Edited by SLW210
CODE TAGS!!!!!!!!!!
Link to comment
Share on other sites

Consider this example instead:

 

(defun c:MASS_P  (/ ss)
 (vl-load-com)
 (while (setq ss (ssget "_:L:S:E" '((0 . "3DSOLID"))))
   (prompt
     (strcat
       "\n  >>  Volume: "
       (rtos (vla-get-volume (vlax-ename->vla-object (ssname ss 0)))))))
 (prompt "\n** Command ended, or non-3DSOLID selected ** ")
 (princ))

 

This code will continuously allow a single, non-locked, entity selection of "3DSOLID" objects (the only objects which possess a volume property).

Link to comment
Share on other sites

Another way . :)

 

(defun c:Test (/ lst ss i sset lst)
 (setq lst 0)
 (if (setq ss (ssget "_:L" '((0 . "3DSOLID"))))
   (progn
     (repeat
       (setq i (sslength ss))
        (setq sset (ssname ss (setq i (1- i))))
        (setq
          lst (+ (vla-get-volume (vlax-ename->vla-object sset)) lst)
        )
     )
     (alert (strcat " The Total Volumeis : " " " (rtos lst 2)))
   )
   (princ)
 )
 (princ)
)

Tharwat

Link to comment
Share on other sites

... And another one:

 

(defun c:TEST2 ( / ss v tot)
 (vl-load-com)
 (if (setq ss (ssget "_:L" '((0 . "3DSOLID"))))
   (progn
     (textpage)
     (vlax-for x (setq ss (vla-get-activeselectionset
                            (vla-get-activedocument
                              (vlax-get-acad-object))))
       (prompt (strcat "\nVolume: " (rtos (setq v (vla-get-volume x)))))
       (cond (tot (setq tot (+ tot v))) ((setq tot v))))
     (prompt (strcat "\n  >>  Total  >>  " (rtos tot)))
     (vla-delete ss))
   (prompt "\n** Nothing selected ** "))
 (princ))

 

... And another one:

 

(defun c:TEST3 ( / ss)
 (vl-load-com)
 (if (setq ss (ssget "_:L" '((0 . "3DSOLID"))))
   ((lambda (i / e v tot)
      (textpage)
      (while (setq e (ssname ss (setq i (1+ i))))
        (prompt
          (strcat
            "\nVolume: "
            (rtos (setq v (vla-get-volume (vlax-ename->vla-object e))))))
        (cond (tot (setq tot (+ tot v))) ((setq tot v))))
      (prompt (strcat "\n  >>  Total  >>  " (rtos tot))))
     -1)
   (prompt "\n** Nothing selected ** "))
 (princ))

Link to comment
Share on other sites

Dear Renderman,

I must appreciate your work. I have checked it & have a run on different PC (not the one having problem). Every program worked fine. I will check it on the problem PC & will post a feed back. Thanks once again.

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