Jump to content

Trying to use Annotate a Contour Line and having an Error


Recommended Posts

Posted (edited)

Thanks in advance!  By the way, It has worked and just stopped working for some reason.  Here is the error message I get

Command: LC
Error: no function definition: VLAX-GET-ACAD-OBJECTAutoCAD variable setting rejected: "osmode" nil
Command:

Here is the LISP I was trying to use

 ; Annotate a Contour Line
; BY: Tom Beauford - 7/11/2005 Modified By: Michael Hamann 7/13/2015
; (load "LabelContour.lsp") LabelContour With Decimal
;=============================================================
(defun c:LC (/ *ERROR* Trl0s mspace om osz e ent pt tblname Rot str mtextobj ent el)
 
  (defun *ERROR* (s)                    ; If an error (such as CTRL-C) occurs
                                      ; while this command is active...
    (if (/= s "Function cancelled")
      (princ (strcat "\nError: " s))
    )
    (grtext -1 "")                      ; Clear status line.
    (setvar "osmode" om)
    (setvar "osnapz" osz)
    (princ)
  )
 
  (defun Trl0s (String); remove trailing zero(s) beyoud the decimal
      (if (= (rem (atof String) 10.0) 0); it's a whole multiple of 10 keep any zero(s) before the decimal
 (itoa (atoi String)); then
 (vl-string-right-trim ".0" String); else
      ); if
  )
 
  (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))
            om (getvar "osmode")
            osz (getvar "osnapz")
  )
  (setvar "osnapz" 0)
  (setvar "osmode" 514)
  (setq pt (getpoint"\nSelect point on Contour Line: ")
            e (nentselp pt) 
            ent (car e)
            pt (cadr e)
            tblname (car(ade_odgettables ent))
  )
  (setq Rot (getangle pt "\nPick or Enter angle..." )
            str (Trl0s(rtos (caddr pt) 2 3)))
  (ade_errsetlevel 2) 
  (if(ade_odgettables ent)
    (cond
      ((ade_odgetfield ent (car(ade_odgettables ent)) "ELEV" 0)
      (setq str (itoa(ade_odgetfield ent (car(ade_odgettables ent)) "ELEV" 0))))
      ((ade_odgetfield ent (ade_odgettables ent) "ELEVATION" 0)
      (setq str (Trl0s(rtos(ade_odgetfield ent (ade_odgettables ent) "ELEVATION" 0))2 3)))
    )
   )
  (ade_errsetlevel 0) 
 
  (princ "\nElev = ")(princ str)
 
  (setq mtextobj (vla-addMText mspace (vlax-3d-point pt) 0.0 str))
  (vla-put-attachmentPoint mtextobj acAttachmentPointMiddleCenter)
  (vla-put-insertionPoint mtextobj (vlax-3d-point pt))
  (vla-put-Rotation mtextobj Rot)
  (vla-put-backgroundfill mtextobj :vlax-true); mask on with background color
  (setq el (entget (vlax-vla-object->ename mtextobj)))
  (setq el (subst (cons 45 1.13) (assoc 45 el) el)) ;Set MaskSize 1.13 × TextSize
  (entmod el)
  (setvar "osmode" om)
  (setvar "osnapz" osz) 
  (princ)
)

 

Edited by mike3_21_21
Posted

It has worked and just stopped working for some reason.  I should have mentioned that.

Posted (edited)

So it turns out, this wasn't the LISP. Didn't think it was.  Another problem altogether.  Here was my search of fixes.  I basically got the Registry fix by exporting from a working computer.  In fact, I've attached here.  Hope it helps someone else.

 

error: no function definition: VLAX-ENAME->VLA-OBJECT; (vl-load-com)

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-no-function-definition-vlax-ename-gt-vla-object-vl-load/td-p/7920349

 

https://www.cadforum.cz/cadforum_en/error-no-function-definition-vlax-ename-vla-object-tip12131

 

https://www.landfx.com/kb/autocad-fxcad/errors/item/3433-no-function-definition.html

AutoCADreg.reg

Edited by mike3_21_21
Posted

Very unusual to screw the registery, should have worked out of the box. has some one been playing with the registery.

Posted
13 hours ago, BIGAL said:

Very unusual to screw the registery, should have worked out of the box. has some one been playing with the registery.

 

Something might have deleted some items I suspect.  It could have been virus protection or some registry cleaner.  I was having audio issues prior to this.

Posted

Yeah some registry cleaner really good at screwing stuff up rather than fixing.

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