TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hyposmurf on May 24, 2007, 05:53:14 AM

Title: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 05:53:14 AM
Hello everyone,been a while since my head has surfaced on here.Been meaning to sign on but find I have very little spare time and the spare time.
Anyway on to my post.I have CAD2K8 installed on my PC now upgraded through subscription.As all installations I have found there are bugs/problems.Never had a clean trouble free install.One of the problems I have is that my autoload files do not autoload if I go to type the command I get this error:
VLAX-ENAME-VLA-OBJECT
The lisp does then not work.This is a intermittant fault, I have done three complete re-installs now.I have also found that if I manually load this lisp I get the same error.This is annoying in that I cant use certain everyday lisps, plus my autolog lisp for my timesheet aint working.Any ideas?
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: Kerry on May 24, 2007, 06:02:40 AM
What error ??

added:
and did you mean (VLAX-ENAME->VLA-OBJECT) ?

and do you have (vl-load-com) called from somewhere in your startup routines ?
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 07:30:23 AM
Code: [Select]
;;  The following are the command line pre set rotate routines
(defun c:90()
  (rotatess 90)
  (princ)
)
(defun c:fl()
  (rotatess 180)
  (princ)
)
(defun c:-90()
  (rotatess 270)
  (princ)
)

(defun c:270()
  (rotatess 270)
  (princ)
)

;; the following works line this
;;  you enter rss <space key> <number> <enter>
(defun c:rss(/ ang)
      (while
        (progn
          (setq ang
                 (cond ((getint "\nEnter the rotation angle [90/180/270] <90>"))
                       (90)))
          (if (not (vl-position ang '(90 180 270 -90)))
            (not (prompt "\nError  Angle must be 90 180 270, please re-enter.")))
        )
      )
  (rotatess ang)
  (princ)
)



;;  By CAB 10/18/06
;;  Rotate a ss at center of ss by angle argument
(defun rotatess ( rang / ss ll-ur cenpt rang)
  ;;  This is my variation of a routine by Joe Burke
  ;;  returns a point list ((lower left)(upper right))
  (defun ssboundingbox (ss / i ent lst ptlst mnpt mxpt)
    (setq i -1)
    (while (setq ent (ssname ss (setq i (1+ i))))
      (setq lst (cons (vlax-ename->vla-object ent) lst))
    )
    (mapcar '(lambda (x)
               (vla-getboundingbox x 'mnpt 'mxpt)
               (setq ptlst (cons (vlax-safearray->list mnpt) ptlst))
               (setq ptlst (cons (vlax-safearray->list mxpt) ptlst))
             )
            lst
    )
     ;following by Tony Tanzillo
    (list
      (apply 'mapcar (cons 'min ptlst))
      (apply 'mapcar (cons 'max ptlst))
    )
  )

  ;;  Start here
  (prompt (strcat  "\nSelect objects to rotate " (itoa rang) " deg."))
  (if (setq ss (ssget))
    (progn
      (setq ll-ur (ssboundingbox ss))
      (setq cenpt (polar (car ll-ur)
                         (angle (car ll-ur) (cadr ll-ur))
                         (/ (distance (car ll-ur) (cadr ll-ur)) 2)))
      ;;(command "_.rotate" ss "" "_non" cenpt rang)
      ;;  Vla-rotate
      (setq rang  (/ (* rang pi) 180.0)) ; deg to rad
      (setq cenpt (vlax-3D-point cenpt))
      (setq i -1)
      (while (setq ent (ssname ss (setq i (1+ i))))
        (vla-rotate (vlax-ename->vla-object ent) cenpt rang)
      )

    )
  )
  (princ)
)
[/color]

Using the above routine to flip an object I get :
Command: fl

Initializing...
Select objects to rotate 180 deg.
Select objects: Specify opposite corner: 1 found

Select objects:
no function definition: VLAX-ENAME->VLA-OBJECT
Command:

This is what is in my auto load lisp:

Code: [Select]
[color=green](AUTOLOAD "rotset" '("fl")) ;  rotate 180[/color]
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: Fatty on May 24, 2007, 08:05:12 AM
As that said to you Kerry just
add vl-load-com function:

Code: [Select]
(defun c:rss(/ ang)
[color=red](vl-load-com)[/color]
      (while
        (progn
          (setq ang
                 (cond ((getint "\nEnter the rotation angle [90/180/270] <90>"))
                       (90)))
          (if (not (vl-position ang '(90 180 270 -90)))
            (not (prompt "\nError  Angle must be 90 180 270, please re-enter.")))
        )
      )
  (rotatess ang)
  (princ)
)



Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 08:19:49 AM
Thats not had any effect. :-(
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 08:59:14 AM
Just used my lisp to insert a rev box.Simple routine should work but it doesnt seem to insert the block, it just throws my titleblock off to the right side of my drawing in paper space.
Code: [Select]
(defun c:P1 ()
(command "-insert" "revP1" pause "" "" "")(command)
(command ".regen")
(princ)
)

If I go insert that block into my drawing afterwards it appears that CAD has the block available to within the drawing to insert manually?
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: CAB on May 24, 2007, 09:12:46 AM
Place the code here:
Change this
Code: [Select]
;;  Start here

to this:
Code: [Select]
;;  Start here
(vl-load-com)


PS I apologize for not including it in the first place.
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 10:01:00 AM
Thanks for that CAB I still have other problems!

Code: [Select]
Enter new value for DIMASZ <3.000>: 3.0000 ; error: no function definition:
VLR-COMMAND-REACTOR
; error: no function definition: VLR-DWG-REACTOR

The lisp that produces this above:

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  (command "dimasz" "3.0000")
  (prin1)
Its just from a number of presets I have when opening drawings.This error is intermittant.Happens when I open CAD from my shortcut and also when I open an existing drawing from a folder
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: CAB on May 24, 2007, 10:09:32 AM
Put this in your acaddoc.lsp so it will load in every drawing.
(vl-load-com)

Then try again.
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: GDF on May 24, 2007, 10:56:03 AM
Put this in your acaddoc.lsp so it will load in every drawing.
(vl-load-com)

Then try again.

This is what I do....to keep from forgetting to include this missing function: (vl-load-com)

Gary
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 24, 2007, 11:11:36 AM
That seems to sort most of my lisps as far as I know.However I still get the really odd problem with the rev block Im inserting.It goes to insert then when I specificy the base point the titleblock shifts together with all the rev blocks and text in paper space.The rev block I tried to insert is not there.Even more oddly if I save the drawing with all the paper space details shifted to the left, I then reopen the drawing and it is back to its original state before I inserted the block via lisp (not shifted to left side).A regen does not effect this.
Thanks for all your help so far.
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: Kerry on May 24, 2007, 05:14:09 PM
looks like I was talking to myself again !  :|
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: T.Willey on May 24, 2007, 05:30:11 PM
looks like I was talking to myself again !  :|

I hate when that happens.  It makes me not want to respond to those people anymore.
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 25, 2007, 05:42:03 PM
looks like I was talking to myself again !  :|

I hate when that happens.  It makes me not want to respond to those people anymore.

Sorry I was trying to sort the problem while at work,with explorer minimised and carry on getting some projects out.Where Im situated at work makes it very difficult use the net.To be honest at the time I didnt try that (vl-load-com) I was still trying out lots of other remedies before I had noticed CAB mentioned it.Im almost back to normal with the installation.Weird that until 2008 I didnt have this problem with (vl-load-com), maybe (vl-load-com) was included in the 2007 acaddoc.lsp.Im almsot there now with my set up just this weird thing still happening with my block insert lisp.

Anyway thanks Tim and CAB. I do appreciate your time and help   :smack:
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: T.Willey on May 25, 2007, 05:49:13 PM
Anyway thanks Tim and CAB. I do appreciate your time and help   :smack:
Wasn't me that helped you, it was Kerry in the first response (see below), so if you are to thank someone besides CAB it would be him.  I was just responding to what Kerry said later on in the thread.
What error ??

added:
and did you mean (VLAX-ENAME->VLA-OBJECT) ?

and do you have (vl-load-com) called from somewhere in your startup routines ?

Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: CAB on May 25, 2007, 07:35:16 PM
He he he - I just told him where to put it. :-D
Title: Re: Lisp wont autoload or load VLAX-ENAME-VLA-OBJECT
Post by: hyposmurf on May 26, 2007, 07:27:30 AM
Now I've gone and done it! :lmao:I was tempted to say Kerry who?But might be pushing my luck :-).Kerry :-D thanks.I'll hopefully get more time to spend on here and not be in such a rush.